Follow-up from #548 (which landed the assertion + refspec-push as a prose contract in reference/safety.md).
Context
#548 fixed a near-miss where a babysit worker in a detached-HEAD / stale-local-branch worktree could git merge origin/main + push and silently revert the newest branch commit. The fix is a behavioral contract in safety.md's Checkout And Push Invariants: assert the assigned worktree's HEAD equals a freshly re-fetched origin/<pr-branch> before any merge/edit/push, and push via git push origin HEAD:<pr-branch> (fast-forward by construction, never --force).
The gap this tracks
#548's own words: "safety depended on luck, not a guard." Enforcement is still agent discipline — a worker that skips the assertion re-opens the exact hole. The repo's recent thesis (#530, #547, #613) is prevention-by-mechanism, not prose. So the open question:
Should the assertion + refspec push be a deterministic helper — e.g. a small script (or an extension of the guarded push/mutation wrappers) that resolves the assigned worktree HEAD, re-fetches origin/<pr-branch>, refuses (fail-closed) on any mismatch, and performs the fast-forward refspec push — so the guarantee holds structurally rather than relying on the worker to follow prose?
Decision needed
Build the guard helper (and where it lives — a new script vs. folding into source-control-babysit-merge/push path), or deliberately keep it as contract. Category: improvement (prevention). Surfaced in the #548 review disposition.
Follow-up from #548 (which landed the assertion + refspec-push as a prose contract in
reference/safety.md).Context
#548 fixed a near-miss where a babysit worker in a detached-HEAD / stale-local-branch worktree could
git merge origin/main+ push and silently revert the newest branch commit. The fix is a behavioral contract insafety.md's Checkout And Push Invariants: assert the assigned worktree'sHEADequals a freshly re-fetchedorigin/<pr-branch>before any merge/edit/push, and push viagit push origin HEAD:<pr-branch>(fast-forward by construction, never--force).The gap this tracks
#548's own words: "safety depended on luck, not a guard." Enforcement is still agent discipline — a worker that skips the assertion re-opens the exact hole. The repo's recent thesis (#530, #547, #613) is prevention-by-mechanism, not prose. So the open question:
Should the assertion + refspec push be a deterministic helper — e.g. a small script (or an extension of the guarded push/mutation wrappers) that resolves the assigned worktree
HEAD, re-fetchesorigin/<pr-branch>, refuses (fail-closed) on any mismatch, and performs the fast-forward refspec push — so the guarantee holds structurally rather than relying on the worker to follow prose?Decision needed
Build the guard helper (and where it lives — a new script vs. folding into
source-control-babysit-merge/push path), or deliberately keep it as contract. Category: improvement (prevention). Surfaced in the #548 review disposition.