Pushes onto a pull request that has a scheduled merge #248

Closed
opened 2026-11-17 22:24:55 +00:00 by Claude · 2 comments
Owner

Part of #87

A push does not cancel a scheduled merge, and the merge runs as whoever scheduled it. The map used this fact for bot branches only, and the control chosen there has a side effect nobody recorded.

To decide

  1. May a merge be scheduled on a pull request whose head branch someone else can still push to? This covers a friend's fork pull request and any branch in this repository that the agent account or another writer can push to.
  2. If not: is that a rule in docs/contributing/reviewing.md (merge at the head you reviewed; do not schedule a merge on a branch others push to), held as aspirational, or a setting (one required approval with stale approvals dismissed, which binds every pull request)?
  3. A branch that matches a protection rule cannot be deleted by anyone. Do renovate/* and release/* keep their push allowlists, with merged bot branches left behind until the maintainer removes them, or do they go back to unprotected with the ride-along risk written into ADR 0001?

Waits on this

Nothing is blocked by a native dependency. The renovate/* and release/* step of chore: apply the recommended repository settings, account permissions and branch protection waits for question 3; a comment there says so.

Evidence is in the first comment.

Part of #87 A push does not cancel a scheduled merge, and the merge runs as whoever scheduled it. The map used this fact for bot branches only, and the control chosen there has a side effect nobody recorded. ## To decide 1. May a merge be scheduled on a pull request whose head branch someone else can still push to? This covers a friend's fork pull request and any branch in this repository that the agent account or another writer can push to. 2. If not: is that a rule in `docs/contributing/reviewing.md` (merge at the head you reviewed; do not schedule a merge on a branch others push to), held as aspirational, or a setting (one required approval with stale approvals dismissed, which binds every pull request)? 3. A branch that matches a protection rule cannot be deleted by anyone. Do `renovate/*` and `release/*` keep their push allowlists, with merged bot branches left behind until the maintainer removes them, or do they go back to unprotected with the ride-along risk written into ADR 0001? ## Waits on this Nothing is blocked by a native dependency. The `renovate/*` and `release/*` step of [chore: apply the recommended repository settings, account permissions and branch protection](https://git.rkdr.net/Mortis/Kamino/issues/192) waits for question 3; a comment there says so. Evidence is in the first comment.
Claude added the
Wayfinder
Grilling
label 2026-11-17 22:24:55 +00:00
Defame1297 was assigned by Claude 2026-11-17 22:24:55 +00:00
Author
Owner

Evidence from the review of the map (2026-11-17)

  • Establish how fork approval behaves on this server's Gitea version, point 4: "A new push does not cancel a scheduled automerge, whoever pushes. The merge waits for the new head's checks and branch protection, then runs as the user who scheduled it."
  • Read again in Gitea's source at the tags v28.0.0, v28.3.0 and v28.4.0 (services/automerge/automerge.go): the schedule is removed only on merge, on close, on re-scheduling and on an explicit cancel. Not tested live.
  • Recommended repository settings and branch protection: zero required approvals stay; "The agent account cannot merge: 'agents do not merge' becomes a control."
  • How friends get code in: "Review a friend's pull request before merging it ... Held by review."
  • Code-owner approval against Renovate automerge, and where secrets live, point 6, covers renovate/* and release/* only.
  • Two limits on the exposure. Stale approvals are dismissed on a push, so on code-owned files the merge waits again. On a friend's first pull request the new push's runs still wait for approval. The open path is files without a code owner, after a friend's first merge, and any branch in this repository.
  • Deletion: Gitea's pre-receive hook says "Detect and prevent deletion of the branch" for every branch that matches a rule, before any allowlist is read; "delete head branch after merge" uses the same check. Same text at all three tags. Renovate logs a refused delete and carries on; not certain how it treats the leftover branch on later runs.
  • The settings decision had said before: "release/next, renovate/* stay unprotected; their checks hold them".

Not settled: no Gitea behaviour here was tested live. One test pull request on a scratch branch settles both facts.

## Evidence from the review of the map (2026-11-17) - [Establish how fork approval behaves on this server's Gitea version](https://git.rkdr.net/Mortis/Kamino/issues/204), point 4: "A new push does not cancel a scheduled automerge, whoever pushes. The merge waits for the new head's checks and branch protection, then runs as the user who scheduled it." - Read again in Gitea's source at the tags `v28.0.0`, `v28.3.0` and `v28.4.0` (`services/automerge/automerge.go`): the schedule is removed only on merge, on close, on re-scheduling and on an explicit cancel. Not tested live. - [Recommended repository settings and branch protection](https://git.rkdr.net/Mortis/Kamino/issues/179): zero required approvals stay; "The agent account cannot merge: 'agents do not merge' becomes a control." - [How friends get code in](https://git.rkdr.net/Mortis/Kamino/issues/100): "Review a friend's pull request before merging it ... Held by review." - [Code-owner approval against Renovate automerge, and where secrets live](https://git.rkdr.net/Mortis/Kamino/issues/210), point 6, covers `renovate/*` and `release/*` only. - Two limits on the exposure. Stale approvals are dismissed on a push, so on code-owned files the merge waits again. On a friend's first pull request the new push's runs still wait for approval. The open path is files without a code owner, after a friend's first merge, and any branch in this repository. - Deletion: Gitea's pre-receive hook says "Detect and prevent deletion of the branch" for every branch that matches a rule, before any allowlist is read; "delete head branch after merge" uses the same check. Same text at all three tags. Renovate logs a refused delete and carries on; not certain how it treats the leftover branch on later runs. - The settings decision had said before: "`release/next`, `renovate/*` stay unprotected; their checks hold them". Not settled: no Gitea behaviour here was tested live. One test pull request on a scratch branch settles both facts.
Author
Owner

Resolution

Grilled with the session's driver on 2026-11-18/19. Each line is the rule, its reason, and how it is held.

  1. Scheduling a merge. Rule in docs/contributing/reviewing.md: "Schedule a merge only on your own pull request, on a branch nobody else pushes to. Merge a pull request you reviewed (a friend's, the agent account's, the release pull request) with the merge button, at the head you read." Reason: a scheduled merge merges whatever head the branch has when the checks pass, as whoever scheduled it, and a push does not cancel it; the merge button refuses a head that moved since the page loaded (source reading, not tested live). Held by: aspirational. The release pull request is included because the prepare job refreshes release/next on every push to main.
  2. Pushing onto others' branches. Rule in the contributing doc: "Do not push to someone else's branch or a bot's branch; put your change in your own pull request." Updating a branch from main with Gitea's update button is not a change and stays allowed. Held by: aspirational.
  3. No approval setting. One required approval with stale approvals dismissed would catch both, but it binds every pull request: it ends Renovate's automerge and a trusted contributor's self-merge on green, against the Delivery note and Renovate automerge posture. Not adopted. "Dismiss stale approvals" stays on for main, so code-owned files wait for approval again after a push.
  4. release/* keeps its push allowlist (release bot and maintainer). release/next is one branch CI reuses, so its being undeletable costs nothing; the release pull request is merged with "delete branch after merge" off. Held by: control (branch protection).
  5. renovate/* loses its push allowlist (reverses point 6 of Code-owner approval against Renovate automerge, and where secrets live for that pattern). A protected branch cannot be deleted by anyone, so every merged Renovate branch would stay, and Renovate reuses branch names. The allowlist bought little: a push onto a bot pull request can only reach version-shaped lines in unowned pin files (bot-diff gate, run from main, shape not value), code-owned files wait for approval again, and every account that can push there already reaches every secret (point 5 of the same decision). Held by: aspirational (point 2), by the maintainer's explicit choice under the Enforcement note.
  6. ADR 0001 residual risk. A writer can add a version-shaped change to a Renovate pull request that has a scheduled merge, and it merges as the Renovate bot; bounded by the bot-diff gate and code-owner approval. Trigger to revisit: a token that can push here but cannot reach the secrets.
  7. Glossary. New term Scheduled merge: "A merge set to run once the required checks pass; it merges whatever head the branch has at that moment, as the person who set it. Renovate's automerge is one." Added to the glossary issue's scope rather than edited on main.

No new ADR (one line in ADR 0001).

Not settled: no Gitea behaviour here was tested live (scheduled merge, merge button head check, deletion of protected branches). The settings issue's tests cover the release/* rule only.

Backlog

Scope added to #189 (points 1, 2), #192 (points 3-5), #143 (point 6), #215 (point 7), #175 and #242 (point 1, release pull request). No new issue: everything lands in issues that already edit those files.

## Resolution Grilled with the session's driver on 2026-11-18/19. Each line is the rule, its reason, and how it is held. 1. **Scheduling a merge.** Rule in `docs/contributing/reviewing.md`: "Schedule a merge only on your own pull request, on a branch nobody else pushes to. Merge a pull request you reviewed (a friend's, the agent account's, the release pull request) with the merge button, at the head you read." Reason: a scheduled merge merges whatever head the branch has when the checks pass, as whoever scheduled it, and a push does not cancel it; the merge button refuses a head that moved since the page loaded (source reading, not tested live). Held by: aspirational. The release pull request is included because the prepare job refreshes `release/next` on every push to `main`. 2. **Pushing onto others' branches.** Rule in the contributing doc: "Do not push to someone else's branch or a bot's branch; put your change in your own pull request." Updating a branch from `main` with Gitea's update button is not a change and stays allowed. Held by: aspirational. 3. **No approval setting.** One required approval with stale approvals dismissed would catch both, but it binds every pull request: it ends Renovate's automerge and a trusted contributor's self-merge on green, against the Delivery note and [Renovate automerge posture](https://git.rkdr.net/Mortis/Kamino/issues/97). Not adopted. "Dismiss stale approvals" stays on for `main`, so code-owned files wait for approval again after a push. 4. **`release/*` keeps its push allowlist** (release bot and maintainer). `release/next` is one branch CI reuses, so its being undeletable costs nothing; the release pull request is merged with "delete branch after merge" off. Held by: control (branch protection). 5. **`renovate/*` loses its push allowlist** (reverses point 6 of [Code-owner approval against Renovate automerge, and where secrets live](https://git.rkdr.net/Mortis/Kamino/issues/210) for that pattern). A protected branch cannot be deleted by anyone, so every merged Renovate branch would stay, and Renovate reuses branch names. The allowlist bought little: a push onto a bot pull request can only reach version-shaped lines in unowned pin files (bot-diff gate, run from `main`, shape not value), code-owned files wait for approval again, and every account that can push there already reaches every secret (point 5 of the same decision). Held by: aspirational (point 2), by the maintainer's explicit choice under the Enforcement note. 6. **ADR 0001 residual risk.** A writer can add a version-shaped change to a Renovate pull request that has a scheduled merge, and it merges as the Renovate bot; bounded by the bot-diff gate and code-owner approval. Trigger to revisit: a token that can push here but cannot reach the secrets. 7. **Glossary.** New term **Scheduled merge**: "A merge set to run once the required checks pass; it merges whatever head the branch has at that moment, as the person who set it. Renovate's automerge is one." Added to the glossary issue's scope rather than edited on `main`. No new ADR (one line in ADR 0001). Not settled: no Gitea behaviour here was tested live (scheduled merge, merge button head check, deletion of protected branches). The settings issue's tests cover the `release/*` rule only. ### Backlog Scope added to [#189](https://git.rkdr.net/Mortis/Kamino/issues/189) (points 1, 2), [#192](https://git.rkdr.net/Mortis/Kamino/issues/192) (points 3-5), [#143](https://git.rkdr.net/Mortis/Kamino/issues/143) (point 6), [#215](https://git.rkdr.net/Mortis/Kamino/issues/215) (point 7), [#175](https://git.rkdr.net/Mortis/Kamino/issues/175) and [#242](https://git.rkdr.net/Mortis/Kamino/issues/242) (point 1, release pull request). No new issue: everything lands in issues that already edit those files.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mortis/Kamino#248