Skip to content

Push rule by owning chief: a former chief's push of a task branch refuses in both hooks (T822) - #459

Merged
erickb336 merged 3 commits into
mainfrom
sage/t822-push-rule-owner
Nov 8, 2026
Merged

erickb336 merged 3 commits into
mainfrom
sage/t822-push-rule-owner

Conversation

@erickb336

Copy link
Copy Markdown
Owner

Takeover, PR B (T822). After a takeover (PR A, #448), a former chief or its agent could still push to the task's branch. This PR closes that in a shared logbook. It is hardening: main was already safe (create is fast-forward only, and the merge must match the head).

What changes

  • One owner test. The state tool has liveBar: why a chief does not land or push a live task's work, and an ended task bars nothing. The merge check uses it (its behaviour is the same). The new branchBar(project, branch, session) uses it for a push.
  • A branch of a task. This is the merge check's notion: the task's branch= and the --branch of its runs. A branch that no task uses passes.
  • Both hooks. The core push policy takes an owner(dir, branch) callback. The Claude hook and the Codex gate each give it the state tool's branchBar with the session's chief. A push in the push form (also --delete) of a branch that a live task of another chief uses is refused. The refusal names the task, the owning chief and the takeover gate (gate replace <T> --to C<n> in Claude, the gate_replace tool in Codex). A throw (for example an event with no session id) refuses too.
  • sage-pr create. It pushes the task's branch, so the Claude hook applies branchBar to that branch after the existing task owner check.
  • A legacy logbook has no chiefs, so its pushes work as before.
  • Also: changes/T822.md, and one row in the shared logbook table of the guide.

Tests (scripts/chiefs.test.mjs)

  • Both pair directions (a Claude chief and a Codex chief, then the reverse). Before the takeover, the owning chief and its agent push and the other chief is refused. After the takeover, the former chief and its agent are refused (also a delete), and the new owning chief and its agent push. A branch that a run uses counts. A branch with no task passes. An ended task passes. A legacy logbook passes, and its hook still judges a push (a force-push is refused). An event with no session id fails closed on a task branch.
  • sage-pr create is refused while a live task of another chief (Codex or Claude) uses the branch, and passes after that task ends.
  • The fakes: gh is a fake, first on PATH, and every folder with a real gh is off PATH. The world checks first that the fake answers. No push runs, because a hook only judges the command.
  • The four new tests fail on the base (afb1a92) and pass on this branch.

🤖 Generated with Claude Code

erickb336 and others added 3 commits November 7, 2026 21:58
…uses in both hooks (T822)

In a shared logbook, the Claude hook and the Codex gate refuse a git push
(and sage-pr create) of a branch that a live task of another chief uses,
by its branch= or by a run on it. One owner test (liveBar) serves the
merge check and the new branchBar of the state tool; the push policy
takes the bar as an owner callback. A legacy logbook keeps today's rules.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ith a plain refusal (T822)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… holds git, as /usr/bin does on Ubuntu (T822)

pushWorld took every folder that holds a gh off the hooks' PATH. On the
Ubuntu runner gh and git are both in /usr/bin, so the hooks could not run
git and refused the owning chief's push. git now goes into the fake's bin
folder first, and the world proves that git runs on that PATH.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@erickb336
erickb336 merged commit 0a52a58 into main Nov 8, 2026
1 check passed
@erickb336
erickb336 deleted the sage/t822-push-rule-owner branch November 8, 2026 09:04
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