Skip to content

Merge Bot Fails on an Operational Develop When a Check Is Still Running #4377

Backlog

Description

@ptr727

Defect

merge-bot-task.yml's merge-dependabot job fails intermittently on an operational repository's develop leg. That leaves the Dependabot pull request open, and the next develop -> main promotion conflicts on the pin lines.

The step runs gh pr merge --auto "$MERGE_METHOD" --match-head-commit "$HEAD_SHA" "$PR_URL". An operational develop ruleset has no required status checks, so GitHub cannot arm auto-merge on it. gh falls back to an immediate merge only when the pull request reads CLEAN at that instant. When another check is still running, the pull request reads UNSTABLE, gh calls enablePullRequestAutoMerge, and GitHub refuses:

GraphQL: Pull request Branch does not have required protected branch rules (enablePullRequestAutoMerge)

The job only runs on opened or reopened, so nothing retries it.

Evidence

Shape of a fix

Not prescribed. One option: where the base branch's ruleset requires no checks, wait for the pull request's checks and merge directly, or let a failed arm trigger a bounded retry, rather than relying on --auto alone.

Hit while promoting ptr727/HomeAssistant-Config develop to main.

🤖 Generated with Claude Code

Activity

  1. ptr727 commented on Nov 24, 2026

    @ptr727
    OwnerAuthor

    Backlog burndown claim (away run 2026-11-24, round 1, group 1): branch burndown/merge-bot-operational-race, issue #4377.

    Predicted files:

    • .github/workflows/merge-bot-task.yml, the merge-dependabot and merge-app merge steps, which share the gh pr merge --auto call.
    • tests/test_merge_bot_rearm.py, or the test file that covers the changed step.
    • WORKFLOW.md, D8.1, only where the change makes its "the required checks are the gate" statement false for an operational develop.
    • docs/reusable-workflows.md, only where it describes how the merge-bot arms.

    Any other group needing one of these files waits for this branch to merge.

    Parked on #4389: the fix needs a check read the merge-bot token lacks. Branch holds no commits; worktree left standing. State: #4377 (comment)

  2. ptr727 commented on Nov 24, 2026

    @ptr727
    OwnerAuthor

    Parked on #4389 (away run 2026-11-24, round 1, group 1).

    • Done: diagnosis only. No code is written and no pull request is open.
    • Branch: burndown/merge-bot-operational-race, cut from origin/develop at 477c4d1f, holding no commits and not pushed.
    • Worktree: left standing and clean at ~/repos/worktrees/ProjectTemplate-merge-bot-operational-race.
    • Why parked: a fix that keeps D8.1's "the checks are the gate" must wait for the head's checks, and the App token every merge-bot call uses cannot read checks or commit statuses. Giving the job that read is an App setting or a change to every caller stub, and the alternative merges without checks. Decide How the Merge Bot Reads Checks to Wait on a Base Requiring None #4389 holds the measurements and the three options.
    • What remains, once Decide How the Merge Bot Reads Checks to Wait on a Base Requiring None #4389 is answered: under option 1 or 2, a merge step that reads the base's rules. With no required_status_checks rule there, it waits for every check on the pinned head except the merge-bot's own workflow's runs, under a bound inside the job's timeout. It then merges directly, and fails visibly on a failed check, a moved head, or the bound. A base with required checks keeps arming. Both merge-dependabot and merge-app share the step. Tests go in tests/test_merge_bot_rearm.py with a stubbed gh, and D8.1 and docs/reusable-workflows.md change only where the new path makes them false. Under option 3, a bounded re-run of the arm while the pull request reads UNKNOWN.
    • Correction to the defect text: gh pr merge --auto merges at once on UNSTABLE as well as CLEAN, so it arms only from a state such as UNKNOWN. The legs that merged did so before their lint job finished.
  3. ptr727 commented on Nov 24, 2026

    @ptr727
    OwnerAuthor

    Blocked on a maintainer step (2026-11-24): #4389 was answered as option 1. Before this resumes, the maintainer changes the codegen GitHub App's permissions to add checks: read and statuses: read, and then accepts the new permissions on each installation. Remove the blocked label once every installation has accepted. The parked branch burndown/merge-bot-operational-race then resumes on #4389's design.

  4. added
    blocked
    on Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    blocked

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions