Repository navigation
refactor(acp): move the goose session code off AcpClient into GooseAcpClient - #37535
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the goose-only branches move behind the existing per-backend subclass registry, and goose is refused to a class that skips the mode read-back, so it can't silently start without its permission check. [DESIGN-REVIEWED] 3e3d072 Description read[DESCRIPTION-READ] acc402c75de416e906b004cfaff26f603203c4637fb6f8fe023223bada7084c7 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing blocks. Every item moves existing goose code or deletes a goose seam. The one new refusal is there because of the move: without it, a goose session could start without its permission-mode read-back. What this change shipsInventory (8 items) — 8 justifiedIntent: separate goose's per-session checks from the shared client so a later PR can let goose chats share one ACP process. This is a refactor, which here means an ADDITION with no behaviour change.
[FIRST-PRINCIPLES-REVIEWED] 3e3d072 Description read[DESCRIPTION-READ] 0c8bead0f6dbb4c734c771877cba6577aff7115b68c5d28855f1e901eaceb649 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
|
Backend Tests (3.12, 6) and Coverage Gate on ca32f2f are red for three TestOffOffer tests in test/metrics/test_kiro_export_destination.py. They fail the same way on main at 87b11b5, this PR's base: #37460 removed the default-home fake from the shared fixture while #37463 added tests that need it. This PR touches no metrics code. Fix for main: #37545. This PR will rebase once it lands. |
Code change approver recommendation: A person should decideWhy: the decider estimates a 10% chance that this change introduces a defect, within the 12% limit for approving on its own, but it changes 729 lines, more than the 400 it may approve on its own. A clean, behaviour-preserving refactor that moves goose-only session code into GooseAcpClient. I verified that the moved functions match the originals apart from the removed _is_goose guards, that no references to _is_goose or the old names are left in src, and that the MCP array order is unchanged (client-class servers, then the now-empty adapter part for goose, then pooled servers). The read-back still runs on session/new and on a successful session/load, and the tripwire still runs on every frame through _tripwire_permission_state. A new check in new refuses goose to any class that doesn't read the mode back, before a process starts, so it fails closed. The tests follow the moved members and add a refusal test. The CI failures are in unrelated metrics tests. An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit |
…pClient AcpClient carried goose's session contract: the read-back of the permission mode goose reports on session/new and session/load, the mid-session mode tripwire, the handshake note of a goose release outside the verified range, and goose's MCP array, behind `_is_goose` branches in the shared start and permission code and a goose seam on the process adapter. GooseAcpClient (acp/client_goose.py) now holds all of it, bound from the new owner module client_goose_session. AcpClient keeps one hook per step (`_reads_back_session_mode`, `_verify_session_mode`, `_tripwire_session_mode`, plus the existing `_note_harness_adapter_version` and `_harness_session_mcp_servers`) with the behaviour every other backend already had, and the subclass fills it. AcpClient(acp_backend="goose") builds GooseAcpClient, so no caller changes; a class that reads no mode back refuses the goose backend. Behaviour is unchanged. The tests follow the members to the new class.
ca32f2f to
3e3d072
Compare
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approving. On this head the review checked these points. The four goose functions moved to client_goose_session.py match their originals body for body, apart from the dropped _is_goose guards. The session/new and session/load read-backs and the tripwire dispatch now key on _reads_back_session_mode, and only GooseAcpClient sets it. The MCP array order is unchanged at both splice sites. The head merges cleanly with current main, and no _is_goose reader is left.
Done well: the new AcpClient.__new__ refusal fails closed. A class that does not read back the mode cannot start goose, and test_a_class_that_reads_no_mode_back_refuses_goose pins both sides.
Security: the goose permission-mode read-back and mid-session tripwire move behind new hooks, but their logic is not changed. The SEL audit, the forced kill and the AcpToolGateUnroutable translation are all preserved verbatim. The new __new__ refusal means a missing or unimported GooseAcpClient raises before any process exists, so the type-based dispatch cannot fail open. Nothing that main refuses is now allowed.
Optional:
- No test drives
_verify_session_modeor_tripwire_session_mode(or the dispatch in_tripwire_permission_state) on a goose client. The existing tests call the impl names directly. Two short tests would pin it: anautoresponse through_stub()._verify_session_mode(...)that raises, and anautoframe through_tripwire_permission_statethat raises and kills. - docs/system-specs/modules/acp-client.md:74 still lists the goose-mode tripwire under client_permissions.py, and the goose cell at agent-host-contract.md:102 still cites client_permissions.py for the read-back. Both should point at client_goose_session.py.
- The Backwards compatibility section could add a Breaking line for an edition subclass of AcpClient built for goose, which is now refused and must subclass GooseAcpClient. No in-tree class is affected.
Problem / Motivation
Goal:
AcpClientholds no goose-only code; a goose session runs exactly as before from a class of its own.AcpClientis the per-session client every non-KAS backend shares, and it carried goose's session contract: reading back the permission mode goose reports when a session opens or is restored, stopping a session that reports leaving that mode, naming a goose release outside the verified range at the handshake, and building goose's MCP array. Those sat behind_is_goosebranches in the shared start and permission code and a goose seam on the process adapter.Why it matters
goose dashboard chats are next to share one ACP process, the way KAS and codex chats can. That needs goose's per-session checks to be a unit the shared runtime can run per session. This is the first of three PRs, done the way claude was split in #37484. Users see no change from this PR.
Not a goal
_CLIENT_STEERING_REQUEST_METHODS) stays onAcpClient: it is a capability table keyed by backend, not an_is_goosebranch.ACP_BACKENDS_*capability sets or the tables keyed by backend (protocol version, tested range, steer floor).What changed (motivation -> approach -> change)
goose code was spread across the shared client -> it now lives in
GooseAcpClient(AcpClient)(acp/client_goose.py), bound from one owner module (acp/client_goose_session.py) ->AcpClientkeeps one hook per step with what every other backend already did, and the subclass fills it.AcpClient(acp_backend="goose", ...)builds aGooseAcpClientthrough the__init_subclass__(serves=...)registry refactor(acp): move the claude-agent-acp session code off AcpClient into ClaudeAcpClient #37484 added, so no caller changes. A class that reads no mode back is refused the goose backend before any process exists (_SESSION_MODE_READ_BACK_BACKENDS), so an edition subclass cannot start goose without its read-back.AcpClient._reads_back_session_mode(False),_verify_session_modeand_tripwire_session_mode(no-ops). The start path and_tripwire_permission_stateread the flag before calling either, so kiro-cli and every other backend make no extra call. The version note uses the existing_note_harness_adapter_versionhook, and the MCP array uses the existing_harness_session_mcp_servershook in place of the goose seam onGooseLaunch, so the array order sent onsession/newandsession/loadis unchanged.client_permissionsandclient_mcp_array:_verify_goose_routing,_tripwire_goose_mode,_note_goose_version,_goose_session_mcp_servers,GOOSE_VERIFIED_VERSION_PREFIXand its once-per-process memo. Theirif not self._is_goose: returnguards are gone, because only a goose session builds the class._is_gooseis removed.ProcessSessionno longer lists_goose_session_mcp_servers. A doc line inagent-host-contract.md, the goose harness docstring and theACP_BACKEND_GOOSEnote inagent_sdk/backends.pyname the new home.Backwards compatibility
Compatible:
AcpClient(acp_backend="goose")still builds a goose client, the facade still exportsGOOSE_VERIFIED_VERSION_PREFIX, and the session start, read-back and tripwire run the same code in the same order.Reader: src/kiro_crew/acp/harness/goose.py:GooseLaunch.session_mcp_servers -- removed; the array now comes from
GooseAcpClient._harness_session_mcp_serverson the same two call sites -- test_goose_gets_its_own_mcp_array_at_both_session_call_sitesReader: src/kiro_crew/acp/client_class.py:AcpClient._is_goose -- removed; its readers were the five moved members and two start-path branches, now
_reads_back_session_mode-- test_the_read_back_is_scoped_to_gooseReader: src/kiro_crew/acp/client_permissions.py:GOOSE_VERIFIED_VERSION_PREFIX -- moved to client_goose_session, still exported by
kiro_crew.acp.client-- test_goose_tested_version_notice.pyTests
test_client_bindings.py: aGooseAcpClientinventory, each member bound fromclient_goose_session; the three new hooks join theAcpClientinventory.test_acp_goose_backend.py: the read-back, tripwire and version tests build the class the backend builds; newtest_a_class_that_reads_no_mode_back_refuses_goose(anAcpClientsubclass without the read-back is refused goose); the call-site tests now count the hook calls.test_harness_parity.py:GooseAcpClientfills_harness_session_mcp_serverswith its own array;GooseLaunchasks no MCP seam.test_acp_mcp_startable.py,test_side_readonly_goose.py,test_goose_tested_version_notice.py: follow the members.test_acp_harness_contract.py,test_acp_session_mcp.py,test_acp_session_mcp_client_seam.py,test_goose_steer_request.py,test_member_dispatch_mount.py,test_campaign_facades_base_public_names.pyand the other goose-touching client tests, all pass. mypy oversrc/kiro_crew/is clean.Proof: not provable -- other: refactor with no behaviour change; tests follow the moved members
Manual verification
N/A -- no behaviour change; unit coverage of the moved members and the new refusal is sufficient. goose chat sharing, which these hooks prepare for, gets a real goose run in the PR that routes it.
Related Issues
Part of #5033
Checklist