Bug Description
In v0.31.3, source routing is silently ignored in two places:
gbrain import does not honor documented source-routing signals for attribution. In my repro, imported pages/chunks landed under default even when the caller intended a named source.
gbrain search --source <id> behaves like a no-op filter. Searching known-empty sources returns the same results as searching the populated source.
This makes multi-source attribution unsafe because the CLI exits successfully while writing/searching the wrong source partition.
Steps to Reproduce
rm -rf ~/.gbrain
gbrain init --pglite
gbrain sources add hermesclaude-main --path /Users/tm_admin/Documents/HermesClaude --federated
gbrain sources add hermesintake --path /Users/tm_admin/Documents/HermesIntake --no-federated
gbrain sources add openclaw-wiki --path /Users/tm_admin/.openclaw/wiki/main --no-federated
# Attempt import into registered source
gbrain import /Users/tm_admin/Documents/HermesClaude --source hermesclaude-main --no-embed
gbrain sources list
gbrain search HermesClaude --source hermesclaude-main --limit 5
gbrain search HermesClaude --source hermesintake --limit 5
gbrain search HermesClaude --source openclaw-wiki --limit 5
gbrain search HermesClaude --source default --limit 5
Expected Behavior
import --source hermesclaude-main writes pages/chunks under pages.source_id = 'hermesclaude-main'.
default remains at 0 pages when nothing is imported to default.
search --source hermesintake / --source openclaw-wiki returns no hits for HermesClaude-only content.
search --source hermesclaude-main returns the imported hits.
Actual Behavior Observed on v0.31.3
- Import completed with rc=0 but source attribution went to
default.
search --source <id> returned the same top results for populated and known-empty sources.
Local Fix Verified
I patched locally and verified the acceptance case now passes:
default federated 0 pages
hermes-local-wiki isolated 0 pages
hermesclaude-main federated 567 pages
hermesintake isolated 0 pages
openclaw-wiki isolated 0 pages
Search query: HermesClaude
--source hermesclaude-main: returns HermesClaude hits
--source hermesintake: No results
--source openclaw-wiki: No results
--source default: No results
--source __all__: returns HermesClaude hits
Focused tests passed:
bun run typecheck
bun test test/source-id-tx-regression.test.ts test/build-llms.test.ts
27 pass / 0 fail
Patch Shape
Local patch does the following:
Environment
- gbrain version: 0.31.3
- DB: PGLite
- OS: macOS
- Local patch commit:
fc143bb fix source routing for import and search
Bug Description
In v0.31.3, source routing is silently ignored in two places:
gbrain importdoes not honor documented source-routing signals for attribution. In my repro, imported pages/chunks landed underdefaulteven when the caller intended a named source.gbrain search --source <id>behaves like a no-op filter. Searching known-empty sources returns the same results as searching the populated source.This makes multi-source attribution unsafe because the CLI exits successfully while writing/searching the wrong source partition.
Steps to Reproduce
Expected Behavior
import --source hermesclaude-mainwrites pages/chunks underpages.source_id = 'hermesclaude-main'.defaultremains at 0 pages when nothing is imported to default.search --source hermesintake/--source openclaw-wikireturns no hits for HermesClaude-only content.search --source hermesclaude-mainreturns the imported hits.Actual Behavior Observed on v0.31.3
default.search --source <id>returned the same top results for populated and known-empty sources.Local Fix Verified
I patched locally and verified the acceptance case now passes:
Search query:
HermesClaude--source hermesclaude-main: returns HermesClaude hits--source hermesintake: No results--source openclaw-wiki: No results--source default: No results--source __all__: returns HermesClaude hitsFocused tests passed:
Patch Shape
Local patch does the following:
src/commands/import.ts--source <id>support.resolveSourceId(engine, explicitSource, process.cwd()).opts.sourceIdcompatibility.--sourcevalues.src/core/operations.tssourceparam to thesearchoperation.engine.searchKeyword(..., { sourceId }).src/core/pglite-engine.tsandsrc/core/postgres-engine.tsp.source_id = $Nfilter insearchKeywordwhenopts.sourceIdis set.__all__as explicit unfiltered search.Adds regression coverage in
test/source-id-tx-regression.test.ts.Environment
fc143bb fix source routing for import and search