Repository navigation
feat(ci): 3-strikes circuit breaker for status:needs-info loops - #342
Conversation
Requested directly: nothing currently bounds a LONGER-term cycle where an issue/PR bounces status:needs-info -> (human answers, pipeline retries) -> fails again -> status:needs-info -> ... indefinitely, each time looking like a fresh question rather than a pattern. Part 3's existing retry-once guard only bounds a single sweep run's own retry attempt, not the item's whole lifetime. Adds a circuit breaker at the top of Part 3, checked before anything else (including the security/release-blocker exclusion — a stuck security item should get MORE visible, not silently skipped): count how many times status:needs-info has ever been applied to the item via GitHub's timeline API (cumulative, survives a human intervening once already). At 3+, swap status:needs-info for a new status:escalated label and stop all automated handling of that item permanently - status:escalated is a one-way door, treated everywhere in the persona exactly like status:blocked. Only a human clears it. Also fixes a real gap the first live end-to-end test (workflow_dispatch) surfaced: Part 1/2's stale-close actions were never actually logged to docs/human-merge-sweep-log.md despite its own header claiming closes are covered - only the merge path had explicit log-append instructions. Fixed both, and backfilled the two entries the test run's real closes (#332, #295, both verified against ground truth) should have produced. Fixed a duplicate step-6 numbering bug introduced while restructuring Part 3 for the circuit breaker. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
📱 iOS Build Status: PASSED✅ iOS Simulator Build & Unit Tests - success iOS UI tests run in a separate, informational job and are not reflected above — check "iOS UI Tests (informational)" for those. |
CONFIRMED finding from principal review: the circuit breaker's gh issue edit/gh pr edit --add-label status:escalated call would have failed on its very first real trigger (HTTP 422, "Label does not exist") - nothing in the PR, the persona, or the workflow ever created the label itself, and this repo has no labels-sync workflow (every status:* label here is created manually, out-of-band). Created status:escalated now (color b60205, matching security/ release-blocker's "human must act" color rather than status:blocked's "someone chose to pause this" red), matching every other status:* label's existing description-sentence convention. Added a note in the persona explaining the label is expected to already exist, so a future "label does not exist" failure reads as "someone deleted it" rather than a mystery. Also fixed the doc-nit flagged in the same review: human-merge-sweep-log.md's top-of-file summary line didn't mention escalation rows, even though the paragraph the previous commit touched already did. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Addressed both review rounds: CONFIRMED fixed: created `status:escalated` as a real repo label (`b60205`, matching `security`/`release-blocker`'s "human must act" color) — the circuit breaker's `--add-label` call would have 422'd on its first real trigger otherwise. Added a note in the persona so a future "label does not exist" failure reads as "someone deleted it," not a mystery. Doc nit fixed: `human-merge-sweep-log.md`'s top summary line now mentions escalation rows. Design tradeoff, not fixed — deliberate, flagging for the record: the counter is cumulative over the item's whole lifetime, so a long-lived multi-phase issue that hits 3 unrelated needs-info cycles months apart (one resolved cleanly, two more later) escalates on the 3rd regardless of how healthy the interim history was. This matches the literal request ("if an issue or PR has had three times a requirement for human intervention") and the reviewer confirmed it's currently inert — no real issue in this repo has count > 1 yet. Keeping it simple for v1; a consecutive-only or time-windowed counter is a reasonable future refinement if this proves too aggressive in practice. |
📱 iOS Build Status: PASSED✅ iOS Simulator Build & Unit Tests - success iOS UI tests run in a separate, informational job and are not reflected above — check "iOS UI Tests (informational)" for those. |
…344) Previously a manually-opened PR with no resolvable "Closes #N" line exited pr-intake.yml's guard early with no risk:*/status:* label applied at all, requiring a human to notice and hand-label it (as happened for PRs #326, #335, #342). Now it still runs classify_pr_risk.py and routes into the pipeline — status:needs-qa when an issue is linked (unchanged), status:needs-review when it isn't, since qa-agent.yml hard-stops on a missing linked issue (no acceptance criteria to check) while principal-review.yml already tolerates one gracefully. Closes #343 Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
What
Requested directly, after the first live end-to-end test of
human-merge-sweep.yml(PR #335) ran clean: nothing currently bounds a longer-term cycle where an issue/PR bouncesstatus:needs-info→ (human answers, pipeline retries) → fails again →status:needs-info→ ... indefinitely. Part 3's existing "retry once per sweep run" guard only bounds a single automated retry attempt — it doesn't stop the same item from cycling back toneeds-infoa 2nd, 3rd, 4th time over its whole lifetime, each time looking like a fresh first-time question rather than a pattern worth a human's specific attention.What's here
A circuit breaker at the very top of Part 3, checked before anything else — including the security/release-blocker exclusion, deliberately: a security-sensitive item stuck in a loop should become more visible, not silently skipped.
status:needs-infohas ever been applied to the item, via GitHub's timeline API (gh api .../issues/<n>/timeline) — cumulative over the item's whole life, survives a human intervening once already.status:needs-infofor a newstatus:escalatedlabel, posts one comment naming the count, logs the escalation, and stops touching that item permanently.status:escalatedis a one-way door — only a human clears it (typically alongside actually fixing the underlying problem). Treated everywhere in the persona exactly likestatus:blocked.Also fixed, found by the live test
The first
workflow_dispatchtest run ofhuman-merge-sweep.yml(see run 32342454728) worked correctly end-to-end and found two real stale/superseded PRs (#332, #295 — both verified against ground truth: genuinely superseded by already-merged PRs #333/#296 fixing the identical issue) — but its own final report flagged that neither close got logged todocs/human-merge-sweep-log.md, because Part 1/2's close instructions never actually said to log them, despite the log's own header claiming closes are covered. Fixed both instructions and backfilled the two missing entries.Also fixed a duplicate step-6 numbering bug introduced while restructuring Part 3.
Risk
Same disclosure as #335:
.claude/agents/human-merge-sweep-agent.mdanddocs/*.md— the former is asensitive_pathsmatch (.claude/agents/**), so this needs a human's own read regardless of how the diff looks. No workflow YAML changes this time (the circuit breaker needs no new permissions — it's a read of an already-accessible API plus a label change already covered by existingissues: write/pull-requests: write).🤖 Generated with Claude Code