Home

mweinbach / agent-coworker

publicmweinbach/agent-coworker
Overview Code History Branches Pull requestsIssuesInsights
main
HomeOverview Code PRsIssues

fix(sandbox): collapse macOS /tmp alias when skipping scratch roots

4 months ago

e338f16
Authored
Claude6/5/2026, 1:25:48 PM
Codex review (commit 975e72f): withTmpScratch skipped the /tmp scratch root for a
/tmp-scoped child but still added /private/tmp. Since /tmp is a symlink to
/private/tmp on macOS, that re-opened the same tree (e.g. a child scoped to
/tmp/proj/src could write /private/tmp/proj/...), bypassing the targetPaths scope.

The ancestor check now normalizes the macOS firmlink aliases (/tmp,/var ->
/private/*) on both sides of the comparison (emitted roots keep their original
spelling; no-op on Linux), so both temp scratch roots are skipped for a
/tmp-scoped child while normal workspaces still get /tmp scratch.

Verified: bun run check, typecheck, docs:check, sandbox + spawnAgent + bash tests (64).

Parentc73f2d1

2 files changed
  • src/platform/sandbox/policy.ts+23−3
  • test/platform/sandbox.test.ts+17−0