MoonshotAI / MoonshotAI/kimi-code
ACP misses autonomous harness turns because event subscription is prompt-scoped
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 7.5k
- Forks
- 1.2k
- Avg merge
- 11h 53m
- Merged PRs (30d)
- 350
Description
Summary
The kimi-code ACP server does not forward session/update notifications for turns started autonomously by the harness. Examples include background-task completion injections, system-reminder-only turns, and cron fires.
Affected version
Verified in kimi-code 0.38.0, published 2026-08-20. The same behavior exists in local 0.34.0.
SHA256 for the checked 0.38.0 Linux x64 binary:
7f18b701ea751d14bf051776747ca0339f8d59693aec9051276933067a914b00
Evidence
The embedded ACP server code in both versions has this structure:
prompt() calls runTurnBody(...)
runTurnBody creates:
const unsub = this.session.onEvent((event) => { ... })
runTurnBody unsubscribes when the prompt turn settles
There is no persistent per-session harness-event subscription. Therefore, when no client prompt request is active, autonomous harness events have no subscription that can forward them as ACP session/update notifications.
Expected behavior
A connected ACP client receives session/update notifications whenever the session produces main-agent events, including events from autonomous harness turns. ACP session updates are not limited to a prompt request lifetime.
Actual behavior
Autonomous turns produce no ACP session/update notifications. A client that is waiting for background activity cannot display the assistant output or the turn boundaries.
Minimal fix proposal
Create one persistent main-agent event subscription when the ACP session is created or loaded. Forward those events to conn.sessionUpdate unconditionally. Keep runTurnBody responsible only for settlement of its own prompt request, such as resolving on that prompt's turn.ended event.
This preserves prompt request semantics while allowing session updates at any time.
Reproduction
- Start kimi-code in ACP mode.
- Establish an ACP session and keep the connection open.
- Trigger a harness action that starts a turn without an active client
prompt, such as a background-task completion injection or cron fire. - Observe that no
session/updatenotification arrives for the autonomous turn. - Compare with a normal client prompt, where updates arrive while
runTurnBodyhas subscribed.
Please let me know if you need the binary extraction details or a small ACP client trace.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the ACP server's prompt() and runTurnBody path, then trace session creation or loading and the existing session.onEvent subscription. Reproduce the issue with an autonomous harness turn while no prompt is active, and compare it with a normal prompt. Done means connected clients receive session/update notifications for autonomous turns without changing prompt settlement behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100