Repository navigation
list-recent-runs: a repo past the workflow fetch limit says so - #1293
Conversation
`gh workflow list` fetches 50 without a limit and never says it truncated, so a repo past that would drop tend workflows from the list outright — not their runs, the workflows — and the session would read the result as a quiet window. It now asks for 200 and warns on hitting it, like the run fetch above it. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
tend-agent
left a comment
There was a problem hiding this comment.
The test doesn't pin the change: test_workflow_fetch_limit_warns asserts "--limit 200" in GH_CALLS, but the same test triggers 200 gh run list --limit 200 calls (RUN_LIMIT is also 200), so that substring is in the log regardless of what the workflow listing asked for.
Removing "--limit", str(WORKFLOW_LIMIT) from the gh workflow list call leaves the whole module green — I ran it. The fake gh ignores --limit and returns all 200 rows from WF_JSON, so the warning still fires; in production gh would hand back 50, len(workflow_rows) >= WORKFLOW_LIMIT would never hold, and truncation would stay silent at exactly the edge this PR closes. So the flag — the half of the change that actually widens the fetch — is unguarded, while the warning block is covered.
Scoping the assertion to the workflow list line, the way test_window_floors_at_the_anchors_start filters GH_CALLS for the anchor query, fails on that revert and passes as written. Suggestion inline; it is ruff format/ruff check clean.
Nothing else came out of the pass: the >= threshold and message match the RUN_LIMIT warning below it, gh workflow list --limit paginates past the 100-per-page ceiling, and no call site of the script changes shape.
The run fetches carry the same `--limit 200`, so searching the whole call log passed with the flag deleted — verified by deleting it. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
`token_report.py` listed workflows with `gh workflow list` and no `--limit`. gh then returns at most 50 workflows and gives no sign that it stopped. On a repo with more than 50 workflows, any `tend-*` workflow past the 50th silently drops out of `review-runs`' Step 2 spend report. Step 1's census still counts that workflow's runs, because `list_recent_runs.py` already passes `--limit 200` and warns at that limit (#1293). So the two steps disagree about which workflows make up the fleet. This PR gives `token_report.py` the same `WORKFLOW_LIMIT = 200`, and the same warning when the listing reaches it. The new test `test_the_workflow_listing_asks_past_gh_s_default_and_warns_at_the_limit` failed before the fix: the recorded call was `workflow list --json name`. The `token_report` and `list_recent_runs` suites pass (43 tests). The listing lines don't overlap with #1397's edits to `token_report.py`. Co-authored-by: tend-agent <[email protected]>
gh workflow listfetches 50 workflows without a--limitand says nothing when it truncates.list_recent_runs.pycalled it with no limit, so on a repo past that edge atend-*workflow could fall outside the listing entirely — the session would then never query its runs, and would read the result as a quiet window rather than an incomplete one.It now asks for 200 and warns on hitting it, matching the
RUN_LIMITwarning directly below it in the same function.The alternative was rewriting the call as
gh api --paginate repos/<repo>/actions/workflows, which removes the cliff rather than moving it. That changes how the script resolves its target repo —gh workflow listtakes-Rand an empty argument list means "the current repo", whilegh apineeds the path spelled out in every case — so it is a wider change to a script every consumer'stend-review-runsruns daily. The warning is what makes truncation visible, which is the actual defect.Found while fixing the same class of bug one file over in #1292, where the bot reviewer caught an unpaginated
/actions/workflowscall in thereview-reviewersskill.