fix(rescue): automerge respects the risk gate — fail closed (#453)#454
Merged
Conversation
Two live incidents in 12 hours on a live-prod repo: rescue PRs sourced from risk:high issues auto-merged with zero review (#92 — whose 'has_tests' was a Dockerfile TEXT LINT — and #107). has_tests is a quality hint, not consent. A rescue PR still opens (work is preserved) but automerge is skipped when the source issue carries the configured risk_gate label, with a typed rescue_automerge_blocked_risk_gate event for operators. FAIL CLOSED: label-fetch failure or a missing gate config also blocks — automerge is the dangerous path; an API hiccup must not open it. TDD: gated-never-automerges, ungated-with-tests still automerges (behavior preserved), fetch-failure fails closed. Suite green. Closes #453. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
hadamrd
added a commit
that referenced
this pull request
Jun 11, 2026
…sed (#455) Live incident (getadaptiq #108, 2026-06-11): an adopted PR from a risk:high issue auto-merged MID-HUMAN-REVIEW — while the operator was running its acceptance evals, which then FAILED 2/6 deterministically. Main carried a broken routing change for ~40 minutes until the review repair landed. _enable_automerge_for_adopted_prs documents itself as mirroring _enable_automerge_for_reviewed_outcomes, but the mirror dropped risk_gated_issues. Adopted PRs predate the tick's dispatch metadata, so the gate now checks the ISSUE's labels fresh via the rescue gate's helper (promoted public; one source of truth, fail-closed on fetch failure), emitting orphan_pr_skipped reason=risk_gated. This closes the LAST of the three merge conveyors: dispatch-path gate (pre-existing), rescue-path gate (#454), adoption-path gate (this). TDD: gated-adoption never merges, fetch-failure fails closed; all existing adoption/rescue tests preserved. 44/44. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two live incidents in 12 hours on a live-prod repo: rescue PRs sourced
from risk:high issues auto-merged with zero review (#92 — whose
'has_tests' was a Dockerfile TEXT LINT — and #107). has_tests is a
quality hint, not consent.
A rescue PR still opens (work is preserved) but automerge is skipped
when the source issue carries the configured risk_gate label, with a
typed rescue_automerge_blocked_risk_gate event for operators. FAIL
CLOSED: label-fetch failure or a missing gate config also blocks —
automerge is the dangerous path; an API hiccup must not open it.
TDD: gated-never-automerges, ungated-with-tests still automerges
(behavior preserved), fetch-failure fails closed. Suite green.
Closes #453.
Co-Authored-By: Claude Fable 5 noreply@anthropic.com