Skip to content

gbrain sources list reports 0 pages for federated sources after successful sync #711

@metaWuming

Description

@metaWuming

What happened?

After gbrain sync --strategy code --source <id> reports successful import (e.g. "17 file(s) imported, 75 chunks, 17 pages embedded"), gbrain sources list continues to show that source as 0 pages. Meanwhile the default source page count grows by exactly the imported amount, suggesting the per-source counter is broken even though pages are written and queryable.

What did you expect?

gbrain sources list should attribute imported pages to the source that received the import. Either the source-level counter is incorrect, OR pages are being written to default instead of the requested source — both are bugs.

Steps to reproduce

  1. Create a federated code source: cd <repo-with-origin> && bun gstack-gbrain-sync.ts --code-only (this calls gbrain sources add + gbrain sync --strategy code)
  2. Sync output: … 17 file(s) imported, 75 chunks, 17 pages embedded …
  3. Check gbrain sources list:
SOURCES
───────
  default                                  federated   347 pages
  gstack-code-tixtrack-pro-822357          federated     0 pages   last sync 2026-05-07T14:43:48Z
                                           /Users/.../tixtrack-pro
  ... (7 other code sources, all 0 pages, all with valid last-sync timestamps)

default shows 347 (which is exactly the cumulative count from all syncs added to the original 296), but the per-source count never moves off 0.

Additional: --source filter on gbrain list ignored

Related but might be a separate issue: gbrain list --source <code-source-id> returns the same set of pages regardless of which source ID is passed — appears to ignore the filter and always return default's pages. Confirmed by passing 5 different source IDs and getting byte-identical output.

Environment

  • gbrain version: 0.28.6
  • OS: macOS Darwin 25.3.0
  • Bun version: 1.3.12
  • Database: PGLite

gbrain doctor --json relevant excerpts

"connection": "Connected, 347 pages"
"frontmatter_integrity": "1237 frontmatter issue(s) across 8 source(s).
  gstack-code-tixtrack-pro-822357: 366 (MISSING_OPEN=366);
  gstack-code-iva-ticketing-140d80: 446 (MISSING_OPEN=446); ..."

The frontmatter issues per source confirm pages are attributed to the right source internally (since doctor counts per source) — but sources list and list --source both fail to surface that attribution.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions