Skip to content

Fix: add _is_isolated_worktree guard to prevent spawn from mutating parent repo checkout - #79237

Open
AnasBabari wants to merge 1 commit into
anthropics:mainfrom
AnasBabari:fix/bounty-79234-1784501159
Open

Fix: add _is_isolated_worktree guard to prevent spawn from mutating parent repo checkout#79237
AnasBabari wants to merge 1 commit into
anthropics:mainfrom
AnasBabari:fix/bounty-79234-1784501159

Conversation

@AnasBabari

Copy link
Copy Markdown

Summary

The bug is that spawn_task/chip creates a worktree dir that is not a real git worktree, so git commands resolve to the parent repo and the harness runs git checkout -b on the shared main checkout. The provided source lacks the spawn logic, but the reusable isolation check belongs in gitutil.py; we add a helper that asserts a directory is a real isolated worktree (toplevel equals dir and git-dir differs from common-dir) so callers can fail loudly instead of flipping the parent branch.

Fixes: #79234


Changes Made

  • plugins/security-guidance/hooks/gitutil.py

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