Repository navigation
Description
Summary
Over ACP, Kimi Code sends no session/update events for turns it starts on its own: the turn that delivers a finished background agent's or background shell's result, and the turn a CronCreate schedule fires. An ACP client sees none of that turn's messages, thoughts, tool calls or its end; only terminal/* requests from it arrive. A client therefore cannot show what the agent did, and cannot tell that the agent is busy.
A related problem: a session/prompt sent while such a turn is running is answered at once with stopReason: "end_turn" and no content, then runs later as its own turn, which is again invisible to the client.
Versions
Kimi Code 2.0.2 and 2.1.1 (kimi acp), Linux x86_64. The same behavior is visible with 0.41.0. acp-server/src/session.ts is identical between 2.0.2 and 2.1.1.
Reproduction
- Start
kimi acpand open a session from any ACP client. - Send: "Start a background agent that runs
sleep 20 && wc -l README.mdand reports the line count; tell me when you have started it." - The client receives the launch and the reply for this prompt, then
end_turn. - About 20 s later the background agent finishes and Kimi starts its own turn to report the result ("README.md has 37 lines."). That turn appears in Kimi's own session record, but the ACP client receives no
session/updatefor it: noagent_message_chunk, no tool calls (exceptterminal/createand related requests if the turn runs shell commands), and nothing marking the turn's end. - The same happens for turns started by a
CronCreateschedule. - Optional: send a
session/promptwhile such an agent-started turn is running. The response is immediateend_turnwith no output; the prompt is then executed later as a separate turn whose updates are also not sent.
Cause (from reading the source)
In acp-server/src/session.ts, driverFor routes events only for turns that a session/prompt started; events of a turn with another origin (the session record shows origin.kind task or cron_job) are dropped.
Expected
- Send
session/updatenotifications for agent-started turns as for prompted ones (messages, thoughts, tool calls), so the client's transcript includes them. A turn-boundary signal for these turns (for example in_meta) would let clients show that the agent is busy. - For a
session/promptthat arrives during an agent-started turn: either wait and run it after that turn with normal updates and a normal response, or refuse it with an error the client can retry, rather than answeringend_turnimmediately and running it unseen.
Observed with Mjolnir (an ACP client that runs Kimi Code sessions).
Activity
Pin Kimi Code 2.1.1
Pin Kimi Code 2.3.1 and turn off its session lock
jason5545 commentedon Oct 24, 2026
Another trigger for the same queued-prompt path:
/compactover ACP (Kimi Code 2.3.1)The "prompt answered at once with
end_turn, then run later invisibly" behavior described above also happens right after/compact, with no background task or cron involved.Reproduction
/compactas asession/prompt.stopReason: "end_turn"and the message "Context compaction started — it runs in the background and the compacted context applies once it finishes." The compaction request itself takes much longer (about 98 s in our case).session/prompt. It is answered in ~15 ms withend_turnand no content.session/updatefor that turn.Cause (from reading the bundled source)
/compactis handled bydriveBuiltinCommand, which callsagent.compact()and returnsend_turnimmediately; the compaction is not registered as a turn.driveTurnguards withassertNoActiveTurn, which only checks for an in-flight prompt, so background compaction does not block a new prompt.agent.prompt()queues the message and returnsundefined. The ACP layer treats that as "no turn started" and answersend_turn, although the nearby comment notes this case should be rejected because the queued turn's events would be unattributed.driverFor(turnId)finds no driver, so all its updates are dropped.Suggested fix
driveTurn, whenagent.prompt()queues instead of starting a turn, return an error (or wait and run it as a normal turn) instead ofend_turn./compactover ACP resolve only when compaction completes or is cancelled, or haveassertNoActiveTurntreat a running compaction as an active turn.As a client-side workaround, we now hold the
/compactprompt open until Kimi emits "Compaction completed." / "Compaction cancelled." before sending the next prompt.Investigated with AI assistance (Claude Code), from T3 Code provider logs, the Kimi session log and the source bundled in the
kimi2.3.1 binary.Dante-dan commentedon Oct 24, 2026
I traced both reports to the current ACP adapter: it filters turn-scoped output through the driver for an outstanding
session/prompt, while task/Cron turns and background compaction can keep the engine busy without that driver.The reference change tracks
turn.started/turn.endedseparately from RPC settlement. It forwards messages, thoughts and tool updates for independently started main-agent turns, while only the matching RPC driver can settle a prompt. The busy check also covers those turns and the compaction lifecycle, so a prompt during/compactis rejected with the existing retryable busy error instead of silently entering the engine queue. The compaction launch marker is released infinally; completion, cancellation and blocking release the lifecycle marker. This keeps the existing background/compactresponse and completion notices.Fixed reference diff.
Validation: package typecheck, source lint and
git diff --checkpassed. The existing ACP turn suite completed all 24 assertions successfully, but its command exited 1 due to 21 unhandledEMFILEfilesystem-watcher errors; the whole ACP suite also hit watcher limits, including with one worker. These checks used Node 24.12.0, below the repository's 24.15.0 minimum. I have not reproduced the actual task/Cron scenarios in a live client, and this change does not add a new turn-boundary protocol extension.Please
/approveif this approach is acceptable; I can continue from the reference branch.IvanLarin commentedon Nov 1, 2026
Reproduced on Kimi Code 2.4.1 / Windows / Zed ACP: completion turn appears only after restart
I reproduced this with a minimal 30-second background Bash task, without any project-specific code.
Environment:
Steps:
sleep 30viaBash(run_in_background=true).TaskList,TaskOutput, orWaitFor, and keep the client idle for 40–60 seconds.Expected:
Actual:
Task evidence:
TaskOutput:completed, exit code 0.bash-sy2k6322.This distinguishes the failure stage: task execution and agent-side notification completed, but the live autonomous turn was not delivered to or displayed by the ACP client until session reload.
The behavior also matches the history-replay observation in #2878.
I have a screen recording showing the launch, the missing live response, two unanswered prompts, the Zed restart, and the subsequent appearance of the missing turn in history. Local paths and unrelated session information will be redacted before sharing.
The issue is intermittent in my controlled series: one client-visible failure was observed across ten background-task probes with varying durations and interaction patterns.
alexanderfedyunin-bit commentedon Nov 22, 2026
Reproduced on Windows with Orca 1.4.269 and bundled Kimi Code 2.7.2.
After background Bash tasks complete or fail, Kimi starts task-origin turns internally without sending their updates over ACP.
User prompts submitted during those invisible turns are immediately recorded by Orca as completed/success after 20-30 ms, with no content. Kimi's wire.jsonl shows that the same prompts actually start 5-6 minutes later and execute normally, but their updates never reach Orca.
Concrete example:
The same happened to two subsequent user prompts.
This is not merely a display issue. Queued prompts can execute file modifications later without user visibility, and repeated submissions can potentially repeat those modifications. Please prioritize the ACP queue handling fix.
jzissimos commentedon Nov 23, 2026
Also on Kimi Code 2.7.2 with T3 Code 0.1.11 (macOS, Intel). A background Bash task finished mid-turn, and Kimi started its own turn (
task:…:completed) at 05:17:59 UTC that ran for 11 minutes. Three prompts sent during it returned in 21–26 ms, then ran later, one after another. None of that output reached the client. Please sendsession/updatefor self-started turns, and refuse or hold prompts until they can run.whynpc9 commentedon Dec 1, 2026
Kimi Code 2.8.1 also loses goal-continuation output over ACP
I observed the same symptom with Kimi's automatic goal continuation in T3 Code. The ACP client recorded the initial response and marked the run complete, while Kimi continued working in the same native session.
Environment: macOS arm64, Kimi Code CLI 2.8.1,
kimi-code/k3.1-pro, T3 Code Nightly0.1.14-nightly.20261128.5385, Kimi launched as an ACP subprocess.Observed sequence (relative times, with message content omitted):
CreateGoal. Its final response is recorded.origin.kind=system_triggerandorigin.name=goal_continuation.Standalone reproduction: A stdlib-only Python client launched Kimi Code 2.8.1 over stdio in a scratch workspace. A loopback model fixture scripted three responses: a
CreateGoaltool call, an initial text marker, and a second marker during automatic goal continuation. The client kept the connection open after the firstsession/promptcompleted. It observed this result:The standalone probe uses synthetic data and the installed
kimibinary. Run the accompanying script withpython3 repro-kimi-acp-goal-output.py "$(command -v kimi)".Expected: After the initial prompt completes, the client can observe output from goal continuation, with enough lifecycle information to tell when Kimi is working and when it is idle.
In the 2.8.1 ACP source,
driveLaunchbinds a driver to a specific turn, andonAssistantDeltareturns before emitting a notification when no driver matches that turn. The T3 observation comes from persisted transcripts. The standalone reproduction captures the ACP output directly.repro-kimi-acp-goal-output.py