Skip to content

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

Done

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

    Released (2026-11-27): PR #4519 merged into develop as 5701f13f, and its branch and worktree are cleaned up, so this claim holds no files.

    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)

    Grown set granted (2026-11-27, away run round 1, group G4): the D8.1 edit changes a generated include region, so this group also holds the scripts/build_dist.py output for the workflow-ci-contract skill and nothing else. That is .agents/skills/workflow-ci-contract/references/d-guarantees.md, its .github/skills/ and .claude-plugin/fleet-skills/skills/ copies, and .claude-plugin/fleet-skills/.source-digests/workflow-ci-contract where it changes. They are regenerated, not edited by hand. No open pull request or other claim touches them.

  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
  5. ptr727 commented on Nov 27, 2026

    @ptr727
    OwnerAuthor

    Unblocked, 2026-11-27. The maintainer granted the #4389 option 1 permissions and accepted them on the installations.

    • GET /apps/ptr727-codegen now reads checks: read and statuses: read alongside the existing three, with the App updated at 2026-11-27T16:24:37Z.
    • Per-installation acceptance cannot be read with a user token, so it rests on the maintainer's confirmation. The resumed fix's first check read under the App token is the check that proves it, so a 403 there means an installation is still pending rather than a defect in the fix.

    The parked branch burndown/merge-bot-operational-race resumes on #4389's design.

  6. removed
    blocked
    on Nov 27, 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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions