#16043: fix(sandbox): align fs-bridge and fs-paths write checks with tool-gating logic
agents
stale
size: S
Cluster:
Sandbox File System Fixes
## Summary
PR #4026 (merged in 2026.2.13) introduced `SandboxFsBridge` which routes file ops through docker exec.
Two places used `workspaceAccess === "rw"` to determine writability, which incorrectly blocked writes when `workspaceAccess` is `"none"`. The tool-gating logic in `pi-tools.ts:242` uses `!== "ro"`, so `"none"` should permit writes.
**Fixes:**
- `fs-bridge.ts` — `allowsWrites()` used `=== "rw"` → changed to `!== "ro"`
- `fs-paths.ts` — `buildSandboxFsMounts()` workspace mount `writable` flag used `=== "rw"` → changed to `!== "ro"`
Line 72 (agent mount) intentionally keeps `=== "rw"` since the agent workspace is excluded entirely when access is `"none"`.
## Test plan
- [x] fs-bridge: added test "allows writes when workspaceAccess is none"
- [x] fs-paths: added tests "marks workspace writable when workspaceAccess is none" and "marks workspace read-only when workspaceAccess is ro"
- [x] `"none"` allows writes, `"ro"` blocks, `"rw"` allows
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Fixed workspace write access checks to align with tool-gating logic. Changed two functions from using `workspaceAccess === "rw"` to `workspaceAccess !== "ro"`, so that `"none"` access mode now correctly permits writes instead of blocking them.
Changes:
- `fs-bridge.ts:232` — `allowsWrites()` helper now uses `!== "ro"`
- `fs-paths.ts:60` — workspace mount `writable` flag now uses `!== "ro"`
- Line 72 (agent mount) intentionally kept as `=== "rw"` since that block is excluded when access is `"none"`
- Added test coverage for `"none"` allowing writes and `"ro"` blocking writes
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk
- The fix correctly aligns workspace access checks with the tool-gating logic in `pi-tools.ts:254`. The changes are minimal, targeted, and well-tested. Line 72 is intentionally preserved as `=== "rw"` since the agent workspace mount is excluded entirely when access is `"none"` (guarded by line 66). All three access modes now behave correctly: `"none"` allows writes, `"ro"` blocks writes, `"rw"` allows writes.
- No files require special attention
<sub>Last reviewed commit: ff47dbc</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#19344: fix(sandbox): allow writes when workspaceAccess is 'none'
by mingming099 · 2026-02-17
93.8%
#16509: Fix sandbox path validation rejecting Docker bind mount paths
by Clawborn · 2026-02-14
81.3%
#16922: fix: remove incorrect sandbox file tool guidance
by carrotRakko · 2026-02-15
79.4%
#11820: fix(sandbox): remap container paths in sandboxed file tools
by steflsd · 2026-02-08
79.2%
#4226: Fix/sandbox containerworkdir rw access
by ozgur-polat · 2026-01-29
78.8%
#23486: Tools/FS: default host-mode filesystem access to workspace-only
by bmendonca3 · 2026-02-22
78.3%
#20991: fix(sandbox): fall back to gateway UID:GID when no user is configur...
by cluster2600 · 2026-02-19
76.8%
#3907: fix(sandbox): use absolute /bin/sh path + add allowedReadPaths config
by pvoo · 2026-01-29
76.4%
#5952: feat(tools): add fs.restrictToWorkspace config option
by reubence · 2026-02-01
75.1%
#21665: fix(sandbox): add /home and /Users to bind-mount denylist
by AI-Reviewer-QS · 2026-02-20
75.0%