Vouch agent-initiated ACP turns so async job delivery renders - #2123
Open
bradhallett wants to merge 1 commit into
Open
Vouch agent-initiated ACP turns so async job delivery renders#2123bradhallett wants to merge 1 commit into
bradhallett wants to merge 1 commit into
Conversation
ACP agents can produce session updates with no prompt in flight (OMP async-job auto-delivery). The bridge gated all work updates on an active prompt, so the output was dropped and nothing reached the thread. The bridge now opens a turn itself when idle agent-work updates arrive, settles it on a quiet window, before the next bb-initiated turn, or on stop; non-work updates stay noise.
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
ACP agents can emit
session/updatework output with no prompt in flight — an agent-initiated turn (OMP's async-job auto-delivery is the concrete case: a background job settles, the agent resumes and streams a follow-up unprompted). ACP brackets no turn for that, and the bridge forwarded the updates unbracketed, so the translator classified themunhandled/onlyIfNoTurnand they never reached the thread: the agent's output was silently dropped. Root cause and evidence in #2122 (DB event gap, wire probe, pre-fix permalinks).What changed
plugins/provider-acp/src/bridge/bridge.ts— the bridge now vouches agent-initiated turns itself, the shapedocs/provider-bridge-protocol.mdturn lifecycle rule 3 sanctions (and the compaction path already uses):agent_message_chunk,agent_thought_chunk,tool_call,tool_call_update,plan) open a vouched turn via the existing bridge turn-started command →turn.open.SPONTANEOUS_TURN_IDLE_TIMEOUT_MS, 120 s, re-armed per chunk) settles the turn asend_turn; a still-open one settles before the next bb-initiated turn or compaction starts;thread/stopand session teardown cancel/clean it. A slow provider can split into multiple vouched turns; output is never lost.available_commands_update,usage_update, …) stay noise — no phantom turns.user_message_chunkstays classified as input-echo noise, so the replayed async result creates no phantom user row.No wire/protocol changes; translator untouched (stays context-free).
fake-acp-agent.mjsgainsspontaneous-stream:N(post-prompt unsoliciteduser_message_chunk+ N agent chunks) andspontaneous-noisebehaviors plus a follow-upusage_updatesignal;__setSpontaneousTurnIdleTimeoutForTestsshrinks the quiet window in tests.How you verified
src/bridge/bridge.test.ts(real bridge + real delta assembler, fake agent over stdio): vouched turn opens for unsolicited output and quiet-closes; a still-open vouched turn settles before the next user turn (3 started / 3 completed, stream intact, exactly oneinput.accepted); non-work idle updates open nothing.agent_message_chunkfrom the work-kind map fails both positive tests (and not the noise test).pnpm -C plugins/provider-acp test→ 184 passed (14 files);tsc --noEmitclean; eslint + prettier clean on touched files.Fixes #2122