Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions .github/workflows/current-head-run-coalescer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@ on:

concurrency:
group: current-head-run-coalescer-${{ github.repository }}-${{ github.event.pull_request.number }}
# Do not restore cancel-in-progress: true here. This job is the control-plane
# worker that retires redundant runs; cancelling it during a push burst lets
# the redundant runs survive and worsens the 60-job ceiling.
# The active worker must finish because it retires redundant runs that consume
# the shared Actions ceiling. A later synchronize event must not kill it.
cancel-in-progress: false
# Keep exactly one pending successor. GitHub replaces that pending run when a
# newer event enters the group, so the retained successor always represents
# the latest head instead of accumulating up to 100 stale-head invocations.
# The script still verifies the event-bound expected head against the live PR
# before any mutation and fails closed if the head moved again.
queue: single

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Cleanup runs starve during push bursts

During runner starvation, queue: single replaces each waiting cleanup whenever another push arrives. Sustained pushes can prevent cleanup from running, leaving redundant jobs consuming the shared ceiling.

Prompt for agents
Restore the multi-pending concurrency policy for .github/workflows/current-head-run-coalescer.yml and update its adjacent explanation and regression contract together. The workflow needs to retain pending cleanup invocations during runner starvation rather than replacing the sole pending invocation on every synchronize event. Preserve cancel-in-progress: false because active cleanup workers must finish, and keep the script's existing live-head fail-closed validation for older triggers.
Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +12 to +17

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 PR narrative describes reversed policy

The description promises queue: max, while the final head requires queue: single. Update the review and release record after restoring the intended policy.

Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.


permissions:
actions: write
Expand Down
8 changes: 5 additions & 3 deletions tests/test_current_head_coalescer_self_cancellation.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""Regression contract for the run-coalescer worker's own concurrency policy."""
"""Regression contracts for the run-coalescer worker's concurrency policy."""

from pathlib import Path

Expand All @@ -7,8 +7,8 @@
WORKFLOW_PATH = REPOSITORY_ROOT / ".github" / "workflows" / "current-head-run-coalescer.yml"


def test_current_head_coalescer_cannot_cancel_its_active_cleanup_worker() -> None:
"""Push bursts must queue the next cleanup instead of killing the active cleanup."""
def test_current_head_coalescer_preserves_active_worker_and_latest_pending_event() -> None:
"""Push bursts must keep the active cleanup plus the latest pending trigger."""
workflow_text = WORKFLOW_PATH.read_text(encoding="utf-8")
concurrency_block = workflow_text.split("concurrency:", 1)[1].split("\npermissions:", 1)[0]
active_lines = [
Expand All @@ -19,3 +19,5 @@ def test_current_head_coalescer_cannot_cancel_its_active_cleanup_worker() -> Non

assert "cancel-in-progress: false" in active_lines
assert "cancel-in-progress: true" not in active_lines
assert "queue: single" in active_lines
assert "queue: max" not in active_lines
Loading