Repository navigation
Conversation
… batch fails runExtract --stale lets a flush error propagate on purpose (CDX-4) so the batch stays unstamped, but that also skipped progress.finish(), leaving the reporter in the process-wide live set. In a long-lived process a later signal then emitted an abort for a phase that had already ended. The leak also broke CI: the CDX-4 test in extract-stale.test.ts runs this path, and progress.test.ts, sharing the same bun process in shard 5, found one leaked live reporter instead of zero. The sweep now finishes the reporter in a finally (the pattern enrich and reindex-code already use), and the CDX-4 test asserts the live count is back to where it started. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GCX2qPfuXzjf2QBmBDjbJY
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the intermittent
test (5)failure:progress reporter > only one process-level signal handler installed across many reportersfailed withExpected: 0, Received: 1attest/progress.test.ts:229.Root cause. The bug is in product code, not in the test.
runExtract --stale(src/commands/extract.ts) lets a link/timeline flush error propagate on purpose (CDX-4), so the failed batch stays unstamped. But the error also skippedprogress.finish(), which left the reporter inprogress.ts's process-wideliveReportersset. The CDX-4 test intest/extract-stale.test.tsexercises exactly that path. When the two files land in the same shard andextract-staleruns first,progress.test.tssees the leaked reporter. Whether they share a shard depends on the weight-based shard packing, which is why the failure came and went. In a long-running process (gbrain serve, the autopilot worker), the leak also means a later SIGINT/SIGTERM prints an abort for a phase that already ended.Fix.
src/commands/extract.ts: the--stalesweep loop now callsprogress.finish()in afinally.enrich,reindex-codeandextract-conversation-factsalready use this pattern. The error still propagates, and stamping behaviour is unchanged.test/extract-stale.test.ts: the CDX-4 test now asserts that the live-reporter count returns to its starting value after the failed sweep.VERSION,package.jsonandCHANGELOG.md(+bun install).test/progress.test.tsis unchanged. Its strict zero check is what surfaced this leak.Test plan
extract-stale.test.ts+progress.test.tstogether reproduce the failureextract-stale+progresspass (32/32)scripts/test-shard.sh 5 10locally: the progress test now passes, and no new failures appear. The remaining local failures are identical on unmodified master and come from this sandbox; they don't happen in CI.test/extract*.test.tspass (253/253)bun run typecheck,bun run verify(31/31),test/build-llms.test.tsGenerated by Claude Code