Skip to content

fix(claude): close read-only writes through nested agents - #444

Merged
Waishnav merged 2 commits into
mainfrom
fix/claude-read-only
Oct 30, 2026
Merged

Waishnav merged 2 commits into
mainfrom
fix/claude-read-only

Conversation

@Waishnav

@Waishnav Waishnav commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

QA on 1.1.0-beta.6 found that a read-only Claude subagent could change the checkout. Asked to fix a bug in read-only mode, Claude's own Edit was denied as expected, so it started a nested agent through its Agent tool, and that nested agent's Write modified src/csv.js. Read-only turns denied only Bash and Edit, the sandbox's denyWrite applies to shell commands rather than Claude's built-in file tools, and agents started by the subagent don't inherit the turn's deny rules.

Read-only turns now deny every file-writing tool (Write, MultiEdit, NotebookEdit, and EnterWorktree, which creates a Git worktree) and every tool that starts another agent now or later (Agent, Task, Workflow, CronCreate, RemoteTrigger). The change stays inside the existing per-turn deny rules, so the warm runtime shared across read-only and write turns is unchanged.

Verified against Claude Code with haiku: the original repro (read-only, "fix the bug, edit the file directly") now only proposes the fix, an explicit request to write a file through a nested Agent finds no such tool, and the same request through Workflow finds none either. The checkout stayed clean and no file was created in all three runs.

Two things this deliberately doesn't settle. A deny list has to keep pace with new Claude Code tools, so the durable fix is a read-only allowlist, which needs the warm-runtime design reconsidered. And a read-only subagent still sees the user's own tools and connectors (Artifact, MCP servers such as Gmail or Google Drive), which can cause side effects outside the workspace; whether read-only should block those is a product decision.

Stacked on #443.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Read-only sessions now block additional actions that could modify files, create workspaces, or launch agents and workflows, alongside the previously blocked shell and edit actions. Attempts to use these tools are denied, and write-enabled sessions remain unchanged. This keeps the available actions consistent with read-only permissions across file editing, task execution, scheduling, and remote triggering.

@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1891689f-d139-4767-bfb6-785e4d4443ba
Commits

Reviewing files that changed from the base of the PR and between 4ee1446 and edb06d6.

Files selected for processing: 1
  • test/agents-replay/transcripts/claude/read-only.jsonl

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 4 remain after this review.

Walkthrough

Read-only Claude turns now deny additional tools that can write locally, create worktrees, or launch agents. The permissions test and replay transcript reflect the expanded deny list and a denied write request.

Changes: Read-only Claude permissions

Layer / File(s) Summary
Define and apply the read-only deny list
src/local-agent-claude.ts, src/local-agent-claude.test.ts, test/agents-replay/transcripts/claude/read-only.jsonl
The deny list adds Write, MultiEdit, NotebookEdit, EnterWorktree, Agent, Task, Workflow, CronCreate, and RemoteTrigger. Read-only turns use the list; allowed turns keep an empty deny list. The test checks the added tools, and the replay records a denied Write request.

Priority: Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: Minimal · up to edb06

The replay update reflects the expanded read-only restrictions. No merge-blocking issue is identified; merge after normal checks pass.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the main change: preventing read-only Claude turns from performing writes through nested agents.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 2 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit checks the read-only gate
New tools find denial at the state
No file is written by the call
The test confirms the list for all
The rabbit hops away, pleased and small

Comment @coderabbitai help to get the list of available commands.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅

View logs ↗
No Preview URL. Enable ↗ edb06d6 2026-10-30T12:34:17.697Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://14205f9d-devspace-site.waishnav.workers.dev 4ee1446 2026-10-30T12:11:05.919Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://c616374c-devspace-site.waishnav.workers.dev db5f53a 2026-10-30T11:47:16.129Z Visit the dashboard ↗

A read-only Claude subagent could modify the checkout: its own Edit was
denied, but it started a nested agent whose Write succeeded. Read-only
turns denied only Bash and Edit, and the sandbox's denyWrite covers
Bash, not Claude's built-in file tools.

Read-only turns now also deny Write, MultiEdit, NotebookEdit, and
EnterWorktree, and every tool that starts another agent now or later
(Agent, Task, Workflow, CronCreate, RemoteTrigger), since those agents
do not inherit the parent's denies.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Waishnav
Waishnav force-pushed the fix/claude-read-only branch from db5f53a to 4ee1446 Compare October 30, 2026 12:06
@Waishnav
Waishnav changed the base branch from fix/pi-extension-conflict to main October 30, 2026 12:24
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Waishnav
Waishnav merged commit 4bb9a08 into main Oct 30, 2026
5 checks passed
@Waishnav
Waishnav deleted the fix/claude-read-only branch October 30, 2026 12:48
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.

1 participant