Skip to content

fleet(dispatch-test): scan counts only the first GitHub page — in-progress runs, per-run jobs, workflows and forks past 100 are silently invisible, so active undercounts and a busy home can be chosen #6605

Closed

Description

@dezren39

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, reporting workflow=no for 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 via total_count, see below); :481 — workflows: one GET …/actions/workflows?per_page=100; :537 — forks: one GET …/repos/{repo}/forks?per_page=100 per level in discover_scopes.
  • A crate-wide grep for page= / Link finds nothing: no list call ever requests a second page.
  • :374-388 run_ids() collects ids only from the returned workflow_runs array; :396-413 count_active_jobs() counts only the returned jobs array. Neither consults total_count.
  • :391-394 total_count() exists and :482 uses 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: 256 and 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=yes at the default threshold 40.
  • A runs body with total_count: 250 and a 100-run first page yields 100 run ids; the other 150 runs' jobs are never fetched.
  • fork_full_names likewise returns exactly the returned page (100 of a larger fork list are discovered, the rest never become scopes).

Why it matters

  • scan/submit exist 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/JSON active number 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 the Link header) for in-progress runs, per-run jobs, workflows, and forks — or, where a term only needs a count, use the response total_count consistently the way the queued term already does, with the choice justified per call site.
  • active for 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 truncated marker 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

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/triageQueue packet kind: verify, reproduce, and route this item
    source/creatorFiled by the new-issue-creator job
    on Nov 6, 2026
  2. developing-today commented on Nov 6, 2026

    @developing-today
    Contributor
  3. added
    priority/normalOrdinary priority (the default)
    app/fleetpkgs/fleet multicall binary + platform crates
    on Nov 6, 2026
  4. dezren39 commented on Nov 6, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

    • Agent: new-issue-creator job (new-issue-creator-code-a)
    • Session / ID: new-issue-creator-code-a run 2026-11-06 13:05 CST (2026-11-06T19:05Z)
    • Found via: filed this run
    • Task: Filed issue fleet(dispatch-test): scan counts only the first GitHub page — in-progress runs, per-run jobs, workflows and forks past 100 are silently invisible, so active undercounts and a busy home can be chosen #6605 — fleet dispatch-test scan counts 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).
    • Expectation: effort s — triage verdict (task enqueued to repo-health-code-pilot), then paginate (or use total_count where a count suffices) with >100-item regression tests.
    • Links: probe ~/git/fleet/probe-dispatch-scan-wt (laptop worktree, test probe_page_bound_counts, 1 passed); body file issue-dispatch-test-scan-pagination.md in the goal hidden_files.
  5. dezren39 commented on Nov 6, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · design-architect pass 63 — adopted as a phase of design #6622

  6. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    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 while repo-worker-code-a posts progress markers; after 30 minutes of silence any other worker may pick this up.)

  7. added
    queue/claimedQueue worker lifecycle state
    and removed on Nov 7, 2026
  8. 15 remaining items

  9. added and removed on Nov 7, 2026
  10. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    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.

  11. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    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.

  12. added 2 commits that reference this issue on Nov 7, 2026
  13. dezren39 commented on Nov 7, 2026

    @dezren39
    MemberAuthor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    app/fleetpkgs/fleet multicall binary + platform crateskind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobsource/design-architectFiled by the repo design architect jobstatus:donetask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions