feat: add PR-only queue cleanup mode with per-PR dispatch gates (Closes #390)

Adds canonical pr-queue-cleanup workflow, report verifier, reviewer-only task
routing, and runbook guidance so operators can drain open PRs one canonical
review at a time with fail-closed boundaries on batching and unauthorized merges.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This commit is contained in:
2026-07-07 10:02:49 -04:00
co-authored by Claude Opus 4.8
parent ae566d5cd1
commit 91c67930ec
14 changed files with 642 additions and 1 deletions
+29
View File
@@ -1699,6 +1699,11 @@ def build_final_report(checkout_proof, inventory, validation, contamination,
if report_text and _QUEUE_STATUS_REPORT_HINT.search(report_text)
else {"proven": True, "block": False, "reasons": [], "violations": []}
)
pr_queue_cleanup_report = (
assess_pr_queue_cleanup_report(report_text)
if report_text and _PR_QUEUE_CLEANUP_REPORT_HINT.search(report_text)
else {"proven": True, "block": False, "reasons": [], "violations": []}
)
proof_wording = (
assess_proof_wording(report_text)
if report_text
@@ -1875,6 +1880,11 @@ def build_final_report(checkout_proof, inventory, validation, contamination,
"queue-status report violates loaded workflow proof gates (#339)"
)
downgrade_reasons.extend(queue_status_report.get("reasons", []))
if not pr_queue_cleanup_report.get("proven"):
downgrade_reasons.append(
"PR-only cleanup report violates cleanup-mode proof gates (#390)"
)
downgrade_reasons.extend(pr_queue_cleanup_report.get("reasons", []))
if not already_landed_handoff.get("proven"):
downgrade_reasons.append(
"already-landed controller handoff has stale or inconsistent fields (#299)"
@@ -1978,6 +1988,12 @@ def build_final_report(checkout_proof, inventory, validation, contamination,
"queue_status_violations": list(
queue_status_report.get("violations") or []
),
"pr_queue_cleanup_report_proven": bool(
pr_queue_cleanup_report.get("proven")
),
"pr_queue_cleanup_violations": list(
pr_queue_cleanup_report.get("reasons") or []
),
"already_landed_handoff_proven": bool(already_landed_handoff.get("proven")),
"already_landed_handoff_violations": list(
already_landed_handoff.get("reasons") or []
@@ -4809,6 +4825,19 @@ _QUEUE_STATUS_REPORT_HINT = re.compile(
re.I,
)
_PR_QUEUE_CLEANUP_REPORT_HINT = re.compile(
r"workflows/pr-queue-cleanup\.md|task:\s*pr-queue-cleanup|"
r"pr[- ]only queue cleanup",
re.I,
)
def assess_pr_queue_cleanup_report(report_text: str | None) -> dict:
"""#390: validate PR-only cleanup final reports (one PR per run)."""
from pr_queue_cleanup import assess_pr_queue_cleanup_report as _assess
return _assess(report_text or "")
_GATE_PASSED_VALUE = re.compile(r"\bpassed\b", re.I)
_NOT_APPLICABLE_VALUE = re.compile(