Skip to content

fix(upstream-sync): approve the held bot-PR run before merging - #61

Merged
negoro26 merged 2 commits into
mainfrom
fix/sync-held-bot-run
Dec 2, 2026
Merged

negoro26 merged 2 commits into
mainfrom
fix/sync-held-bot-run

Conversation

@negoro26

@negoro26 negoro26 commented Dec 2, 2026 •

Copy link
Copy Markdown
Owner

Summary

Since GitHub's June 2026 change, a PR opened with github.token gets its pull_request workflow run held (action_required) until a user with write access approves it. That held run blocks the main ruleset, even though upstream-sync already dispatched gate.yml on the same commit and all three required checks passed there.

This stalled sync PR #60 on Nov 29. The sync job opened #60. The dispatched gate passed gate, smoke and statechart with the required app ID. The merge job then failed with "the base branch policy prohibits the merge". GraphQL showed mergeStateStatus: BLOCKED with no status rollup. Once I approved the held run (46279459801) and it passed, #60 turned CLEAN, MERGEABLE, rollup SUCCESS, and merged as e0a95ac. Every sync after that stopped at the open-PR guard, including the Dec 2 run for upstream eb55343.

What changes:

  • The merge job clears the held run first. It finds the held gate.yml pull_request run at the sync commit, approves it with the job's own token, and waits for it to pass, then merges. If GitHub refuses the bot's approval, the job says so and the merge fails as before, leaving the PR open for a human. After approving, it waits for the run to leave its held state before watching it.
  • The merge job's permissions are explicit: actions: write to approve, watch and cancel, plus contents: write and pull-requests: write to merge.
  • The harness tests the new merge.land step. omp-port/test-upstream-sync.sh now extracts and runs it against the gh stub, with three cases:
    • The held run at the built commit is approved and watched. A held run at an older commit, and a finished run at the same commit, are left alone.
    • When approval is refused, the run is cancelled and the merge still runs.
    • With no held run, nothing is approved and the merge runs.
  • PORTING.md describes the step.

Unverified. GitHub does not document whether the workflow token may approve a held run. Third-party reports say it can with actions: write. The next real sync shows which, because both outcomes print a line. Upstream eb55343 is already waiting, so the next scheduled run tests this.

Verification

  • /usr/bin/bash omp-port/test-upstream-sync.sh passes.
  • Old workflow. Run against the old workflow, the harness fails at extracting merge.land.
  • Mutation 1. Removing the action_required filter fails "leaves a run that already finished alone".
  • Mutation 2. Removing the cancel fallback fails "cancels the run it could not approve".
  • actionlint 1.7.12 is clean on both workflows.
  • CANON=/tmp/cursor-plugins /usr/bin/bash omp-port/check-port.sh prints check-port: PASS.

Review round

Reviewer: APPROVE (0.8). I applied its points. The cancel fallback is gone: a held run already reports completed, so GitHub would refuse the cancel. The job now waits for the approved run to start before watching it. New cases pin that a failed held run blocks the merge, that the merge comes after the approval, and that only the gate's pull_request runs on the sync branch are listed. Each of those mutations now fails the harness.

@negoro26
negoro26 merged commit 44ee50d into main Dec 2, 2026
6 checks passed
@negoro26
negoro26 deleted the fix/sync-held-bot-run branch December 2, 2026 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant