Repository navigation
ci(queue janitor): page in-flight runs to their total_count, not to the first short page - #25356
Conversation
Fails on the base: status=queued answered 99 runs on page 1 and 85 on page 2 of 182 at 06:10Z on 2026-10-26, and the janitor stopped at page 1. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-db24627e2a9fc2dffb63
…he first short page A status-filtered runs listing can return a short page before its last one. The janitor stopped at the first page under 100, so every queued run older than page 1 dropped out of the sweep: the 05:57Z snapshot on 2026-10-26 gave blacksmith-12vcpu-macos-26's oldest wait as 24 minutes while run 40259152940's fast tier had waited 205, and category b never cancelled run 40259152940 after its PR landed. Paging now ends at an empty page or once total_count is read (at a short page when there is no total). owned_pool_rescue's failed-run listing gets the same rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-db24627e2a9fc2dffb63
|
All contributors have signed the CLA ✍️ ✅ |
|
Owned by an agent session · session |
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Pagination and regression tests scripts/ci/owned_pool_rescue.py, scripts/ci/queue_janitor.py, tests/test_ci_owned_pool_rescue.py, tests/test_ci_queue_janitor.py |
Both listings track results across pages and use an integer total_count to determine when to stop. The tests check short-page continuation, complete-page stopping, and fallback behavior when total_count is absent. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Possibly related issues
manaflow-ai/cmuxissue 14196: The issue concerns CI queue latency and the queue janitor. This change updates the janitor’s pagination so it can continue past a short page when more runs are reported.
Suggested reviewers: lawrencecchen
Merge Risk: 
Minimal · up to 2af32
-
The pagination change is mergeable after normal checks; no specific blocking failure is identified.
Pre-merge checks: 
24 · 
1
-
Failed checks: 1 warning Passed checks: 24 passed-
Full details: Description check
-
Explanation
The description provides a detailed problem statement, resulting behavior, risk, testing results, and observed/not-run evidence. It omits the template's Proof and Checklist sections, but the core review information is complete and the change is CI-only.
Full details: Cmux Cloud Persistent Session And Early Input
-
Explanation
PASS: The pull request changes only CI run-list pagination in
scripts/ci/owned_pool_rescue.py,scripts/ci/queue_janitor.py, and related tests. The diff introduces no Cloud terminal creation, cmux-tui transport, manual renderer, input-routing, snapshot, auth, revision, or lease behavior covered by the rule.
Full details: Cmux Swift Blocking Runtime
-
Explanation
PASS: The pull request changes only Python files and Python tests. The diff contains no production Swift files and introduces no Swift semaphores, blocking waits, sleeps, delayed dispatch, polling, main-queue sync, or manual locks.
Full details: Cmux Browser Automation Off-Main
-
Explanation
PASS. The pull request changes only Python CI listing logic and its tests:
scripts/ci/owned_pool_rescue.py,scripts/ci/queue_janitor.py, and two Python test files. The diff contains nobrowser.*socket commands, WebKit/AppKit access, socket-worker routing, or browser policy tests. The browser automation rule is therefore not applicable.
Full details: Cmux Expensive Synchronous Load
-
Explanation
PASS: The pull request changes only Python CI scripts and Python tests. The diff contains no Swift changes and no agent-history load, main-actor, or interactive-path code. The custom check does not apply.
Full details: Cmux Cache Substitution Correctness
-
Explanation
PASS: The pull request changes only Python files under scripts/ci and tests. The diff contains no production Swift, TypeScript, or JavaScript changes, so the cache-substitution correctness condition does not apply.
Full details: Cmux No Hacky Sleeps
-
Explanation
PASS: The pull request changes pagination only in the two production Python CI scripts. It adds
seen/total_counthandling and no fixed sleeps, timers, polling waits, delayed dispatch, or wall-clock synchronization. The added tests also contain no timing scaffolding.
Full details: Cmux Algorithmic Complexity
-
Explanation
PASS. The production changes add bounded pagination, not a nested collection scan.
queue_janitor.pyprocesses each returned run once across three fixed statuses and at mostMAX_RUN_PAGES = 3pages per status.owned_pool_rescue.pysimilarly processes each page once with the caller’s documentedSWEEP_LISTING_PAGES = 5bound. The diff adds no repeated sorting, filtering, rescanning, or in-memory join over the run collection.
Full details: Cmux Swift `@Concurrent`
-
Explanation
The reviewed diff changes only four Python files:
scripts/ci/owned_pool_rescue.py,scripts/ci/queue_janitor.py, and two Python test files. It contains no Swift changes, so the@concurrentSwift check is not applicable.
Full details: Cmux Swift Package Boundaries
-
Explanation
PASS: The pull request changes only Python files under
scripts/ciandtests. It introduces no production Swift code or SwiftPM target-boundary changes, so the Swift package boundary check does not apply.
Full details: Cmux Swiftpm Lockfiles
-
Explanation
PASS: The pull request changes only Python CI scripts and Python tests. It does not change a SwiftPM package, Xcode project,
.gitignore, workflow, or dependency pins. The SwiftPM lockfile rules therefore do not apply.
Full details: Cmux User-Facing Error Privacy
-
Explanation
PASS. The diff changes pagination logic and adds regression tests. It does not add or alter a cmux app UI, product CLI, or product API error, alert, command output, or recovery message. The changed functions run only in scheduled/manual GitHub Actions workflows and feed internal queue snapshots and operator step summaries. The added provider names, run IDs, and diagnostic details are in an internal CI docstring/comment or operational path, which the rule allows.
Full details: Cmux Full Internationalization
-
Explanation
PASS: The PR changes only CI pagination logic, comments/docstrings, and tests. It adds no Swift UI text, app catalog or Info.plist entries, web UI/API copy, rendered markdown, changelog text, or locale-dependent data. The added production prose is developer-only documentation, which the rule allows.
Full details: Cmux Source Artifacts
-
Explanation
All four changed paths are intentional Python source and test files:
scripts/ci/owned_pool_rescue.py,scripts/ci/queue_janitor.py,tests/test_ci_owned_pool_rescue.py, andtests/test_ci_queue_janitor.py. The diff adds paging logic and regression tests. It adds no logs, screenshots, caches, build output, scratch directories, dependency checkouts, or other source-control artifacts.
Full details: Cmux No Test Or Debug Seam In Production Source
-
Explanation
The pull request changes only Python files under scripts/ci and tests/. It changes no Swift file under a production Sources/ path, so the specified production Swift test/debug seam condition does not apply.
-
-
Finishing Touches: 💡 1
-
📝 Generate docstrings: 💡
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks 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 @coderabbitai help to get the list of available commands.
…e cap Review: counting rows against total_count stops early when a page repeats rows or the listing shifts between pages. Only an empty page (or the cap) ends a status now; runs stay keyed by id, and failed_runs() lists a (run, attempt) once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Agent-Session: https://cmux.com/deeplink/agent?id=aid-db24627e2a9fc2dffb63
|
cmux status (one comment, edited in place; each line is updated by the job that owns it) Merge receipt for |
Summary
The queue janitor lists in-flight runs one status at a time (
status=queued,in_progress,pending) and stopped at the first page with fewer than 100 runs. GitHub's status-filtered run listing can return a short page before the last one. At 06:10Z on 2026-10-26,status=queuedreturned 99 runs on page 1 and 85 on page 2, against atotal_countof 182. So each sweep dropped every queued run older than page 1:macos-pool-loadputblacksmith-12vcpu-macos-26's oldest wait at 24 minutes. Run 40259152940's fast tier had been queued there for 205 minutes by then.next_macos_cascade.pyandpr_runner_pool.pyroute by those numbers, and the cascade's stall check reads that oldest wait.The fix: paging continues until a page is empty or the runs read reach that status's
total_count. When there is nototal_count, it falls back to the short-page rule.MAX_RUN_PAGES(3) still caps it, so a sweep costs at most one more request per status than before.owned_pool_rescue.GitHub.failed_runs()(status=failure) gets the same rule.Risk: low. More runs are visible to the janitor, so each category may act on older runs it used to miss. Those runs were always in scope; the janitor just never saw them.
Testing
pytest -q tests/test_ci_queue_janitor.py tests/test_ci_owned_pool_rescue.py -k "InFlightRunListing or short_page"on cmux15 (Python 3.13):test_a_short_first_page_does_not_hide_the_older_queued_runs,test_failed_runs_reads_past_a_short_page_while_the_total_says_more).Observed / Not run
total_countabove, from the live API. The 05:57Z snapshot. That sweep's log (eight stale-pr cancels, no mention of 40259152940). Both test runs.Changelog
none
Agent session: cosmic-gray
🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.Summary by CodeRabbit