Repository navigation
Fix Windows CI flakes from real gh calls in tests and wall-clock parity throttling - #5186
Merged
Merged
Conversation
Since #5161 dropped the `primaryHostId !== null` guard, a server with no host-id file forwards GitHub credentials to every host. The server test harness has no host-id file, so every turn dispatch in a harness test now ran the real `gh auth token` and `gh api user` through resolveHostEnvironment. That took ~1 s locally and longer on Windows, so tests that advance fake timers and then assert on the dispatched turn (child-outcome-gaps.test.ts) failed whenever the subprocess outlived the fake-timer advance. It also read the runner's or developer's real gh login. The harness now disables machineGitCredentialsEnabled by default. Tests that cover forwarding mock resolveGitCredentials and opt back in; tests that disabled it by hand drop the now-redundant setup. Co-Authored-By: Claude Opus 5.5 <[email protected]>
createBridgeDeltaEventCollector throttled progress events against the wall clock. Parity self-tests assemble the recorded lane in a tight synchronous loop, always inside the 500 ms throttle, but assemble the replay live while the bridge subprocess streams. On a slow Windows runner the replay's item.open -> item.progress gap exceeded 500 ms and emitted an extra item/backgroundTask/progress for claude-code/subagent. The collector already pins text flushing (textDeltaFlushMs: 0) for determinism; it now pins its clock too, so both sides coalesce identically regardless of runner speed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Human comments
What was wrong
Two Windows-only CI flakes kept
mainred.child-outcome-gaps.test.ts(Windows server-1, 5 of the last 7 redmainruns). Forward server gh credentials when the server has no local host daemon #5161 dropped theprimaryHostId !== nullguard inresolveHostEnvironment, so a server with nohost-idfile forwards GitHub credentials to every host. The server test harness has nohost-idfile, so every turn dispatch in a harness test began running the realgh auth tokenandgh api user. That takes ~1 s locally and longer on Windows. The test advances fake timers and then asserts on the dispatched parent notice, so it failed whenever the subprocess outlasted the advance. Locally, 5 of the 7 tests in the file failed on every run. Harness tests were also reading the runner's or developer's real gh login.claude-code/subagentreplay (Windows packages-other, latest run).createBridgeDeltaEventCollectorthrottled progress events against the wall clock (500 ms). The recorded lane is assembled in a synchronous loop, always inside the throttle. The replay is assembled live while the bridge subprocess streams, so on a slow runner theitem.open→item.progressgap passed 500 ms and emitted an extraitem/backgroundTask/progress.What changed
apps/server/test/helpers/test-app.ts: the harness disablesmachineGitCredentialsEnabledby default.machine-environment,public-project-clone-sources,public-terminals) mockresolveGitCredentialsand opt back in.[]mock is removed./system/configdefaults test lists the harness override.packages/provider-bridge-protocol/src/testing/bridge-delta-assembly.ts: the testing collector pins its clock (now: () => 0), alongside its existingtextDeltaFlushMs: 0, so both parity sides coalesce progress identically regardless of runner speed. The signature is unchanged and no SDK surface file is touched.No production code, wire, or CLI changes.
How you verified
vitest run test/threads/child-outcome-gaps.test.tsfailed 5/7 locally on every run. Instrumentation showedresolveThreadRuntimeCommandConfigtaking ~1000 ms insideresolveGitCredentials. After: it passes, and the touched files pass 91/91.pnpm exec turbo run test typecheck lint --filter=@bb/server: 3398 passed with 2 failures. Thegeneral-settingsdefaults test is now fixed.builtin-pluginshot-reload passed when rerun in isolation and is unrelated. Both files pass on rerun.item/backgroundTask/progress). With the pinned clock all 56 cells pass.pnpm exec turbo run test typecheck lint --filter=@bb/provider-bridge-protocol --filter=@bb/provider-parity --filter=bb-plugin-echo-provider --filter=@get-bb/plugin-sdk: 13/13 tasks passed.🤖 Generated with Claude Code