Skip to content

list-recent-runs: a repo past the workflow fetch limit says so - #1293

Merged
max-sixty merged 2 commits into
mainfrom
faber-tend-issues
Sep 18, 2026
Merged

max-sixty merged 2 commits into
mainfrom
faber-tend-issues

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

gh workflow list fetches 50 workflows without a --limit and says nothing when it truncates. list_recent_runs.py called it with no limit, so on a repo past that edge a tend-* 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_LIMIT warning 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 list takes -R and an empty argument list means "the current repo", while gh api needs the path spelled out in every case — so it is a wider change to a script every consumer's tend-review-runs runs 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/workflows call in the review-reviewers skill.

This was written by Claude Code on behalf of max-sixty

`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 tend-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]>
@max-sixty
max-sixty merged commit 6d9e4dd into main Sep 18, 2026
13 checks passed
@max-sixty
max-sixty deleted the faber-tend-issues branch September 18, 2026 00:52
max-sixty pushed a commit that referenced this pull request Sep 27, 2026
`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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants