Skip to content

ACP: subagent tool calls needing approval are rejected without asking the client (seen on the ACP Registry build, kimi-cli 1.52.0); please confirm Kimi Code CLI 2.4.1 forwards subagent approvals #4657

Open

Description

@mESmaC

What version of Kimi Code is running?

kimi, version 1.52.0 — the archived Python Kimi CLI, which is still what the ACP Registry entry kimi distributes to Zed, T3 Code and JetBrains users. That repository is archived (read-only since 2026-11-03) and MoonshotAI/kimi-cli#2661 asks for issues that still apply to be re-filed here. I have not yet reproduced this on Kimi Code CLI 2.4.1; see "Additional information" for why it may or may not apply.

Which open platform/subscription were you using?

Kimi Code subscription, OAuth login via kimi login against auth.kimi.ai (KIMI_CODE_OAUTH_HOST=https://auth.kimi.ai, KIMI_CODE_BASE_URL=https://api.kimi.ai/coding/v1)

Which model were you using?

kimi-code/kimi-for-coding,thinking (also reproduced with kimi-code/k3.1-pro-highspeed,thinking)

What platform is your computer?

Microsoft Windows NT 10.0.26300.0 x64 (Windows 11 Pro). ACP client: T3 Code desktop (nightly 0.1.7), and a minimal stdio JSON-RPC client for the repro below.

What issue are you seeing?

When Kimi runs as an ACP agent (kimi acp) and the root agent delegates work to a subagent through the Agent tool, every subagent tool call that needs approval (Shell, WriteFile, StrReplaceFile, …) is rejected immediately. The ACP client is never asked: no session/request_permission request is sent for any subagent tool call.

Read-only tools do not need approval, so an explore subagent works and a coder subagent cannot write or run anything. The coder subagent's own summary came back as:

Implementation was blocked by tool permissions.
- Read-only inspection of the task worktree succeeded ...
- All Shell commands targeting <worktree> were rejected.
- `WriteFile` for crates/oia-app/src/witness.rs was also rejected

~/.kimi/logs/kimi.log for the same session (0b621ce7-…), one warning per rejected subagent tool call:

2026-11-03 10:10:46.562 | INFO    | kimi_cli.soul.agent:load_agent:402 | 0b621ce7-0e15-40ca-91c4-5b8e218ffc4d - Loading agent: ...\kimi_cli\agents\default\coder.yaml
2026-11-03 10:10:55.361 | WARNING | kimi_cli.acp.session:_handle_approval_request:479 |  - Tool call not found: tool_iA0hJE6jlBkCAk3Y0fWFrpjA
2026-11-03 10:10:56.344 | WARNING | kimi_cli.acp.session:_handle_approval_request:479 |  - Tool call not found: tool_SwQppi4UTZnhAr6wNMDr5NfY
2026-11-03 10:11:21.806 | WARNING | kimi_cli.acp.session:_handle_approval_request:479 |  - Tool call not found: tool_FgtdClAqb9zg2R9thAUjTICe

The ACP client's trace for the same window contains no session/request_permission at all. Root-agent tool calls in the same session are approved normally.

Cause (tag 1.52.0, unchanged on main at 9ab1286b8f):

src/kimi_cli/acp/session.py, ACPSession._handle_approval_request (lines 477–481) looks the approval's tool_call_id up in self._turn_state.tool_calls and rejects when it is missing:

state = self._turn_state.tool_calls.get(request.tool_call_id, None)
if state is None:
    logger.warning("Tool call not found: {id}", id=request.tool_call_id)
    request.resolve("reject")
    return

_turn_state.tool_calls is only populated by _send_tool_call for the root agent's ToolCall wire messages. Subagent tool calls arrive wrapped in SubagentEvent, which the ACP prompt loop ignores (case SubagentEvent(): pass, line ~202). The unified approval runtime (1.25.0+) still routes the subagent's ApprovalRequest to the root wire, so it reaches _handle_approval_request with a tool_call_id the session has never seen, and is rejected before the client is consulted.

Everything else in the handler already supports forwarding: request.description and request.display are available, and request.source carries agent_id / subagent_type / parent_tool_call_id.

What steps can reproduce the bug?

Reproduced on the ACP Registry build. The same steps should apply to Kimi Code CLI's kimi acp.

  1. Install Kimi CLI 1.52.0 (the ACP Registry build) and kimi login. Leave default_yolo = false (the default) in ~/.kimi/config.toml.
  2. Run kimi acp from an empty directory and speak ACP over stdio. The client must answer session/request_permission with an allow_once option so root-agent calls are not the thing being rejected.
  3. Send:
{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":1,"clientCapabilities":{"fs":{"readTextFile":false,"writeTextFile":false},"terminal":false},"clientInfo":{"name":"repro","version":"0"}}}
{"jsonrpc":"2.0","id":2,"method":"session/new","params":{"cwd":"<that directory>","mcpServers":[]}}
{"jsonrpc":"2.0","id":3,"method":"session/prompt","params":{"sessionId":"<from session/new>","prompt":[{"type":"text","text":"Use the Agent tool with subagent_type \"coder\" to create a file named subagent-wrote-this.txt in the current working directory containing exactly the line: subagent ok. Do not create the file yourself; only the subagent may write it. After the subagent finishes, reply with one line: DONE or FAILED plus the subagent's summary."}]}}
  1. Observe: the client receives a tool_call for Agent, then in_progress updates, then the root agent reports that the subagent's WriteFile was rejected. No session/request_permission arrives. kimi.log shows Tool call not found: tool_… from _handle_approval_request. The file is not created.

  2. Control: set default_yolo = true in ~/.kimi/config.toml and repeat. The coder subagent writes the file and the turn ends with DONE, which shows the subagent has the tools and only the approval path is broken. (Session 9fec58a5-b5b4-47b4-9250-7b92ce2b38f8, Tool Agent completed in 23.6s, zero permission requests.)

Minimal stdio ACP client used for steps 2–4 (Node 20+): node repro.mjs <path-to-kimi> <empty-dir>. The two KIMI_CODE_* variables select the kimi.ai region; drop them for kimi.com accounts.
import { spawn } from "node:child_process";
import * as fs from "node:fs";
const [exe, workDir] = process.argv.slice(2);
fs.mkdirSync(workDir, { recursive: true });
const child = spawn(exe, ["acp"], { cwd: workDir, stdio: ["pipe", "pipe", "pipe"], env: { ...process.env, KIMI_CODE_OAUTH_HOST: "https://auth.kimi.ai", KIMI_CODE_BASE_URL: "https://api.kimi.ai/coding/v1" } });
let buf = "", sessionId, permissionRequests = 0;
const send = (o) => child.stdin.write(JSON.stringify(o) + "\n");
const finish = (why) => { console.log("finish:", why, "permission requests seen:", permissionRequests); try { child.stdin.end(); } catch {} setTimeout(() => { try { child.kill(); } catch {} process.exit(0); }, 15000); };
child.stdout.on("data", (d) => {
  buf += d.toString();
  let idx;
  while ((idx = buf.indexOf("\n")) >= 0) {
    const line = buf.slice(0, idx); buf = buf.slice(idx + 1);
    if (!line.trim()) continue;
    let msg; try { msg = JSON.parse(line); } catch { continue; }
    if (msg.id === 1) send({ jsonrpc: "2.0", id: 2, method: "session/new", params: { cwd: workDir, mcpServers: [] } });
    else if (msg.id === 2) {
      sessionId = msg.result.sessionId; console.log("session", sessionId, "model", msg.result.models?.currentModelId);
      send({ jsonrpc: "2.0", id: 3, method: "session/prompt", params: { sessionId, prompt: [{ type: "text", text: "Use the Agent tool with subagent_type \"coder\" to create a file named subagent-wrote-this.txt in the current working directory containing exactly the line: subagent ok. Do not create the file yourself; only the subagent may write it. After the subagent finishes, reply with one line: DONE or FAILED plus the subagent's summary." }] } });
    } else if (msg.id === 3) { console.log("prompt result:", JSON.stringify(msg.result ?? msg.error)); finish("prompt finished"); }
    else if (msg.method === "session/request_permission") {
      permissionRequests++;
      const opt = msg.params.options.find((o) => o.kind === "allow_once") ?? msg.params.options[0];
      console.log("permission request for", msg.params.toolCall?.title, "-> answering", opt?.optionId);
      send({ jsonrpc: "2.0", id: msg.id, result: { outcome: { outcome: "selected", optionId: opt.optionId } } });
    } else if (msg.method === "session/update") {
      const u = msg.params.update;
      if (u.sessionUpdate === "agent_message_chunk" && u.content?.type === "text") process.stdout.write(u.content.text);
      else if (u.sessionUpdate === "tool_call") console.log("\n[tool_call]", u.title, u.kind ?? "");
      else if (u.sessionUpdate === "tool_call_update" && u.status) console.log("\n[tool_call_update]", u.toolCallId, u.status);
    } else if (msg.method && msg.id !== undefined) { console.log("unhandled request", msg.method); send({ jsonrpc: "2.0", id: msg.id, error: { code: -32601, message: "unsupported" } }); }
  }
});
child.stderr.on("data", (d) => process.stderr.write("[stderr] " + d));
child.on("exit", (c) => { console.log("\nkimi exited", c); process.exit(0); });
send({ jsonrpc: "2.0", id: 1, method: "initialize", params: { protocolVersion: 1, clientCapabilities: { fs: { readTextFile: false, writeTextFile: false }, terminal: false }, clientInfo: { name: "probe", version: "0" } } });
setTimeout(() => finish("timeout"), 8 * 60 * 1000);

What is the expected behavior?

A subagent's approval request is forwarded to the ACP client like a root-agent one, as a session/request_permission carrying a ToolCallUpdate for the subagent's tool call (or, until subagent tool calls are surfaced over ACP, a synthesized one built from request.description / request.display, with request.source in _meta). The client's answer should resolve the subagent's request. Rejecting without asking should only happen when the client actually rejects.

Additional information

Contribution

  • I am willing to submit a PR for this bug fix myself (please wait for maintainer approval in this issue first)

Activity

  1. MoonshotAI-support commented on Nov 4, 2026

    @MoonshotAI-support

    Hi, this has been escalated to the development team, thanks for your valuable feedback.

  2. MoonshotAI-support commented on Nov 10, 2026

    @MoonshotAI-support

    Hi, follow up on the issue, the issue has been resolved in the current version (v2.5.2) based on testing

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