fix(acp): start the claude CLI without the bypass-permissions flag - #10413
fix(acp): start the claude CLI without the bypass-permissions flag#10413amansk wants to merge 1 commit into
Conversation
|
👋 Hi! This PR's description is missing some required sections from our PR template. Workflow runs won't be auto-approved until the description is updated. Missing sections:
Please update your PR description to include these sections, then push or re-save the description. The workflows will be approved on the next cycle. |
Design Review (Fable 5, fork) — ✅ PASSDesign-level review of Verified against the base tree: Design-Verdict: PASS Interposes at the one seam Crew owns, withholds exactly one capability, fails open, defers unverified Windows — scope and residuals stated precisely and pinned. [DESIGN-REVIEWED] 7602dfa |
GPT 5.6 Review (fork) — 🔴 changes requested (blocking)Reviewed 1 of 1 blocking finding(s) are security-class and were withheld from adjudication, so the blocking verdict stands. BLOCKING -- src/kiro_crew/acp/client.py:962 -- Agent can replace or remove the launcher to bypass the host gate (origin: validation)
Adjudication (Opus 4.8) — is blocking on each finding proportionate?I've reviewed the fenced finding F1 against the diff (as DATA) and the base tree. F1 — Harm rung: fenced/unbounded (governance-ceiling bypass). Conditions I confirmed:
The condition combination is extreme (package-code write = total pre-existing compromise) and the fallback merely restores today's production behavior, so a human would plausibly accept the residual — a FLAG. [ADJUDICATION] 7602dfa total=0 uphold=0 downgrade=0 [ADJUDICATION-FENCED] 7602dfa fenced=1 flagged=1 🏷️ Fenced finding(s) machine-flagged as likely edge caseThe security fence keeps these findings blocking regardless of adjudication; the only clearance path is a human override recorded by a repository writer, who must independently verify a rationale before recording it — it is machine-authored, and a wrong override on a security-class finding ships exactly the class the fence exists to stop. (This lane's comment deliberately carries no override command.)
|
First Principles Review (Fable 5, fork) — ✅ PASSPremise-level review of All claims verified against the base tree. The doc's vendoring claim ( First-Principles-Verdict: PASS Before merge, confirm one end-to-end Claude session on Linux — the manual launcher verification cited is macOS-only, and session/new is the failure point. Not justified as shipped
What this change shipsInventory (10 items) — 8 justifiedIntent: make the Claude backend start on hosts whose CLI refuses the bypass-permissions flag, by withholding a capability Crew never uses — a FIX.
[FIRST-PRINCIPLES-REVIEWED] 7602dfa |
Opus 4.8 Review (fork) — ✅ no blocking findingsReviewed |
claude-agent-acp asks the Agent SDK for allowDangerouslySkipPermissions on every non-root session, which puts --allow-dangerously-skip-permissions on the claude command line. That flag is the capability to enter bypassPermissions, the one mode in which the adapter never sends session/request_permission. Crew never selects that mode, and the adapter gives an ACP client no way to turn the option off. The claude backend now points CLAUDE_CODE_EXECUTABLE at a small node launcher shipped in the package. It drops that one flag and starts the real CLI with every other argument, stdio and the environment unchanged. An operator-set CLAUDE_CODE_EXECUTABLE is still the CLI that runs. Sessions no longer fail on a CLI that refuses the flag in its environment. The ACP spec no longer claims the adapter is vendored into the build; nothing in this repository ships it.
0f43489 to
7602dfa
Compare
|
Dispositions for the review findings, addressed in
|
|
Disposition for the GPT 5.6 finding on Rebutted, no change. The launcher ships beside |
Problem / Motivation
On the Claude Code backend,
claude-agent-acpasks the Agent SDK forallowDangerouslySkipPermissionson every non-root session, which puts--allow-dangerously-skip-permissionson theclaudecommand line. A CLI that refuses that flag in its environment (it does so as root, for example) fails everysession/newwithClaude Code process exited with code 1, so the backend is unusable there. The adapter gives an ACP client no way to turn the option off, and Crew does not ship the adapter, so it cannot patch that line either.Why it matters
That flag is the capability to enter
bypassPermissions, the one mode in which the adapter never sendssession/request_permissionand so never reaches Kiro Crew's host gate. Crew never selects that mode, so every session was requesting a capability the governance model exists to withhold, and on hosts whose CLI refuses it the Claude backend did not start at all.What changed (motivation → approach → change)
Crew owns
CLAUDE_CODE_EXECUTABLE, which the adapter forwards to the SDK aspathToClaudeCodeExecutable. Rather than a patched adapter or a text edit of its bundle, the claude backend now points that variable at a small node launcher shipped in the package,src/kiro_crew/acp/claude_launcher.mjs, and names the real CLI inKIROCREW_CLAUDE_CODE_EXECUTABLE. The launcher drops exactly that one flag and starts the real CLI with every other argument in order, stdio inherited, exit status and terminating signal propagated, andCLAUDE_CODE_EXECUTABLEset back to the real path. An operator-setCLAUDE_CODE_EXECUTABLEis still the CLI that runs; only the capability request is withheld. An explicit--permission-modepasses through unchanged, so the inherited-settings boundary the spec already documents is not closed by this. A launcher missing from the install starts the CLI directly, with a warning.One follow-on in the same change: the launcher carries a
#!/usr/bin/env nodeshebang and the executable bit, because the adapter also spawnsCLAUDE_CODE_EXECUTABLEdirectly forclaude auth status; without them that spawn fails withEACCESand every session logs an auth-status failure even though the session runs.On Windows the launcher is not used:
_point_adapter_at_claude_clistarts the CLI directly there, the pre-PR path, and logs that the capability is not withheld. An npm-installedclauderesolves to a.cmdshim on Windows, and neither the SDK running a.mjsexecutable under node on win32 nor a cmd.exe routing of that shim has been exercised on a Windows host, so a wrong guess would fail every Windows Claude session atsession/newwhere the direct path works today. Enabling it there waits on an end-to-end verification on a Windows host. An earlier revision of this PR shipped a COMSPEC routing for those shims; it is withdrawn.The ACP spec no longer claims the adapter is vendored into the build; nothing in this repository ships it.
Tests
test/test_claude_launcher.py(16 tests):_point_adapter_at_claude_clisets the launcher asCLAUDE_CODE_EXECUTABLEand the resolved or operator-chosen CLI as the launcher target; no CLI found sets nothing and warns; a missing launcher falls back to the CLI directly with a warning; on Windows the CLI is started directly and the log says the capability is not withheld (test_windows_starts_the_cli_directly_until_verified).setup.cfgpackage data andMANIFEST.in, starts with the node shebang and is executable on POSIX.--permission-modethrough, propagates exit status, fails loudly on a missing or unstartable target, executes a native target directly.Manual verification
On macOS with
agent.acp_backend = claude,kirocrew chat -m ...on this branch answers through the launcher, and the adapter'sclaude auth statusspawn no longer logsEACCES(it did before the shebang and exec bit were added). A session with an explicit--permission-mode bypassPermissionsand no capability flag starts on Claude Code 2.1.269 when not running as root, which is what the spec now states for inheriteddefaultMode: bypassPermissions. Not exercised on a Windows host, which is why Windows keeps the direct path.Related Issues
None filed; found while bringing up the Claude backend on a host whose CLI refuses the flag.
Pattern harvest
Not generalizable: the defect is a capability request hard-wired inside a third-party adapter Crew does not ship; the fix is a one-off wrapper at the one seam Crew owns.
Checklist
feat|fix|docs|refactor|perf|test|chore|ci|build|revert: ...)🤖 Generated with Claude Code
https://claude.ai/code/session_01FY8xmPpyfqCbxHPwM2gb9E