Skip to content

Watch the Merge Bot's Auto-Merge and Re-Arm a Disable GitHub Makes - #4310

Merged
ptr727 merged 8 commits into
developfrom
burndown/merge-bot-rearm
Nov 20, 2026
Merged

ptr727 merged 8 commits into
developfrom
burndown/merge-bot-rearm

Conversation

@ptr727

@ptr727 ptr727 commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

Summary

GitHub can disable an armed auto-merge with every check green. It did so on Dependabot workflow-file bumps the codegen App armed, recording the App as the disabler with reason code workflow_policy_update_error. gh pr merge --auto only arms the merge, so the merge-bot job stayed green and the pull request stayed open.

This follows the maintainer's decisions on the issue: the App keeps its permissions (option 1), and the merge bot answers the disable on its own event rather than by polling.

  • App permissions, read first. GET /apps/ptr727-codegen reports contents: write, metadata: read, and pull_requests: write, with no workflows permission. That matches the recorded reason. Nothing here changes them.
  • Caller stubs add the event. The hub's own .github/workflows/merge-bot-pull-request.yml, the catalog snippet, and the stub in docs/reusable-workflows.md now trigger on auto_merge_disabled as well. Every job of the currently pinned task skips that event, since each one's if: needs opened, reopened, synchronize, or closed. So a stub carrying the event under an older pin is a no-op until its pin reaches the release with the re-arm job. Downstream stubs take it on their next resync.
  • New rearm-auto-merge job in .github/workflows/merge-bot-task.yml, running on that event with no runner held while waiting for it. It acts only on a pull request the merge jobs would arm: an in-repo Dependabot pull request, or an App head that merge-app's rule matches. merge-app resolves that rule on the event without arming, so a no-auto-merge- head is never re-armed.
    • Not open, already armed again, or disabled by anyone but the App (read from the token's app-slug): it leaves the disable alone.
    • The head is not the bot's own push: it leaves the disable alone. That covers the maintainer-push disable, which runs under the same App token. The check needs the bot as the head commit's author, and no force push onto the head from anyone else.
    • A second App-recorded disable on the same head: it fails.
    • Otherwise it waits for the base to stay unchanged for 60 seconds, for at most five minutes, then re-arms once, pinned to the head it read.
    • Where every check is green, gh merges at once instead of arming. In the workflow-permission case GitHub refuses that merge, and the job fails. That is visibility, not recovery, and D8.1 says so.
  • The initial arming in both merge jobs pins the event's head too, and one workflow-level MERGE_METHOD replaces their two case blocks.
  • Inputs and secrets are unchanged, so every existing caller stays compatible.
  • WORKFLOW.md D8.1 states the re-arm, and limits "merges or fails visibly" to a pull request the merge-bot armed. The branching-and-release-model branch-protection reference and docs/reusable-workflows.md say the same. The include region in the workflow-ci-contract D-guarantees reference and the generated skill copies are regenerated by scripts/build_dist.py.
  • The branch-protection reference named a merge-codegen job that does not exist; it is merge-app. Corrected.

Verification

  • The re-arm step's script was extracted from the YAML and run against a mocked gh. The cases: a first disable re-armed, a Dependabot rebase then re-armed, a maintainer amend with a force push, a maintainer commit, an older head's disable ignored, and a second disable failing. Also a person's disable, closed, already armed, an unreadable disable event, and a refused merge. Also a settle ending on a head move, a maintainer push, or a close, and a base that never settles. Each ended as described above.
  • The GraphQL queries were run read-only against real pull requests. The recorded disabler reads ptr727-codegen[bot]. Across 97 sampled fleet disables, only closed and workflow_policy_update_error occur.
  • actionlint (with its shellcheck pass), editorconfig-checker, markdownlint, the repo gate, build_dist.py --check, the prose gate, and the unit tests (4550, OK, which include the stub-equals-snippet check) pass locally.
  • The live re-arm cannot be exercised from the hub, since it needs a refused merge. The first workflow-file bump after this merges is the hub's own proof, since the hub's caller reaches the task locally.

Deferred

Earlier rounds

An earlier head of this branch carried a 30-minute polling watch. The maintainer replaced it with the event-driven re-arm, since a burst of watches could fill the account's concurrent-job limit. The hosted-review threads raised on that head are answered in their threads.

Closes on promotion: #4063

🤖 Generated with Claude Code

ptr727 and others added 3 commits November 19, 2026 17:58
GitHub can disable an armed auto-merge with every check green, as it did
for workflow-file bumps the codegen App may not merge after the base moved.
gh pr merge --auto only arms the merge, so the stall left no failure.

A new watch-auto-merge job runs after arming, and after the bot's own push
while armed. It re-arms a disable the App was recorded for once the base
branch has settled, and fails on a second disable or on a 30-minute window
with no merge. A person's disable is left in place, and any head push hands
the watch to the run for that push. The App's permissions are unchanged.

WORKFLOW.md D8.1, the branch-protection reference, and the reusable
workflows doc state the watch.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A watch that saw GitHub disable auto-merge ended when the bot pushed
before the re-arm, and the run for that push read the PR as unarmed and
did nothing. That run now treats a disable the App is recorded for as its
own to re-arm.

The base-to-method mapping moves to one workflow-level MERGE_METHOD, so
the two merge steps and the re-arm share it rather than each carrying a
case statement.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The disabler of a refused merge is the App that minted the arming token,
so the watch compares it against that token's app-slug rather than the
app-login input, which a caller may point at another App. The settle wait
ends on a close, a merge, a head push, or another arming, so the loop's
own checks act on it rather than holding the concurrency group. The re-arm
warning no longer credits GitHub with a disable the maintainer-push job
made, and D8.1 drops a warning the synchronize path does not emit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI lite review requested due to automatic review settings November 20, 2026 02:23
@ptr727 ptr727 added the comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses label Nov 20, 2026
@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 5 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 8b8d9b0 and bf77b62.

Files ignored due to path filters: 6

  • .claude-plugin/fleet-skills/.source-digests/branching-and-release-model is excluded by !.claude-plugin/fleet-skills/**
  • .claude-plugin/fleet-skills/.source-digests/workflow-ci-contract is excluded by !.claude-plugin/fleet-skills/**
  • .claude-plugin/fleet-skills/skills/branching-and-release-model/references/branch-protection-and-promotion.md is excluded by !.claude-plugin/fleet-skills/**
  • .claude-plugin/fleet-skills/skills/workflow-ci-contract/references/d-guarantees.md is excluded by !.claude-plugin/fleet-skills/**
  • .github/skills/branching-and-release-model/references/branch-protection-and-promotion.md is excluded by !.github/skills/**
  • .github/skills/workflow-ci-contract/references/d-guarantees.md is excluded by !.github/skills/**
Files selected for processing: 7

  • .agents/skills/branching-and-release-model/references/branch-protection-and-promotion.md
  • .agents/skills/workflow-ci-contract/references/d-guarantees.md
  • .github/workflows/merge-bot-pull-request.yml
  • .github/workflows/merge-bot-task.yml
  • WORKFLOW.md
  • catalog/snippets/workflows/merge-bot-pull-request.yml
  • docs/reusable-workflows.md
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@ptr727

ptr727 commented Nov 20, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head dc83e5e61258006f8b989f55c6f9426fecd94a23, the content this pull request carries at that commit against develop, and it recorded 4 findings.

The bot-push path could re-arm an App pull request the rules leave
unmerged, such as a no-auto-merge- head a maintainer had armed by hand.
merge-app now resolves its rule on the bot's own push too, arming
nothing there, and the watch takes that path only for Dependabot or a
matched App head.

The re-arm pins the head it read, so a push landing after that read is
not armed. The watch step drops an unused BASE_REF, the re-arm error
names the method it used, and the merge jobs' comments no longer call
the maintainer-push disable sticky.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Multiple active critical issues remain in the merge-bot workflow, including unsafe re-arming, incorrect maintainer-disable detection, and failure to pin the Dependabot head before arming.

6 open issues
What changed in this PR

This pull request hardens the reusable merge bot against GitHub disabling auto-merge after workflow-file changes by adding bounded monitoring and recovery, then updates the related workflow contracts and generated references.

Changes:

  • Adds shared merge-method mapping, arming outputs, and a 30-minute auto-merge watcher with one re-arm attempt.
  • Documents watcher behavior and visible failure handling across workflow and branching references.
  • Regenerates the affected skill distributions and source digests.
File Description
WORKFLOW.md Updates D8.1 with the merge-bot auto-merge monitoring and recovery contract.
docs/​reusable-workflows.md Documents watcher behavior and failure handling for downstream workflow callers.
.github/​workflows/​merge-bot-task.yml Implements shared merge-method mapping, arming outputs, auto-merge monitoring, and re-arming.
.github/​skills/​workflow-ci-contract/​references/​d-guarantees.md Regenerates the workflow guarantee reference.
.github/​skills/​branching-and-release-model/​references/​branch-protection-and-promotion.md Updates branch-protection and merge-bot behavior guidance.
.claude-plugin/​fleet-skills/​skills/​workflow-ci-contract/​references/​d-guarantees.md Regenerates the Claude workflow guarantee skill copy.
.claude-plugin/​fleet-skills/​skills/​branching-and-release-model/​references/​branch-protection-and-promotion.md Regenerates the Claude branching and promotion skill copy.
.claude-plugin/​fleet-skills/​.source-digests/​workflow-ci-contract Updates the generated workflow skill source digest.
.claude-plugin/​fleet-skills/​.source-digests/​branching-and-release-model Updates the generated branching skill source digest.
.agents/​skills/​workflow-ci-contract/​references/​d-guarantees.md Updates the authored workflow guarantee reference.
.agents/​skills/​branching-and-release-model/​references/​branch-protection-and-promotion.md Updates the authored branching and promotion reference.

Review effort: Lite

Comment thread .github/workflows/merge-bot-task.yml Resolved
Comment thread .github/workflows/merge-bot-task.yml Resolved
Comment thread .github/workflows/merge-bot-task.yml Resolved
Comment thread .github/workflows/merge-bot-task.yml Resolved
Comment thread .github/workflows/merge-bot-task.yml Resolved
merge-app now runs its rule step on the bot's own push, so the
branch-protection reference says the merge jobs arm only on opened or
reopened rather than fire only then. A settle cut short by the watch
window's end now says the window ran out, rather than pointing at base
churn that may not have happened.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@codecov

codecov Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.06%. Comparing base (b38e084) to head (bf77b62).
⚠️ Report is 265 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4310      +/-   ##
===========================================
- Coverage    81.60%   79.06%   -2.55%     
===========================================
  Files           26       43      +17     
  Lines         9070    15739    +6669     
===========================================
+ Hits          7402    12444    +5042     
- Misses        1668     3295    +1627     
Flag Coverage Δ
python-3.13 79.06% <ø> (-2.55%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

D8.1 now says the maintainer-push disable holds until the bot itself
pushes again, and that a head push ends the watch while only the bot's
own push starts a new one. The deadline error names the watch's start
rather than the arming, which on a bot push may be hours earlier.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ptr727

ptr727 commented Nov 20, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head 7f630aa8d6377d71455edfbeb8df18e40da9ecf4, the content this pull request carries at that commit against develop, and it recorded 2 findings.

The maintainer chose an event-driven re-arm on #4063. The polling
watch-auto-merge job is gone, so no runner slot is held while waiting.
The caller stubs, the hub's own and the catalog snippet, add the
auto_merge_disabled event, and a short rearm-auto-merge job answers it.

The job answers only a pull request the merge jobs would arm: Dependabot,
or an App head merge-app's rule matches, which it resolves on the event.
It acts on a disable recorded under the App when the head commit is the
bot's own. It waits up to five minutes for the base to settle, then
re-arms once, pinned to the head it read. A second such disable on the
head fails it. Where every check is green gh merges at once, so a refused
merge fails the job, which D8.1 now states as visibility rather than
recovery. D8.1's merges-or-fails sentence is limited to a pull request
the merge-bot armed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
An amend or rebase keeps the bot as the head commit's author, so the
re-arm job also requires that no force push onto the head came from
anyone but the bot. It reads the head commit through the head ref rather
than the last listed commit.

The initial arming pins the event's head, the rule and re-arm jobs skip
an auto_merge_disabled payload whose pull request is no longer open, and
the comment above check_pr says why it re-reads.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ptr727

ptr727 commented Nov 20, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head bf77b6283b97bdcf80f99c40db400fc3a06cd972, the content this pull request carries at that commit against develop, and it recorded 0 findings.

@ptr727

ptr727 commented Nov 20, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@ptr727

ptr727 commented Nov 20, 2026

Copy link
Copy Markdown
Owner Author

/review

@coderabbitai

coderabbitai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@ptr727
ptr727 merged commit 0b06540 into develop Nov 20, 2026
13 checks passed
@ptr727
ptr727 deleted the burndown/merge-bot-rearm branch November 20, 2026 03:26
ptr727 added a commit that referenced this pull request Nov 20, 2026
…d, and Hub Pin Drift (#4315)

## Summary

Promotes `develop` to `main`. It carries these changes:

- [#4303](#4303) orders
the STANDUP.md seed push, carry commits, and secret hand-over.
- [#4304](#4304) forbids
state-changing probes and routes observed secrets to revocation.
- [#4305](#4305) routes
SIGINT and SIGTERM through one handler, bounds the child wait, and
states two stop paths.
- [#4306](#4306) holds
`pr_review.py merge` for a hosted review not registered yet.
- [#4309](#4309) reads the
branch before the tree so an empty root commit resolves its secrets.
- [#4310](#4310) watches
the merge bot's auto-merge and re-arms a disable GitHub makes.
- [#4311](#4311) counts
untracked files in the dirty stamp and states the session tree bound.
- [#4314](#4314) reports
each caller's hub pin behind the newest release as drift past a 30-day
bound.

Related issues #4308, #4312, and #4313 stay open.

Fixes #1418
Fixes #4137
Fixes #4063
Fixes #4147
Fixes #2598
Fixes #4128
Fixes #4240
Fixes #4229
Fixes #3806
Fixes #4146
Fixes #4100
Fixes #4218
Fixes #4223
Fixes #4228
Fixes #4224

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **New Features**
* Repository audits now report outdated reusable-workflow pins as
advisories or drift, with advisory findings kept separate from blocking
issues.
* Merge automation can retry enabling auto-merge after the base branch
settles; unsupported target branches and refused merges are reported as
failures.
* Pull-request checks now account for a brief hosted-review registration
window before reporting checks as pending.

* **Bug Fixes**
* Empty repositories and empty root commits are handled correctly when
resolving repository secrets.
* Long-running tools improve cleanup and signal handling when
interrupted.

* **Documentation**
* Updated guidance for repository setup, review handling, workflow
automation, and safe verification practices.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
ptr727 added a commit that referenced this pull request Nov 20, 2026
…4326)

## Summary

#4310 moved the merge bot's re-arm onto the pull request
`auto_merge_disabled` event, which each caller stub has to subscribe to.
Nothing audited that subscription. `requireTokensInJob` reads one job,
and a stub's `on:` types sit outside every job, so a repository keeping
its old stub passed the audit while the re-arm job never ran there.

- `spec/audit_contract.py` (new): a file-level `requireTokens` contract
key, read against the whole caller file's code view, so a comment naming
the token does not satisfy it. A missing token is `DRIFT`, matching the
other interface contract keys. The module holds every contract token
check, so `artifactNameToken`, `requireTokensInJob`, and
`forbidTokensInJob` move here too, with their findings, messages, and
order unchanged.
- `spec/audit.py`: `check_interface` calls the new module. The file goes
from 2996 to 2977 lines. Its 3000-line ceiling is unchanged.
- `spec/files.json`: the merge-bot entry requires `auto_merge_disabled`.
- `spec/files.schema.json` and `spec/validate.py`: declare the key and
validate it as an array of strings.
- `tests/test_audit_helpers.py`: a pass case, a fail case, a
comment-only case, and a check that the hub's own stub and the catalog
snippet meet the carried contract. A further case runs the validator
over a manifest whose `requireTokens` is a single string and asserts its
refusal. The two shipped-stub cases share one contract lookup.
- `tests/test_audit_size.py`: a 200-line ceiling for the new module.
- `spec/fidelity-model.md`: a caller stub's contract now also covers an
activity type its hub task needs it to subscribe to.

## Fleet effect: drift, not an advisory

A read of each registry repository's default-branch stub found that 20
cataloged repositories still lack `auto_merge_disabled`, plus 1 archived
one. Only the hub's own stub has it. Each of those now draws one `DRIFT`
finding from the `interface` check on `merge-bot-pull-request.yml`.

That is drift rather than an advisory, for these reasons:

- The stub is carried content. A hub change to a carried unit puts every
carrier out of line until that carrier's next resync, and the drift
finding is what drives the resync to carry it. The new subscription
rides each repository's next resync the way any other carried-stub
change does.
- Nothing else moves it. An advisory fits a gap an automatic mechanism
closes on its own, as Dependabot does for a hub pin under `pins.age`. No
mechanism edits a stub's `on:` types.
- The gap is a functional one. Without the subscription the re-arm job
never runs, which is the silent stall #4063 fixed.

A repository that holds the old stub on purpose can say so with a
registry `driftNote`, as for any other drift.

## Verification

- `uv run --no-project --script spec/validate.py`: OK.
- `python -m unittest discover -s tests` with `tests/requirements.txt`:
4618 tests, OK (12 skipped).
- `spec/audit.py --selftest` passes.
- `ruff check`, `ruff format --check`, `mypy`, and the prose gate are
clean.

Closes on promotion: #4313

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants