Repository navigation
feat: --workspace flag extends the file-tools jail to a configurable root - #63
Merged
Merged
Conversation
…root read_file/write_file/edit_file/delete_file were jailed to the process cwd, forcing agents through run_command workarounds for any absolute- path work outside it. A global --workspace <dir> flag now sets the file tools' jail root (canonicalized; must exist and be a directory). run_command/git stay bound to the process cwd — their semantics are cwd-based by contract. Jail safety semantics are unchanged: the root moves, the TOCTOU-safe jail walk does not. Closes #57
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
This was referenced Oct 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What (description of the change)
New global
--workspace <dir>flag: sets the jail root for read_file/write_file/edit_file/delete_file (default unchanged: process cwd). Root resolution (resolve_workspace_root) canonicalizes the path and rejects missing dirs/files, extracted as a testable unit (bin-only crate). run_command/git stay cwd-bound by contract.Why (the problem you're solving)
Issue #57: file tools jailed to the session cwd forced the agent through run_command cat/python-writer workarounds for any work touching paths outside cwd (vetio missions wrote to /opt/data/tmp/... this way — token-expensive). The jail now MOVES but keeps its TOCTOU-safe per-component symlink walk; a workspace flag that silently fell back to cwd on a typo would be worse than failing, so resolution is strict.
Testing (how you verified this works)
cargo test --workspacegreen, fmt + clippy -D warnings clean.--workspace /tmp/t57-ws, the agent read note.txt living in the workspace via read_file (returned its exact content); WITHOUT the flag the same file is unreachable (agent replied UNREACHABLE). Both directions proven against the real provider.Closes #57