Repository navigation
Stop ACP inbound dispatch after kill - #2594
Merged
ymichael merged 1 commit intoAug 27, 2026
Merged
Conversation
AcpAgentConnection kept dispatching parsed stdout messages after kill latched the stopping state, allowing a SIGTERM-time request to mutate a released workspace. Drop inbound protocol lines while stopping and cover the real child-process race.
ymichael
deleted the
bb/fix-acp-inbound-requests-after-stop-thr_ymtw8zyhrt
branch
August 27, 2026 20:14
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
AcpAgentConnection.kill()synchronously stopped bb-to-agent writes, but the ACP stdout listener continued dispatching agent-to-bb JSON-RPC while the child was terminating. An ACP agent could emit a request such asfs/write_text_filefrom its SIGTERM handler and have bb execute it after the owning session had already been released.What changed
Added an early
stoppingguard at the shared ACP stdout-listener boundary, before inbound messages are parsed or classified as responses, requests, or notifications. Updated the lifecycle coverage and added a real-child regression whose SIGTERM handler emits a write request; the test proves neither the request callback nor its filesystem mutation occurs afterkill(). No server/daemon wire contract changed, soHOST_DAEMON_PROTOCOL_VERSIONremains unchanged.How you verified
late-write.txtfile.origin/main, force-ran the focused SIGTERM regression three times: all three passed with no cache reuse.pnpm exec turbo run test --filter=@bb/provider-bridge-acp --filter=bb-plugin-provider-acp --force: 299 bridge tests and 76 provider-plugin tests passed.pnpm exec turbo run typecheck --filter=@bb/provider-bridge-acp --filter=bb-plugin-provider-acp --force: passed.pnpm exec turbo run build --filter=@get-bb/plugin-sdk --force: all 17 runtime entries built.oxfmt --check,git diff --check, and a debug-marker search successfully.