Repository navigation
feat(side-chat): run read-only tools on the Claude Code backend - #19059
Conversation
Sensitive Change ReviewSensitive files changed:
|
Design Review (Opus 5.5) — 🟡 CONCERNSDesign-level review of Design-Verdict: CONCERNS The no-write guarantee depends on the claude adapter actually honouring the Watch
[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 |
UX Review (Opus 5.5) — 🟡 CONCERNSUX-level review of 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
Suggestions
[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 |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Below the claude-agent-acp version floor the backend card's What this change shipsInventory (10 items) — 10 justifiedIntent: On the Claude Code backend, Side Chat can read files, search the codebase and fetch pages while nothing can write. This is an ADDITION.
[FIRST-PRINCIPLES-REVIEWED] 71e3933 Description read[DESCRIPTION-READ] 6e50834fe923ebdc3dd3d2d93d531d63c9d5d25f3db968547c9de383f52115fe That sha256 names the PR description this verdict read. Recompute it with |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
Sensitive change reviewHead commit: 3a97643
|
Opus 5.5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
Security Scope Review -- 🟡 CONCERNSWhich legitimate operations does Verdict basis: the reviewer's own judgement; no confirmed regression. Security scope review -- adjudicated candidates
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 ADJUDICATED: 19 candidates, 0 confirmed newly-refused PLATFORM COVERAGE:
UNADJUDICATED:
[SCOPE-REVIEWED] 71e3933 |
|
Dispositions for the advisory notes on 3a97643 (no lane blocked; none of these needs a push here):
|
|
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 ( |
|
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. |
3a97643 to
ebc582c
Compare
ebc582c to
2f77816
Compare
|
|
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:
|
|
@buluoray your change request is the only thing holding this PR. @iamwhatever says it is addressed on head Posted by an AI assistant at bolichen97's request. |
|
@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. |
3e05605 to
40cbf56
Compare
Sensitive change reviewHead commit: 40cbf56
|
Sensitive change reviewHead commit: 40cbf56
|
40cbf56 to
b69e26f
Compare
Sensitive change reviewHead commit: b69e26f
|
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
Sensitive change reviewHead commit: 010348a
|
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>
Sensitive change reviewHead commit: 71e3933
|
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_READONLYnames kiro-cli alone, because claude-agent-acp approves a call by itself when Claude Code's settings pre-approve it (apermissions.allowrule, or abypassPermissions/autodefault mode), and such a call never reaches theREAD_ONLYgate. 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
ls,git status) in a claude side session:Bashis not in its tool list.WebSearchtool (a Bedrock-routed setup, see Manual verification), or through an MCP server:READ_ONLYrefuses MCP calls on every backend.HARNESS_TOOL_TABLESrow, and the mapped name rides only side sessions.~/.claude, or a checked-in project.claude/settings.json, from claude sessions (the inherited-config gap inclaude-code-provider.md). In a side session such a file can still pre-approve a read, never a write.PreToolUsehook in force in a side session.disableAllHooksturns it off with every other hook, as the kiro-cli derived spec already removespreToolUse, so a hook that denies reading a file does not cover a native Read there, exactly as it does not cover kiro-cli'sfs_read. Running hooks would run shell commands fed the model's tool input outside the gate (a memory plugin'sPostToolUsehook, 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.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:
side_read_only,READ_ONLY)Read,WebFetch,WebSearchGrep,Globsearch-kind request that reaches the gate is refusedRead,Grep,Globof a host sensitive path (~/.aws,~/.ssh, Crew's own secrets)permissions.deny), whatever the user's allow rules oradditionalDirectoriessayWrite,Edit,MultiEdit,NotebookEditkind: "read"Bash,TaskstrictMcpConfig, emptymcpServers); refusedNo 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 underHOOK_BASEDandREAD_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, WebFetchand started neither the project's hook nor its.mcp.jsonserver (Manual verification).tools:Read,Grep,Glob,WebFetch,WebSearchBashor subagent exists for an allow rule to pre-approvemcpServers+strictMcpConfigpermissions.askonWebFetch/WebSearchpermissions.deny:Read(//<target>)andRead(//<target>/**)for everysandbox_credential_targets()entrydisableAllHooksbypassPermissions/autopinned todefault_meta.claudeCode.toolNameThe 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'sfs_readis; 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_onlygoes from_run_side_turn(dashboard/handlers/side.py) and the thread-reply turn (dashboard/chat_threads.py) throughget_or_create, the provider factory (config/loader.py) andAcpProvider(providers/acp.py) toAcpClient(acp/client.py); aside:orthread:key never claims a pooled child. There_claude_session_metaadds the options, the MCP splice sends no servers, and_pin_claude_starting_modepins the session and stops it on a handshake belowCLAUDE_ACP_SETTING_SOURCES_MIN_VERSION. For the gate,harness_tool_name(acp/_dispatch.py) reads claude's stamped name, and on aside_read_onlysession onlybuild_permission_eventmaps it throughCLAUDE_READ_ONLY_BUILTINS(acp/harness_tool_names.py) intoAcpEvent.harness_builtin_tool(acp/types.py);ToolCall(hook_runtime/tool_identity.py,hooks.py) carries it intohook_runtime/gate_tiers.pyas a deny target, a governance identity and the claude half of theclassifier_onlyread-only proof.claudejoinsACP_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 throughagent_sdk/drivers/acp.py. The turn and the newGET /api/chat/side/tools(dashboard/routes/chat.py) both ask it, and the Side Chat footer (SideChat.tsx, throughsideToolsinwebsite/src/api/client/chat.ts) reads the GET, so below the floor the turn keepsREJECT_ALLand the footer, told byclaude_adapter_outdatedon the same answer, says to update claude-agent-acp (context_only_claude_adapter_outdated, added to everywebsite/src/i18n/localescatalog).side.md,claude-code-provider.md,harness-parity.md(H6),harness-onboarding.md,history.mdand 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 noharness_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 governancetoolsentry (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 readsGET /api/chat/side/toolsinstead of the backend card'sside_chat_toolsline, 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_unavailableon 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_eventandstream_and_collect. On a side session underREAD_ONLY, Read, WebFetch and WebSearch run; Write, Edit, MultiEdit, NotebookEdit, Bash, Task and an MCP call are refused, also when the request claimskind: "read". Off a side session the event and the gate verdict equal an unstamped frame's, underHOOK_BASEDandREAD_ONLY.test/test_side.py: a claude side turn requests aside_read_onlysession for the base agent, derives no kiro spec, streamsREAD_ONLYand sends the no-shell prompt; an installed adapter below the floor runsREJECT_ALL; a non-member backend (opencode) keepsREJECT_ALL; a dashboard-bound profile denyingweb_searchrefuses claude's WebSearch, which fails without the governance identity;GET /api/chat/side/toolsanswers true on kiro and on a verified claude adapter, and false below the floor, on opencode and when the config does not load (withconfig_unavailableset 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 throughClaudeLaunch.resolve_spawnunder 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 onsession/newandsession/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; onsession/newandsession/loadthe side session ships the read built-ins, no MCP servers,strictMcpConfig, the webaskrules anddisableAllHooks, and is pinned frombypassPermissionstodefault; on the exclusion path the project's deny rules still ride along; a handshake below the floor stops it;claude_adapter_honours_session_optionsfollows the installed version; only aside_read_onlyclient puts the stamped name on its permission event (red without the forward).test/test_llm_helpers_tool_gate.py(realHookManager): claude WebSearch, WebFetch and Read with their stamped built-in are approved underREAD_ONLY; asearch-kind Grep, a stamped name with an MCP server, and a WebFetch an operator denied asweb_fetchare refused.test/test_harness_tool_names.py: a claude sidetool_callframe 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: aside_read_onlyside session cold-starts and the factory receives the flag.test/test_cc_permission_mode_seed.py: the factory passes the flag toAcpProviderby 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 newToolCallfield is pinned in the gate-kwargs extraction.website/src/test/SideChat.multiturn.test.tsx: the footer follows the gateway'sread_only_toolsanswer, says to update claude-agent-acp onclaude_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 outsidekirocrewConfig).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.tsxmocks the new call.Determinism (testing-conventions D12), over the 45 new or changed node ids above: 20 runs at
-n0green; 10 runs at-n 4 --dist loadgroup --max-worker-restart=2besidetest/test_side_readonly_spec.pyandtest/test_side_context_cov80.pygreen; one shuffled order, seed26968, green. The 12 node ids the deny rules add or change intest/test_acp_session_mcp.py: 20 runs at-n0green; 10 runs at-n 2 --dist loadgroupbeside the rest ofTestClientSeam(this host's load cap, in place of-n 4) green; one shuffled order of that class, seed19059, 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.jsonpre-approvesWrite,Bash(touch:*),WebSearchandWebFetch, enables project MCP servers and carries aUserPromptSubmithook, and whose.mcp.jsonserver touches a marker file when it starts. One prompt asked for the tool list, a Write ofout.txt,touch bash-ran.txtthrough Bash and a WebFetch ofhttps://example.com; every permission request was rejected.autoauto, pinned todefaultGlob, Grep, Read, WebFetchout.txttouchsession/request_permissionsent despite the allow rule.mcp.jsonserverAn 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
WebSearchon 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.toolsinto the SDK'stoolsand spreadsstrictMcpConfigandsettingsinto 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), andtest_an_inherited_read_allow_does_not_open_a_sensitive_pathchecks 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
SideChatcomponent with its footer query seeded: before onupstream/main@ 6765454 (configagent.acp_backend: "claude"), after on this branch with the gateway answeringread_only_tools: true(adapter at the floor) andfalsewithclaude_adapter_outdated: true(adapter below it). Uploaded as PR attachments; nothing is committed undertemp-screenshots/.After, adapter below the floor, and light theme
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
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)