Skip to content

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

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

fix(brain-sync): fail loud when artifacts source has zero pages#2670
jzeisweiss wants to merge 1 commit into
garrytan:mainfrom
jzeisweiss:codex/bug/3047-brain-sync-indexing

Conversation

@jzeisweiss

Copy link
Copy Markdown

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.

Refs jzeisweiss/my_dog_molly#3047.

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
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.ts97 pass, 0 fail.

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