Skip to content

dev-lead: enable auto-merge (squash) by default on every PR it works on #446

Closed

Description

@don-petry

Summary

The dev-lead agent enables GitHub auto-merge with squash, but only when a PR's reviewDecision is already APPROVED (see try_enable_auto_merge in scripts/dev-lead-fix-reviews.sh). That eligibility gate, plus the fact that the check only runs as a side-effect of a handful of intents, leaves several cases where auto-merge is never enabled.

Edge cases where auto-merge never gets enabled

  1. Bot approves while a required human/code-owner review is outstanding. A trusted-bot APPROVED review emits the enable-auto-merge intent, but reviewDecision is REVIEW_REQUIRED, so the function no-ops. Nothing re-attempts it.
  2. No standalone re-check. try_enable_auto_merge only runs as a side-effect of enable-auto-merge / fix-reviews / fix-bot-comment / review-changes. The retry cron only re-dispatches status=rate-limited markers, which a no-op'd enable never writes. So a PR that becomes APPROVED+mergeable via a non-review event (dismissed blocking review, last required check passing) is never picked up.
  3. Human APPROVED review. Routes to review-changes, which runs a full engine pass; try_enable_auto_merge sits behind rc == 0, so a hard engine failure blocks auto-merge — and it spends an LLM run just to enable a merge.
  4. on-mention never calls it at all.

Proposed fix (per maintainer direction)

Stop gating on reviewDecision. GitHub already holds an auto-merge PR until branch protection is satisfied (required reviews approved, review threads resolved, required checks green), so enabling early is safe and the PR merges the moment it becomes mergeable — no further dev-lead event required.

  • Drop the reviewDecision == APPROVED gate in try_enable_auto_merge (keep idempotency when auto-merge is already on).
  • Call try_enable_auto_merge from the on-mention path too (PR mentions only).

Assumption: relies on the standard pr-quality branch-protection ruleset (required review + required checks + conversation resolution) being configured, which is the documented org standard. Without it, --auto could merge a PR with no gating checks immediately.

PR: implemented in a companion PR.

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

    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