Skip to content

ACP: turns self-started by background-task notifications emit no session/update; prompts arriving during them are answered with empty end_turn and lost #5095

Open

Description

@Joey0904

TL;DR: Turns that kimi starts on its own from background-task notifications are never forwarded over ACP (the host sees nothing), and prompts that arrive while such a turn runs get an immediate empty end_turn reply — the text is never executed and is silently lost when the process stops.

Environment: @moonshot-ai/kimi-code 2.6.2 via kimi acp (stdio) at the time of the incident; ACP host: Orca 1.4.262; macOS 27.2.1. The CLI has since auto-updated to 2.6.3 — not yet re-tested.

Two related problems observed in a single session (full provider wire transcript available):

1. Self-started turns are invisible over ACP

Background-task notifications (task.completed, task.lost, task.failed) start a turn inside kimi that runs to completion — tool calls, assistant messages, prompt.completed are all present in the session's wire.jsonl — but no session/update is emitted for it. The host chat therefore shows nothing and stays "done" at the previous user-started turn. In our session exactly the three notification-driven turns were invisible to the host, while every user-prompt turn was displayed normally.

2. Prompts arriving during a self-started turn are swallowed

A session/prompt sent while such a turn runs is answered immediately with stopReason: end_turn and no output (mechanism as diagnosed together with the Orca maintainer from the wire timeline). The text is kept only in memory: it never appears in the provider-side transcript, is never executed, and is lost when the process is stopped or closed. In our session, three user messages were recorded by the host chat but have 0 matches in the provider transcript and were never answered.

Expected

  • Emit session/update for all turns the agent runs, including self-started ones — or at least notify the host that a self-started turn is in progress.
  • Do not silently drop prompts arriving during a self-started turn: keep them pending until they can run, or reject them so the host can surface it to the user.

Evidence available on request

Provider wire.jsonl timeline (turn.prompt / turn.ended / step.end with timestamps), kimi-code.log (zero error/warn lines during the affected window; lastTurnReason: "completed"), host-side chat record and trace spans (provider exits with closeCause: user-stop / user-close).

Activity

  1. Joey0904 commented on Nov 19, 2026

    @Joey0904
    Author

    Adding the raw artifacts we captured so you don't need to ask for them.

    Session correlation: Orca chat 9ed98191-4e97-4137-a8db-b84f75f82f4e → kimi session session_88b4373b-30d0-4a2d-93d9-4602f69bd3ec (spawned via orca-provider-exec … kimi acp). Provider transcript: agents/main/wire.jsonl; CLI log: logs/kimi-code.log. All times UTC, 2026-11-18.

    Turn timeline (from wire.jsonl turn.prompt / turn.ended events; the list is complete):

    UTC turn trigger ended host displayed?
    15:05:57 0 host resume prompt 15:14:45 yes
    15:21:15 1 user prompt 15:25:22 yes
    15:25:22 2 task.completed notification (self-started) 15:27:10 no
    15:30:00 3 user prompt (image) 15:31:19 yes
    15:32:16 4 task.lost notification (self-started) — no turn.ended; provider killed at 15:38:00 no
    15:38:15 5 user prompt, freshly spawned provider 15:40:32 yes
    15:40:32 6 task.failed notification (self-started) 15:45:11 (prompt.completed) no

    Host side: orca agent show reported state done / updatedAt 15:40:32.249Z, and orca agent read still ends at 15:40:32 today (the chat has since been closed). Orca trace has exactly two spans for this session: provider exits with closeCause: "user-stop" at 15:31:20 and "user-close" at 15:38:00.

    Turn 6 ran to completion while invisible. Its final step in wire.jsonl (trimmed):

    {"type":"context.append_loop_event","agentId":"main","event":{"type":"step.end","turnId":"6","step":15,"finishReason":"end_turn","usage":{"inputOther":368,"output":1561,"inputCacheRead":283904},"providerFinishReason":"completed","rawFinishReason":"stop"},"time":1795016711386}

    Trigger (appended as a user-role message at 15:40:32):

    <notification id="task:bash-i7ov0s39:failed" category="task" type="task.failed" source_kind="background_task" source_id="bash-i7ov0s39"> … 阅读关系动画新版预览 4219 failed.
    

    kimi-code.log during that turn — healthy traffic, zero error/warn/cancel lines anywhere in the file:

    15:42:49 INFO llm request  turnStep=6.10
    15:43:00 INFO llm response turnStep=6.10 ttftMs=5689 streamDurationMs=5283 outputTokens=411
    15:44:17 INFO llm response turnStep=6.12 ttftMs=6134 streamDurationMs=54964 outputTokens=4889
    15:45:11 INFO llm response turnStep=6.15 ttftMs=5807 streamDurationMs=21129 outputTokens=1561
    

    state.json after: lastTurnReason: "completed", lastPrompt: "继续?", updatedAt 1795016711390. A file edited at 15:44Z inside turn 6 exists on disk with no corresponding entry in the host record.

    The three host-recorded messages the provider never saw. Present in the host chat history; rg -c against wire.jsonl:

    • 等等,我没有要求重做。… → 0 matches
    • 你停止了 没做出任何回复 (×2) → 0 matches

    No turn.prompt events exist for them either (the timeline above is the complete list). The host chat shows no reply to any of the three. Context: one was sent while turn 2 ran, two while turn 4 ran — both self-started; the one user message that did go through arrived on a freshly spawned provider with no self-started turn in progress.

    Boundary of what we can prove from outside: we can't distinguish host-side dropping vs. nothing emitted — we only observe provider-completed vs. host-record-ends-earlier. The queue + empty-end_turn mechanism is the Orca maintainer's code-level reading, consistent with everything above.

    Full wire.jsonl (1611 lines; includes unrelated later activity after 15:45:11) or kimi-code.log available if useful.

  2. Joey0904 commented on Nov 19, 2026

    @Joey0904
    Author

    Host-side thread with full context and the client-side diagnosis (same session): stablyai/orca#44155

  3. Joey0904 commented on Nov 19, 2026

    @Joey0904
    Author

    Second occurrence, two new data points. Same host (Orca 1.4.262), different chat, next day.

    • kimi session session_9298901e-25d3-4ecb-9d1b-6ea0a9d57b4d, started 2026-11-19 09:30:21Z. Host record ends at 10:26:59Z — state done, last entry is turn 3's output (ends with a completed WaitFor). Turn 4 (10:26:59Z→10:28:36Z) is invisible to the host: same signature as the original report.
    • This session ran on kimi-code 2.6.3 (auto-updated 08:34Z, ~1h before session start; kimi --version = 2.6.3). So the behavior is still present in 2.6.3.
    • Trigger class extends to subagents. Turn 4's prompt was a task.completed notification for the Agent tool's background subagent (task:agent-akn494ns:completed, source_kind: "background_task"). Sequence from the wire: main turn 3 spawned a kimi subagent (agents/agent-0, profile plan) at 10:22:09Z and waited on it; the subagent completed at 10:26:59Z; the notification spawned turn 4, which made 2 LLM calls (~4.2k output tokens), read the subagent's output, and updated the todo list — ended cleanly (end_turn, providerFinishReason: completed). kimi-code.log: zero error/warn lines. Host displayed none of turn 4.

    So the trigger is background-task notifications generally — a bash background task in the first report, a subagent here; completion/failure/loss all spawn a host-invisible continuation turn.

    wire.jsonl and kimi-code.log for this session available if useful.

  4. Samjossi commented on Nov 22, 2026

    @Samjossi

    We were bitten by the same class of settlement bugs and found a working escape hatch worth sharing for anyone who has the option: kimi web serves KAP (Kimi Agent Protocol) over local HTTP/WebSocket, and that path bypasses the ACP adapter entirely — self-started turns, busy-prompt handling and cancellation all behave correctly there. It's not a substitute for fixing this adapter (Zed-style clients don't have that choice), but for anyone building their own client integration, it unblocked us completely. Still very much hoping to see this fixed in the ACP layer so the whole ecosystem isn't pushed onto workarounds.

  5. mnmami commented on Nov 26, 2026

    @mnmami

    Additional data point: this is not limited to self-started/background-notification turns — we've seen the same instant empty end_turn swallow during ordinary user-requested turns, twice, on Linux (Ubuntu 24.04 under WSL2), kimi-code 2.6.2 spawned via ACP by Orca 1.4.271, model kimi-k3.

    Instance 1 (2026-11-24). A single turn ran ~10:58–11:28 UTC (30+ LLM steps; an auto-compaction completed mid-turn at 10:52 UTC, 213,048 → 21,959 tokens). Six user prompts sent between 11:02:13 and 11:27:04 UTC while it was running were each completed as success in 25–312 ms with no assistant output. The agent-side kimi-code.log shows uninterrupted llm request/response steps for the long turn across the same window (last step 11:28:09 UTC). When the long turn finally ended, the next prompt got a normal full response (reasoning, tool calls, assistant text).

    Instance 2 (2026-11-26). The busy turn was the direct answer to a user prompt sent ~1 minute earlier (its first LLM step at ~13:15:3x UTC, still streaming new steps at 13:34 UTC). Four user prompts sent 13:23:20–13:32:14 UTC each returned success in 32–196 ms, again with zero output.

    Evidence on our side: the host app's journal rows for these turns show state=completed, outcome=success with sub-second durations and no assistant items between them, while ~/.kimi-code/sessions/<workspace>/<session>/logs/kimi-code.log shows real llm request/response traffic covering the same wall-clock windows. The ACP connection itself was healthy throughout (session lease renewing every ~30s; prompts sent after the busy turn completes work fine).

    Happy to provide sanitized journal excerpts or full session logs if useful. (Cross-ref: stablyai/orca#44155.)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions