Repository navigation
Description
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-failedandsecurity: outside-actorwithout case; the skill's pr-verify read matches onlypr-verify-failed, exact case; - check failures: the hook blocks
failure,timed_out,cancelled,action_required,startup_failureandstale; 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 byscripts/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 andmerge_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_enabledtomerge_guard_enabledand the hook tomerge-guard.sh. A saved old-keyfalseis 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_failureandstaleblock; no agent-judged informational failure. - Tightened (both): a saved
block_unresolved_pr_merge_enabled: falseno 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 --checkpasses. - 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: falseturns the hook off;scripts/check-killswitch-hoist.shpasses.- The skill without guardrails still runs the full mechanical preflight; guardrails without source-control still enforces.
References
- docs/owner-decisions.md#L411, the owner-decision row (melodic-software/architecture#237).
plugins/source-control/skills/babysit-prs/scripts/babysit_merge_policy.pyMERGE_HOLD_LABELSand.github/scripts/lib/lane-vocabulary.mjsARM_HOLDS, the other hold-label lists.
Activity