Repository navigation
feat(acp): GooseHarness, goose on the shared runtime with per-session checks (not routed) - #37562
Conversation
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks: the harness is registered but no session is routed to it, every new seam does nothing by default, and the per-chat client's checks now call the same functions as the new harness. Notes
[DESIGN-REVIEWED] aa19163 Description read[DESCRIPTION-READ] 5825319183a6d30692f98ff4391911c5976e1af43d9452bfa0dec8e798a4ba1d 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 |
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: |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Nothing here locks anything in. The harness and its two new seams have no production caller until the routing PR, and all of it can be deleted without anyone noticing. Notes
What this change shipsInventory (6 items) — 4 justifiedIntent: let one shared goose process serve many chats safely, with each chat keeping its own ask-before-every-tool checks. This is an ADDITION, staged and not routed.
[FIRST-PRINCIPLES-REVIEWED] aa19163 Description read[DESCRIPTION-READ] 6c4e6649f474f8d1d8caa5b27892cd9ead33f577177c4118af87bd2141de6d24 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: |
84b8d00 to
f9e8a1d
Compare
|
Dispositions for f9e8a1d:
|
2cec543 to
9be28f5
Compare
f9e8a1d to
b385b8f
Compare
b385b8f to
1b8fcb6
Compare
9be28f5 to
7a21d8b
Compare
1b8fcb6 to
960ffc3
Compare
|
First Principles (8415923) blocker, second copy of the harness-string scrub: real, fixed in 12038a7.
Test: |
12038a7 to
40d686d
Compare
|
GPT 6.1 F1 (test_acp_harness_contract.py:58, missing-binary test depends on goose not being installed): real, fixed in 40d686d.
Checked with a goose binary on PATH: before the fix the |
40d686d to
dac9d9b
Compare
|
Backend Tests red on 40d686d (3.12 shards 2/3/4/6/7/8, Windows 8): caused by this PR, fixed in dac9d9b (rebased onto main c4f432a).
All 12 files that failed in CI, plus the goose, harness-contract, security-posture and harness-parity suites, pass locally on the new head: 1423 passed. |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approving. On this head the review checked these points. Goose is still outside ACP_BACKENDS_ACP_RUNTIME, and every harness_for caller gates on that set, so no session reaches GooseHarness yet. host_checks_sessions turns on only for a literal per_session_state is True, so Kiro, KAS, codex and mock runtimes skip the new paths. The client_permissions refactor keeps the same predicates and reasons. The per-chat goose client reads the same mode and raises the same refusal. The new tests use no sleeps, clocks or ports.
Security: the new per-session refusals deny by default and write SEL audit rows. The shared-process and spawn-mask changes do nothing until goose is routed, which is out of scope for this PR. A session refused at start closes only that session and keeps the process, and test_a_session_in_auto_is_closed_and_the_process_kept checks this against a real AcpRuntime.
Done well: each identity refusal now has one function (unclassified_call_refused, foreign_server_refused), and both drivers call it, which removes duplicated security logic.
Optional:
- Before #37567 routes goose: the mid-turn mode tripwire (
session_handle_permissions.py:967) relies onsession/close, andterminate_sessionswallows a failed close. The per-chat driver kills the process instead. Consider failing closed when the close is unconfirmed, and pin that with a test in which the close raises. - The body says
GOOSE_PATH_ROOTis removed and the spawn usesresolve_spawn_masks. The code (goose.py:388) keeps the operator'sGOOSE_PATH_ROOT, the test asserts that, and the spawn runs goose's own preflight. The "Stacked on" paragraph also predates the merge of #37521 and #37535. A body edit fixes both. _refuse_by_harnessand the order of the update tripwire relative to the yield are pinned only by name checks. A handle-level test would cover the reject call and the order.
… checks (not routed) The shared runtime (AcpRuntime) had no harness for goose, and the checks that make a goose session ask before every tool lived on AcpClient, where a refusal kills the session's own process. On one process several sessions share, each check has to be one session's. GooseHarness (acp/harness/goose.py) is registered in _HARNESSES and not routed. Spawn: the self-served `goose acp` argv with the developer builtin, under the credential mask, GOOSE_MODE=approve seeded on the child and GOOSE_PATH_ROOT removed (a Side Chat home is process-wide, so side sessions keep a process of their own). Teardown: session/close as a request, which ends one session and keeps its record. Per session, through the seams ClaudeHarness added: after session/new and session/load the mode goose resolved is read back off that answer, and a session not in `approve` is closed alone and refused. Two new seams, inert by default and read only where per_session_state is True: permission_refusal (the unclassified-call and foreign-server refusals of goose's _meta.goose.toolCall identity channel, against that session's placed servers) and session_update_issue (a current_mode_update off `approve`, read in the turn's dispatch loop and in the pre-turn drain; the session is closed and its turn fails with the gate's reason). The mode reads move into acp.harness.goose (session_mode_issue, mode_update_issue, refuse_routing) and GooseAcpClient uses the same ones, so both drivers judge goose's answers alike.
dac9d9b to
aa19163
Compare
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approving. On this head the review confirmed four things. Goose is still outside ACP_BACKENDS_ACP_RUNTIME, so no session reaches GooseHarness yet. host_checks_sessions turns on only for a literal True, so Kiro, KAS and codex make none of the new calls. The per-chat GooseAcpClient refactor keeps the same predicates, the same audit reasons and the _kill_process(force=True) tripwire. The new tests use no sleeps, clocks, ports or real children. PR Readiness is green.
Done well: both drivers now decide each identity refusal with one function (unclassified_call_refused, foreign_server_refused), so the two paths cannot drift. A refused session is closed by itself against a real AcpRuntime, and the shared process keeps running.
Security: the new paths add tool-approval refusals, a mode tripwire, and a spawn path with a credential mask and a key strip. None of them runs today, because nothing routes goose to the shared runtime. The refusals deny by default and write audit rows. The spawn uses goose's own _sandbox_preflight and strips KIRO_API_KEY, as the codex and claude harnesses do.
Optional:
- Before #37567 routes goose: if
terminate_sessionfails or times out,_refuse_moved_permission_state(session_handle_permissions.py:967) still raises locally, but goose may keep the session in auto mode. Consider failing closed when the close is not confirmed, and pin that with a test where the close raises. - Tests check
_refuse_by_harnessand the "refuse before yield / before prompt" order only by method name. One handle-level test on a realAcpSessionHandlewould pinreject_tool, the audit reason and the order. - Body drift (a body edit is enough): the code keeps the operator's
GOOSE_PATH_ROOT, the spawn uses_sandbox_preflightand notresolve_spawn_masks, and the "Stacked on" paragraph and threeReader:lines describe work already on main.
Problem / Motivation
Goal: the shared runtime can drive goose with each session's own permission checks, while no session is routed to it yet.
The shared runtime (
AcpRuntime) serves kiro-cli, KAS and codex from one process per runtime. goose still runs one process per chat (GooseAcpClient), becauseharness_for("goose")has no harness, and the checks that keep a goose session asking before every tool live on the per-chat client: the read-back of the mode goose resolved, the stop on a mid-session move toauto, and the two refusals of goose's_meta.goose.toolCallidentity channel. On a per-chat client a refusal kills the session's own process. On a shared process each check must belong to one session.Why it matters
goose 1.57.0 itself serves many sessions in one process and runs their turns in parallel (measured: one session ran a 60 s shell command while a second answered twice in 0.02 s, with no crosstalk, and a closed session loaded back on the same process). Sharing one goose process across dashboard chats needs a harness first, and it must be safe before any chat is routed to it: a session left in
autoasks Crew about nothing, and one refusal that ended the process would end every other chat on it. Users see no change from this PR.Not a goal
ACP_BACKENDS_ACP_RUNTIME, so every goose chat still runs onGooseAcpClient. The routing, the per-harness switch and the real-goose run land in the next PR.GOOSE_PATH_ROOT, a process-wide setting, so side sessions keep a process of their own._session/steering, so the runtime queues a mid-turn message as the next turn, as it does for any host that does not advertise it.What changed (motivation -> approach -> change)
goose's per-session checks had no home on the shared runtime -> the goose harness answers them per session, through the seams
ClaudeHarnessadded plus two new ones -> the session handle runs them only on a host withper_session_state.GooseHarness(acp/harness/goose.py), registered in_HARNESSESand not routed. Spawn: the self-servedgoose acpargv with--with-builtin developer, under the credential mask (resolve_spawn_masks), withGOOSE_MODE=approveseeded on the child andGOOSE_PATH_ROOTremoved. Teardown:session/closeas a request, which ends one session and keeps its record. Protocol version and client capabilities are the per-chat client's.after_session_startreads the mode off that session's ownsession/neworsession/loadanswer; anything butapprove(a missingmodesblock included) closes that session alone and raises the gate's refusal. The process and every other session keep running.HarnessAdapter, inert by default:permission_refusal(a call goose's identity channel classified as nothing, or a trusted identity naming a server this session never placed and that is not goose's own extension) andsession_update_issue(acurrent_mode_updateoffapprove)._refuse_by_harnessruns in the permission chain beside the other identity refusals._note_permission_statereads each update in the dispatch loop and in the pre-turn drain, and_refuse_moved_permission_statecloses the session and fails the turn, before the frame is yielded or the next prompt goes out. Every call is behindhost_checks_sessions(runtime), so kiro-cli, KAS and codex make none (harness-parity H13).AcpRuntimeProtocolnames_harnessand_session_harness_states.session_mode_issue,mode_update_issueandrefuse_routingmove intoacp/harness/goose.py, andGooseAcpClient(client_goose_session.py) uses them. The identity refusals' predicates move into_dispatch_parts/permission_requests.py(unclassified_call_refused,foreign_server_refused, with the two audit reasons as constants, exported fromacp/_dispatch.py), and bothclient_permissionsandGooseHarness.permission_refusalcall them, so one function decides each refusal on both drivers.GooseLaunch, for goose's backend, and hands back goose's own read-only files (adapter_expose_files).Backwards compatibility
Compatible: every new seam defaults to doing nothing, only
GooseHarnessandClaudeHarnesssetper_session_state, no backend set routes goose to the runtime, and the per-chat goose client keeps the same checks and messages.Reader: src/kiro_crew/acp/harness/goose.py:GooseLaunch.session_mcp_servers -- chat -- removed by #37535's commit; the array 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 -- chat -- removed by #37535's commit; its readers moved to
GooseAcpClientbehind_reads_back_session_mode-- test_the_read_back_is_scoped_to_gooseReader: src/kiro_crew/acp/client_permissions.py:GOOSE_VERIFIED_VERSION_PREFIX -- chat -- moved to client_goose_session, still exported by
kiro_crew.acp.client-- test_goose_tested_version_notice.pyReader: src/kiro_crew/acp/client_goose_session.py:_verify_goose_routing -- chat -- its body now calls
acp.harness.goose.session_mode_issueandrefuse_routing, the same read and refusal -- test_acp_goose_backend.py read-back testsReader: src/kiro_crew/acp/client_goose_session.py:_tripwire_goose_mode -- chat -- its body now calls
acp.harness.goose.mode_update_issueandrefuse_routing-- test_a_mid_session_move_off_the_required_mode_stops_the_harnessTests
test/test_goose_shared_runtime.py(new): the harness answers (registered, not routed,session/closeteardown, the client's handshake); the spawn argv carries the developer builtin under goose's own mask, the preflight and the re-exposure both asked for goose's backend; both drivers call the same two identity-refusal predicates; the child getsGOOSE_MODE=approveand noGOOSE_PATH_ROOT;approvekeeps the session andauto,smart_approve, an empty mode or nomodesblock each close only that session and refuse; the identity refusals (unclassified call, foreign server, goose's owndeveloperand a placed server pass); the handle closes the session on a mode move, ignores a child session's frame and does nothing on a host without session state; the unclassified read needs the session's owntool_callframe; a realAcpRuntimestart inapproverecords and ends the session's state, and one inautosendssession/closeand keeps the process; the dispatch loop and the turn call both refusals.test/test_acp_harness_contract.py: goose joins the harness checks and the registered-ahead-of-routing set.test/test_session_handle_bindings.py: the four new handle members join the inventory.test_acp_goose_backend.py,test_side_readonly_goose.py,test_claude_shared_runtime.py,test_client_bindings.py,test_runtime_bindings.py,test_harness_parity.py,test_acp_session_mcp.py, and thetest_acp_runtime_*andtest_acp_session_handle_*dispatch, drain, load, start and turn files, all pass. mypy oversrc/kiro_crew/acp/is clean.Proof: not provable -- other: new harness, not routed; no shipped behaviour changes for prove.py to revert
Manual verification
Measured on goose 1.57.0 with a loopback model stub, outside Crew: one process, two sessions; session A's turn ran a 60 s shell command through goose's developer tool (60.2 s), session B was asked at 2 s and at 30 s and answered in 0.03 s and 0.02 s; after
session/closeof A, B answered in 0.02 s;session/loadof A on the same process replayed its answer; neither session's text carried the other's tag. Crew's own run against a real goose is in the routing PR.Related Issues
Part of #5033
This is step 2 of 3 for goose chat sharing. Step 1 (#37535) moved goose's per-session code onto
GooseAcpClient. This step gives the shared runtime a goose harness with each session's own checks, routed to by nothing, sopermission_refusalandsession_update_issuehave one override each until step 3. Step 3, stacked on the claude routing PR #37540 and reusing its routing rather than writing another: goose joinsACP_BACKENDS_CHAT_RUNTIME_SHARINGandACP_BACKENDS_SHARED_RUNTIME_ONLY_FOR_CHATS, so only a dashboard chat whose new "Goose chats" switch (off by default, 13 languages) is on takes the shared runtime; a goose account era from goose's stable provider identity (GOOSE_PROVIDERand its*_HOSTkeys, never a credential file that refreshes; unreadable means no sharing); and a run against a real goose in a pod, with process counts and memory measured with the switch on and off.Stacked on #37521 (base
feat/claude-harness, the per-session seams) and carries #37535's commit (the goose client move, which also touchesdocs/system-specs/modules/agent-host-contract.mdand a note insrc/kiro_crew/agent_sdk/backends.py). Rebased onto main once both land.Checklist