Guard a member clone that is on a feature branch #147
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Seen at
d7036ed199.Location
.agents/hooks/main-checkout-guard.sh, lines 9–10 (the header'sexemption for "a main worktree on another branch, as an adoption works")
and lines 89–90 (
[[ -n $main && $branch == "$main" ]] || return 0).Evidence
The guard refuses an edit only while the main worktree is on its main
branch. The exemption is there so an adoption, which runs in the main
checkout on a branch of its own, can edit. A member clone in an umbrella
falls under the same exemption, although
AGENTS.md§ Members says "themember's clone stays as it was". Member work happens in
.worktrees/<name>/<branch>.Reproduction: in an umbrella whose member clone
members/appis on theuser's branch
feature/x, feed the guard anEditevent formembers/app/README.md. It exits 0. The same event with the clone onmainexits 2.Scenario
An agent slips and edits the member clone instead of opening the
member's worktree. The edit lands in the user's own feature branch,
mixed with the user's work, and nothing warns either of them.
Smallest fix
The narrower option: refuse on any branch when the main worktree is
nested inside another repository's working tree, since an adoption never
runs in one. The alternative is to state the exemption in § Members.