Skip to content

fix: add Write to headed-mode server allowedTools - #2

Draft
RachaelQuisel wants to merge 3 commits into
mainfrom
claude/implement-todo-item-Bd4HJ
Draft

fix: add Write to headed-mode server allowedTools#2
RachaelQuisel wants to merge 3 commits into
mainfrom
claude/implement-todo-item-Bd4HJ

Conversation

@RachaelQuisel

@RachaelQuisel RachaelQuisel commented Jul 16, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds Write to the server's allowedTools in spawnClaude() — the sidebar agent's fallback already included it, but the server-provided args take precedence, so Write was silently blocked
  • Adds a regression test in sidebar-security.test.ts ensuring the server's allowedTools stays in sync with the agent's, placed in its own "Allowed Tools" section for clarity

Test plan

  • bun test browse/test/sidebar-security.test.ts — 13 tests pass (was 12 before)
  • No new dependencies or breaking changes — Write doesn't expand attack surface beyond Bash (which can already write files)

The server.ts was sending '--allowedTools Bash,Read,Glob,Grep' (without
Write) in the sidebar queue args. Since sidebar-agent uses queue args
over its fallback defaults, Write was never available in headed mode
despite the CHANGELOG claiming it was. Adds a regression test.

https://claude.ai/code/session_01BfhJ1ohd7R9X1ecR1p3x7W
@sourcery-ai

sourcery-ai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR ensures the headed-mode sidebar agent is allowed to use the Write tool by updating the server’s allowedTools argument and adds a regression test tying server and agent behavior together so the omission cannot silently recur.

Sequence diagram for headed-mode sidebar Write tool enablement

sequenceDiagram
  actor User
  participant headed_server as headed_server
  participant Claude as Claude_sidebar_agent

  User->>headed_server: requestSidebarWrite
  headed_server->>Claude: spawnClaude(userMessage, extensionUrl, forTabId)
  Claude->>Claude: [allowedTools "Bash,Read,Glob,Grep,Write"]
  Claude-->>User: fileWriteCompleted
Loading

File-Level Changes

Change Details Files
Server process now explicitly includes the Write tool in its allowedTools argument passed to the sidebar agent.
  • Updated the spawnClaude args array to append Write to the comma-separated allowedTools list.
  • Preserves existing tools (Bash, Read, Glob, Grep) while expanding capabilities to include Write in headed mode.
browse/src/server.ts
Added a security-oriented regression test to confirm the server’s allowedTools includes Write and stays aligned with the sidebar agent’s defaults.
  • Introduced a new Jest test case that asserts SERVER_SRC contains the full allowedTools string including Write.
  • Documented rationale that Write does not expand attack surface beyond Bash and that server args must include Write for it to take effect.
  • Kept existing test verifying sidebar-agent’s fallback allowedTools unchanged, ensuring coverage for both server-provided args and agent defaults.
browse/test/sidebar-security.test.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

claude added 2 commits August 21, 2026 16:23
The server's spawnClaude args passed 'Bash,Read,Glob,Grep' without Write.
The sidebar-agent fallback included Write, but the server-provided args
take precedence, so the sidebar agent could never actually write files.

Adds a regression test tying server and agent allowedTools together.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BfhJ1ohd7R9X1ecR1p3x7W
The remote commit already had a test for this. My rebase created a
duplicate — consolidate into the better-placed "Allowed Tools" section.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BfhJ1ohd7R9X1ecR1p3x7W
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants