Skip to content

feat(acp-adapter): steer and queue client prompts during busy turns#685

Open
sailist wants to merge 1 commit into
MoonshotAI:mainfrom
sailist:fix/acp-steer
Open

feat(acp-adapter): steer and queue client prompts during busy turns#685
sailist wants to merge 1 commit into
MoonshotAI:mainfrom
sailist:fix/acp-steer

Conversation

@sailist

@sailist sailist commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

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:

  • Forward agent-initiated background turns to ACP clients.
  • Merge plain-text prompts into active turns via steer when the agent is busy.
  • Queue skill activations until the active turn ends.
  • Move tool-call streaming state to the session level to survive turn hand-offs.
  • Add comprehensive unit tests for steering behavior (packages/acp-adapter/test/session-steer.test.ts).

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

- 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
@changeset-bot

changeset-bot Bot commented Jun 12, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 5a6fa0e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Jun 12, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@5a6fa0e
npx https://pkg.pr.new/@moonshot-ai/kimi-code@5a6fa0e

commit: 5a6fa0e

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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) => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant