Repository navigation
Prune low-value @bb/agent-runtime tests and require providerThreadId on resume - #6936
Merged
ymichael merged 4 commits intoNov 3, 2026
Merged
Conversation
…on resume Delete duplicate, vacuous, and inventory tests across the runtime unit and live-CLI suites, merge their unique assertions into the keeper tests, and repair assertions that could not fail. ResumeThreadArgs.providerThreadId is now required: every production caller already supplies it, and the fallback only existed for the tests that relied on it. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The three provider exit-race tests now answer initialize and then exit while a grandchild holds stderr open, so they act between the child's exit and close events; each fails when its fix in RuntimeProviderProcessManager is reverted. The Claude deny-escalation test asserts the blocked Bash attempt, and both automatic-review tests write outside the workspace so the reviewer actually runs. Co-Authored-By: Claude Opus 5.5 <[email protected]>
On Windows the stderr holder can take longer to start than the one-second close grace, so the provider's exit was already finalized before the test observed the window. The provider now exits when the test writes a signal file, after the holder is running and the exit listener is attached. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Windows locks a directory that a live process uses as its cwd, so cleanup failed with EBUSY while the holder was still being torn down. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
deleted the
bb/test-audit-packages-agent-runtime-thr_5nrkrkx5b8
branch
November 3, 2026 21:18
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
@bb/agent-runtimecarried about 1,300 lines of tests that couldn't catch a regression:initialize. Since then they run against an empty process map, so all three pass with each Fix provider process exit lifecycle races #1402 fix reverted.ResumeThreadArgs.providerThreadIdwas optional only so tests could register a thread with no provider identity. Every production caller already passes it.What changed
All changes are in
packages/agent-runtime: tests +328 / −1,487, production +12 / −17. No wire, protocol, CLI or docs changes, soHOST_DAEMON_PROTOCOL_VERSIONis unchanged.Production
ResumeThreadArgs.providerThreadIdis required.resumeThreaddrops the?? requireProviderThreadId(threadId)fallback and theundefinedbranches around it.@bb/host-daemon(the only production caller) already checks the id before calling.Deleted or merged tests, each one's unique assertions moved into its keeper first:
auto/deny × providerof the permission matrix.it.eachthat pins the real-32601 Unsupported provider requestreply.SameUnionchecks against the domain types already fail typecheck when a new mode, escalation or enforcer appears.test/bridges/unsolicited-turn-bridge.ts, and request-record setups that were never written to.Repaired tests
commandExecutionitem.runTurnandrenameThreadnow run during a real in-flightstartThread.initialize, starts a grandchild holding stderr open, then exits. Each test acts between the child'sexitandcloseevents:exitFinalized;require_escalatedand went throughauto_review.How you verified
Turbo runs on the rebased branch (base
7130d9692b), with--force:pnpm exec turbo run lint typecheck --filter=@bb/agent-runtime --filter=@bb/host-daemon --filter=@bb/server: green.pnpm exec turbo run test --filter=@bb/agent-runtime --force: 297/297. The baseline was 314/314; the difference is the deleted tests.pnpm exec turbo run test:integration --filter=@bb/agent-runtime --force: 54/55. The baseline was 64/65.runtime.process-lifecycle.test.ts: 5 consecutive uncached runs, all 31/31.Mutation checks. Each bug is introduced into production code and the before/after tests are run. All mutations were reverted byte for byte.
51d8ddc75aand the first commit, in separate worktrees. Every bug caught by a removed test is still caught by a kept test.runTurnguard withgetProviderThreadId(...) ?? ""fails the restored test.RuntimeProviderProcessManager:ensureProviderdoesn't awaitexitFinalizedor re-checkshutdown()waits for anexitevent that already fired (the pre-#1402 bug)Existing failure:
integration.env-isolation.test.ts"codex provider applies rotated and removed contributions on the next turn". It is not caused by this change.origin/mainworktree (cbde50f2d9) and on the pre-change baseline51d8ddc75a: the turn with the rotated value readsFAIL. Reproduced on every run with codex-cli 0.166.0.shell_environment_policy.set.*config when the session is built.turn/startcarries no env.constructionSignature(plugins/provider-codex/src/bridge/bridge.ts) changes, and that signature takes onlyCODEX_HOMEand the pool route fromenvVars. So a rotated or removed contribution never reaches the live session.envVarstoconstructionSignatureon the samemainworktree makes the test pass. That edit was reverted and is not part of this PR.test:integrationcase, so nothing in CI catches this. It should be fixed in its own PR.🤖 Generated with Claude Code