Repository navigation
fix(sandbox): read tool rejects declared binds with workspace-only enabled - #130540
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 8:51 PM ET / August 27, 2026, 00:51 UTC. ClawSweeper reviewWhat this changesThe PR lets workspace-only sandbox read tools access explicitly declared Docker bind mounts by deriving their allowed roots from the canonical sandbox mount table. Merge readinessThis PR remains necessary: current main’s workspace-only read guard omits declared Docker binds while the sandbox bridge already resolves them. The patch reuses that canonical mount table and preserves the separate write/edit guards. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (partial) — step 2 Assertions:
How this fits togetherAgent file tools apply a workspace-only guard before the sandbox filesystem bridge maps a container path to a permitted host mount. Both layers must recognize the same declared mounts while write and edit operations remain separately confined. flowchart LR
A[Agent read request] --> B[Workspace-only path guard]
C[Sandbox configuration] --> D[Canonical mount table]
D --> B
D --> E[Filesystem bridge]
B --> E
E --> F[Declared host bind]
G[Write and edit tools] --> H[Existing write confinement]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -19, Tests +51. Total +32 across 2 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the canonical mount-table reuse after rebasing or refreshing the merge result and confirming the focused sandbox regression and required checks on that exact result. Do we have a high-confidence way to reproduce the issue? Yes, at source level: current main excludes declared binds from the read guard while the bridge accepts them, and the PR supplies a concrete Docker scenario with after-fix output. Is this the best way to solve the issue? Yes. Reusing the bridge’s canonical mount table removes the diverging read-side policy without changing configured mounts or write/edit confinement. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 42112dd86ec3. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
Fixes #130193
What Problem This Solves
Fixes an issue where sandboxed agents using
tools.fs.workspaceOnly: truecould not read files from their own declaredsandbox.docker.binds. The workspace guard rejected those container paths before the sandbox filesystem bridge could resolve the configured mount, so operators sawPath escapes sandbox rootfor files that were present and readable inside the sandbox.Why This Change Was Made
The read guard now consumes the canonical sandbox filesystem mount table instead of maintaining a second, incomplete list of workspace and skill mounts. This keeps the guard and bridge aligned for agent workspace, protected skill, and declared bind mounts while excluding the primary workspace mount already represented by the guard root.
The change only expands read access to mounts already declared in the sandbox configuration. Write, edit, and apply-patch confinement is unchanged; no config, schema, default, container mount, or persistence format changes.
User Impact
Sandboxed agents can read operator-declared bind-mounted files while workspace-only confinement remains enabled. Read-only bind mounts remain protected from write and edit operations, and paths outside the workspace plus declared mounts remain rejected.
Evidence
Before the repair, the new production-assembly regression failed with:
After the repair, the focused agent tool suite passes:
A real Docker sandbox was provisioned with
workspaceOnly: true,workspaceAccess: none, and a read-only bind mounted at/cache/repos. The production sandbox resolver, filesystem bridge, and assembled read/write/edit tools observed:{"reporterPath":"/cache/repos/example/tree-index.json","readDelivered":true,"writeRejected":true,"editRejected":true,"hostContentPreserved":true}Impact-surface verification also passed the canonical mount resolver and workspace-root guard suites (31 tests, with one unrelated platform skip), the runtime import-cycle guard, and the full
pnpm checkpreflight/typecheck/lint pipeline. The consumer sweep coveredcreateCoreCodingTools,buildSandboxFsMounts, the filesystem bridge, workspace/agent/skill mount handling, and the write/edit guard siblings; only the read wrapper receives the additional canonical mounts.