Skip to content

fix(acp): stream agent-initiated turn updates - #2906

Open
bjvgukv25842-cmyk wants to merge 1 commit into
MoonshotAI:mainfrom
bjvgukv25842-cmyk:fix/acp-agent-initiated-turns
Open

fix(acp): stream agent-initiated turn updates#2906
bjvgukv25842-cmyk wants to merge 1 commit into
MoonshotAI:mainfrom
bjvgukv25842-cmyk:fix/acp-agent-initiated-turns

Conversation

@bjvgukv25842-cmyk

Copy link
Copy Markdown

Related Issue

Fixes #2163

Problem

The ACP adapter subscribed to SDK events only while a session/prompt request was in flight. Agent-initiated turns triggered by background work, cron, or autonomous continuation therefore continued running but emitted no live session/update notifications after the prompt returned.

What changed

  • Keep one SDK event subscription for the lifetime of each ACP session and reuse the existing event-to-ACP mappings for prompt-driven and agent-initiated main-agent turns.
  • Track prompt waiters separately so only the matching main-agent turn.ended settles a prompt; autonomous turns and subagent events cannot settle unrelated requests.
  • Dispose persistent listeners when sessions are replaced or the ACP transport closes.
  • Cover normal prompt streaming, autonomous assistant/thinking/tool/plan updates, subagent filtering, autonomous turn completion, and listener cleanup.
  • Add a patch changeset for the user-visible ACP fix.

This intentionally does not add _meta markers, disconnected buffering, or replay of missed history.

Validation:

  • corepack pnpm --filter @moonshot-ai/acp-adapter test (328 tests passed)
  • corepack pnpm --filter @moonshot-ai/acp-adapter typecheck
  • corepack pnpm lint (0 errors)

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.

Keep one session-lifetime SDK event subscription so autonomous turns continue forwarding ACP updates after prompt completion. Release listeners when the transport closes while preserving prompt-specific settlement.
@changeset-bot

changeset-bot Bot commented Aug 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 11c7a83

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

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

@bjvgukv25842-cmyk
bjvgukv25842-cmyk marked this pull request as ready for review August 14, 2026 03:03
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.

ACP: agent-initiated turns (background task completions, cron fires) never emit session/update while no prompt is in flight

1 participant