feat(acp): register opencode ACP backend — known, gated until enforceable routing exists - #9013
feat(acp): register opencode ACP backend — known, gated until enforceable routing exists#9013atomsbaza wants to merge 1 commit into
Conversation
82114e6 to
041d037
Compare
GPT 5.6 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
Design Review (Fable 5, fork) — 🟡 CONCERNSDesign-level review of Design-Verdict: CONCERNS Sound staged landing, but the doc's claimed session-time refusal doesn't exist — registry exclusion is the only control keeping opencode's ungated tools out. Watch
Suggestions
[DESIGN-REVIEWED] 3b1e8e6 |
First Principles Review (Fable 5, fork) — 🟡 CONCERNSPremise-level review of All evidence is in. The verdict below is grounded in these counted facts: First-Principles-Verdict: CONCERNS The stated job — run sessions on opencode — is deliberately undelivered; the code half stages an unreachable backend for a selectability decision this PR itself defers. What this change shipsIntent: let operators who run opencode point Kiro Crew agent sessions at it — an ADDITION, and the diff deliberately does not deliver that job (declared in the title).
Watch
Subtractions
[FIRST-PRINCIPLES-REVIEWED] 3b1e8e6 |
Opus 4.8 Review (fork) — ✅ no blocking findingsReviewed Review detailsI've verified the reachable changed paths:
The sole candidate requires an out-of-repo edition to call No findings. [OPUS-REVIEWED] 3b1e8e6 |
041d037 to
b640e3d
Compare
Register `opencode` in the baseline selectable backend registry and add its spawn arm (stdio JSON-RPC via `opencode acp`), install probe, session lifecycle with capability gating, and content serialization, mirroring the codex backend template. v1 scope: chat-only (no per-session MCP array), no steer/compaction, no model-via-config; unsupported capability calls fail fast with explicit errors so existing backends are unaffected. Adds twin tests (test_acp_opencode_backend.py, 29 tests) and updates the agent-host-contract and acp-client docs.
b640e3d to
3b1e8e6
Compare
|
@atomsbaza Thanks for the detailed writeup. Flagging overlap with other open PRs before this lands. #9055 (@Premshay) edits the same method body, The harder blocker is elsewhere. #6777 and #6307 also define Two mechanical items either way: the branch is 34 commits behind and needs a rebase onto #9281's Posted from the 2026-09-08 open-PR relationship audit (read-only, one auditor per PR); reply here if any of this is wrong. |
|
Closing in favor of the competing designs — as flagged in the open-PR relationship audit, #6307 and #6777 both define |
Problem / Motivation
Users who run opencode want to point agent sessions at it from Kiro Crew. opencode ships an ACP-compatible stdio agent (
opencode acp), and the backend registry is data-driven, so the surface change is small — but it must not ship selectable until Crew can gate its tool calls.Why it matters
Two user-facing values: the groundwork (registration, install probe, spawn resolution, docs) makes opencode a first-class known backend, and the security analysis in this PR documents exactly why it is not selectable yet — closing the gap a selectable-but-ungated backend would open.
What changed (motivation → approach → change)
Goal: add
opencodefollowing the codex template, gated by Crew's security posture rather than around it.acp_backends.py:ACP_BACKEND_OPENCODEregistered inACP_BACKENDS_KNOWNand deliberately excluded fromBASELINE_SELECTABLE_BACKENDS. A live probe ofopencode acpv1.18.xsession/newshows the adapter advertises exactly one config option (model, select) and no permission mode, so there is nothing to enforce throughsession/set_config_option;routing_for("opencode")answersUNVERIFIEDhonestly. Config naming opencode falls back to the default backend with the standard not-selectable warning (same path as an unknown id on a stock build) — verified fromresolve_selected_backendthrough every consumer (config load, member backend, boot re-check, dashboard schema,_bgruntime). Joining any capability set later is an explicit, evidenced edit.acp/client.py: spawn arm (OPENCODE_ACP_BINenv → mise → PATH),_is_opencodearms for prompt/resume, and capability fail-fast (steer/compact/set-model). No per-session MCP seam: opencode joins noSESSION_MCP_ARRAY, and the claude/codex splices are untouched.agent_sdk/backend_install.py:_probe_opencode()reports the binary plus theopencode auth loginprerequisite.Tests
New
test/test_acp_opencode_backend.pymirrors the codex twins: registry snapshot (known-but-not-selectable), spawn-resolution order (Windows-safe fixtures), probe state, capability fail-fast, serialization (incl. a source-level lock that no opencode MCP splice exists), member-dispatch exclusion, and a regression test that a config naming opencode degrades to the default backend with the warning. Known-keyed parity gates (agent-host-contract buckets, frame replay) gained honest opencode rows/fixtures.Local validation: targeted suites across the touched files all green (298 checks across 10 files); mypy + flake8 + black clean on touched files.
Manual verification
Live E2E against a real gateway booted from this branch (isolated
KIROCREW_HOME, port 5588), during the development round: the Developer → Agent Backend page probed and listedopencode (Experimental), selecting it persisted, and a real chat prompt was answered through theopencode acpadapter. That round is what surfaced the security gap (opencode's built-in shell tools ran outside Crew's gate), which this PR's gating now closes — on this head, opencode no longer appears as selectable and the fallback path is test-locked.Screenshots / video
Captured during the development round (before the gating decision), as evidence the adapter works end-to-end:
Related Issues
N/A — no tracking issue yet.
Checklist
feat|fix|docs|refactor|perf|test|chore|ci|build|revert: ...)