#17402: fix:sandbox path issue
docker
agents
stale
size: XS
Cluster:
Sandbox Path Management Fixes
## Summary
Describe the problem and fix in 2–5 bullets:
- Problem:
- Why it matters:
- What changed:
- What did NOT change (scope boundary):
## Change Type (select all)
- [ ] Bug fix
- [ ] Feature
- [ ] Refactor
- [ ] Docs
- [ ] Security hardening
- [ ] Chore/infra
## Scope (select all touched areas)
- [ ] Gateway / orchestration
- [ ] Skills / tool execution
- [ ] Auth / tokens
- [ ] Memory / storage
- [ ] Integrations
- [ ] API / contracts
- [ ] UI / DX
- [ ] CI/CD / infra
## Linked Issue/PR
- Closes #
- Related #
## User-visible / Behavior Changes
List user-visible changes (including defaults/config).
If none, write `None`.
## Security Impact (required)
- New permissions/capabilities? (`Yes/No`)
- Secrets/tokens handling changed? (`Yes/No`)
- New/changed network calls? (`Yes/No`)
- Command/tool execution surface changed? (`Yes/No`)
- Data access scope changed? (`Yes/No`)
- If any `Yes`, explain risk + mitigation:
## Repro + Verification
### Environment
- OS:
- Runtime/container:
- Model/provider:
- Integration/channel (if any):
- Relevant config (redacted):
### Steps
1.
2.
3.
### Expected
-
### Actual
-
## Evidence
Attach at least one:
- [ ] Failing test/log before + passing after
- [ ] Trace/log snippets
- [ ] Screenshot/recording
- [ ] Perf numbers (if relevant)
## Human Verification (required)
What you personally verified (not just CI), and how:
- Verified scenarios:
- Edge cases checked:
- What you did **not** verify:
## Compatibility / Migration
- Backward compatible? (`Yes/No`)
- Config/env changes? (`Yes/No`)
- Migration needed? (`Yes/No`)
- If yes, exact upgrade steps:
## Failure Recovery (if this breaks)
- How to disable/revert this change quickly:
- Files/config to restore:
- Known bad symptoms reviewers should watch for:
## Risks and Mitigations
List only real risks for this PR. Add/remove entries as needed. If none, write `None`.
- Risk:
- Mitigation:
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Adds fallback logic to handle container-absolute paths (like `/workspace/file.pdf`) in sandbox environments by stripping the container workdir prefix before path validation, and rewrites bundled skill paths in snapshots to point to synced workspace copies when running in a sandbox
- **sandbox-paths.ts**: strips `/workspace/` prefix from container-absolute paths and retries resolution before throwing escape errors
- **workspace.ts**: replaces bundled skill directory references in snapshot prompts with workspace skill directories to fix inaccessible path issues in sandboxes
The changes improve path resolution robustness when sandbox agents use container-absolute paths instead of relative paths.
<h3>Confidence Score: 4/5</h3>
- This PR is safe to merge with minimal risk - it adds defensive fallback logic for path resolution
- The changes add fallback logic that makes path resolution more robust without changing existing behavior. The sandbox-paths.ts change only triggers when a path would otherwise be rejected, and properly validates the fallback path. The workspace.ts change is purely a string replacement that fixes inaccessible bundled skill paths in sandboxes. No security vulnerabilities introduced, and both changes follow defensive programming patterns.
- No files require special attention - both changes are straightforward defensive improvements
<sub>Last reviewed commit: 4b15071</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#11820: fix(sandbox): remap container paths in sandboxed file tools
by steflsd · 2026-02-08
84.1%
#14810: fix:sandbox file path Inconsistency
by luckylhb90 · 2026-02-12
84.0%
#16509: Fix sandbox path validation rejecting Docker bind mount paths
by Clawborn · 2026-02-14
82.3%
#4226: Fix/sandbox containerworkdir rw access
by ozgur-polat · 2026-01-29
82.2%
#3907: fix(sandbox): use absolute /bin/sh path + add allowedReadPaths config
by pvoo · 2026-01-29
81.2%
#16922: fix: remove incorrect sandbox file tool guidance
by carrotRakko · 2026-02-15
80.7%
#16929: fix(security): block access to sensitive directories from within sa...
by CornBrother0x · 2026-02-15
80.3%
#3967: fix(sandbox): correct workspace prompt path
by sweepies · 2026-01-29
80.3%
#12174: fix(agents): add path containment check in apply_patch for non-sand...
by coygeek · 2026-02-08
80.1%
#20991: fix(sandbox): fall back to gateway UID:GID when no user is configur...
by cluster2600 · 2026-02-19
79.3%