Skip to content

fix(brain-sync): fail loud when artifacts source has zero pages - #2670

Closed
jzeisweiss wants to merge 1 commit into
garrytan:mainfrom
jzeisweiss:codex/bug/3047-brain-sync-indexing
Closed

jzeisweiss wants to merge 1 commit into
garrytan:mainfrom
jzeisweiss:codex/bug/3047-brain-sync-indexing

Conversation

@jzeisweiss

@jzeisweiss jzeisweiss commented Aug 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • stop reporting a successful artifact git command as gbrain indexing
  • verify the maintained artifact source page count with a read-only, five-second bounded probe
  • fail loud with index_failed when that source reports zero pages; otherwise report the git result and explicitly mark index freshness as unverified
  • terminate the full probe process tree on timeout, including Git Bash/MSYS native cleanup

This deliberately does not run gbrain sync at every skill boundary: that operation is expensive and owns a single-writer database. Missing, unavailable, invalid, or nonzero probe results remain truthful indexing not verified outcomes rather than false indexing claims.

Verification

Red first on upstream main: the zero-page regression returned status 0 before this change. The final test proves a real artifact commit reaches the remote, then the command fails because the maintained source still has zero pages.

  • bun test test/brain-sync.test.ts test/gstack-gbrain-sync.test.ts test/brain-sync-windows-paths.test.ts test/gbrain-spawn-windows-shell.test.ts — 122 pass, 0 fail
  • bash -n bin/gstack-brain-sync
  • shellcheck --severity=error bin/gstack-brain-sync
  • git diff --check

The broader free suite completed every shard except one unrelated timeout-wrapper timing assertion under six-way load (rc=143 vs rc=124); that assertion passes standalone on both this commit and pristine upstream main.

@trunk-io

trunk-io Bot commented Aug 22, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@jzeisweiss
jzeisweiss force-pushed the codex/bug/3047-brain-sync-indexing branch from 91c53e9 to eb6654f Compare August 27, 2026 06:42
@jzeisweiss

Copy link
Copy Markdown
Contributor Author

Rebased onto current main (ad840054, v1.69.0.0). Same commit, new parent.

Local verification after rebase: bun test test/brain-sync.test.ts test/gstack-gbrain-sync.test.ts → 97 pass, 0 fail.

@jzeisweiss

Copy link
Copy Markdown
Contributor Author

/trunk merge

@trunk-io

trunk-io Bot commented Aug 28, 2026

Copy link
Copy Markdown

An error occurred while submitting your PR to the queue: Only users that are a part of this repo's Trunk organization or have write permissions to the repo can submit a PR to the queue

@jzeisweiss

jzeisweiss commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor Author

Privacy scrub: removed a private-repository reference from the PR description that was not resolvable for external readers. No other description changes.

@capy-ai

capy-ai Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

Thank you, @jzeisweiss. Your fix is folded into v1.91.19.0 (#3025), which is now merged, and you're credited as a co-author on the release commit and in the CHANGELOG. Closing this PR because the change is on main now.

@capy-ai capy-ai Bot closed this Oct 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant