Skip to content

Consolidate the merge gate into one shared merge-readiness script #18822

Description

@kyle-sexton

Context

The guardrails merge hook (plugins/guardrails/hooks/block-unresolved-pr-merge.sh) and the source-control pull-request skill's merge preflight (skills/pull-request/reference/merge.md §4.1 and §4.2, reference/readiness.md, reference/providers/github/pull-request/merge.md) each judge merge readiness, with different rules:

  • hold labels: the hook matches do-not-merge, pr-verify-failed and security: outside-actor without case; the skill's pr-verify read matches only pr-verify-failed, exact case;
  • check failures: the hook blocks failure, timed_out, cancelled, action_required, startup_failure and stale; the skill's Gate 2 lets an agent classify a failure as informational and proceed;
  • review threads: the hook reads the first 100 (GraphQL, then the Claude Code cloud route) and fails open past 100; the skill pages every thread over GraphQL only and holds when GraphQL is refused;
  • changes requested: only the hook blocks on a reviewer whose latest review requests changes;
  • pr-verify with no verdict: the skill merges after a 30-minute wait; the hook blocks with no time limit.

The owner decided on 2026-11-24 (~11:15 AM EST), option (a), recorded in the owner-decisions row docs/owner-decisions.md#L411 (added by melodic-software/architecture#237). Owner's concern, verbatim: "I just want to make sure there's not dual: multiple reasons to change there or potential conflict, so that they're both configured to do the same thing differently", and the toggle must "accurately represent what it's doing or what the scope is, semantically accurate", with graceful degradation when only one plugin is installed. Owner, verbatim: "Yes, go with recommendations."

Proposed work

  • One shared merge-readiness script, canonical under lib/, copied into guardrails and source-control by scripts/sync-shared-copies.sh. It owns every mechanical condition: hold labels, unresolved review threads (paged, cloud fallback), changes-requested reviews, failed check runs and statuses (with the workflow-file exemption and merge_guard_ignored_checks), pending checks for an immediate merge, and the pr-verify verdict with one 30-minute no-verdict rule.
  • The hook runs it and refuses on a block; the skill's merge preflight runs its own copy at the pinned head and holds on a block or an unreadable state.
  • Rename the toggle block_unresolved_pr_merge_enabled to merge_guard_enabled and the hook to merge-guard.sh. A saved old-key false is dropped, so the guard comes back on.
  • Settled rules: (1) an informational failure clears only through merge_guard_ignored_checks; (2) hold labels match without case, from one list; (3) the pr-verify 30-minute no-verdict rule lives only in the shared script.
  • Ownership: the shared script owns the mechanical conditions; the skill owns judgment and process (security triage, cooldown, stale base, CLEAN, unattended eligibility); GitHub rulesets are the server-side backstop.

Direction changes, per check:

  • Loosened (hook): a head with no pr-verify verdict 30 minutes after its checks completed, with none still running, is allowed, with a notice (was: blocked with no limit). Authorized by the owner-decisions row linked above, rule (3).
  • Loosened (skill): a failed check the workflow-file exemption covers no longer needs an agent's classification; a Claude Code cloud session reads threads through the cloud route instead of holding. Authorized by the same row's decision that one shared script owns the mechanical conditions for both the hook and the skill.
  • Tightened (hook): every review thread is read, past 100 (was: unchecked past 100).
  • Tightened (skill): hold labels without case; changes-requested reviews block; timed_out, cancelled, action_required, startup_failure and stale block; no agent-judged informational failure.
  • Tightened (both): a saved block_unresolved_pr_merge_enabled: false no longer turns the guard off.

Acceptance criteria

  • The hook and the skill's merge preflight both call the same shared script, and scripts/sync-shared-copies.sh --check passes.
  • A test fails on the old behavior for each difference above and passes on the new.
  • Every existing hook test passes under the renamed paths.
  • merge_guard_enabled: false turns the hook off; scripts/check-killswitch-hoist.sh passes.
  • The skill without guardrails still runs the full mechanical preflight; guardrails without source-control still enforces.

References

Activity

  1. added
    session-owned
    on Nov 24, 2026
  2. added theissue type 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

    session-owned

    Type

    Fields

    No fields configured for Task.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions