Skip to content

sync-gbrain read probe reports unknown when the first listed page is over 64 KB #4396

Closed

Description

@nfitzsimmons

Summary

bin/gstack-gbrain-read-capability.ts answers {"status":"unknown","reason":"source-scoped get unavailable; retry later"} whenever the page it reads is larger than its 64 KiB output cap. The reason says to retry, but the result repeats on every run until a smaller page happens to list first. /sync-gbrain then reports a YELLOW verdict on a healthy brain.

Observed

gstack 1.99.5.0 at 0326b144, gbrain 0.60.619.0, macOS, local Postgres engine, a Node project with a lockfile.

  • /sync-gbrain (incremental): the code stage reports OK with 580 pages. The capability check then returns the unknown result above. It did so on three runs across two sessions.
  • gbrain list --source <id> --limit 1 returns the code page for package-lock.json (slug package-lock-json).
  • gbrain get package-lock-json --source <id> run by hand succeeds and prints 257,224 bytes, so the source-scoped read works.
  • The same call through spawnSync with the helper's cap fails, and passes with a larger one:
maxBuffer=65536   status=143 error=ENOBUFS   stdoutBytes=131072
maxBuffer=1048576 status=0   error=undefined stdoutBytes=284411

(gbrain get package-lock-json --source <id> --json, timeout: 10000, run from a small Node script, not from the helper itself.)

Cause (from reading the helper, not from instrumenting it)

  • Line 41: run() calls spawnSync with timeout: 10_000, maxBuffer: 64 * 1024.
  • Line 66: it lists one page with list --source <pin> --limit 1.
  • Lines 79 to 80: it reads that slug with get <slug> --source <pin> --json and maps any failed run to unknown('source-scoped get unavailable; retry later').

So the probe's outcome depends on the size of whichever page lists first. A lockfile, a generated file or any other large code page is enough.

Effect

  • /sync-gbrain reports Capability ...... WARN and a YELLOW verdict on every run while the large page lists first.
  • Per the skill text, an unknown result never installs the search guidance block, so a first-time setup in this state would not get it. I did not test a first-time setup.

Possible fixes

  • Choose a small page for the probe, for example list a few and read the smallest.
  • Or give the get call a larger maxBuffer.
  • Or treat ENOBUFS on the get as a read that was arriving, since the cap was reached by real page output.

Happy to send a PR for whichever you prefer.

Activity

  1. capy-ai commented on Nov 16, 2026

    @capy-ai
    Contributor

    Thanks for the measurements. On main (8c3c39b), bin/gstack-gbrain-read-capability.ts:41 still runs gbrain get with a 64 KiB maxBuffer, so a large first page (a lockfile is the usual one) turns a working read into unknown on every run. It's a small, plainly correct fix, so we're taking it. It will be rebuilt on current main and linked here after November 21.

  2. nfitzsimmons commented on Nov 18, 2026

    @nfitzsimmons
    ContributorAuthor

    Confirmed on gstack 1.100.0.0 at b49ed6a and gbrain 0.60.619.0, on macOS.

    A bounded page read fixes this without raising the subprocess output limit or weakening source and slug checks:

    const fetched = run(['get', slug, '--source', pin, '--json', '--body', 'window', '--max-bytes', '4096']);

    The same live lockfile response shrank from 284411 bytes to 5676 bytes, and the helper changed from unknown to ready. A regression fixture with a 300000-character body fails on the original helper and passes with this change. The shared CLI fixtures were updated to match the bounded read contract.

    Validation on an isolated checkout of that revision: 53 focused tests passed, product typecheck passed, and the test typecheck ratchet reported 812 known diagnostics with none new. No paid agent evaluations ran. The full suite is not claimed green: separate baseline updater-fixture and macOS snapshot-path failures were reproduced. Compatibility with older gbrain releases was not tested.

    This is supporting evidence for the existing issue; no duplicate PR is proposed.

  3. added
    bug
    S3
    on Nov 18, 2026
  4. capy-ai commented on Nov 18, 2026

    @capy-ai
    Contributor

    Thank you @nfitzsimmons for the clear report and the argument list. The fix is merged as #4497 (d789dd9), with you credited as co-author: the /sync-gbrain read probe now reads a small window of the first page, so a page over 64 KB reports ready instead of unknown, and older gbrain versions fall back to the previous read.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    S3bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions