Repository navigation
Description
fleet(dispatch-test): scan counts only the first GitHub page — in-progress runs, per-run jobs, workflows and forks beyond 100 are silently invisible, so active undercounts and a busy home can be chosen
Summary
fleet dispatch-test scan (and the scan inside submit) decides which execution home has free Actions capacity. Every GitHub list it reads is fetched exactly once with per_page=100 and no page parameter, and the counting helpers count only the items in that single returned page. Anything past item 100 is silently invisible:
- in-progress runs past the first 100 are never visited, so none of their jobs count;
- a single run's jobs past the first 100 never count (one GitHub run can fan out to 256 matrix jobs, so a single run can hide up to 156 jobs);
- the workflow list past 100 can hide
fleet-dispatch-test.yml, reportingworkflow=nofor a home that has it; - forks past 100 per repo are never discovered as execution homes.
The crate already knows the exact-count pattern: the queued-runs term uses the response's total_count (total_count(&queued)), which is correct no matter how many pages there are. The in-progress and jobs terms ignore the total_count sitting in the same responses and count the page array instead — so the reported active=<n> is a lower bound presented as an exact count, and eligible (active < threshold) can be yes for a home that is actually at or over threshold. With a large configured threshold (e.g. --threshold 1000) even the jobs of the first 100 runs undercount enough to flip eligibility; at the default 40, a >100-job matrix run whose first page shows <40 active jobs while later pages hold the rest flips it too.
Evidence (file:line, origin/main @ fa2bb52)
All in pkgs/fleet/crates/fleet-dispatch-test/src/lib.rs:
:469— in-progress runs: one GET…/actions/runs?status=in_progress&per_page=100;:473— per-run jobs: one GET…/runs/{run_id}/jobs?per_page=100;:478— queued runs: one GET (but counted viatotal_count, see below);:481— workflows: one GET…/actions/workflows?per_page=100;:537— forks: one GET…/repos/{repo}/forks?per_page=100per level indiscover_scopes.- A crate-wide grep for
page=/Linkfinds nothing: no list call ever requests a second page. :374-388run_ids()collects ids only from the returnedworkflow_runsarray;:396-413count_active_jobs()counts only the returnedjobsarray. Neither consultstotal_count.:391-394total_count()exists and:482uses it for the queued term — the internal oracle showing the exact shape was available and used for exactly one of the three counted terms.
Verification (this run, laptop, real crate)
Probe worktree ~/git/fleet/probe-dispatch-scan-wt (origin/main export; one probe test module appended, no production code changed), cargo test -p fleet-dispatch-test probe_page_bound_counts — 1 passed:
PROBE jobs counted=30 total_count=256
PROBE runs ids=100 total_count=250
- A jobs body with
total_count: 256and a 100-job first page (30 in_progress, 70 completed) counts 30 — if the remaining 156 jobs are in progress (a 256-job matrix run), the true active count is 186 and scan reports 30, i.e.eligible=yesat the default threshold 40. - A runs body with
total_count: 250and a 100-run first page yields 100 run ids; the other 150 runs' jobs are never fetched. fork_full_nameslikewise returns exactly the returned page (100 of a larger fork list are discovered, the rest never become scopes).
Why it matters
scan/submitexist to not pile work onto a saturated execution home (Design: fleet dispatch-test — explicit-dispatch CI over fleet runner capacity #6580). An undercount that reports a busy home as free defeats the one job of the capacity check, and the printed/JSONactivenumber is wrong on its face — an operator (or the submit path) trusting it dispatches into congestion that the tool claimed was absent.- The failure is silent: no error, no truncation marker; the JSON output carries the undercount as fact.
- The forks case silently shrinks the fleet of execution homes: copies past page 1 are never chosen, so capacity that exists is never used.
Acceptance criteria
- Every GitHub list the scan reads is read completely: follow pagination (
page=until a short page, or theLinkheader) for in-progress runs, per-run jobs, workflows, and forks — or, where a term only needs a count, use the responsetotal_countconsistently the way the queued term already does, with the choice justified per call site. -
activefor a repo with >100 in-progress runs, or a run with >100 jobs, equals the true number of in_progress/queued jobs (tests pin both shapes, plus a >100-workflow and >100-fork shape). - Existing counting tests keep passing; the documented queued-run approximation (crate docs) is unchanged — this is about un-read pages, not the approximation.
- If complete pagination is deliberately rejected for any call site, that site caps loudly (error or an explicit
truncatedmarker in text + JSON output) instead of presenting a page-bound count as exact.
Related: #6580 (the design this implements), #6603 (the threshold-zero gap in the same scan path — distinct: that is input validation, this is incomplete reading).
Activity
developing-today commentedon Nov 6, 2026
CODE-2014
dezren39 commentedon Nov 6, 2026
🤖 Agent note · filed
fleet dispatch-test scancounts only the first GitHub page (per_page=100, no page follow) for in-progress runs, per-run jobs, workflows and forks in pkgs/fleet/crates/fleet-dispatch-test/src/lib.rs, while the queued term uses total_count exactly; active undercounts and a busy execution home can be chosen. Verified this run on the laptop @ origin/main fa2bb52 with probe worktree ~/git/fleet/probe-dispatch-scan-wt (real crate, probe test appended, 1 passed: jobs counted=30 of total_count=256; run ids=100 of total_count=250).probe_page_bound_counts, 1 passed); body file issue-dispatch-test-scan-pagination.md in the goal hidden_files.dezren39 commentedon Nov 6, 2026
🤖 Agent note · design-architect pass 63 — adopted as a phase of design #6622
files/designs/code-pagination-contract.mdin the keep-the-four-repos-healthy goal workspace. Audit at origin/main075b2de90dezren39 commentedon Nov 7, 2026
Picked up by
repo-worker-code-a— working this now. (Fleet queue fallback mode: the queue backend is down, so this issue's comments carry the claim. The claim stays live whilerepo-worker-code-aposts progress markers; after 30 minutes of silence any other worker may pick this up.)15 remaining items
dezren39 commentedon Nov 7, 2026
Heartbeat · stage: verified — defect confirmed by code read (lib.rs scan_repo/discover_scopes: five list GETs with per_page=100 and no page parameter; run_ids/count_active_jobs count only the returned page; queued term already uses total_count). Worktree ~/git/fleet/6605-dispatch-pagination, branch queue/fallback-6605-dispatch-pagination. Next: add fetch_all_pages page-driver + Github::get_paginated, switch runs/jobs/workflows/forks to it (queued keeps total_count), tests pinning >100 runs/jobs/workflows/forks shapes.
dezren39 commentedon Nov 7, 2026
Heartbeat · stage: pr_opened — PR #6729 (branch queue/fallback-6605-dispatch-pagination, commit fcdfca5). cargo test -p fleet-dispatch-test → 20 passed on laptop. Next: CI + Codex check, merge when green, then release.
test(fleet-dispatch-test): property coverage for the pagination state…
Merge pull request #6729 from developing-today/queue/fallback-6605-di…
dezren39 commentedon Nov 7, 2026
Released · done — PR #6729 merged (merge sha c86d831; branch queue/fallback-6605-dispatch-pagination; commits fcdfca5 + 90b7fe6). fleet-dispatch-test scan now reads every list completely: fetch_all_pages page-driver + Github::get_paginated for in-progress runs, per-run jobs, workflows, and forks; the queued term keeps its single GET + total_count (count-only, already complete; documented approximation unchanged) and merged object bodies get total_count corrected to the merged length; walks past 100 pages error loudly instead of truncating. Tests: cargo test -p fleet-dispatch-test → 21 passed (laptop), including >100 runs/jobs/workflows/forks shapes and a generated property test (concatenation + request-sequence oracles, cap invariant) added for the Codex P1 on PR #6729 — Codex re-review completed with no findings; CI scripts-test 3.12 + 3.14 SUCCESS. This issue closed automatically via Fixes #6605 on merge.
ci(fleet): wire pkgs/fleet/smoke.sh into a fleet-smoke workflow (#6400)