Skip to content

fix(pi): disable user extensions in sandboxed runs - #443

Merged
Waishnav merged 2 commits into
mainfrom
fix/pi-extension-conflict
Oct 30, 2026
Merged

Waishnav merged 2 commits into
mainfrom
fix/pi-extension-conflict

Conversation

@Waishnav

@Waishnav Waishnav commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

In read_only and allowed mode DevSpace loads a sandbox extension that replaces Pi's read, bash, edit, write, and grep tools to keep the agent inside the workspace. When the user has an extension that overrides the same tools, such as pi-foldable-tools, Pi refuses to start (Tool "read" conflicts with …/devspace-sandbox.ts), so every sandboxed Pi run failed. If Pi ever let the user's extension win instead, it would silently bypass the sandbox, so the sandbox has to be the only thing providing those tools.

Sandboxed runs now launch Pi with --no-extensions. Pi still loads paths passed explicitly with --extension, so DevSpace's sandbox stays in place. full_access runs have no sandbox and keep the user's extensions. The trade-off matches what T3 Code does for its unattended Pi runs: models or tools that only come from a user extension aren't available to sandboxed DevSpace runs. The launch arguments moved into piLaunchArgs so they're covered by a test for the first time.

Verified on a machine with pi-foldable-tools installed: a read-only run with xai/grok-4.5 now completes, and a read-only run asked to edit a file reports it only has read, grep, find, and ls and leaves the checkout unchanged.

Stacked on #442.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Sandboxed read-only and allowed launches now disable user extensions, load the configured sandbox extension, and apply the tools available for each mode.
    • Selecting read-only or allowed mode without a sandbox extension now reports an error.
    • Full-access launches continue to retain user extensions and use their existing RPC settings.

In read_only and allowed mode DevSpace loads a sandbox extension that
replaces Pi's read/bash/edit/write/grep tools to enforce the workspace
boundary. A user extension that overrides the same tools (for example
pi-foldable-tools) made Pi exit on startup, and one that won would have
bypassed the sandbox. Launch sandboxed runs with --no-extensions; the
explicit --extension sandbox path still loads. full_access has no
sandbox and keeps the user's extensions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@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: cb5344bc-a3c3-4eba-8149-2564d94d754a
Commits

Reviewing files that changed from the base of the PR and between 2439f09 and 17c71ad.

Files selected for processing: 7
  • src/local-agent-pi.test.ts
  • src/local-agent-pi.ts
  • test/agents-replay/transcripts/pi/continue.jsonl
  • test/agents-replay/transcripts/pi/events.jsonl
  • test/agents-replay/transcripts/pi/read-only.jsonl
  • test/agents-replay/transcripts/pi/run-wait.jsonl
  • test/agents-replay/transcripts/pi/stop.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

The Pi RPC factory now uses piLaunchArgs to build arguments by write mode. Sandboxed launches disable user extensions and load the sandbox extension with the configured tool list. Tests and replay transcripts cover the updated arguments.

Changes: Pi launch argument construction

Layer / File(s) Summary
Build and validate launch arguments
src/local-agent-pi.ts, src/local-agent-pi.test.ts, test/agents-replay/transcripts/pi/*.jsonl
piLaunchArgs preserves extensions for full_access and adds RPC and approval arguments. Sandboxed modes require a sandbox extension path, disable other extensions, and select their tool lists. The RPC factory delegates argument construction to the helper. Tests and replay transcripts cover the arguments.

Priority: Normal

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

Change: Bug fix

Merge Risk: Minimal · up to 17c71

Sandboxed Pi runs disable user extensions while explicitly loading the sandbox extension; full-access runs retain user extensions. No merge-blocking issue is identified in the supplied evidence.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.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. Documenta… 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: disabling user extensions in sandboxed Pi runs.
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 50.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 2 functions across 2 files. (5 skipped: 5 unsupported.)

Resolution

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

Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 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 launch args twice
The sandbox path is tucked in nice
Read-only tools stay in their lane
Allowed tools follow the same chain
User extensions sit this run out
The replay logs record the route

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 URL: https://fix-pi-extension-conflict-devspace-site.waishnav.workers.dev (commit 17c71ad)

This URL reflects your latest Preview deployment

Preview Deployments by commit

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

View logs ↗
https://83afa1b8-devspace-site.waishnav.workers.dev 17c71ad 2026-10-30T12:09:36.305Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://817d7998-devspace-site.waishnav.workers.dev 4645eba 2026-10-30T11:44:15.204Z Visit the dashboard ↗

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Waishnav
Waishnav changed the base branch from fix/claude-env-overrides to main October 30, 2026 12:06
@Waishnav
Waishnav merged commit 6bfba34 into main Oct 30, 2026
5 checks passed
@Waishnav
Waishnav deleted the fix/pi-extension-conflict 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