Repository navigation
Fix GitHub sync service abort race - #1854
Merged
Merged
Conversation
ymichael
added a commit
that referenced
this pull request
Aug 19, 2026
## What was wrong The test suite had three related quality problems: an ACP integration test used file existence as a proxy for completed output and could race with a confirmed child-process stdin teardown error ([CI run 32188276525](https://github.com/get-bb/bb/actions/runs/32188276525)); package coverage reports omitted unimported runtime files, hiding substantial gaps; and high-risk JSON-RPC/GitHub behavior had little boundary coverage while presentation-only header sizing assertions added maintenance cost without protecting product behavior. Recent GitHub sync/auth fixes in #1282, #1758, and #1854 helped identify the missing regression surfaces. The first PR run also exposed a source-wrapper test that deep-compared the unrelated, evolving `bb status` payload; Turbo did not model its hidden `@bb/cli` dependency, so the stale assertion had previously remained cached green. ## What changed - Wait for the completed ACP turn rather than file creation, and suppress only the benign `EPIPE`/`ERR_STREAM_DESTROYED` child-stdin teardown race. - Add lifecycle regression tests for ACP connection shutdown and write completion. - Add opt-in reproducible V8 coverage for packages using the shared Vitest configuration. Explicit source globs include files never imported by tests; normal test and CI runs remain unchanged unless `--coverage` is passed, and no threshold is imposed. - Expand provider JSON-RPC coverage from one test to ten across parsing, malformed messages, schema validation, timeouts, notifications, structured errors, and exactly-once settlement. - Add GitHub plugin RPC tests for sync, cache patching, PR/check/review normalization, pagination, and file patches, plus app tests for routes, query matching, and suggestions. - Ensure all GitHub plugin test files are included in typechecking and remove three presentation-only header sizing tests. - Keep the source CLI wrapper test focused on clean, parseable JSON and declare its `@bb/cli#build` Turbo dependency so CLI changes cannot reuse a stale test result. There are no server/daemon wire changes, CLI changes, or user-facing configuration changes, so no protocol-version or guide update is required. ## How you verified - [Replacement PR CI run 32311230863](https://github.com/get-bb/bb/actions/runs/32311230863) passed every required check, including packages, server, integration, all app shards, and Linux/macOS package smoke. - `pnpm exec turbo run test --filter=@bb/scripts --force` — 17 files and 92 tests passed; the command explicitly executes `@bb/cli#build` first. - `pnpm exec turbo run test --filter=@bb/integration-tests --force` — 55 tests passed. - `pnpm exec turbo run test typecheck --filter=@bb/provider-bridge-protocol --filter=bb-plugin-github --force` after rebasing — 86 provider tests and 21 GitHub tests passed; both relevant typechecks passed. - Repeated the new provider transport tests 25 times (250 executions) and the complete GitHub plugin suite 10 times (210 executions) without a failure. - Provider bridge line coverage increased from 60.00% to 66.96%; `runtime-json-rpc.ts` reaches 90.32%. - GitHub plugin line coverage increased from 23.07% to 41.19%; `server.ts` increased from 40.22% to 69.31%. - Full app and server audit runs passed 3,092 app tests and 1,775 server tests. Fixes: N/A — test-coverage audit without a single tracking issue. > AGENT GENERATED: by GPT-5
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.
What was wrong
The GitHub plugin's sync service could be aborted while
syncAll()was still running. After the pass finished, the service installed its retry-delay abort listener without first rechecking the signal. BecauseAbortSignaldoes not replay an abort to listeners added later, a failed pass then slept for the full 30-second retry delay. On a loaded packages shard, the test's 150 ms abort landed in that window and hit its 20-second timeout.What changed
The sync loop now checks for an already-aborted signal before scheduling its next delay. Its delay listener is also removed when the timer completes instead of accumulating across successful sync cycles.
The auth-latch regression now waits for the service's first
ghcall instead of assuming it starts within 150 ms, deliberately slows that call so abort occurs mid-pass, and verifies that the all-repos failure is caught without advancing the sync cursor. No wire, CLI, or documentation surfaces changed.How you verified
pnpm exec turbo run test typecheck --filter=bb-plugin-github --force— 14/14 tests passed and typecheck passed.git diff --checkpassed.Fixes #1758