Repository navigation
fix(acp): name the adapter that spawned, not the seam - #9135
Conversation
GPT 5.6 Review (fork) — ✅ no blocking findingsReviewed Review detailsFINDING -- src/kiro_crew/acp/client.py:343 -- For |
Design Review (Fable 5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Label derived from the same resolved argv the spawn uses, pre-wrap, seam kept as a stable prefix — root-cause fix, no persisted or compared contract touched. The helper's two shapes ( [DESIGN-REVIEWED] 4bb33dc |
Opus 4.8 Review (fork) — ✅ no blocking findingsReviewed |
First Principles Review (Fable 5, fork) — 🟡 CONCERNSPremise-level review of All evidence gathered. The base confirms the defect is real (claude/codex binaries resolve through documented env overrides while the spawn label was a constant), no existing mechanism logs the resolved argv, but two sibling branches in the same function share the identical root cause and stay on constant labels: opencode ( First-Principles-Verdict: CONCERNS The author's own harvest pattern names the root cause, then fixes 2 of 4 branches — opencode and kiro keep constant labels despite the same env overrides. Not justified as shipped
What this change shipsInventory (6 items) — 4 justifiedIntent: make spawn/stderr logs name the adapter program that actually ran when an env override redirects the seam — a FIX. Defect provenance is verifiable in base:
Watch
Subtractions
[FIRST-PRINCIPLES-REVIEWED] 4bb33dc |
761b37d to
43bad8c
Compare
43bad8c to
1c90b7a
Compare
1c90b7a to
f86fc56
Compare
|
@Premshay Thanks for the detailed writeup. The defect is real and nothing on Three things before it can land, audited at 1c90b7a:
One thing worth declaring in the body: the claude stderr prefix changes from Posted from the 2026-09-08 open-PR relationship audit (read-only, one auditor per PR); reply here if any of this is wrong. |
153aede to
50d487c
Compare
50590a0 to
c97c203
Compare
c97c203 to
99b5e22
Compare
Both ACP seams resolve their adapter through a documented environment override (CLAUDE_AGENT_ACP_BIN, CODEX_ACP_BIN), and either may point at a dispatch shim or a vendored build that is not the seam's own adapter. The spawn log line and the adapter's forwarded stderr both named a fixed constant, so a session routed through an override was attributed to a program that never ran -- and the two seams collapsed onto one name whenever both resolved to the same Node launcher. The label is now derived from the resolved argv, and derived before the sandbox and cgroup wrappers prepend their own program, so it names the adapter rather than env or systemd-run. A launcher that carries the adapter's entry script as its next argument is skipped so the label is the script, not "node"; the match is case-folded because a Windows shim can report node.EXE. The seam prefix is kept, so existing log parsers still see which seam a line came from. The kiro-cli path keeps its original control flow and labels: harness parity holds that branch fixed, and nothing about it is resolved through an override. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
99b5e22 to
4bb33dc
Compare
iamwhatever
left a comment
There was a problem hiding this comment.
Tier 1 auto-approve: fix (2 files). Criteria: no conflict, no requested changes, security path denylist clean, design-doc gate clean, SAST annotations clean, security checklist all-NO, AI reviewers green. Category: fix -- the ACP spawn and stderr log label was taken from argv[0], so every adapter resolved to a script logged as 'node' rather than as the adapter that actually ran; the fix names the resolved program alongside the seam, and the second file is its test. CodeQL is not applicable on this fork PR (default-setup emits no check-run); SAST coverage is Semgrep only, latest run success with 0 annotations.
Both ACP seams resolve their adapter through a documented environment override (CLAUDE_AGENT_ACP_BIN, CODEX_ACP_BIN), and either may point at a dispatch shim or a vendored build that is not the seam's own adapter. The spawn log line and the adapter's forwarded stderr both named a fixed constant, so a session routed through an override was attributed to a program that never ran -- and the two seams collapsed onto one name whenever both resolved to the same Node launcher. The label is now derived from the resolved argv, and derived before the sandbox and cgroup wrappers prepend their own program, so it names the adapter rather than env or systemd-run. A launcher that carries the adapter's entry script as its next argument is skipped so the label is the script, not "node"; the match is case-folded because a Windows shim can report node.EXE. The seam prefix is kept, so existing log parsers still see which seam a line came from. The kiro-cli path keeps its original control flow and labels: harness parity holds that branch fixed, and nothing about it is resolved through an override. Co-authored-by: Premshay <28099628+Premshay@users.noreply.github.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Problem / Motivation
AcpClient._spawnreports fixed seam names in its spawn and adapter-stderrlogs even though Claude and Codex each resolve the program they launch. An
override can therefore make the diagnostics name a different program than the
one that ran.
Why it matters
Those labels are how an operator confirms which adapter a session used. A
resolved native binary or dispatch shim must be visible, while the shared Node
launcher used by vendored adapters must not collapse both seams into the
unhelpful
index.jsentry-script name.What changed (motivation → approach → change)
The Claude and Codex branches derive their labels before sandbox or cgroup
wrappers can replace argv. A directly executable adapter adds its resolved path
to the stable seam label; an interpreter launch keeps the seam label alone.
Adapter labels stay local to those two branches. The
kiro-clispawn and stderrpaths remain unchanged.
Tests
test/test_acp_spawn_label.pycovers native adapters, dispatch shims, Node andWindows Node launchers (including a case-variant
node.EXE), empty argv,adapter stderr, and unchanged Kiro stderr.
pytest test/test_acp_spawn_label.py test/test_acp_client.py test/test_acp_client_more_coverage.py test/test_acp_auth_failure_on_stderr.py test/test_acp_spawn_offload.py— 767 passed. Black, Flake8, the comment-historyand subprocess-encoding gates, and the harness-parity gate all pass.
Manual verification
The implementation takes the label from the same resolved argv passed to the
subprocess, before any wrapper modifies it.
Related Issues
N/A — found while diagnosing a misreported adapter in a live deployment.
Pattern harvest
Rule candidate: semgrep
Pattern: a diagnostic label built from the constant that names a launch path's
default, while the program that path launches is selectable by an environment
override — the log then attributes work to a program that never ran. Derive the
label from the resolved argv at the launch site, before any wrapper prepends its
own program.
Pattern: a case-sensitive membership test against a fixed lowercase set misses
case variants that Windows shims report (e.g.
node.EXE) — compare the namewith
.casefold()against a lowercased set so platform case variance can'tdefeat a fixed-allowlist check.
Checklist
feat|fix|docs|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
N/A — template placeholder; no CLA wording is supplied.