reject git push to a branch that already has a merged PR #1107

Closed
opened 2026-08-17 00:14:53 +00:00 by coilysiren · 1 comment
Owner

flow:

  • push a branch
  • kai reviews the PR, merges, forgets to tell the agent
  • agent pushes to that branch
  • kai doesn't realize that's a branch setting there without a PR, the work is lost forever

thats the flow to avoid

flow: - push a branch - kai reviews the PR, merges, forgets to tell the agent - agent pushes to that branch - kai doesn't realize that's a branch setting there without a PR, the work is lost forever thats the flow to avoid
Member

Merged into #1034. Closing. Darren (director seat), 2026-08-17, from a full triage pass of this repo.

Same guard, same flow. #1034 was filed 2026-08-12 with the mechanism worked out, so it is the canonical one and this is the restatement.

Your flow, and where #1034 already lands it

push a branch / kai reviews the PR, merges, forgets to tell the agent / agent pushes to that branch / kai doesn't realize that's a branch sitting there without a PR, the work is lost forever

#1034 names exactly that: the push succeeds, the branch fast-forwards, no PR points at it, and the work is stranded on a dead branch that looks pushed. It adds why the branch is still there to push to - three of the four repos keep merged branches around, per coilyco-flight-deck/infrastructure#807.

The part worth not losing, and the reason this needs care

The obvious cheap implementation is wrong, and #1034 proves it rather than asserting it:

A local-only check will not work. The obvious cheap version is "is the branch tip already an ancestor of main". It misses squash and rebase merges, which these repos allow and use.

Measured: agentic-os PR #1030 merged as 8186344f, and its branch commit 91113830 is not an ancestor of that. The ancestor test returned false on a genuinely merged branch, so a hook built on it would have passed the exact case it exists to catch.

So the check has to ask the forge whether a PR for this branch is merged. That is the whole difficulty and it is why this is not a ten-line hook.

Machinery that already exists

The pre-push stage is in use across the fleet - agentic-os-kai, agentic-os-hardware, and infrastructure all declare stages: [pre-commit, pre-push] - so this needs no new plumbing, only the new hook.

#1034 is priority/P1 autonomy/headless role/engineer. P1 because the failure is silent and the loss is unrecoverable work, which is the pair that earns urgency regardless of frequency.

**Merged into #1034. Closing. Darren (director seat), 2026-08-17, from a full triage pass of this repo.** Same guard, same flow. #1034 was filed 2026-08-12 with the mechanism worked out, so it is the canonical one and this is the restatement. ## Your flow, and where #1034 already lands it > push a branch / kai reviews the PR, merges, forgets to tell the agent / agent pushes to that branch / kai doesn't realize that's a branch sitting there without a PR, the work is lost forever #1034 names exactly that: the push succeeds, the branch fast-forwards, no PR points at it, and the work is stranded on a dead branch that looks pushed. It adds why the branch is still there to push to - three of the four repos keep merged branches around, per `coilyco-flight-deck/infrastructure#807`. ## The part worth not losing, and the reason this needs care The obvious cheap implementation is wrong, and #1034 proves it rather than asserting it: > **A local-only check will not work.** The obvious cheap version is "is the branch tip already an ancestor of main". It misses squash and rebase merges, which these repos allow and use. Measured: `agentic-os` PR #1030 merged as `8186344f`, and its branch commit `91113830` is **not** an ancestor of that. The ancestor test returned false on a genuinely merged branch, so a hook built on it would have passed the exact case it exists to catch. So the check has to ask the forge whether a PR for this branch is merged. That is the whole difficulty and it is why this is not a ten-line hook. ## Machinery that already exists The `pre-push` stage is in use across the fleet - `agentic-os-kai`, `agentic-os-hardware`, and `infrastructure` all declare `stages: [pre-commit, pre-push]` - so this needs no new plumbing, only the new hook. #1034 is `priority/P1` `autonomy/headless` `role/engineer`. P1 because the failure is silent and the loss is unrecoverable work, which is the pair that earns urgency regardless of frequency.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
coilyco-flight-deck/agentic-os#1107
No description provided.