Skip to content

feat(side-chat): run read-only tools on the Claude Code backend - #19059

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

chenmingwei23 merged 2 commits into
mainfrom
feat/claude-side-chat-readonly-takeover

Conversation

@iamwhatever

@iamwhatever iamwhatever commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: On the Claude Code backend, Side Chat and thread replies can read files, search the codebase and fetch web pages, while changes stay impossible.

On agent.acp_backend: "claude" every Side Chat tool call is refused (REJECT_ALL). ACP_BACKENDS_SIDE_READONLY names kiro-cli alone, because claude-agent-acp approves a call by itself when Claude Code's settings pre-approve it (a permissions.allow rule, or a bypassPermissions / auto default mode), and such a call never reaches the READ_ONLY gate. So a side question asked while the main turn is busy is answered from memory, and the footer says tools are unavailable on this backend.

Why it matters

Side Chat exists for quick lookups while the main turn runs. On the Claude Code backend it cannot open the file the question is about or check a page, so the answer is a guess, and the user has to wait for the main chat to get a real one.

Not a goal

  • Read-only shell commands (ls, git status) in a claude side session: Bash is not in its tool list.
  • Web search where Claude Code offers no WebSearch tool (a Bedrock-routed setup, see Manual verification), or through an MCP server: READ_ONLY refuses MCP calls on every backend.
  • Changing which spec hooks, Hooks-page hooks, deny rules or governance rules match a claude call in the main chat: the claude name table is not a HARNESS_TOOL_TABLES row, and the mapped name rides only side sessions.
  • Isolating the user's ~/.claude, or a checked-in project .claude/settings.json, from claude sessions (the inherited-config gap in claude-code-provider.md). In a side session such a file can still pre-approve a read, never a write.
  • Keeping a user's own PreToolUse hook in force in a side session. disableAllHooks turns it off with every other hook, as the kiro-cli derived spec already removes preToolUse, so a hook that denies reading a file does not cover a native Read there, exactly as it does not cover kiro-cli's fs_read. Running hooks would run shell commands fed the model's tool input outside the gate (a memory plugin's PostToolUse hook, for one, writes every call to its store); refusing tools whenever a hook is configured would switch the feature off for nearly every user with a plugin.
  • Any harness other than kiro-cli and claude.

What changed (motivation → approach → change)

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

Call on claude Side turn (side_read_only, READ_ONLY) Normal (main-chat) turn
Read, WebFetch, WebSearch runs (proved from the adapter-stamped name) unchanged
Grep, Glob run natively inside the work dir; a search-kind request that reaches the gate is refused unchanged
Read, Grep, Glob of a host sensitive path (~/.aws, ~/.ssh, Crew's own secrets) denied by Claude Code itself (inline permissions.deny), whatever the user's allow rules or additionalDirectories say unchanged
Write, Edit, MultiEdit, NotebookEdit not offered to the session; refused if requested, even with kind: "read" unchanged
Bash, Task not offered; refused unchanged
any MCP tool no server started (strictMcpConfig, empty mcpServers); refused unchanged

No normal-turn gate loosened: off a side session the permission event carries no harness_builtin_tool, so it is field-for-field the event a frame with no claude stamp builds, and the gate's verdict is the same under HOOK_BASED and READ_ONLY (test/test_side_readonly_claude.py). The read-only proof, deny targets and governance identity read the new name only on a side session. kiro-cli and KAS side turns are unchanged.

On the Claude Code backend a Side Chat question or thread reply can now read files, search the codebase and fetch web pages, and nothing that writes can run. The side session is started in a shape where Claude Code's own pre-approvals cannot reach a write. Checked on claude-agent-acp 0.84.0, the version floor: under a project that pre-approves Write and Bash, the side session offered only Glob, Grep, Read, WebFetch and started neither the project's hook nor its .mcp.json server (Manual verification).

On a claude Side Chat or thread-reply session What it does
tools: Read, Grep, Glob, WebFetch, WebSearch No write tool, Bash or subagent exists for an allow rule to pre-approve
empty mcpServers + strictMcpConfig No MCP server from Crew, the user, the project or a plugin
inline permissions.ask on WebFetch / WebSearch A web call asks the host even under a user allow rule
inline permissions.deny: Read(//<target>) and Read(//<target>/**) for every sandbox_credential_targets() entry No allow rule or additional directory from the user's settings opens a sensitive path to a native read
inline disableAllHooks Settings and plugin hooks (shell commands claude runs unprompted) stay off, as on kiro-cli
bypass off, bypassPermissions / auto pinned to default The adapter's mode cannot approve on its own
gate identity from _meta.claudeCode.toolName The call is named by the tool claude-agent-acp runs, never by its title, for the read-only proof, the deny rules and governance

The gate cannot see claude's own pre-approvals, so instead of hiding them this change removes what they could approve. The user's settings still load, because they carry the provider routing and model ids (env, modelOverrides); settingSources: [] would break a Bedrock or gateway setup. Inside the work dir, or where the user's settings allow it, Claude Code runs Read, Grep and Glob without asking, the same kind of native read kiro-cli's fs_read is; those reads never reach the gate's sensitive-path check, so the session carries that check's set as deny rules, which Claude Code applies before any allow rule. The launch (acp/harness/claude.py) builds them off the loop and does not start a session it cannot build them for. side_read_only goes from _run_side_turn (dashboard/handlers/side.py) and the thread-reply turn (dashboard/chat_threads.py) through get_or_create, the provider factory (config/loader.py) and AcpProvider (providers/acp.py) to AcpClient (acp/client.py); a side: or thread: key never claims a pooled child. There _claude_session_meta adds the options, the MCP splice sends no servers, and _pin_claude_starting_mode pins the session and stops it on a handshake below CLAUDE_ACP_SETTING_SOURCES_MIN_VERSION. For the gate, harness_tool_name (acp/_dispatch.py) reads claude's stamped name, and on a side_read_only session only build_permission_event maps it through CLAUDE_READ_ONLY_BUILTINS (acp/harness_tool_names.py) into AcpEvent.harness_builtin_tool (acp/types.py); ToolCall (hook_runtime/tool_identity.py, hooks.py) carries it into hook_runtime/gate_tiers.py as a deny target, a governance identity and the claude half of the classifier_only read-only proof.

claude joins ACP_BACKENDS_SIDE_READONLY (agent_sdk/backends.py) beside kiro-cli and KAS, and the backend card and no-shell boundary prompts (dashboard/side_prompts.py, dashboard/side_context.py, chat_threads.py) follow it. Whether a side turn runs tools is one check, _side_read_only_tools: membership, then on claude the installed adapter's version, read through agent_sdk/drivers/acp.py. The turn and the new GET /api/chat/side/tools (dashboard/routes/chat.py) both ask it, and the Side Chat footer (SideChat.tsx, through sideTools in website/src/api/client/chat.ts) reads the GET, so below the floor the turn keeps REJECT_ALL and the footer, told by claude_adapter_outdated on the same answer, says to update claude-agent-acp (context_only_claude_adapter_outdated, added to every website/src/i18n/locales catalog). side.md, claude-code-provider.md, harness-parity.md (H6), harness-onboarding.md, history.md and the feature map describe it.

Backwards compatibility

Removes nothing: every session other than a claude Side Chat or thread-reply session gets the same _meta.claudeCode.options, MCP array, pool use and mode, and its permission events carry no harness_builtin_tool, so no deny or governance verdict on a main-chat claude call changes. On a claude side session a kiro-cli-named deny rule or governance tools entry (fs_read, grep, glob, web_fetch, web_search) now binds claude's matching call; that session refused every call before, so nothing it ran is newly refused. The Side Chat footer reads GET /api/chat/side/tools instead of the backend card's side_chat_tools line, because the card is membership only and cannot see the claude adapter floor. It keeps every state it had, including the two failure messages: config_unavailable on the answer says the config did not load (the turn runs without tools), and a failed request says the tools are unknown. Below the adapter floor it says to update claude-agent-acp instead of calling the backend unsupported.

Tests

  • test/test_side_readonly_claude.py (new): claude frames through the real ACP parser, AcpProvider._to_llm_event and stream_and_collect. On a side session under READ_ONLY, Read, WebFetch and WebSearch run; Write, Edit, MultiEdit, NotebookEdit, Bash, Task and an MCP call are refused, also when the request claims kind: "read". Off a side session the event and the gate verdict equal an unstamped frame's, under HOOK_BASED and READ_ONLY.
  • test/test_side.py: a claude side turn requests a side_read_only session for the base agent, derives no kiro spec, streams READ_ONLY and sends the no-shell prompt; an installed adapter below the floor runs REJECT_ALL; a non-member backend (opencode) keeps REJECT_ALL; a dashboard-bound profile denying web_search refuses claude's WebSearch, which fails without the governance identity; GET /api/chat/side/tools answers true on kiro and on a verified claude adapter, and false below the floor, on opencode and when the config does not load (with config_unavailable set only then); it names an outdated claude adapter only in the below-floor case.
  • test/test_chat_threads.py: the same two claude cases for a thread reply.
  • test/test_acp_session_mcp.py: launched through ClaudeLaunch.resolve_spawn under user settings that allow every read and add the home as a directory, the side session's deny rules keep every sensitive target, and everything under it, from a native read on session/new and session/load, while a work-dir file still reads (red on the previous head); a launch whose deny rules cannot be built raises, an envelope without them is refused, and a main-chat session is unchanged; a target becomes a // rule with its glob characters escaped, a Windows drive written /c; on session/new and session/load the side session ships the read built-ins, no MCP servers, strictMcpConfig, the web ask rules and disableAllHooks, and is pinned from bypassPermissions to default; on the exclusion path the project's deny rules still ride along; a handshake below the floor stops it; claude_adapter_honours_session_options follows the installed version; only a side_read_only client puts the stamped name on its permission event (red without the forward).
  • test/test_llm_helpers_tool_gate.py (real HookManager): claude WebSearch, WebFetch and Read with their stamped built-in are approved under READ_ONLY; a search-kind Grep, a stamped name with an MCP server, and a WebFetch an operator denied as web_fetch are refused.
  • test/test_harness_tool_names.py: a claude side tool_call frame names the read built-in on the permission event (Write, Bash and MCP tools name none), a main-chat event names none, a frame without the stamp is not named by its title, and only the claude backend reads the table.
  • test/test_session_pool.py: a side_read_only side session cold-starts and the factory receives the flag. test/test_cc_permission_mode_seed.py: the factory passes the flag to AcpProvider by name.
  • test/test_backend_cards.py: claude's core count is re-pinned from 5 to 6, since its Side Chat tools line is now available.
  • test/test_side_context.py: the no-shell prompt keeps the read-only boundary and names no shell. test/test_hooks.py: the new ToolCall field is pinned in the gate-kwargs extraction.
  • website/src/test/SideChat.multiturn.test.tsx: the footer follows the gateway's read_only_tools answer, says to update claude-agent-acp on claude_adapter_outdated, says the tools are unknown when the answer fails to load, and asks again when the config changes (red with the query keyed outside kirocrewConfig). SideChat.footerBackend.test.tsx: the footer follows the gateway answer on every state, with the config failure and the request failure each in its own words. SideChat.stop.test.tsx mocks the new call.

Determinism (testing-conventions D12), over the 45 new or changed node ids above: 20 runs at -n0 green; 10 runs at -n 4 --dist loadgroup --max-worker-restart=2 beside test/test_side_readonly_spec.py and test/test_side_context_cov80.py green; one shuffled order, seed 26968, green. The 12 node ids the deny rules add or change in test/test_acp_session_mcp.py: 20 runs at -n0 green; 10 runs at -n 2 --dist loadgroup beside the rest of TestClientSeam (this host's load cap, in place of -n 4) green; one shuffled order of that class, seed 19059, green.

Manual verification

Drove claude-agent-acp over raw ACP (session scratch installs, Bedrock-routed user settings with defaultMode: auto) in a throwaway project whose .claude/settings.local.json pre-approves Write, Bash(touch:*), WebSearch and WebFetch, enables project MCP servers and carries a UserPromptSubmit hook, and whose .mcp.json server touches a marker file when it starts. One prompt asked for the tool list, a Write of out.txt, touch bash-ran.txt through Bash and a WebFetch of https://example.com; every permission request was rejected.

claude-agent-acp 0.84.0 Ordinary session (no options) Side session (this PR's options)
Starting mode auto auto, pinned to default
Tools it listed Bash, Edit, Write, Read and others, plus the user's MCP tools Glob, Grep, Read, WebFetch
Write out.txt ran, no permission request, file written no Write tool; no file
Bash touch ran, no permission request, file written no Bash tool; no file
WebFetch ran, not asked session/request_permission sent despite the allow rule
Settings hook ran did not run
.mcp.json server started not started

An earlier run on 0.86.0 (Write, WebFetch, a web search and a read of a work-dir file) matched, and there the side session's Read ran natively. Neither version offers WebSearch on this Bedrock route. claude-agent-acp reports no session tool list over ACP (its session updates carry commands, config options, plans, tool calls and usage), so the version floor is the only check the host can make; the 0.87.0 source still reads _meta.claudeCode.options.tools into the SDK's tools and spreads strictMcpConfig and settings into its options.

The sensitive-path deny rules were not driven live: no claude-agent-acp is installed on the host this round ran on. Their shape follows Claude Code's documented permission rules (a // path is absolute from the filesystem root, deny rules from every source are evaluated before allow rules, and a symlink is denied when its target matches), and test_an_inherited_read_allow_does_not_open_a_sensitive_path checks the shipped list against that order; it is red on 143abe8.

Screenshots / video

The Side Chat footer on the Claude Code backend, captured from the real SideChat component with its footer query seeded: before on upstream/main @ 6765454 (config agent.acp_backend: "claude"), after on this branch with the gateway answering read_only_tools: true (adapter at the floor) and false with claude_adapter_outdated: true (adapter below it). Uploaded as PR attachments; nothing is committed under temp-screenshots/.

Before After
Before: Side Chat footer on claude says tools are unavailable on this agent backend After: Side Chat footer on claude says lookups work here but changes don't
After, adapter below the floor, and light theme

After, claude-agent-acp below the version floor: the footer says to update claude-agent-acp

After, light theme: the read-only footer

Related Issues

Closes #17674

Supersedes #17785 (the fork PR by @rinbn, taken over on a branch of this repository because it changes sensitive gate paths, which a fork PR cannot pass Sensitive Change Review for). The original commit keeps @rinbn as author, and the follow-up commit carries Co-authored-by.

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

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

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Sensitive Change Review

Sensitive files changed:

  • src/kiro_crew/hook_runtime/gate_tiers.py

  • src/kiro_crew/hook_runtime/tool_identity.py

  • src/kiro_crew/hooks.py

  • @iamwhatever posted a complete reasoning template for 71e3933.

@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — 🟡 CONCERNS

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

Design-Verdict: CONCERNS

The no-write guarantee depends on the claude adapter actually honouring the tools option, and nothing checks that once the session starts.

Watch

  • The adapter's option handling is trusted, not checked. The patch sets options["tools"] = list(CLAUDE_READ_ONLY_BUILTINS) and treats it as the confinement. The only guard is the version floor CLAUDE_ACP_SETTING_SOURCES_MIN_VERSION; there is no upper version bound and no check of which tools the session actually offers. The side panel has no approval card, so the gate is the only control. If a later claude-agent-acp ignores or renames _meta.claudeCode.options.tools, a user's permissions.allow rule on Write or Bash would run in Side Chat without the gate ever seeing it. Mode pinning only covers bypassPermissions and auto; it does not stop explicit allow rules. Users would be told Side Chat is read-only while a write runs and no SEL row is written. This only holds while the check stays at 0.84.0. If a later release fails, reverting the PR undoes it, so the risk is reversible but silent.
    Clears when: the side session fails closed after session/new, either when the tool set the adapter reports is wider than CLAUDE_READ_ONLY_BUILTINS, or when the adapter version is outside the verified range. A test must pin that behaviour.

  • The backwards-compatibility section is past the description's cut. The description was truncated at 8000 bytes, so the reader list could not be checked. I found no reader that breaks. build_side_system_prompt still accepts tools_available and adds shell_available with a default. The footer moves to an additive GET /api/chat/side/tools. The deleted test_side_turn_on_another_backend_runs_no_tools_and_derives_nothing pinned the old rule for joining ACP_BACKENDS_SIDE_READONLY. The PR replaces that test and also rewrites the rule itself in side.md and harness-parity.md, so a human should approve the new rule.
    Clears when: a maintainer confirms the revised H6 joining rule for ACP_BACKENDS_SIDE_READONLY: a call may either run natively as a read or reach session/request_permission, under a confinement the harness enforces.

[DESIGN-REVIEWED] 71e3933

Description read

[DESCRIPTION-READ] 25f8410b52204fa93b80cbfa12219ef90e91438687ede96d7efaa6f6c7c4cef1

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 11, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — 🟡 CONCERNS

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

UX-Verdict: CONCERNS

The new "Update claude-agent-acp" footer gives an instruction the user can't follow: no command, no version, no link.

Watch

  • The outdated-adapter notice gives no way to act on it. The new string context_only_claude_adapter_outdated reads "Context only · Update claude-agent-acp to use read-only tools here." The footer is plain role="note" text, so it has no link and no command. In shot-03 the blind reader said "no idea what 'claude-agent-acp' is… I would not know how to 'update claude-agent-acp'". Every claude user whose adapter is older than 0.84.0 sees this on every Side Chat open, and Side Chat stays answer-only until they find the fix somewhere else. Severity is medium: it doesn't happen often, but it blocks the feature and doesn't go away. Smallest fix: put the command and the minimum version in the string.
  • "Context only" and "read-only" in one sentence. The new string opens with "Context only" and then promises "read-only tools". The reader already found these two terms hard to tell apart: "'Read-only' and 'Context only' sound alike to me". Using both in one line makes the two footer states harder to separate. Severity is low: it's friction, not a failure.

Suggestions

  • Change context_only_claude_adapter_outdated to: "Lookups off · Run npm i -g @agentclientprotocol/claude-agent-acp (0.84 or newer) to look things up here. Use the main chat to take action." Update every locale to match.

[UX-REVIEWED] 71e3933

Description read

[DESCRIPTION-READ] 9cedb4aa377336f582de289e64cbbb655854187f02451ad1e8ad9744e43fa664

That sha256 names everything this verdict read: the PR description, plus the 7 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 11, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 71e393339d7dfb76f7c9db4b5f6b0f9880042434 — 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: PASS

Below the claude-agent-acp version floor the backend card's side_chat_tools line says yes, but /api/chat/side/tools and the turn say no. Make sure that mismatch is intended.

What this change ships

Inventory (10 items) — 10 justified

Intent: On the Claude Code backend, Side Chat can read files, search the codebase and fetch pages while nothing can write. This is an ADDITION.

  1. A claude Side Chat turn can now run Read, Grep, Glob, WebFetch and WebSearch where every tool call used to be refused — justified
  2. Claude thread replies get the same read-only tools — justified
  3. The claude side session starts with only read tools, no MCP servers, hooks off, its mode pinned to default, and web calls set to ask — justified
  4. Host sensitive paths are denied to claude's native reads, and the session won't start if those deny rules can't be built — justified
  5. On side sessions the gate names a claude call by its adapter-stamped tool name, for the read-only proof, deny rules and governance — justified
  6. Below the adapter version floor, claude side turns keep running with no tools — justified
  7. A new GET /api/chat/side/tools, which the footer now reads instead of the backend card — justified
  8. A new footer message in 15 locales tells the user to update claude-agent-acp — justified
  9. New prompt wording for side and thread turns that have no shell — justified
  10. The claude backend card's Side Chat tools line now shows as available (6 core lines become 7) — justified

[FIRST-PRINCIPLES-REVIEWED] 71e3933

Description read

[DESCRIPTION-READ] 6e50834fe923ebdc3dd3d2d93d531d63c9d5d25f3db968547c9de383f52115fe

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 11, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

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

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 71e3933

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

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Sensitive change review

Head commit: 3a97643

  • What rule changed: The READ_ONLY tier in hook_runtime/gate_tiers.py can now prove a claude read built-in (Read, WebFetch, WebSearch) from harness_builtin_tool, the name claude-agent-acp stamps on its tool_call frame, mapped through CLAUDE_READ_ONLY_BUILTINS. The same name is added as a deny target and a governance identity. tool_identity.py and hooks.py only carry the new field into ToolCall. The field is filled only on a side_read_only (Side Chat or thread-reply) claude session.
  • Before -> after (what was allowed/blocked, now): Before, every tool call in a claude side turn was refused (REJECT_ALL). After, on a claude side turn, Read, WebFetch and WebSearch are approved under READ_ONLY. Write, Edit, MultiEdit, NotebookEdit, Bash, Task and every MCP call are still refused, also when the request claims kind: "read". Normal (main-chat) claude turns are unchanged: their permission event carries no harness_builtin_tool, so the gate sees the same input and gives the same verdict as before. kiro-cli and KAS side turns are unchanged.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): A claude side turn could run a call that is not read-only without a card. Two layers stand against that: the side session is started with only the read built-ins, no MCP server, disableAllHooks and its mode pinned to default, so no write or shell tool exists for an allow rule to pre-approve; and the gate refuses any call whose stamped name is not in the read table. A web read could still fetch a URL the model picks, the same as a kiro-cli side turn's web_fetch, and it asks the host under the inline permissions.ask rule.
  • Evidence checked (which sandbox result proves it): No OS sandbox code changed, so no sandbox run applies. test/test_side_readonly_claude.py drives claude frames through the real ACP parser, AcpProvider._to_llm_event and stream_and_collect with a real HookManager: reads approved, every write, shell, subagent and MCP call refused on a side session, and for each of those tools the normal-turn verdict equals the verdict for an unstamped frame under HOOK_BASED and READ_ONLY. The original author's raw-ACP check on claude-agent-acp 0.84.0 (PR body, Manual verification) shows a side session lists only Glob, Grep, Read, WebFetch under a project that pre-approves Write and Bash.
  • No regression:
    • Tools still work: Main-chat claude calls get the same _meta.claudeCode.options, MCP array, mode and gate input as before, and kiro-cli and KAS side turns keep their READ_ONLY path; test_side_readonly_kas.py and the kiro side-turn tests pass.
    • Backward compatible: Nothing is removed. A kiro-cli-named deny rule or governance entry (fs_read, web_fetch, web_search) now also binds the matching claude side call, which was refused outright before, so nothing that ran before is newly refused.
    • Existing tests: Ran test_side.py, test_side_readonly_kas.py, test_side_context.py, test_chat_threads.py, test_acp_session_mcp.py, test_hooks.py, test_harness_tool_names.py, test_llm_helpers_tool_gate.py, test_cc_permission_mode_seed.py, test_session_pool.py, test_harness_parity.py, test_backend_cards.py and the new file: 916 passed. The SideChat vitest files pass 192 of 192.
  • How to undo: Revert this PR. That takes claude out of ACP_BACKENDS_SIDE_READONLY, so a claude side turn goes back to REJECT_ALL, and the gate stops reading harness_builtin_tool.

@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

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

Review details

No findings.

[OPUS-REVIEWED] 71e3933

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

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

@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Security Scope Review -- 🟡 CONCERNS

Which legitimate operations does 71e393339d7dfb76f7c9db4b5f6b0f9880042434 newly refuse? Updated in place on each push. A script-confirmed regression blocks; the model proposes candidates and never decides a refusal.

Verdict basis: the reviewer's own judgement; no confirmed regression.

Security scope review -- adjudicated candidates

  • macos-latest (platform posix): 13 classified, 0 newly refused, 13 still allowed.
  • ubuntu-latest (platform posix): 13 classified, 0 newly refused, 13 still allowed.
  • windows-latest (platform windows): 12 classified, 0 newly refused, 12 still allowed.

No candidate flipped from allowed to refused.

Scope-Verdict: CONCERNS

TIGHTENING: the claude Side Chat or thread-reply session is now started confined, and the gate's deny and governance targets now include a mapped built-in name. Three hunks in src/kiro_crew/acp/client.py (_claude_session_meta) carry the session confinement: options["tools"] = list(CLAUDE_READ_ONLY_BUILTINS), options["strictMcpConfig"] = True, and side_permissions["deny"] extended with Read({pattern}) / Read({pattern}/**) for every sandbox_credential_targets() entry, plus disableAllHooks and ask rules on ("WebFetch", "WebSearch"). The gate change is in src/kiro_crew/hook_runtime/gate_tiers.py: if call.harness_builtin_tool and call.harness_builtin_tool not in targets: targets.append(call.harness_builtin_tool). The one threat it refuses: a pre-approval inherited from the user's ~/.claude settings (an allow rule, additionalDirectories, bypassPermissions) letting a READ_ONLY side session run a write, or a native read of a host credential path, with no gate decision. None of the three shell tiers changed: hooks.py only threads a new keyword through, and harness_builtin_tool is empty on every shell call.

ADJUDICATED: 19 candidates, 0 confirmed newly-refused

PLATFORM COVERAGE:

  • posix: grep, rg, find and cat lookups inside the touched modules, a jq read of ~/.claude/settings.json, the pinning pytest run, and a pathspec-scoped git diff. These cover the $HOME// spelling that sandbox_credential_targets() and _claude_root_pattern assume on non-Windows hosts.
  • windows: npm.cmd, Select-String, findstr with \ separators, $env:USERPROFILE, a drive-letter C:\Users\... settings read, and the .venv\Scripts\python.exe test run. The diff adds a Windows-only branch, the PureWindowsPath rewrite of C:\x to //c/x, and these rows probe that spelling.
  • any: the adapter upgrade, version and registry reads named by the new warning, a loopback probe of GET /api/chat/side/tools, a public docs fetch, and the harness-parity script. All are platform-neutral strings.
  • Not probed: UNC targets (\\server\share), which _claude_root_pattern does not special-case. They reach no shell tier, so no shell row can probe them; they are listed under UNADJUDICATED.

UNADJUDICATED:

  • Guard 1, claude-side permissions.deny rules built by _claude_side_read_deny_rules, enforced by Claude Code and not by the host gate.
    • Call path: _run_side_turn or _run_thread_turn → get_or_create(side_read_only=True) → provider factory → AcpProvider → AcpClient → ClaudeLaunch → _prepare_claude_side_read_denies → _claude_session_meta → session/new._meta.claudeCode.options.settings.permissions.deny.
    • Legitimate native reads I would have submitted, all of which must stay allowed:
      • Read of <workdir>/README.md.
      • Grep over <workdir>/src when the work dir itself sits under a directory that is one of the sensitive targets' parents.
      • Glob of ~/projects/app/**/*.py.
      • Read of a file under a project directory literally named [x] or containing *, to probe the gitignore escaping.
      • Read of C:\Users\dev\repo\file.py against a target spelled //c/Users/dev/.aws.
      • Read of a file on a UNC share, where PureWindowsPath.drive is \\server\share. That drive is longer than two characters, so the rewrite is skipped and the pattern becomes ///server/share/.... Whether Claude Code matches that spelling is unverified, so a gap could fail open, or a mis-rooted rule could over-match.
  • Guard 2, the tool allowlist (options["tools"]) and the empty mcpServers array (with strictMcpConfig) on the claude side session. Bash, Edit, Write, Task and every MCP tool no longer exist there.
    • Legitimate operations newly lost on claude Side Chat and thread replies: read-only shell lookups (git log, git status, ls), read-only MCP tools, and any subagent lookup.
    • The change states this on purpose through SIDE_BOUNDARY_PROMPT_NO_SHELL and THREAD_BOUNDARY_PROMPT_NO_SHELL. Even so, it is a capability claude Side Chat users do not get, even though kiro-cli side sessions keep is_read_only_bash shell lookups. No verdict is possible: these are session options, not a shell command line.
  • Guard 3, disableAllHooks on the claude side session. A user's own PreToolUse or PostToolUse hooks stop running there. The spec names this cost, but no classifier can measure it.
  • Guard 4, harness_builtin_tool as a new deny target and governance identity in _tier_governance and GateFacts targets.
    • Effect: a tool-scoped auto_deny_tools entry or a ceiling tools deny on fs_read, grep, glob, web_fetch or web_search now also binds claude's Read, Grep, Glob, WebFetch and WebSearch in a Side Chat session.
    • The concern is a rule an operator wrote to stop kiro-cli's shell grep: it now also refuses claude's native Grep in Side Chat, since both map to the name grep.
    • That is a narrowing worth confirming with a tool-call (non-shell) adjudicator, but this lane has none, so it stays unconfirmed. If it is real, the narrow fix is to key the claude alias on a distinct identity (for example claude#Grep) and let only web_*, where the semantics match, join the deny targets.
  • Guard 5, the adapter-floor check (claude_adapter_honours_session_options) in side, thread and /api/chat/side/tools.
    • Effect: a claude install whose version cannot be read, or which is below CLAUDE_ACP_SETTING_SOURCES_MIN_VERSION, falls to REJECT_ALL.
    • Inputs I could not submit: an adapter installed from a git checkout or local path, where package.json may lack a parseable version, and a pnpm or yarn global install the resolver may not find.

[SCOPE-REVIEWED] 71e3933

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Dispositions for the advisory notes on 3a97643 (no lane blocked; none of these needs a push here):

  • UX Review, CONCERNS (adapter-outdated footer copy): Agreed the string should name the adapter and the minimum version. That needs the endpoint to return the floor and a new string in every locale, and it only affects users below the floor, who get the safe REJECT_ALL posture meanwhile. Tracked in Side Chat: clearer claude adapter-outdated footer, and spec the config_unavailable field #19061.
  • Opus Review, finding on docs/system-specs/modules/side.md: Correct, the row omits config_unavailable, which api_side_tools returns and SideChat.tsx reads. A one-line doc fix, tracked in Side Chat: clearer claude adapter-outdated footer, and spec the config_unavailable field #19061 so this PR does not rerun every lane for it.
  • Security Scope Review, CONCERNS: The tightening it names is intended. harness_builtin_tool is filled only on a claude side_read_only session, which refused every call before, so a kiro-cli-named deny or governance entry binding it refuses nothing that ran before. The lane adjudicated 17 candidates with 0 newly refused on macOS, Ubuntu and Windows. Main-chat claude events carry no harness_builtin_tool, and test/test_side_readonly_claude.py pins that their gate verdict equals an unstamped frame's.

@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 11, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Self-review (crew-pr-reviewer, read-only): CHANGES NEEDED

This PR lets a Claude Code Side Chat or thread reply run Read/Grep/Glob/WebFetch/WebSearch instead of refusing every tool, and it fixes the root cause: rather than trusting a gate that cannot see Claude's own pre-approvals, the side session is started with only the read built-ins (options["tools"]), empty mcpServers plus strictMcpConfig, disableAllHooks, inline ask rules on WebFetch/WebSearch, and bypass/auto pinned to default, below a version floor the turn stays REJECT_ALL (acp/client.py _claude_session_meta, _pin_claude_starting_mode, the three MCP splices). I read the full production diff: harness_builtin_tool is set only when side_read_only and harness_backend == ACP_BACKEND_CLAUDE, comes only from the adapter-stamped _meta.claudeCode.toolName cached from the tool_call frame (never the title or the permission payload), fails closed with any MCP server, and only adds deny targets and a governance identity, so main-chat claude verdicts are unchanged; I tried a write claiming kind: "read", a title-only frame and an MCP call against that path and each is refused (test_side_readonly_claude.py and test_harness_tool_names.py cover these). All lanes are green or PASS on head 3a97643; the UX copy concern, the Opus side.md config_unavailable doc nit and the Security Scope tightening each have a reasoned disposition (the first two tracked in #19061), and nobody has an open change request. The one blocking problem is that this same-repo branch commits four PNGs under temp-screenshots/side-chat-claude-tools/ (before-claude-dark.png, after-claude-dark.png, after-claude-light.png, after-claude-old-adapter-dark.png), and the body links them as raw blobs at that SHA; once merged they stay in main's history for good. Suggested fix: drop the four files from the commit (git rm --cached them and amend through push_guard), re-upload them with gh pr edit 19059 --body-file <body> --attach ... (this is now a branch of the repo, so --attach works, unlike on the fork #17785), and replace the four raw/3a97643... links with the returned user-attachments URLs. Reviewer note: the code owner should confirm that approving claude's Read/Grep/Glob from the stamped name with no path check is the intended parity with kiro-cli fs_read in side chat (a Read outside the work dir that reaches the gate is approved), and that disableAllHooks turning off a user's own PreToolUse deny hook in side sessions is acceptable, as the Not-a-goal section states. — crew-pr-reviewer

@iamwhatever
iamwhatever marked this pull request as draft October 11, 2026 07:51
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Converted to draft by crew-pr-reviewer: the self-review above is CHANGES NEEDED. Mark ready again (gh pr ready 19059) once the points are addressed.

@github-actions github-actions Bot added readiness: checking Automated validation is still running merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: passed Eligible automated validation passed for the current revision labels Oct 11, 2026
@iamwhatever
iamwhatever force-pushed the feat/claude-side-chat-readonly-takeover branch from 3a97643 to ebc582c Compare October 12, 2026 06:54
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: checking Automated validation is still running labels Oct 12, 2026
@iamwhatever
iamwhatever force-pushed the feat/claude-side-chat-readonly-takeover branch from ebc582c to 2f77816 Compare October 12, 2026 07:25
@github-actions github-actions Bot removed the readiness: action required A blocking check or review needs attention label Oct 12, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author
  • Item 6 — duplicate of src/kiro_crew/agent_sdk/backend_cards.py (LINE_SIDE_CHAT_TOOLS). span=b37d89c82395

rebutted, with the reason the clear condition asks for: the card line cannot carry the adapter-version check. backend_cards.py is a projection of the membership sets in agent_sdk/backends.py, the same on every host, with no host probe. The floor is this host's installed adapter version.
The card says what the claude harness can do. The footer says what this host's turn will do, from the turn's own check (_side_read_only_tools), and names the fix when they differ. Pointing the footer back at the card would promise tools below the floor, where the turn runs none.
Same as on ecefe3a; this head is a rebase.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Answers to the Security Scope Review on 3e05605 (CONCERNS, 0 newly refused on macOS, Ubuntu and Windows). This head is a rebase; the rule is unchanged from ecefe3a. No push needed:

  • Guard 1, the claude side session's options. Each item is the intended shape, not an over-match. The deny rules are the gate's own set (sandbox_credential_targets()), so a native read loses only what a gated read of the same path loses; ~/.ssh/config and ~/.config/<tool>/config.toml are refused or allowed exactly as the gate already does. Hooks off, no MCP servers and an ask on the web tools are the confinement itself: a side session had no tools at all before, so no hook, MCP lookup or pre-allowed WebFetch that used to run there is lost.
  • Guard 2, kiro-cli-named rules binding claude side calls. Intended, and stated in the PR's Backwards compatibility section. It only reaches a claude side session, which refused every call before, so an auto_deny_tools: ["grep"] refusing claude's Grep there refuses nothing that ran before.
  • Guard 3, the adapter floor. An adapter whose version cannot be read fails safe: the side turn runs with no tools (REJECT_ALL), the same posture as before this PR, and the footer says so.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: checking Automated validation is still running labels Oct 13, 2026
@bolichen97

Copy link
Copy Markdown
Contributor

@buluoray your change request is the only thing holding this PR. @iamwhatever says it is addressed on head 3e056057fc, and readiness passed there. Could you re-review that head?

Posted by an AI assistant at bolichen97's request.

@bolichen97

Copy link
Copy Markdown
Contributor

@iamwhatever also: this branch now conflicts with main after today's merges, so it needs a rebase too.

Posted by an AI assistant at bolichen97's request.

@iamwhatever
iamwhatever force-pushed the feat/claude-side-chat-readonly-takeover branch from 3e05605 to 40cbf56 Compare October 14, 2026 00:30
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Oct 14, 2026
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Sensitive change review

Head commit: 40cbf56

  • What rule changed: The READ_ONLY tier in hook_runtime/gate_tiers.py can now prove a claude read built-in (Read, WebFetch, WebSearch) from harness_builtin_tool, the name claude-agent-acp stamps on its tool_call frame, mapped through CLAUDE_READ_ONLY_BUILTINS. The same name is added as a deny target and a governance identity. tool_identity.py and hooks.py only carry the new field into ToolCall. The field is filled only on a side_read_only (Side Chat or thread-reply) claude session. That session also carries inline permissions.deny rules for every host sensitive path (Read(//<target>) and Read(//<target>/**) per security.sandbox_credential_targets() entry), built off the loop at launch; a launch that cannot build them does not start the session.
  • Before -> after (what was allowed/blocked, now): Before, every tool call in a claude side turn was refused (REJECT_ALL). After, on a claude side turn, Read, WebFetch and WebSearch are approved under READ_ONLY, and a native Read, Grep or Glob that an inherited allow rule or additionalDirectories entry pre-approves is still denied by Claude Code itself on any sensitive path. Write, Edit, MultiEdit, NotebookEdit, Bash, Task and every MCP call are still refused, also when the request claims kind: "read". Normal (main-chat) claude turns are unchanged: their permission event carries no harness_builtin_tool and their session options carry no new rule, so the gate sees the same input and gives the same verdict as before. kiro-cli and KAS side turns are unchanged.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): A claude side turn could run a call that is not read-only without a card, or read a credential natively. Three layers stand against that: the side session is started with only the read built-ins, no MCP server, disableAllHooks and its mode pinned to default, so no write or shell tool exists for an allow rule to pre-approve; Claude Code applies the inline deny rules before any allow rule from any settings source, so the user's settings cannot open a sensitive path to a native read; and the gate refuses any call whose stamped name is not in the read table. If the deny rules cannot be built, or the session options grow past the platform's command-line limit, the side session does not start: it fails closed, never open.
  • Evidence checked (which sandbox result proves it): No OS sandbox code changed, so no sandbox run applies. test/test_acp_session_mcp.py::TestClientSeam::test_an_inherited_read_allow_does_not_open_a_sensitive_path launches a side session through ClaudeLaunch.resolve_spawn under user settings that allow every Read and add the home as an additional directory, and checks every sensitive target and everything under it is denied before the allow, with a work-dir file still allowed; it is red on 143abe8 and green here, and nine single-mutation runs (no launch build, no deny merge, no refusal, no AcpError conversion, no escaping, no drive rewrite, no child rule, no root rule, the load splice mounting servers) each turn a test red. test/test_side_readonly_claude.py drives claude frames through the real ACP parser, AcpProvider._to_llm_event and stream_and_collect with a real HookManager: reads approved, every write, shell, subagent and MCP call refused on a side session.
  • No regression:
    • Tools still work: Main-chat claude calls get the same _meta.claudeCode.options, MCP array, mode and gate input as before, and kiro-cli and KAS side turns keep their READ_ONLY path.
    • Backward compatible: Nothing is removed. A kiro-cli-named deny rule or governance entry (fs_read, web_fetch, web_search) now also binds the matching claude side call, which was refused outright before, so nothing that ran before is newly refused.
    • Existing tests: This head is a rebase onto main 09efe8a; the rule change is the same as on 3e05605. The PR's own diff to gate_tiers.py, tool_identity.py and hooks.py is line-for-line identical to the one on 3e05605, and the PR still changes 55 files (+1612/-198). test_acp_session_mcp.py, test_backend_cards.py, test_cc_permission_mode_seed.py, test_chat_threads.py, test_harness_tool_names.py, test_hooks.py, test_llm_helpers_tool_gate.py, test_session_pool.py, test_side.py, test_side_context.py, test_side_context_cov80.py, test_side_readonly_claude.py, test_side_readonly_kas.py, test_side_readonly_spec.py, test_side_readonly_spec_reap.py, test_gate_tiers.py, test_harness_parity.py, test_claude_steering_request.py and test_flake_pattern_ratchet.py pass on this head (1219 passed, 1 skipped). The full matrix runs in CI.
  • How to undo: Revert this PR. That takes claude out of ACP_BACKENDS_SIDE_READONLY, so a claude side turn goes back to REJECT_ALL, the side session options go away, and the gate stops reading harness_builtin_tool.

@iamwhatever

Copy link
Copy Markdown
Contributor Author

Sensitive change review

Head commit: 40cbf56

  • What rule changed: The READ_ONLY tier in hook_runtime/gate_tiers.py can now prove a claude read built-in (Read, WebFetch, WebSearch) from harness_builtin_tool, the name claude-agent-acp stamps on its tool_call frame, mapped through CLAUDE_READ_ONLY_BUILTINS. The same name is added as a deny target and a governance identity. tool_identity.py and hooks.py only carry the new field into ToolCall. The field is filled only on a side_read_only (Side Chat or thread-reply) claude session. That session also carries inline permissions.deny rules for every host sensitive path (Read(//<target>) and Read(//<target>/**) per security.sandbox_credential_targets() entry), built off the loop at launch; a launch that cannot build them does not start the session.
  • Before -> after (what was allowed/blocked, now): Before, every tool call in a claude side turn was refused (REJECT_ALL). After, on a claude side turn, Read, WebFetch and WebSearch are approved under READ_ONLY, and a native Read, Grep or Glob that an inherited allow rule or additionalDirectories entry pre-approves is still denied by Claude Code itself on any sensitive path. Write, Edit, MultiEdit, NotebookEdit, Bash, Task and every MCP call are still refused, also when the request claims kind: "read". Normal (main-chat) claude turns are unchanged: their permission event carries no harness_builtin_tool and their session options carry no new rule, so the gate sees the same input and gives the same verdict as before. kiro-cli and KAS side turns are unchanged.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): A claude side turn could run a call that is not read-only without a card, or read a credential natively. Three layers stand against that: the side session is started with only the read built-ins, no MCP server, disableAllHooks and its mode pinned to default, so no write or shell tool exists for an allow rule to pre-approve; Claude Code applies the inline deny rules before any allow rule from any settings source, so the user's settings cannot open a sensitive path to a native read; and the gate refuses any call whose stamped name is not in the read table. If the deny rules cannot be built, or the session options grow past the platform's command-line limit, the side session does not start: it fails closed, never open.
  • Evidence checked (which sandbox result proves it): No OS sandbox code changed, so no sandbox run applies. test/test_acp_session_mcp.py::TestClientSeam::test_an_inherited_read_allow_does_not_open_a_sensitive_path launches a side session through ClaudeLaunch.resolve_spawn under user settings that allow every Read and add the home as an additional directory, and checks every sensitive target and everything under it is denied before the allow, with a work-dir file still allowed; it is red on 143abe8 and green here, and nine single-mutation runs (no launch build, no deny merge, no refusal, no AcpError conversion, no escaping, no drive rewrite, no child rule, no root rule, the load splice mounting servers) each turn a test red. test/test_side_readonly_claude.py drives claude frames through the real ACP parser, AcpProvider._to_llm_event and stream_and_collect with a real HookManager: reads approved, every write, shell, subagent and MCP call refused on a side session.
  • No regression:
    • Tools still work: Main-chat claude calls get the same _meta.claudeCode.options, MCP array, mode and gate input as before, and kiro-cli and KAS side turns keep their READ_ONLY path.
    • Backward compatible: Nothing is removed. A kiro-cli-named deny rule or governance entry (fs_read, web_fetch, web_search) now also binds the matching claude side call, which was refused outright before, so nothing that ran before is newly refused.
    • Existing tests: This head is a rebase of 3e05605 onto main 09efe8a with no code change: the gate_tiers.py, tool_identity.py and hooks.py diff against main is line-for-line the same as on 3e05605. The only conflict was the H6 row in docs/system-specs/modules/harness-parity.md, where main's goose steer text is kept and this PR's ACP_BACKENDS_SIDE_READONLY sentence is applied. test_acp_session_mcp.py, test_backend_cards.py, test_cc_permission_mode_seed.py, test_chat_threads.py, test_harness_tool_names.py, test_hooks.py, test_llm_helpers_tool_gate.py, test_session_pool.py, test_side.py, test_side_context.py, test_side_context_cov80.py, test_side_readonly_claude.py, test_side_readonly_kas.py, test_side_readonly_spec.py, test_side_readonly_spec_reap.py, test_gate_tiers.py, test_harness_parity.py, test_claude_steering_request.py and test_flake_pattern_ratchet.py pass on this head (1219 passed, 1 skipped). The full matrix runs in CI.
  • How to undo: Revert this PR. That takes claude out of ACP_BACKENDS_SIDE_READONLY, so a claude side turn goes back to REJECT_ALL, the side session options go away, and the gate stops reading harness_builtin_tool.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed readiness: checking Automated validation is still running labels Oct 14, 2026
@iamwhatever
iamwhatever force-pushed the feat/claude-side-chat-readonly-takeover branch from 40cbf56 to b69e26f Compare October 14, 2026 01:48
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Sensitive change review

Head commit: b69e26f

  • What rule changed: The READ_ONLY tier in hook_runtime/gate_tiers.py can now prove a claude read built-in (Read, WebFetch, WebSearch) from harness_builtin_tool, the name claude-agent-acp stamps on its tool_call frame, mapped through CLAUDE_READ_ONLY_BUILTINS. The same name is added as a deny target and a governance identity. tool_identity.py and hooks.py only carry the new field into ToolCall. The field is filled only on a side_read_only (Side Chat or thread-reply) claude session. That session also carries inline permissions.deny rules for every host sensitive path (Read(//<target>) and Read(//<target>/**) per security.sandbox_credential_targets() entry), built off the loop at launch; a launch that cannot build them does not start the session.
  • Before -> after (what was allowed/blocked, now): Before, every tool call in a claude side turn was refused (REJECT_ALL). After, on a claude side turn, Read, WebFetch and WebSearch are approved under READ_ONLY, and a native Read, Grep or Glob that an inherited allow rule or additionalDirectories entry pre-approves is still denied by Claude Code itself on any sensitive path. Write, Edit, MultiEdit, NotebookEdit, Bash, Task and every MCP call are still refused, also when the request claims kind: "read". Normal (main-chat) claude turns are unchanged: their permission event carries no harness_builtin_tool and their session options carry no new rule, so the gate sees the same input and gives the same verdict as before. kiro-cli and KAS side turns are unchanged.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): A claude side turn could run a call that is not read-only without a card, or read a credential natively. Three layers stand against that: the side session is started with only the read built-ins, no MCP server, disableAllHooks and its mode pinned to default, so no write or shell tool exists for an allow rule to pre-approve; Claude Code applies the inline deny rules before any allow rule from any settings source, so the user's settings cannot open a sensitive path to a native read; and the gate refuses any call whose stamped name is not in the read table. If the deny rules cannot be built, or the session options grow past the platform's command-line limit, the side session does not start: it fails closed, never open.
  • Evidence checked (which sandbox result proves it): No OS sandbox code changed, so no sandbox run applies. test/test_acp_session_mcp.py::TestClientSeam::test_an_inherited_read_allow_does_not_open_a_sensitive_path launches a side session through ClaudeLaunch.resolve_spawn under user settings that allow every Read and add the home as an additional directory, and checks every sensitive target and everything under it is denied before the allow, with a work-dir file still allowed; it is red on 143abe8 and green here, and nine single-mutation runs (no launch build, no deny merge, no refusal, no AcpError conversion, no escaping, no drive rewrite, no child rule, no root rule, the load splice mounting servers) each turn a test red. test/test_side_readonly_claude.py drives claude frames through the real ACP parser, AcpProvider._to_llm_event and stream_and_collect with a real HookManager: reads approved, every write, shell, subagent and MCP call refused on a side session.
  • No regression:
    • Tools still work: Main-chat claude calls get the same _meta.claudeCode.options, MCP array, mode and gate input as before, and kiro-cli and KAS side turns keep their READ_ONLY path.
    • Backward compatible: Nothing is removed. A kiro-cli-named deny rule or governance entry (fs_read, web_fetch, web_search) now also binds the matching claude side call, which was refused outright before, so nothing that ran before is newly refused.
    • Existing tests: This head is a rebase onto main aab0641; the rule change is the same as on 40cbf56. The PR's own diff to gate_tiers.py, tool_identity.py and hooks.py is line-for-line identical to the one on 40cbf56. The only edit from the rebase is one import line in acp/_dispatch.py: main now imports ACP_BACKEND_PI there and this PR imports ACP_BACKEND_CLAUDE, so the line keeps both. test_acp_session_mcp.py, test_backend_cards.py, test_cc_permission_mode_seed.py, test_chat_threads.py, test_harness_tool_names.py, test_hooks.py, test_llm_helpers_tool_gate.py, test_session_pool.py, test_side.py, test_side_context.py, test_side_context_cov80.py, test_side_readonly_claude.py, test_side_readonly_kas.py, test_side_readonly_spec.py, test_side_readonly_spec_reap.py, test_gate_tiers.py, test_harness_parity.py, test_claude_steering_request.py, test_flake_pattern_ratchet.py and test_acp_dispatch*.py pass on this head (1225 passed, 1 skipped). The full matrix runs in CI.
  • How to undo: Revert this PR. That takes claude out of ACP_BACKENDS_SIDE_READONLY, so a claude side turn goes back to REJECT_ALL, the side session options go away, and the gate stops reading harness_builtin_tool.

@github-actions github-actions Bot removed merge conflict Branch has merge conflicts with its base — author must resolve before merge readiness: passed Eligible automated validation passed for the current revision labels Oct 14, 2026
On the Claude Code backend every Side Chat and thread-reply tool call
was refused, because claude-agent-acp approves a call by itself when
the user's settings pre-approve it, so the READ_ONLY gate never sees
that call.

The side session now starts with only claude's read built-ins (Read,
Grep, Glob, WebFetch, WebSearch), no MCP server, an ask rule on the
web tools, settings hooks off and its mode pinned to default, so an
allow rule can pre-approve a read at most. Its inline settings also
deny the read tools every host sensitive path (each
sandbox_credential_targets() entry, as Read(//<target>) and
Read(//<target>/**)), which Claude Code checks before any allow rule
or additionalDirectories entry the user's settings carry, so no
inherited setting opens ~/.aws or Crew's own secrets to a native
read. The rules are built off the loop at launch, and a launch that
cannot build them does not start the session.

On that session the gate proves a claude read from the tool name the
adapter stamps on the tool_call frame, mapped to the kiro-cli
built-in, and the same name is a deny target; main-chat claude calls
are matched as before. claude joins ACP_BACKENDS_SIDE_READONLY; an
installed adapter below the verified options floor keeps REJECT_ALL,
and the footer asks the gateway (GET /api/chat/side/tools) so it says
the same and names the adapter update.

Closes #17674
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Sensitive change review

Head commit: 010348a

  • What rule changed: The READ_ONLY tier in hook_runtime/gate_tiers.py can now prove a claude read built-in (Read, WebFetch, WebSearch) from harness_builtin_tool, the name claude-agent-acp stamps on its tool_call frame, mapped through CLAUDE_READ_ONLY_BUILTINS. The same name is added as a deny target and a governance identity. tool_identity.py and hooks.py only carry the new field into ToolCall. The field is filled only on a side_read_only (Side Chat or thread-reply) claude session. That session also carries inline permissions.deny rules for every host sensitive path (Read(//<target>) and Read(//<target>/**) per security.sandbox_credential_targets() entry), built off the loop at launch; a launch that cannot build them does not start the session.
  • Before -> after (what was allowed/blocked, now): Before, every tool call in a claude side turn was refused (REJECT_ALL). After, on a claude side turn, Read, WebFetch and WebSearch are approved under READ_ONLY, and a native Read, Grep or Glob that an inherited allow rule or additionalDirectories entry pre-approves is still denied by Claude Code itself on any sensitive path. Write, Edit, MultiEdit, NotebookEdit, Bash, Task and every MCP call are still refused, also when the request claims kind: "read". Normal (main-chat) claude turns are unchanged: their permission event carries no harness_builtin_tool and their session options carry no new rule, so the gate sees the same input and gives the same verdict as before. kiro-cli and KAS side turns are unchanged.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): A claude side turn could run a call that is not read-only without a card, or read a credential natively. Three layers stand against that: the side session is started with only the read built-ins, no MCP server, disableAllHooks and its mode pinned to default, so no write or shell tool exists for an allow rule to pre-approve; Claude Code applies the inline deny rules before any allow rule from any settings source, so the user's settings cannot open a sensitive path to a native read; and the gate refuses any call whose stamped name is not in the read table. If the deny rules cannot be built, or the session options grow past the platform's command-line limit, the side session does not start: it fails closed, never open.
  • Evidence checked (which sandbox result proves it): No OS sandbox code changed, so no sandbox run applies. test/test_acp_session_mcp.py::TestClientSeam::test_an_inherited_read_allow_does_not_open_a_sensitive_path launches a side session through ClaudeLaunch.resolve_spawn under user settings that allow every Read and add the home as an additional directory, and checks every sensitive target and everything under it is denied before the allow, with a work-dir file still allowed; it is red on 143abe8 and green here, and nine single-mutation runs (no launch build, no deny merge, no refusal, no AcpError conversion, no escaping, no drive rewrite, no child rule, no root rule, the load splice mounting servers) each turn a test red. test/test_side_readonly_claude.py drives claude frames through the real ACP parser, AcpProvider._to_llm_event and stream_and_collect with a real HookManager: reads approved, every write, shell, subagent and MCP call refused on a side session.
  • No regression:
    • Tools still work: Main-chat claude calls get the same _meta.claudeCode.options, MCP array, mode and gate input as before, and kiro-cli and KAS side turns keep their READ_ONLY path.
    • Backward compatible: Nothing is removed. A kiro-cli-named deny rule or governance entry (fs_read, web_fetch, web_search) now also binds the matching claude side call, which was refused outright before, so nothing that ran before is newly refused.
    • Existing tests: This head is a rebase onto main 70d2fa6; the rule change is the same as on b69e26f. The PR's own diff to gate_tiers.py, tool_identity.py and hooks.py is line-for-line identical to the one on b69e26f. The rebase touched no sensitive file: it merged one docs/feature-map/README.md row (main's new sideTurnWire.ts note kept, this PR's Claude Code clause added) and kept main's three new imports in SideChat.tsx. One new commit, 010348a, swaps the kirocrewConfig/acpBackends mocks for sideTools in main's new SideChat.sendReceipt.test.tsx, the same swap this PR already makes in SideChat.stop.test.tsx; no product code changed. test_acp_session_mcp.py, test_backend_cards.py, test_cc_permission_mode_seed.py, test_chat_threads.py, test_harness_tool_names.py, test_hooks.py, test_llm_helpers_tool_gate.py, test_session_pool.py, test_side.py, test_side_context.py, test_side_context_cov80.py, test_side_readonly_claude.py, test_side_readonly_kas.py, test_side_readonly_spec.py, test_side_readonly_spec_reap.py, test_gate_tiers.py, test_harness_parity.py, test_claude_steering_request.py, test_flake_pattern_ratchet.py and test_acp_dispatch*.py pass on this head (1225 passed, 1 skipped), and the 18 Side Chat vitest files pass (335 tests) with tsc -b clean. The full matrix runs in CI.
  • How to undo: Revert this PR. That takes claude out of ACP_BACKENDS_SIDE_READONLY, so a claude side turn goes back to REJECT_ALL, the side session options go away, and the gate stops reading harness_builtin_tool.

Drive claude tool_call frames through the real ACP parser, the provider's
event conversion and stream_and_collect: on a side_read_only session under
READ_ONLY, Read, WebFetch and WebSearch run while Write, Edit, MultiEdit,
NotebookEdit, Bash, Task and MCP calls are refused, including when the
permission request claims kind "read". Off a side session the claude stamp
leaves the permission event and the gate verdict identical to an unstamped
frame, under HOOK_BASED and READ_ONLY alike.

GET /api/chat/side/tools also answers config_unavailable, so the Side Chat
footer keeps both failure messages: a config that did not load (the turn
runs without tools) and a request that failed (tools unknown).

Co-authored-by: wenlin <34065934+rinbn@users.noreply.github.com>
@iamwhatever

Copy link
Copy Markdown
Contributor Author

Sensitive change review

Head commit: 71e3933

  • What rule changed: The READ_ONLY tier in hook_runtime/gate_tiers.py can now prove a claude read built-in (Read, WebFetch, WebSearch) from harness_builtin_tool, the name claude-agent-acp stamps on its tool_call frame, mapped through CLAUDE_READ_ONLY_BUILTINS. The same name is added as a deny target and a governance identity. tool_identity.py and hooks.py only carry the new field into ToolCall. The field is filled only on a side_read_only (Side Chat or thread-reply) claude session. That session also carries inline permissions.deny rules for every host sensitive path (Read(//<target>) and Read(//<target>/**) per security.sandbox_credential_targets() entry), built off the loop at launch; a launch that cannot build them does not start the session.
  • Before -> after (what was allowed/blocked, now): Before, every tool call in a claude side turn was refused (REJECT_ALL). After, on a claude side turn, Read, WebFetch and WebSearch are approved under READ_ONLY, and a native Read, Grep or Glob that an inherited allow rule or additionalDirectories entry pre-approves is still denied by Claude Code itself on any sensitive path. Write, Edit, MultiEdit, NotebookEdit, Bash, Task and every MCP call are still refused, also when the request claims kind: "read". Normal (main-chat) claude turns are unchanged: their permission event carries no harness_builtin_tool and their session options carry no new rule, so the gate sees the same input and gives the same verdict as before. kiro-cli and KAS side turns are unchanged.
  • Worst case if wrong (breaks commands / leaks secret / locks user out): A claude side turn could run a call that is not read-only without a card, or read a credential natively. Three layers stand against that: the side session is started with only the read built-ins, no MCP server, disableAllHooks and its mode pinned to default, so no write or shell tool exists for an allow rule to pre-approve; Claude Code applies the inline deny rules before any allow rule from any settings source, so the user's settings cannot open a sensitive path to a native read; and the gate refuses any call whose stamped name is not in the read table. If the deny rules cannot be built, or the session options grow past the platform's command-line limit, the side session does not start: it fails closed, never open.
  • Evidence checked (which sandbox result proves it): No OS sandbox code changed, so no sandbox run applies. test/test_acp_session_mcp.py::TestClientSeam::test_an_inherited_read_allow_does_not_open_a_sensitive_path launches a side session through ClaudeLaunch.resolve_spawn under user settings that allow every Read and add the home as an additional directory, and checks every sensitive target and everything under it is denied before the allow, with a work-dir file still allowed; it is red on 143abe8 and green here, and nine single-mutation runs (no launch build, no deny merge, no refusal, no AcpError conversion, no escaping, no drive rewrite, no child rule, no root rule, the load splice mounting servers) each turn a test red. test/test_side_readonly_claude.py drives claude frames through the real ACP parser, AcpProvider._to_llm_event and stream_and_collect with a real HookManager: reads approved, every write, shell, subagent and MCP call refused on a side session.
  • No regression:
    • Tools still work: Main-chat claude calls get the same _meta.claudeCode.options, MCP array, mode and gate input as before, and kiro-cli and KAS side turns keep their READ_ONLY path.
    • Backward compatible: Nothing is removed. A kiro-cli-named deny rule or governance entry (fs_read, web_fetch, web_search) now also binds the matching claude side call, which was refused outright before, so nothing that ran before is newly refused.
    • Existing tests: This head is a rebase onto main 70d2fa6; the rule change is the same as on b69e26f. The PR's own diff to gate_tiers.py, tool_identity.py and hooks.py is line-for-line identical to the one on b69e26f. The rebase touched no sensitive file: it merged one docs/feature-map/README.md row (main's new sideTurnWire.ts note kept, this PR's Claude Code clause added) and kept main's three new imports in SideChat.tsx. The second commit (test(side-chat): pin the claude side turn's safe scope end to end) now also swaps the kirocrewConfig/acpBackends mocks for sideTools in main's new SideChat.sendReceipt.test.tsx, the same swap this PR already makes in SideChat.stop.test.tsx; no product code changed. This head has the same tree as 010348a, squashed to two commits for PR Hygiene. test_acp_session_mcp.py, test_backend_cards.py, test_cc_permission_mode_seed.py, test_chat_threads.py, test_harness_tool_names.py, test_hooks.py, test_llm_helpers_tool_gate.py, test_session_pool.py, test_side.py, test_side_context.py, test_side_context_cov80.py, test_side_readonly_claude.py, test_side_readonly_kas.py, test_side_readonly_spec.py, test_side_readonly_spec_reap.py, test_gate_tiers.py, test_harness_parity.py, test_claude_steering_request.py, test_flake_pattern_ratchet.py and test_acp_dispatch*.py pass on this head (1225 passed, 1 skipped), and the 18 Side Chat vitest files pass (335 tests) with tsc -b clean. The full matrix runs in CI.
  • How to undo: Revert this PR. That takes claude out of ACP_BACKENDS_SIDE_READONLY, so a claude side turn goes back to REJECT_ALL, the side session options go away, and the gate stops reading harness_builtin_tool.

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.

Side Chat: run read-only tools on the Claude Code backend

5 participants