Skip to content

fix(list-recent-runs): fetch runs to the Actions pagination ceiling - #1377

Merged
max-sixty merged 2 commits into
mainfrom
review-reviewers/35712126842-dormouse-run-fetch-limit
Sep 22, 2026
Merged

max-sixty merged 2 commits into
mainfrom
review-reviewers/35712126842-dormouse-run-fetch-limit

Conversation

@tend-agent

@tend-agent tend-agent commented Sep 22, 2026 •

Copy link
Copy Markdown
Collaborator

list_recent_runs.py fetched at most 200 runs per workflow, which is below
what a busy consumer produces inside the fetch's own span — the window (49h at
the cap) plus the 24h creation cushion. Truncation drops the oldest rows, so
the census loses the start of the window and the sweep reading it reports an
all-clear for a span it never looked at. The next tick's floor advances past
that span regardless, so nothing revisits it.

Measured on a consumer: one workflow had 254 runs complete inside a single
48h review-reviewers window, against the 200 cap — the 54 oldest were
dropped, and the sweep recorded the window as covered apart from a hedged note.

The same cap also fires the warning when the fetch did cover the window,
because the count is over window-plus-cushion rather than over the window. At
this run rate every sweep draws it, and each one has to disprove it by hand
before it can record an all-clear instead of a coverage gap. A warning that is
usually wrong is one the next session learns to discount, which is the failure
the warning exists to prevent.

200 was set in #838, when the recovered window reached back 8h; the window has
since grown to 49h and gained the 24h cushion, and the limit stayed put.
token_report.py, in the same directory, moved to 1000 in #887 — the ceiling
on a --created-filtered run listing, which stops at 1000 however many runs
total_count reports, while an unfiltered listing pages past it — and its
warning says so: at the ceiling only a narrower window helps. Both scripts pass
--created on every fetch, so the ceiling binds at both call sites. This
brings list_recent_runs.py to the same limit and the same reading of what a
hit means.

The higher limit costs requests only where the runs exist: gh run list pages
a server-side --created filter, and a 374-run fetch against a live consumer
took 13s. Printed output is unchanged — out-of-window rows are filtered before
the dump, so only a window that genuinely holds more than 200 runs gets longer,
and there the extra rows are the ones that were missing.

Tests: the limit test pins the constant and the new message. A new test asserts
the fetch passes --limit at all — nothing covered that, and without the flag
gh defaults to 20.

uv run pytest passes except the two test_refresh_consumers.py cases that
need PyPI, which the sandbox has no DNS for. pre-commit run --all-files could
not install shellcheck_py (its download returned HTTP 500), so the shell hooks
went unrun; every hook matching the two changed Python files passes.

Evidence: https://gist.github.com/tend-agent/f46893e5763af22d940108b9782960eb

The 200-run per-workflow limit is below what a busy consumer produces in
the fetch's span (the window, 49h at the cap, plus the 24h creation
cushion). Truncation drops the oldest rows, so the census loses the start
of the window and the sweep reports an all-clear for a span nothing read;
the next tick's floor advances past it regardless.

Raise it to 1000, the Actions API's pagination ceiling and the value
token_report.py already uses, and reword the warning to match: at the
ceiling only a narrower window helps.
@tend-agent tend-agent added the claude-behavior Behavioral issues found by review-reviewers label Sep 22, 2026

@tend-agent tend-agent left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

RUN_LIMIT's comment attributes the 1000 ceiling to the Actions API rather than to the --created-filtered listing this script makes, which is the only place it holds. Against this repo's ci workflow (2,988 runs): actions/workflows/<id>/runs?per_page=100&page=11 returns 100 rows unfiltered and 0 rows with created=>=2025-01-01, and gh run list --workflow ci --limit 1200 returns 1,200 unique ids without the filter against exactly 1,000 with it. The pin is right at this call site — every run fetch here passes --created — but as written the comment tells a later reader that no run listing can exceed 1,000, which would leave a caller that drops or widens the filter holding a limit the API no longer imposes. Suggestion inline.

The 1000-run cap is a property of the `--created`-filtered query the
script makes, not of the workflow-runs endpoint: unfiltered, the same
listing pages past 1000.
@max-sixty
max-sixty merged commit df85cb4 into main Sep 22, 2026
11 checks passed
@max-sixty
max-sixty deleted the review-reviewers/35712126842-dormouse-run-fetch-limit branch September 22, 2026 17:07
max-sixty pushed a commit to max-sixty/worktrunk that referenced this pull request Sep 23, 2026
Regenerates the nine `tend-*.yaml` workflows from tend 0.3.1, up from
0.2.15. Behavior here is unchanged: the only substantive diff is two new
action inputs, `merge: maintainer` and `control_plane_owner: ""`, both
of which are the action's own defaults. `maintainer` is the merge
authority this repo already runs under — the bot proposes, a maintainer
merges.

What the upgrade changes for this repo:

- **`tend check` audits protected refs and credential environments more
strictly**
([max-sixty/tend#1382](max-sixty/tend#1382)). A
protected branch must now restrict creation, update and deletion
together rather than update alone, and the credential audit no longer
treats a ref-qualified reusable workflow as this tree's copy. This repo
does not clear the new bar yet — the nightly filed #4242 with the single
ruleset gap and the remediation.
- **Yolo merge mode exists, and is off**
([max-sixty/tend#1172](max-sixty/tend#1172),
[#1390](max-sixty/tend#1390)). The new inputs
are how a repo would opt into letting the bot merge its own PRs; leaving
them at the defaults keeps the current arrangement, and the `merge:
maintainer` value is what the mitmproxy cache step is now gated on.
- **`review-runs` sees the whole night**
([max-sixty/tend#1377](max-sixty/tend#1377)).
Run listing now pages to the Actions ceiling instead of stopping at the
first page, so a busy night's early runs stop falling out of the census;
[#1374](max-sixty/tend#1374) keeps each
correction row's author alongside it.
- **CI polling is bounded by elapsed time, not iteration count**
([max-sixty/tend#1376](max-sixty/tend#1376),
reinstating [#1371](max-sixty/tend#1371) after
[#1375](max-sixty/tend#1375) reverted it). A
settle loop against slow checks now stops on a sleep budget, so a long
matrix can't quietly stretch a session.
- **Install-test drift detection tightened**
([max-sixty/tend#1381](max-sixty/tend#1381)):
generator output a PR never committed now fails tend's own drift check,
which is the check that makes a regeneration PR like this one
trustworthy.

Full comparison:
[0.2.15...0.3.1](max-sixty/tend@0.2.15...0.3.1).

This PR does not touch `.config/tend.yaml`, whose `sandbox_setup:` key
0.3.1 now warns "will be refused in a later release". That migration is
a separate change.


#4240 overlaps this completely: it was generated with the same 0.3.1, so
it carries the identical headers and the identical `merge: maintainer` /
`control_plane_owner: ""` on the same lines, underneath a Claude → Codex
harness swap. The only thing that distinguishes the two is which harness
the action runs. Whichever lands first leaves the other conflicting on
the eight `uses:` lines, resolved by regeneration rather than by hand.
So this PR is worth landing on its own only for as long as the Codex
cutover stays in draft — if that lands first, close this one.

Verified by regenerating in the merged tree: `uvx [email protected] init`
reproduces these nine files byte-for-byte, and the action declares
`default: maintainer` and `default: ""` for the two new inputs at
`0.3.1`, so neither changes behavior.

Co-authored-by: worktrunk-bot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

claude-behavior Behavioral issues found by review-reviewers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants