Skip to content

fix(pi): Confine file tools to checkout - #513

Merged
gricha merged 2 commits into
mainfrom
fix/confine-pi-file-tools
Aug 24, 2026
Merged

fix(pi): Confine file tools to checkout#513
gricha merged 2 commits into
mainfrom
fix/confine-pi-file-tools

Conversation

@gricha

@gricha gricha commented Aug 22, 2026

Copy link
Copy Markdown
Member

Confine Pi read, grep, find, and ls tools to the active checkout and return repository-relative guidance when a path escapes it.

Sentry traces showed mistaken root-level searches crawling the runner filesystem for many minutes. Hard confinement stops those calls before traversal begins, including parent traversal and symlinks that resolve outside the checkout.

The canonical path that passes confinement is now the exact path executed by Pi. This prevents Pi from reinterpreting @, ~, or file:// syntax after validation.

GitHub Actions remains bounded by GITHUB_WORKSPACE. Local Git runs use the repository root even when invoked from a subdirectory, while non-Git file runs use the invocation directory. Caller-provided custom tools keep their existing behavior.

@sentry-junior sentry-junior Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Overriding the Pi built-ins with same-name custom tools is the right lever, and the pre-execute boundary covers the failure mode from traces (root searches, .. traversal, and out-of-checkout symlinks) without changing caller-provided tools. The repo-root vs invocation-directory behavior for local file context is clear, and the new tests lock the important cases in.

@gricha
gricha force-pushed the fix/confine-pi-file-tools branch from ce70e77 to c4a2f55 Compare August 22, 2026 03:03
@vercel

vercel Bot commented Aug 22, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
warden-prod Skipped Skipped Aug 24, 2026 5:22pm

Request Review

Comment thread packages/warden/src/sdk/runtimes/pi-file-tools.ts Outdated
Prevent Pi read and search tools from traversing outside the active checkout.

Mistaken root searches can otherwise turn into very long Warden runs.

Preserve local behavior by using the Git root when available and the invocation directory otherwise.

Co-Authored-By: GPT-5.6 Sol <noreply@anthropic.com>
Execute Pi file tools with the canonical path that passed checkout confinement. This prevents Pi from reinterpreting alternate path syntax after validation and escaping the checkout.

Co-Authored-By: GPT-5.6 Sol <noreply@anthropic.com>
@vercel
vercel Bot temporarily deployed to Preview – warden-prod August 24, 2026 17:22 Inactive
@gricha
gricha merged commit fb25971 into main Aug 24, 2026
21 of 22 checks passed
@gricha
gricha deleted the fix/confine-pi-file-tools branch August 24, 2026 18:36
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.

1 participant