Skip to content

feat: --workspace flag extends the file-tools jail to a configurable root - #63

Merged
ajianaz merged 1 commit into
developfrom
feat/workspace-flag
Sep 12, 2026
Merged

ajianaz merged 1 commit into
developfrom
feat/workspace-flag

Conversation

@ajianaz

@ajianaz ajianaz commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

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)

  • 4 new unit tests (valid dir canonicalized / missing dir rejected / file rejected / None → cwd), all pass; workspace suite 12/12, full cargo test --workspace green, fmt + clippy -D warnings clean.
  • Live E2E with the freshly built release binary: from /tmp/t57-run with --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

…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
@github-actions

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

@ajianaz
ajianaz merged commit 85d4a2b into develop Sep 12, 2026
13 checks passed
@ajianaz
ajianaz deleted the feat/workspace-flag branch September 12, 2026 04:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

File tools are jailed to the session cwd - add a configurable session workspace

1 participant