Skip to content

fix(auto-merge): wait for current-head review and pre-merge gates #548

Description

@devantler

Problem

Restricting the shared auto-merge workflow to trusted bot authors (actions#545 / draft #546) closes the human-PR bypass, but the workflow still arms eligible bot PRs immediately on opened, synchronize, or ready_for_review. Branch protection waits for CI, but it does not currently require the current-head CodeRabbit/Codex review or CodeRabbit pre-merge summary.

Live proof: trusted KSail bot PR #6058 was armed at 18:10Z, had zero review objects and no supported pre-merge result, then merged automatically at 18:30Z as soon as CodeQL finished. This contradicts the merged portfolio contract in monorepo#2128: bot auto-merge may be armed only after the current-head pentad is green.

Proposed direction

Fail closed at the shared workflow boundary:

  • keep the exact trusted-bot author gate from fix(auto-merge): restrict privileged workflow to trusted bots #546;
  • do not call gh pr merge --auto until a current-head CodeRabbit or Codex green review and a supported green CodeRabbit pre-merge result are both proven;
  • if those surfaces cannot be re-evaluated reliably from a safe event, stop auto-arming in the required workflow and leave arming to the maintenance agent after its live pentad check;
  • never treat missing, stale, inconclusive, or disabled review/pre-merge state as green.

The implementation must account for the current service-setting blockers tracked in monorepo#2123 and ksail#6051; weakening or bypassing the gate is not an acceptable workaround.

Acceptance criteria

  • A trusted-bot PR with green CI but no current-head green review is not auto-armed.
  • A trusted-bot PR with a green review but missing/stale/non-green pre-merge state is not auto-armed.
  • Only the exact current head can satisfy both review surfaces.
  • A fully green trusted-bot fixture remains eligible.
  • Human and unknown authors remain denied by fix(auto-merge): restrict privileged workflow to trusted bots #546's allowlist.
  • Tests cover missing, stale, failed, and green combinations.

Rough size

M: shared workflow state machine and tests, plus coordination with the CodeRabbit settings trackers. A conservative no-auto-arm fallback is smaller and safer than duplicating a fragile summary parser in privileged CI.

Related: actions#545, actions#546, monorepo#2123, ksail#6051, monorepo#2128.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions