Skip to content

feat(side-chat): run read-only tools on the goose backend - #20173

Merged
chenmingwei23 merged 2 commits into
mainfrom
feat/goose-side-readonly
Oct 14, 2026
Merged

chenmingwei23 merged 2 commits into
mainfrom
feat/goose-side-readonly

Conversation

@iamwhatever

@iamwhatever iamwhatever commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: On the goose backend, Side Chat and thread replies can list folders and view images, while changes stay impossible.

On agent.acp_backend: "goose" every Side Chat and thread-reply tool call is refused (REJECT_ALL), because goose is not in ACP_BACKENDS_SIDE_READONLY. goose has its own pre-approval store, permission.yaml in its config directory. In the approve mode Crew seeds, goose runs a tool listed under user.always_allow without sending session/request_permission, so such a call would never reach the READ_ONLY gate. A side question on goose is answered from memory, and the footer says tools are unavailable on this backend.

Why it matters

Side Chat is for quick lookups while the main turn runs. On goose it cannot even look at which files exist, so its answers about the project are guesses until the main turn finishes.

Not a goal

  • Reading a file's text on a goose side turn. goose has no tool that does that apart from its shell, and the shell stays refused.
  • analyze. goose serves it from an extension named analyze, which the identity-drift refusal turns down on every goose session; changing that refusal is a separate decision.
  • Changing what a normal (main-chat) goose session reads from the user's goose home.
  • Any harness other than goose.

What changed (motivation → approach → change)

Safe scope, for review. What a goose side turn (Side Chat or thread reply) may run, and what stays refused:

Call on goose Side turn (side_read_only, READ_ONLY) Normal turn
developer tree, read_image runs (proved from the pair goose stamps) unchanged
the same call on a sensitive path (~/.ssh, the linked secrets.yaml) refused (sensitive-path deny on the call's path) unchanged
shell, write, edit refused unchanged
platform tools (analyze, delegate, load, todo__*, apps__*, extensionmanager__*) refused unchanged
any MCP or config-extension tool, including one named tree refused; none is mounted unchanged

Approach: goose's pre-approval store cannot be emptied from outside, but goose roots its whole config at GOOSE_PATH_ROOT. So a side session gets a goose home of its own, built where the gateway already gives each process a private directory:

  • GooseLaunch.prepare_spawn_env builds the home inside the session's scratch window (build_side_goose_root) and sets GOOSE_PATH_ROOT. The config directory links every entry of the user's config directory (goose_config_dir, resolved as goose resolves it) except permission.yaml, so provider secrets, OAuth tokens and custom providers still work. config.yaml is copied without its extensions block, so no user extension starts. data and state start empty. Each spawn removes the previous home first. Entry names are compared case-folded, so a Permission.yaml on case-insensitive storage stays out. With no scratch window, a home that cannot be built, or a config.yaml that is not a mapping, the session is refused, never started on the user's home.
  • POSIX hosts only (side_home_supported). On Windows goose keeps its secrets under %APPDATA%, outside the credential leaf the sensitive-path deny names, and linking needs a symlink privilege, so a goose side turn there keeps running REJECT_ALL and the footer says tools are unavailable.
  • _goose_session_mcp_servers places no server on a side session's array, as on claude. A server named developer would otherwise replace goose's builtin read tools.
  • build_permission_event proves a read from the (extensionName, toolName) pair goose stamps on the tool_call frame, read as goose wrote it, before the prefix strip: ("developer", "tree") and ("developer", "read_image") map to fs_read as harness_builtin_tool (GOOSE_READ_ONLY_BUILTINS). goose names every other extension's tool <extension>__<tool>, so a shadow arrives as developer__tree and matches nothing. A matched pair is goose's own extension, so the event carries no server, as goose's builtin shell already does, and the other kind goose's permission request fills in is read as read; a kind goose does state still narrows. Side sessions only.
  • _run_side_turn and _run_thread_turn take the goose branch (side_read_only, READ_ONLY, binding goose_read_only), and the boundary prompt is a new listing-only variant that names no shell and no file read.
  • goose joins ACP_BACKENDS_SIDE_READONLY; side_chat_tools reads available on its card.

No gate-tier, tool-identity or hooks file changes: the READ_ONLY proof _is_harness_read_only_builtin from #19059 already accepts a mapped built-in with no server.

Backwards compatibility

Compatible: a goose side turn that refused every tool now runs two read tools; normal goose sessions, and every other backend, build the same events and spawn the same way.

Removes nothing: no field, path, key or function is taken away; the prompt helpers gain a defaulted keyword.

Tests

  • test/test_side_readonly_goose.py (new), through the real parser, provider conversion and stream_and_collect with goose 1.50.1's live frame shapes:
    • (a) a side tree / read_image is approved under READ_ONLY;
    • (b) shell, write, edit, analyze, delegate, load, todo__todo_write, apps__create_app, extensionmanager__manage_extensions gain no built-in on side or normal turns and are refused under READ_ONLY;
    • (c) a shadow (developer__tree, shadowx__tree, ("shadowx", "tree"), ("analyze", "read_image")), a frame with no goose identity, and a proven read with a stated write kind are refused;
    • (d) tree / read_image of ~/.ssh/id_rsa, and read_image of the side home's linked secrets.yaml while the user's permission.yaml lists both tools, are refused;
    • a normal-turn event is unchanged by the mapping;
    • the side home leaves out permission.yaml (and its lock, and case variants such as Permission.yaml), drops extensions, links secrets and custom providers, is rebuilt per spawn, and refuses an unparsable config or a link that fails;
    • a host without a side home (Windows) answers no side tools for goose, on Side Chat and on thread replies;
    • the launch sets GOOSE_PATH_ROOT under the scratch window only for a side session, refuses one with no window, and a side session mounts no MCP server.
  • test/test_side.py: a goose side turn requests side_read_only, streams READ_ONLY with the listing prompt and binding goose_read_only; the footer endpoint answers read_only_tools: true on goose.
  • test/test_chat_threads.py: the same for a goose thread reply.
  • test/test_backend_cards.py: goose's core count 6 → 7.
  • test/test_acp_refactor_facade.py: the goose host now reads the error family like every other host.

On origin/main the new file fails at import (build_side_goose_root does not exist), and the side, thread and card tests fail on the REJECT_ALL posture.

Manual verification

Live, goose 1.50.1 (linux x86_64 release binary) in python:3.12-slim, spawned as Crew spawns it (goose acp --with-builtin developer, GOOSE_MODE=approve, empty mcpServers), with a scripted local OpenAI-compatible stub calling one tool per run. The user's goose config listed tree, shell, analyze and read_image under permission.yaml user.always_allow, and declared a stdio extension shadowx serving tree, analyze and read_image. The side home was built by this PR's build_side_goose_root.

Tool called User's own home: asks User's own home: result Side home: asks Side home: result
tree 0 ran 1 refused, did not run
read_image 0 ran 1 refused
shell (touch a file) 0 ran, file written 1 refused, no file
shadowx__tree 1 — 0 not offered (no extension)

On the side home every other tool asked too: analyze, write, todo__todo_write, apps__create_app, load, delegate, extensionmanager__manage_extensions each raised one session/request_permission. A Crew server named developer serving tree replaced the builtin extension and was stated as ("developer", "developer__tree"). A config extension named developer or analyze did not displace the builtin tool. Only the reject answer was driven end to end. The approve path is covered by the unit tests above, not by a full gateway run.

Related Issues

None filed. This closes the goose side_chat_tools gap on the harness capability card.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

Contributions are accepted under the project's Apache-2.0 license.

@iamwhatever
iamwhatever requested review from a team and KiroCrewCaptain as code owners October 14, 2026 07:12
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Oct 14, 2026
@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision a09b80ea33f224973973a7b8fe9bb255e35aec01 touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Advisory — does not block merge.

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — 🟡 CONCERNS

Premise-level review of a09b80ea33f224973973a7b8fe9bb255e35aec01 — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: CONCERNS

goose_side_home_supported is a second name for side_home_supported, a function whose whole body is os.name != "nt". Both dashboard callers could import the original.

Not justified as shipped

  • Item 8 — duplicate of src/kiro_crew/acp/harness/goose.py::side_home_supported: the diff adds def goose_side_home_supported(): from kiro_crew.acp.harness.goose import side_home_supported; return side_home_supported(), which only passes the call through. Grep for goose_side_home_supported finds 2 consumers (dashboard/handlers/side.py, dashboard/chat_threads.py). The dashboard already imports from kiro_crew.acp in 12 files, so no layering rule forces the wrapper.
    Subtraction: delete goose_side_home_supported and its __all__ entry from agent_sdk/drivers/acp.py, and have both callers import side_home_supported directly.
    Clears when: the wrapper is removed, or an import-boundary test is cited that forbids dashboard/ importing acp.harness.

What this change ships

Inventory (8 items) — 7 justified

Intent: on goose, let Side Chat and thread replies list folders and view images while every change stays refused. This is an ADDITION.

  1. On goose, side and thread turns now run tree and read_image instead of refusing every tool — justified
  2. A goose side session runs on its own goose home, without the user's permission.yaml — justified
  3. The side home's config.yaml is a copy with the user's extensions removed, so none start — justified
  4. A goose side session mounts no MCP server — justified
  5. Windows hosts keep REJECT_ALL, and the footer says tools are unavailable — justified
  6. New listing-only boundary prompt for side and thread turns — justified
  7. Goose's other kind on a proven read pair is treated as read — justified
  8. New goose_side_home_supported pass-through in agent_sdk/drivers/acp.py — duplicate of acp/harness/goose.py::side_home_supported

[FIRST-PRINCIPLES-REVIEWED] a09b80e

Description read

[DESCRIPTION-READ] 893b4e4f20bb5195e7252c2a9ad55d28b46c64c372c83ea1048e23d85fac4560

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — 🟡 CONCERNS

Design-level review of a09b80ea33f224973973a7b8fe9bb255e35aec01 — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: CONCERNS

The side home leaves out only what goose 1.50.1 is known to use, so a new pre-approval source in a later goose release would skip the READ_ONLY gate without any warning.

Watch

  • The confinement is a deny-list over a third-party config directory. _SIDE_ROOT_UNLINKED skips only permission.yaml (and its lock). _SIDE_CONFIG_DROPPED_KEYS = ("extensions",) strips one key, and every other entry and key is linked or copied through. Suppose a later goose adds another way to pre-approve tools: a new file, a subdirectory, or a config.yaml key such as a mode or allowlist. That source gets linked into the side home, goose runs the tool without sending session/request_permission, and Crew's gate never sees the call. Nothing goes red, because membership in ACP_BACKENDS_SIDE_READONLY rests on a one-time measurement on 1.50.1 ("verified range 1.50.x"), not on a runtime check. The safety claim is "every call reaches the READ_ONLY gate", and that holds only as long as goose's config layout stays the same.
    Clears when: the side home is built from an allow-list: link only the credential and provider entries goose needs, and copy only the config.yaml keys you name. Alternatively, the goose side posture is tied to the verified version range, so an unverified goose falls back to REJECT_ALL.

Suggestions

  • Build the side config.yaml from a short list of named keys (provider and model) instead of copying it with extensions removed. This closes the key half of the Watch item at no extra cost.

[DESIGN-REVIEWED] a09b80e

Description read

[DESCRIPTION-READ] 00fe17f00b7e9260e627c5dea380ba9b316ef47da33309f676b152efa70be38d

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 .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed a09b80ea33f224973973a7b8fe9bb255e35aec01 — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] a09b80e

Verdict parsed from the review's SHA-scoped output markers for commit a09b80ea33f224973973a7b8fe9bb255e35aec01.

False positive or not applicable? A repository writer can comment:
/ai-review override fable a09b80ea33f224973973a7b8fe9bb255e35aec01: <one-sentence reason>

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 14, 2026
@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of a09b80ea33f224973973a7b8fe9bb255e35aec01 and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] a09b80e

False positive or not applicable? A repository writer can comment:
/ai-review override gpt a09b80ea33f224973973a7b8fe9bb255e35aec01: <one-sentence reason>

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Oct 14, 2026
On goose every Side Chat and thread-reply tool call was refused
(REJECT_ALL): goose's own permission.yaml runs a tool listed under
user.always_allow without asking, so a pre-approved call would skip
the READ_ONLY gate.

A goose side session now starts on a goose home of its own inside
its scratch window (GOOSE_PATH_ROOT): the user's config entries are
linked in except permission.yaml, config.yaml is copied without its
extensions block, and no MCP server is mounted. On that home every
tool goose 1.50.1 served asked first. A read is proved from the
(extension, tool) pair goose stamps, as written: developer/tree and
developer/read_image only, so another extension's tool under an
allowed name is refused. The shell stays refused, so a goose side
turn lists folders and views images, and its prompt says so.
@iamwhatever
iamwhatever force-pushed the feat/goose-side-readonly branch from d54e5a6 to f0acaeb Compare October 14, 2026 07:53
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Dispositions for the review lanes at d54e5a6abb. The current head is f0acaeb66a, rebased on main.

GPT 6.1, BLOCKING goose.py:110 (case-sensitive exclusion). Fixed in f0acaeb66a. I checked it in the code, not just the comment. The skip at build_side_goose_root compared entry.name with the lowercase set by exact match. So on case-insensitive storage, a Permission.yaml was linked in and goose opened it as permission.yaml. Names are now compared with casefold(). test_a_case_variant_of_permission_yaml_is_not_linked pins Permission.yaml, PERMISSION.YAML and permission.YAML.lock.

Design, CONCERNS (Windows symlink OSError). Fixed in f0acaeb66a.

  • An OSError while the home is built is now raised as AcpError (test_a_home_that_cannot_be_built_refuses_the_side_session).
  • The goose side allowance is POSIX-only (side_home_supported). On Windows goose keeps secrets.yaml under %APPDATA%, outside the credential leaf the sensitive-path deny names for goose. So a Windows goose side turn keeps the old REJECT_ALL posture, and the footer says tools are unavailable. Tests: test_a_host_without_a_side_home_keeps_goose_side_turns_tool_free and test_a_goose_turn_on_a_host_without_a_side_home_runs_no_tools.
  • The Windows branch of goose_config_dir is removed.

First Principles, CONCERNS (home builder oversized). Kept as is, with reasons:

  • Why a home at all. goose reads permission.yaml from the directory GOOSE_PATH_ROOT roots. No env var or session option turns it off in approve mode (goose permission_inspector.rs, step 1). So the "smaller seam" the lane asks for is a separate root. Crew cannot rewrite or delete the user's own file.
  • Why link the other entries. A root holding only config.yaml loses provider secrets, OAuth token caches (githubcopilot/, chatgpt_codex/, gemini_oauth/) and custom_providers/. Every goose source reads those from the config dir, so the session would not reach its model.
  • Why rewrite config.yaml. Dropping extensions stops user extensions from starting in a side turn. Live on 1.50.1, a config extension loads even when the session array is empty. That is the ownership half of this item.
  • analyze is not offered, as the description says.
  • tree alone would not shrink the builder: the builder is the cost of withholding permission.yaml, whichever tools are offered.

@github-actions github-actions Bot removed the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Oct 14, 2026
@iamwhatever
iamwhatever force-pushed the feat/goose-side-readonly branch from f0acaeb to 6ad29db Compare October 14, 2026 08:27
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Oct 14, 2026
The side home skipped permission.yaml by exact name, so a
Permission.yaml on case-insensitive storage was linked in and goose
opened it as its pre-approval store. Names are now compared
case-folded. A home that cannot be built is refused as an AcpError,
and a goose side turn on Windows keeps running REJECT_ALL: goose
keeps its secrets under APPDATA there, outside the credential leaf
the sensitive-path deny names.
@iamwhatever
iamwhatever force-pushed the feat/goose-side-readonly branch from 6ad29db to a09b80e Compare October 14, 2026 08:58
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Dispositions for the advisory CONCERNS at a09b80ea33. No code change.

First Principles, item 8 (goose_side_home_supported pass-through). Kept, because a boundary gate requires it. The lane asks for "an import-boundary test that forbids dashboard/ importing acp.harness". That test is scripts/check_agent_sdk_boundary.py, which runs in Backend Lint & Type Check. At f0acaeb66a the dashboard imported side_home_supported directly, and that job failed with: "imports the ACP layer. Application code must reach the agent backend through kiro_crew.agent_sdk" (dashboard/chat_threads.py:30), and "ACP-layer imports grew from 1 to 2. The baseline is shrink-only" (dashboard/handlers/side.py). The 12 dashboard files that already import kiro_crew.acp are baselined edges, and that baseline only shrinks. The wrapper follows the existing pattern: it sits beside claude_adapter_honours_session_options in the same driver module.

Design, Watch (the side home leaves out known pre-approval sources rather than allowing named ones). Accepted as advisory, not changed in this PR.

  • An allow-list of config.yaml keys would break providers. goose reads each provider's settings from top-level keys (OPENAI_HOST, ANTHROPIC_HOST, OLLAMA_HOST, DATABRICKS_HOST, ... across its provider registry). A short named list would silently drop every provider that is not on it, and the side turn would fail to reach its model.
  • An allow-list of config-dir files is the same trade. The OAuth caches live in per-provider subdirectories (githubcopilot/, chatgpt_codex/, gemini_oauth/, kimicode/), and that set grows with goose releases.
  • What is pinned instead:
    • The mode cannot come from config. GOOSE_MODE is seeded in the child's environment, which goose resolves above config.yaml, and the client reads the mode back off the session/new response and refuses anything but approve (AcpClient._verify_goose_routing).
    • permission.yaml is the only per-tool pre-approval store in goose 1.50.x. PermissionManager is its sole reader, and PERMISSION_FILE is its only path.
  • On drift: a goose release outside 1.50.x is already logged at the handshake (_note_goose_version). A new pre-approval source in goose would bypass the gate on normal goose turns too, not only on side turns. So it belongs in the goose verified-range re-capture this backend already requires before the range is raised, not in a side-chat-only fence.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Oct 14, 2026

@chenmingwei23 chenmingwei23 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Readiness passed, all CI lanes green, no conflicts. Approving for merge.

@chenmingwei23
chenmingwei23 merged commit e261dda into main Oct 14, 2026
102 checks passed
@chenmingwei23
chenmingwei23 deleted the feat/goose-side-readonly branch October 14, 2026 15:26
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants