Skip to content

fix(agents): guard resolves nearest existing ancestor dir (no fail-open)#2519

Merged
os-zhuang merged 1 commit into
mainfrom
fix/guard-walkup-ancestor
Jul 2, 2026
Merged

fix(agents): guard resolves nearest existing ancestor dir (no fail-open)#2519
os-zhuang merged 1 commit into
mainfrom
fix/guard-walkup-ancestor

Conversation

@os-zhuang

Copy link
Copy Markdown
Contributor

Follow-up to #2517. git -C "$(dirname file)" fails when the edited file's parent dir doesn't exist yet (a Write creating a new nested directory), and || exit 0 then let the edit through on the shared checkout. Now the guard walks up to the nearest existing ancestor before resolving the repo — new-file-in-new-dir writes are guarded too. Mirrored in objectui#2160 / cloud#721. Tested: primary(existing & new-nested)→block, worktree→allow, non-repo→allow. Authored from a worktree.

🤖 Generated with Claude Code

…fail-open)

Follow-up to #2517. The guard ran `git -C "$(dirname file)"`, which fails when the
edited file's parent directory doesn't exist yet (a Write creating a new nested dir)
— and `|| exit 0` then let the edit through on the shared checkout. Now it walks up to
the nearest existing ancestor before resolving the repo, so new-file-in-new-dir writes
are guarded too. (Also applied to objectui#2160 / cloud#721.)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 2, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
spec Ready Ready Preview, Comment Jul 2, 2026 1:33pm

Request Review

@github-actions github-actions Bot added the size/s label Jul 2, 2026
@os-zhuang
os-zhuang merged commit 6d26e42 into main Jul 2, 2026
15 checks passed
@os-zhuang
os-zhuang deleted the fix/guard-walkup-ancestor branch July 2, 2026 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant