Skip to content
Merged
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
18 changes: 17 additions & 1 deletion .github/workflows/pr-review-merge-scheduler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,23 @@ on:
default: ""
type: string
schedule:
- cron: "*/30 * * * *"
# scan-pr-queue's own repository-local heartbeat. org-queue-sweep below
# explicitly excludes ContextualWisdomLab/.github from its target list
# (a PR in THIS repository, including one editing the governance
# workflows themselves, is never covered by the org-wide sweep), so this
# is the only periodic fallback for this repository's own PR queue. It
# also plugs a real event-coverage gap shared by every repository:
# required checks such as Security Scan and SAST Semgrep have no
# workflow_run listener anywhere in this file, so a PR where either is
# the last required check to go green has no event-driven re-wake at
# all. Offset by 30 minutes from org-queue-sweep's "0 * * * *" tick so
# the two heartbeats do not collide. Lengthened from */30 to hourly for
# the same Actions-capacity reason, and by the same lever, as the
# org-queue-sweep hourly cadence below (see
# docs/doctoring/actions-queue-saturation-hourly-sweep.md, #1630) — do
# NOT remove it outright; that would leave this repository's own queue
# with zero fallback heartbeat.
- cron: "30 * * * *"
# Hourly org-wide sweep cadence for the org-queue-sweep job below. Target
# repositories only receive scheduler runs on PR events, review/security
# workflow completion, and protected-branch pushes; a PR whose approval or
Comment on lines +92 to 95

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.

📝 Info: Schedule routing remains mutually exclusive

The 30 * * * * event runs only the repository scan; 0 * * * * remains reserved for the organization sweep. Their concurrency keys also differ.

(Refers to this code)

Devin Review

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

Expand Down
20 changes: 20 additions & 0 deletions tests/test_actions_queue_saturation_scheduler_cadence.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,23 @@ def test_repository_scheduler_keeps_event_driven_wakes() -> None:
assert "pull_request_review:" in workflow
assert "workflow_run:" in workflow
assert "repository_dispatch:" in workflow


def test_scan_pr_queue_heartbeat_is_hourly_and_offset_not_removed() -> None:
"""scan-pr-queue's own repository-local heartbeat must not be dropped.

org-queue-sweep excludes ContextualWisdomLab/.github from its target
list by name, so scan-pr-queue's own cron is the sole periodic fallback
for this repository's PR queue (and for any required check, such as
Security Scan or SAST Semgrep, with no workflow_run listener anywhere in
this file). It must be lengthened to hourly for the same capacity reason
as org-queue-sweep, not deleted, and offset from org-queue-sweep's
"0 * * * *" tick so the two heartbeats do not collide.
"""
workflow = WORKFLOW.read_text(encoding="utf-8")
assert '- cron: "30 * * * *"' in workflow
assert '*/30 * * * *' not in workflow
schedule_block = workflow.split(" schedule:", 1)[1].split(
" repository_dispatch:", 1
)[0]
assert schedule_block.count('- cron:') == 2
Comment on lines +47 to +53

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.

📝 Info: Text test matches narrow contract

This test does not prove job routing, but existing contract tests pin both schedule guards. It detects heartbeat removal, cadence reversal, and cron-count drift.

Devin Review

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

4 changes: 2 additions & 2 deletions tests/test_required_workflow_queue_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -988,8 +988,8 @@ def test_org_queue_sweep_covers_target_repositories_on_a_heartbeat() -> None:
visible reason when it cannot mutate sibling repositories. The sweep runs
hourly so an approval that lands after a PR's last event is
auto-updated/merged promptly instead of idling indefinitely. Its cron has a
distinct concurrency key from the separate 30-minute scan, and the job has
enough runtime headroom to finish a complete organization walk.
distinct concurrency key from the separate scan-pr-queue heartbeat, and the
job has enough runtime headroom to finish a complete organization walk.
"""
workflow = workflow_text("pr-review-merge-scheduler.yml")

Expand Down
Loading