fix(coalescer): treat CoalescingRefused as the documented safe no-op in main() - #1822
Merged
Merged
Conversation
…in main() current-head-run-coalescer.yml's own design comment states that CoalescingRefused (a queued run's remembered head no longer matching the live head) is "a safe no-op". coalesce()'s top-level live-PR-state check raises exactly that exception before any per-candidate loop starts, but main() only called coalesce() directly with no handling for it, so the exception propagated uncaught and crashed the required coalesce check with exit code 1 instead of the intended graceful no-op. Reproduced live on #1503 (run 33766056421, job 100684095620): a stale queued run drained from the org-wide Actions capacity backlog against an already-superseded head failed with "CoalescingRefused: pull request head moved before duplicate classification". main() now catches CoalescingRefused specifically and exits 0 with an informational message, matching the per-candidate loop's existing treatment of the same exception type. Any other exception (malformed identity, an unavailable GitHub API) still fails closed. Verification: - RED: new regression test fails against pre-fix main() with the uncaught CoalescingRefused propagating. - GREEN: coverage run -m pytest tests -- 2762 passed, 1 skipped (2 pre-existing Python 3.11-vs-3.12+ sandbox-incompatible files), 21 subtests passed. - coverage report --include='scripts/ci/*' -- 100%. - interrogate scripts/ci/current_head_run_coalescer.py -- 100%. - git diff --check -- clean. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01KPmJErfkcHer4UVEgrQxUX
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Summary
current-head-run-coalescer.yml's own design comment states thatCoalescingRefused(a queued run's remembered head no longer matching the PR's live head) is "a safe no-op."coalesce()'s top-level live-PR-state check raises exactly that exception before any per-candidate cancellation loop even starts — butmain()only ever calledcoalesce()directly with no handling for that exception, so it propagated uncaught and crashed the requiredcoalescecheck with exit code 1, instead of the intended graceful no-op.ContextualWisdomLab/.github#1503, run33766056421, jobcoalesce— a queued run drained from the org-wide Actions capacity backlog against an already-superseded head failed withCoalescingRefused: pull request head moved before duplicate classification.main()now catchesCoalescingRefusedspecifically and exits 0 with an informational message, matching the treatment the per-candidate loop insidecoalesce()already gives the same exception type. Any other exception (malformed repository/PR identity, an unavailable GitHub API) still fails closed — this is a narrow, intentional carve-out, not a general fail-open.Changes
scripts/ci/current_head_run_coalescer.py: wrap thecoalesce()call inmain()in atry/except CoalescingRefused.tests/test_current_head_run_coalescer.py: new regression testtest_main_treats_coalescing_refused_as_a_safe_no_op, confirmed failing (uncaught exception propagating) against the pre-fixmain()before the fix landed.CHANGELOG.md:## [Unreleased]entry describing the fix and the live incident it responds to.Verification
RED confirmed: the new test fails against the pre-fix
main()with theCoalescingRefusedexception propagating uncaught. GREEN confirmed after the fix.Notes for reviewers
.github-central-repo-only change (no workflow YAML edits) to a script the trustedcurrent-head-run-coalescer.ymlpull_request_targetworkflow already calls. No bypass-merge request — normal review is fine.CoalescingRefusedsignal is caught. Malformed-inputRuntimeErrors fromcoalesce()'s own validation still propagate and fail closed, unchanged.Generated by Claude Code