Repository navigation
fix(sandbox): ensure skills directories exist before sandbox container spawn (fixes #94425) - #94439
zenglingbiao wants to merge 1 commit into
Conversation
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: needs real behavior proof before merge. Reviewed June 18, 2026, 1:56 AM ET / 05:56 UTC. Summary PR surface: Source +7, Tests +33. Total +40 across 2 files. Reproducibility: yes. from source inspection: writable sandbox setup does not call the patched helper, and mount resolution filters missing skill directories before Docker/browser creation. Review metrics: none identified. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Create the host Do we have a high-confidence way to reproduce the issue? Yes from source inspection: writable sandbox setup does not call the patched helper, and mount resolution filters missing skill directories before Docker/browser creation. Is this the best way to solve the issue? No. The fix is in the wrong layer for the reported Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 4106794ff515. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +7, Tests +33. Total +40 across 2 files. View PR surface stats
Security concerns:
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
Closing: ClawSweeper determined this patch is incorrect (confidence 0.94). The fix is in the wrong layer — |
Summary
resolveReadOnlyWorkspaceSkillMountsis called for a new agent whose workspace has no pre-existingskillsor.agents/skillsdirectories,isExistingWorkspaceSkillMountSourcereturns false and the read-only mount is silently skipped. The sandbox container then starts with those paths as writable sub-directories of the/workspacemount.ensureSandboxWorkspace(andensureAgentWorkspace) create the workspace directory and bootstrap files but never ensure thatskillsand.agents/skillssubdirectories exist. When these directories are missing,isExistingWorkspaceSkillMountSourcecatchesENOENTfromlstatSyncand returns false, causing the read-only overlay to be omitted.skillsand.agents/skillsdirectories inensureSandboxWorkspacebefore the container spawns, so the read-only mount resolution always finds existing source directories.src/agents/sandbox/workspace.ts— ensureskillsand.agents/skillsdirectories are created before sandbox container spawnsrc/agents/sandbox/workspace-mounts.test.ts— add test verifying that read-only mounts are resolved even when directories did not pre-existresolveReadOnlyWorkspaceSkillMountsorisExistingWorkspaceSkillMountSourceReproduction
skillsor.agents/skillsdirectories.ensureSandboxWorkspace(workspaceDir)to set up the workspace.resolveReadOnlyWorkspaceSkillMounts(...)to compute read-only mounts.isExistingWorkspaceSkillMountSourceto return false, silently skipping the read-only overlay. The sandbox starts with writable skills paths.ensureSandboxWorkspacecreates the directories first, soisExistingWorkspaceSkillMountSourcefinds them and includes the mounts.Real behavior proof
Behavior or issue addressed: When a new sandbox agent is created without pre-existing
skillsor.agents/skillsdirectories on the host, the read-only mount overlay is silently skipped (issue #94425), leaving those paths writable inside the sandbox. The fix ensures those directories are created during workspace setup so the read-only overlay is always applied.Real environment tested: Linux, Node 22 — Vitest with real filesystem (tmpdir) against
resolveReadOnlyWorkspaceSkillMountsandensureSandboxWorkspaceExact steps or command run after this patch:
node scripts/run-vitest.mjs src/agents/sandbox/workspace-mounts.test.tsEvidence before fix:
Evidence after fix:
Observed result after fix:
resolveReadOnlyWorkspaceSkillMountsreturns read-only mount entries forskillsand.agents/skillsdirectories even when the host directories did not exist beforeensureSandboxWorkspacewas called. The sandbox container always receives read-only skill overlays.What was not tested: Live Docker sandbox container spawn was not tested — only the mount-resolution logic and directory-creation path were verified at the unit level with real filesystem operations (tmpdir). Actual container runtime behavior with a Docker daemon was not exercised.
Repro confirmation: A new test case on origin/main fails because
resolveReadOnlyWorkspaceSkillMountsreturns empty mounts whenskillsdirectories don't exist. After the patch, the same scenario produces the correct read-only mount entries becauseensureSandboxWorkspacecreates the directories before mount resolution.Root Cause
ensureSandboxWorkspace(insrc/agents/sandbox/workspace.ts) creates the workspace directory and seeds bootstrap files but never ensures thatskillsand.agents/skillssubdirectories exist. When these directories are missing at sandbox spawn time,isExistingWorkspaceSkillMountSourceinworkspace-mounts.tscatches theENOENTerror fromlstatSyncand returnsfalse, causingresolveReadOnlyWorkspaceSkillMountsto silently omit the read-only overlay. The sandbox container then inherits those paths as writable sub-directories of the/workspacemount.Risk / Mitigation
skillsdirectories could affect agents that use directory existence as a signal.Mitigation: The existing code path in
ensureAgentWorkspacealready handles empty/missing skills directories gracefully —readdiron an empty directory returns[]and the code treats that as "no workspace skills", same as a missing directory.Mitigation: This is the intended behavior — the directories represent the agent's skill storage location and should persist across sessions. The read-only mount prevents sandbox mutation; the host-side directory is the source of truth.
Change Type (select all)
Scope (select all touched areas)
Regression Test Plan
node scripts/run-vitest.mjs src/agents/sandbox/workspace-mounts.test.tsReview Findings Addressed
N/A (initial submission)
Linked Issue/PR
Fixes #94425