feat(acp-adapter): steer and queue client prompts during busy turns#685
feat(acp-adapter): steer and queue client prompts during busy turns#685sailist wants to merge 1 commit into
Conversation
- forward agent-initiated background turns to ACP clients - merge plain-text prompts into active turns via steer when agent is busy - queue skill activations until the active turn ends - move tool-call streaming state to session level to survive turn hand-offs - add unit tests for steering behavior
|
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5a6fa0ebce
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| sessionId, | ||
| details: event.details, | ||
| }); | ||
| busyFallback.steer().catch((err: unknown) => { |
There was a problem hiding this comment.
Keep steered prompts pending until their steer takes effect
When a prompt hits turn.agent_busy, this starts the follow-up steer() RPC but still lets the next main-agent turn.ended settle the prompt immediately. If the active background turn finishes before that steer RPC is processed, the old turn's turn.ended resolves and cleans up this prompt; then agent.turn.steer() may launch a fresh turn after the adapter has removed the prompt subscriber, so the user sees the request complete before their input is actually handled (or its output is forwarded as an unsolicited agent-initiated turn). The turn-ended path should ignore the busy turn while a steer is still pending / until the steered input is known to belong to that turn or a new turn.
Useful? React with 👍 / 👎.
Summary
This PR introduces steering and queuing capabilities in the ACP adapter to handle client prompts that arrive while the agent is already in the middle of a busy turn. It ensures plain-text prompts are merged into the active turn, skill activations are queued for the next turn, and tool-call streaming state survives across turn hand-offs. Agent-initiated background turns are also forwarded to ACP clients.
1. Steer and queue client prompts during busy turns
Problem: When a client sends a new prompt or skill activation while the agent is already processing an active turn, the adapter had no clean way to inject the new input into the ongoing conversation or defer it for the next turn. Tool-call streaming state was also tied to the turn level, causing data loss during turn hand-offs.
What was done:
steerwhen the agent is busy.packages/acp-adapter/test/session-steer.test.ts).Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.