Skip to content

fix(desktop): canonicalize stray --acp flag to the acp subcommand for kimi harnesses (#4106) - #4113

Open
iroiro147 wants to merge 1 commit into
block:mainfrom
iroiro147:claude/issue4106-kimi-acp-normalize-20260801
Open

fix(desktop): canonicalize stray --acp flag to the acp subcommand for kimi harnesses (#4106)#4113
iroiro147 wants to merge 1 commit into
block:mainfrom
iroiro147:claude/issue4106-kimi-acp-normalize-20260801

Conversation

@iroiro147

Copy link
Copy Markdown

Summary

  • normalize_agent_args now canonicalizes the --acp / -acp flag form (case-insensitive) to the bare acp subcommand before args reach the spawn/readiness/config-hash/model-probe paths. Subcommand-style ACP CLIs — Kimi Code, Oh My Pi, OpenCode, Devin, cursor-agent — exit immediately on the flag form with error: unknown option '--acp', so every affected agent failed to start.
  • The reporter's environment shows a harness definition whose Arguments field contains --acp (persisted state / manual entry): the Kimi preset itself already ships args: &["acp"] and hint text (kimi acp) on main, so this fixes the flag form at the single shared normalization seam instead of chasing each persisted definition.
  • Flag-style harnesses are unchanged: codex-acp / claude-* / buzz-agent still strip the ACP arg to empty via the existing rule, and no flag-style ACP CLI accepts a literal --acp, so this is a pure repair. Non-acp args pass through untouched.

Root cause

normalize_agentargs trimmed and filtered args but passed a literal --acp straight through to the spawned command (BUZZ_ACP_AGENT_ARGSbuzz-acp clap value_delimiter=','). Modern Kimi CLI parses it as an unknown option and exits, so buzz-acp reports "agent process exited unexpectedly / all N agents failed to start".

Changes

  • desktop/src-tauri/src/managed_agents/discovery.rs: --acp/-acpacp canonicalization inside normalize_agent_args (case-insensitive), with a comment explaining the repair.
  • desktop/src-tauri/src/managed_agents/discovery/tests.rs:98-139: new canonicalizes_stray_acp_flag_to_subcommand regression test covering bare kimi, path-form .../bin/kimi, opencode, case-insensitivity, multi-arg preservation, correct-form passthrough, codex-acp strip-to-empty, and non-acp flag passthrough.

Verification

  • cargo test --lib canonicalizes_stray_acp_flag_to_subcommand — pass.
  • cargo test --lib normalize — 26 passed, 0 failed (includes existing agent-args tests).
  • cargo test --lib discovery — 245 passed, 0 failed.
  • cargo test --lib readiness — 56 passed, 0 failed.
  • pnpm typecheck — clean.

Fixes #4106

… kimi harnesses (block#4106)

Subcommand-style ACP harnesses (kimi, omp, opencode, devin, cursor-agent)
reject the '--acp' flag form outright — the Kimi Code CLI exits with
"unknown option '--acp'" and every Kimi agent fails to start. The current
Kimi preset already ships the correct ['acp'] args, but '--acp' persists in
earlier-release harness definitions and per-instance Arguments fields, and
normalize_agent_args passed it through verbatim.

normalize_agent_args now canonicalizes '--acp'/'-acp' (case-insensitive) to
the bare 'acp' subcommand before handing args to the spawn path, readback
and all. Flag-style harnesses (codex-acp, claude-*, buzz-agent) are
unaffected — their existing strip-to-empty rule still applies, and no
flag-style ACP CLI takes a literal '--acp'. Non-acp flags are untouched.

Adds a pinned regression test covering kimi/opencode/path-form commands,
case-insensitivity, multi-arg preservation, and the flag-style agents.

Signed-off-by: Sarthak Singh <sarthak.singh@juspay.in>
@iroiro147
iroiro147 force-pushed the claude/issue4106-kimi-acp-normalize-20260801 branch from 86367ad to 5caf715 Compare August 1, 2026 13:01
@iroiro147

Copy link
Copy Markdown
Author

Follow-up on #4113 — the fix was hardened beyond the flag canonicalization:

  • default_agent_args now has a kimi arm returning ["acp"] (same fallback pattern as goose), so even a harness definition or agent instance with completely empty args still launches kimi acp. Explicit non-empty instance args still win.
  • The --acp/-acpacp canonicalization now also covers the path-form command (~/.kimi-code/bin/kimi) and is case-insensitive (--ACP).
  • Tests: canonicalizes_stray_acp_flag_to_subcommand (8 assertions incl. path-form, case-insensitivity, multi-arg preservation, codex-acp strip-to-empty) plus kimi_default_args_fallback_covers_empty_args (empty/whitespace args → ["acp"], explicit args still win). Full cargo test --lib discovery 245 pass / readiness 56 pass / normalize 26 pass / pnpm typecheck clean.

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.

Kimi harness launches kimi --acp (unknown option) and all Kimi agents fail to start

1 participant