Refuse agent-branch commits from a main checkout #119
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
allod/tools#119
Loading…
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?
Worktree isolation only holds if agents actually use it, and today nothing stops an agent from running bare
git switch -cin a shared checkout — which is how the collision in allod/tools#115 happened, since neither agent invokedallod changeat all. Move the rule down to the hook layer so working on an agent branch in a shared checkout is refused rather than merely discouraged.Part of allod/tools#115. Depends on allod/tools#112.
Primary goals:
agent/*branch from a registry checkout is blocked, with a message naming theallod change begininvocation that produces a correct worktree.git commit --no-verify, never a flag the tooling offers, perarchitecture.mdprinciple 4.allod change, which is the failure mode actually observed.Why this depends on allod/tools#112
The hook cannot currently tell where it is.
git-hooks/protected-refs-policy:4resolves the repo asgit rev-parse --show-topleveland:21derives the lookup key as${repo#"$HOME"/}, so inside a linked worktree the key is an absolute path that matches nothing. Both path-keyed policy files therefore go silent in a worktree:protected-branches(:21) andsigning-required-branches(:35). Signing enforcement disappearing inside a worktree is the more serious half, since a repo whose default branch requires signed pushes loses that guard entirely there.Worth noting that the same hook already keys two other policies off remote identity —
active-pr-branches(:48, used at:174and:186) andallowed-external-remotes(:62-68) — so allod/tools#112's remote-identity lookup is the established pattern in this file and the path-keyed pair is the outlier. Until that lands, adding a rule that pushes more work into worktrees widens the gap rather than closing it.Current state
Nothing distinguishes a registry checkout from a linked worktree in the hook, and nothing keys on the
agent/branch prefix. A linked worktree can be identified bygit rev-parse --git-common-dirdiffering from--git-dir, which is also howallod changealready resolves repo identity from a worktree.Scope
In:
git-hooks/protected-refs-policyand its tests, covering the refusal, the default-branch pass-through, and the human override. Out: the identity-resolution change itself (allod/tools#112) and worktree creation policy (allod/tools#116).