#16922: fix: remove incorrect sandbox file tool guidance
agents
stale
size: XS
Cluster:
Sandbox File System Fixes
## Summary
Remove incorrect workspace guidance for sandboxed agents. Commit 2bf33077 added guidance stating
file tools (read/write/edit/apply_patch) resolve paths against the host workspace. This is wrong —
all file tools use `SandboxFsBridge` → `docker exec` inside the container.
## Changes
- `src/agents/system-prompt.ts`: Remove sandbox-specific `workspaceGuidance` branch. Use the same
guidance for both sandbox and non-sandbox modes.
## Evidence
`SandboxFsBridgeImpl.runCommand` in `src/agents/sandbox/fs-bridge.ts` executes all file operations
through `docker exec -i <containerName> sh -c <script>`. Host-side `node:fs` is never used when
sandbox is enabled.
## Related
- Closes #16920
- Related: #16790 (original sandbox path bug, fixed by 2bf33077)
✍️ Author: Claude Code with @carrotRakko (AI-written, human-approved)
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
This PR removes an incorrect sandbox-specific `workspaceGuidance` branch from the system prompt builder. The previous code told sandboxed agents that file tools (read/write/edit/apply_patch) resolve paths against the host workspace, which is wrong — `SandboxFsBridgeImpl.runCommand` in `src/agents/sandbox/fs-bridge.ts` runs all file operations via `docker exec` inside the container.
The fix correctly unifies the guidance to use a single string for both sandbox and non-sandbox modes.
- **Issue found**: The test in `src/agents/system-prompt.e2e.test.ts` (line 450-452) still asserts the old removed text (`"For read/write/edit/apply_patch, file paths resolve against host workspace: /tmp/openclaw."`) and will fail. This test needs to be updated to match the new behavior.
<h3>Confidence Score: 3/5</h3>
- The production code change is correct but the PR will break an existing e2e test.
- The logic fix itself is sound and well-evidenced — sandbox file tools do use docker exec, not host-side node:fs. However, the corresponding e2e test in system-prompt.e2e.test.ts was not updated and will fail, which means CI should catch this. Score of 3 reflects that the code change is correct but incomplete.
- src/agents/system-prompt.e2e.test.ts — contains a stale assertion (line 450-452) that will fail after this change.
<sub>Last reviewed commit: 139c932</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#3967: fix(sandbox): correct workspace prompt path
by sweepies · 2026-01-29
84.7%
#4226: Fix/sandbox containerworkdir rw access
by ozgur-polat · 2026-01-29
84.6%
#19344: fix(sandbox): allow writes when workspaceAccess is 'none'
by mingming099 · 2026-02-17
82.7%
#11820: fix(sandbox): remap container paths in sandboxed file tools
by steflsd · 2026-02-08
82.6%
#16509: Fix sandbox path validation rejecting Docker bind mount paths
by Clawborn · 2026-02-14
82.3%
#20991: fix(sandbox): fall back to gateway UID:GID when no user is configur...
by cluster2600 · 2026-02-19
81.5%
#17402: fix:sandbox path issue
by luckylhb90 · 2026-02-15
80.7%
#16043: fix(sandbox): align fs-bridge and fs-paths write checks with tool-g...
by steflsd · 2026-02-14
79.4%
#10185: fix: pass effective workspace as cwd to Pi SDK createAgentSession
by Yida-Dev · 2026-02-06
78.9%
#3907: fix(sandbox): use absolute /bin/sh path + add allowedReadPaths config
by pvoo · 2026-01-29
78.7%