fix(desktop): canonicalize stray --acp flag to the acp subcommand for kimi harnesses (#4106) - #4113
Open
iroiro147 wants to merge 1 commit into
Open
Conversation
… 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
force-pushed
the
claude/issue4106-kimi-acp-normalize-20260801
branch
from
August 1, 2026 13:01
86367ad to
5caf715
Compare
Author
|
Follow-up on #4113 — the fix was hardened beyond the flag canonicalization:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
normalize_agent_argsnow canonicalizes the--acp/-acpflag form (case-insensitive) to the bareacpsubcommand 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 witherror: unknown option '--acp', so every affected agent failed to start.--acp(persisted state / manual entry): the Kimi preset itself already shipsargs: &["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.codex-acp/claude-*/buzz-agentstill 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-acpargs pass through untouched.Root cause
normalize_agentargstrimmed and filtered args but passed a literal--acpstraight through to the spawned command (BUZZ_ACP_AGENT_ARGS→buzz-acpclapvalue_delimiter=','). Modern Kimi CLI parses it as an unknown option and exits, sobuzz-acpreports "agent process exited unexpectedly / all N agents failed to start".Changes
desktop/src-tauri/src/managed_agents/discovery.rs:--acp/-acp→acpcanonicalization insidenormalize_agent_args(case-insensitive), with a comment explaining the repair.desktop/src-tauri/src/managed_agents/discovery/tests.rs:98-139: newcanonicalizes_stray_acp_flag_to_subcommandregression test covering barekimi, path-form.../bin/kimi,opencode, case-insensitivity, multi-arg preservation, correct-form passthrough,codex-acpstrip-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