Skip to content

Let overlays skip advisory checks, rank review findings by severity, rotate nightly's issue sweep, name relayed mention runs, drop the session deadline - #1450

Merged
max-sixty merged 17 commits into
mainfrom
poll-budget-constants
Sep 29, 2026

Conversation

@max-sixty

@max-sixty max-sixty commented Sep 29, 2026 •

Copy link
Copy Markdown
Owner

Follow-ups to #1448, which dropped the fixed CI-wait budget. Five changes:

Overlays can leave checks out of the CI gate. poll_pr_checks.py poll and approval take trailing --skip '<check name>' pairs; a skipped check is neither waited for nor read, so an advisory red neither blocks the CI verdict nor withholds the approval. The default is unchanged — every check gates — and monitor-ci tells the session to pass --skip only where the repo's overlay names checks; approving.md passes the same ones.

code-review ranks by severity, not a count. The "up to 4/6 candidates" and "at most 10" caps are gone; the reviewer returns every finding the author would change the code for, most severe first, and the bar is severity rather than list length.

nightly's issue sweep covers every open issue. Step 5 read the newest 200 open issues, so older ones were never revisited. It now paginates all open issues: the bot's own every run, so a transient report it filed still closes the night after its fix, and the rest by the bucket number % 7 == GITHUB_RUN_NUMBER % 7, visiting each at least once a week.

Relayed mention runs are named for their PR. A review event relayed to tend-mention ran with the display title tend-mention-review, which active_subject_runs.py couldn't tie to the PR, so the notifications poll booted a session for a subject a live run already held. The relay now passes the PR title in client_payload, and tend-mention sets run-name from it. run-name also replaces the run's name in the Actions REST API, so everything that identified a workflow by its run name now reads path (active_subject_runs.py) or workflowName (token_report.py, list_recent_runs.py, debug-tend-run, review-runs). The notifications check's 10-minute grace stays, with a comment giving its actual purpose: not booting a session that would only defer to the event run still holding its subject.

The session deadline from #1448 is removed. TEND_DEADLINE, session_end.py, and the poll's deadline exit are gone. A check that registers and never finishes now holds the wait until the session's own timeout ends the run, which reads as timed out. This keeps the machinery minimal until a real run shows the case needs handling.

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

🤖 Generated with Claude Code

max-sixty and others added 16 commits September 28, 2026 18:50
…ault timeout

The CI poll's 9-minute budget came from #695, which trimmed the loop to fit
Claude Code's default 10-minute Bash-tool ceiling; #876 then made that budget
terminal. So one harness default became the longest any session waits for a
consumer's CI. Measured on the last 30 merged PRs of each consumer, the
slowest check exceeds it on every PR in leaf (15 min), numbagg (17 min), and
worktrunk, and on a third of PRQL's and Faber2026's — the poll reports
UNVERIFIED there, so yolo never merges and a red check never dismisses an
approval.

The ceiling was configurable all along. Both harnesses now let one foreground
command run for the whole session: Claude through BASH_MAX_TIMEOUT_MS set to
the run's timeout, Codex through background_terminal_max_timeout, with the
Codex instructions telling the agent to wait on a running command in one
write_stdin call rather than 30-second polls that each cost a model turn.

The wait itself becomes WAIT_SEC = 30 minutes, shared with
rerun_failed_jobs.py, above the slowest gating check measured across
consumers (26 min). The skills pass a 40-minute command timeout, and a test
keeps every skill-named timeout above the script's own bound.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
bot_review_state.py read the first 100 review threads, oldest first, so on a
PR past 100 the bot's newest findings dropped out of both its feedback and
its unresolved-thread list. It now follows every page with
`gh api graphql --paginate`.

review_runs_corrections.py listed the bot's newest 200 PRs and then kept the
ones closed inside the window, so an older PR a maintainer closed that day
was never seen; on worktrunk the 200th bot PR is two months old. It now
searches `closed:>=<since>` directly, and both searches read to GitHub's
1000-result search ceiling.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…ting

Several dedup checks listed the newest 200 issues or PRs and scanned their
titles. That window is measured in bot throughput: on leaf the newest 200 PRs
reach back two days, so ci-fix's "was this fix already rejected?" check
missed any rejection older than that, and triage's open-issue list already
truncates on PRQL (234 open issues). The review-runs and review-reviewers
lists also carried every body, overflowing what the harness shows inline.

ci-fix, triage, review-runs, and review-reviewers now search by keyword,
which matches titles and bodies at any age; ci-fix still lists open PRs,
which stay few. ci-fix's tracker lookups read up to 100 instead of 10, and
its 7-day transient count moves the window into the search, where a
truncated page can no longer read as a short one. ground-claims states the
rule, and open-pr's sibling recheck drops to the projection ground-claims
sizes for 200 rows. review-runs paginates its waiting-run and Dependabot
alert reads.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A 30-minute wait holds the session's concurrency group, and a review of a
newly pushed head queues behind it. review/SKILL.md already said to stop
polling a stale commit, which one foreground command couldn't do. The poll
now re-reads the head after each read that still has checks pending, and
exits 4 (UNVERIFIED) once it has moved: a merge requires the pinned commit
to be the head, and the new head is its pusher's to verify. A rollup that
settles is still reported as the pinned commit's, with the move noted.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…he last 24 hours

Step 4 reviewed `git log --since='24 hours ago' main`, so a night that was
skipped, failed, or paused under TEND_ENABLED dropped its commits for good,
and a consumer whose default branch isn't `main` reviewed nothing. It now
diffs from the previous successful tend-nightly run's head to the default
branch, falling back to the last 24 hours when there is no earlier success
or its commit has left history.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The 30-minute WAIT_SEC was still a guess at how long a consumer's CI runs,
and any guess strands the repos whose CI outlasts it. No limit is needed:
each running check ends by its own job timeout, so the poll now waits until
the checks settle, however long that takes. Only two states have no such
end, and each ends at the event that shows it:

- checks pend and the PR head has moved off the pinned commit (exit 3):
  the commit can no longer merge, and a review of the new head is queued;
- no complete rollup for five minutes: the commit has no check coming.
  That margin covers GitHub's registration lag, not CI.

A check that registers and never finishes holds the wait until the
session's own timeout, which then reads as a timed-out run.

approval() drops its cancelled-run heuristic, which existed only to decide
a red still standing at the cap: the wait now reaches the replacement run's
result. rerun_failed_jobs.py waits for its jobs the same way. The skills
give the poll the longest command timeout the harness allows instead of a
number, and a test keeps a numeric one from coming back.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
A check that registers and never finishes held the poll until the harness
killed the session: nothing reported on the PR, an outage issue filed, the
concurrency group held. Each harness now exports TEND_DEADLINE, when the
session will be stopped, and the poll and the rerun wait end 10 minutes
before it, reporting the checks still pending as unverified.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
The poll waits for every check by default. `poll --skip '<check>'` drops
the named checks entirely, so a repo can merge without waiting on a slow
advisory job. The usage error no longer blames a valid SHA.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Each run checks the open issues whose number matches its run number mod 7,
read through paginated REST, so every issue is checked every seventh run
however many are open.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…l sees them

A tend-mention run started by the review relay's repository_dispatch was
named 'tend-mention-review', so active_subject_runs.py never matched it to
its PR, and the notifications poll could answer a thread that run was still
answering. The relay now passes the PR title, and tend-mention sets
run-name from it.

run-name also becomes the run's `name` in the Actions API, so code that
read `name` as the workflow now reads the workflow file (active_subject_runs)
or workflowName (token_report, list_recent_runs, debug-tend-run). The
notifications grace stays at 10 minutes, now named with its actual job:
keeping the poll from booting a session only to defer to a live run.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Minimum machinery until a real failure shows it is needed: a check that
never settles holds the wait until the session's own timeout ends the run.
Removes TEND_DEADLINE from both harnesses, session_end.py, and the deadline
exits in poll_pr_checks.py and rerun_failed_jobs.py.

Co-Authored-By: Claude Opus 5.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.

--skip stops an advisory red from blocking the CI verdict, but it doesn't stop one from withholding the approval. The review skill calls poll_pr_checks.py approval before every APPROVE (references/approving.md), and approval still reads every check: main parses --skip only for poll, and approval calls fetch_rollup/_settle without skip. So when the overlay names a flaky advisory check, poll would report green, while approval returns withhold: on that same red and the bot never approves. I can push a fix that parses --skip for both commands, threads it through approval, and has approving.md point to the same overlay-named skips as monitor-ci. Let me know if you want it.

…the bot's issues every run

The approval check read every check, so a red advisory check the poll left
out still withheld the approval. It now takes the same --skip arguments.

Nightly's issue rotation delayed closing the bot's own transient reports by
up to six runs; the bot's open issues are now checked every run and the
rest rotate by number.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@max-sixty
max-sixty merged commit 087f5f1 into main Sep 29, 2026
14 checks passed
@max-sixty
max-sixty deleted the poll-budget-constants branch September 29, 2026 20:22
max-sixty pushed a commit to max-sixty/worktrunk that referenced this pull request Sep 30, 2026
Upgrades the generated Tend workflows from 0.3.4 to 0.3.5
([compare](max-sixty/tend@0.3.4...0.3.5)).
The regenerated YAML changes little on its own: the action pin moves to
`max-sixty/tend/[email protected]`, and most of the behavior change arrives
through the new action's bundled skills and scripts.

What maintainers will notice:

- **Bot PRs get their review findings applied.** The review workflow now
decides whether to apply its own findings by who authored the PR, so a
review on a bot-authored PR follows through with a fix instead of
stopping at the comment (max-sixty/tend#1433).
- **Relayed PR-review mentions are named after the PR.** `tend-mention`
runs triggered through `tend-mention-relay` now get the PR title as
their run name rather than the event type, and the notifications poll
uses that name to tell which PR a live run is handling
(max-sixty/tend#1450). The relay job also skips when `TEND_ENABLED` is
`false`, instead of dispatching a run that does nothing
(max-sixty/tend#1452).
- **CI waits run to completion instead of a fixed cap.** CI polling and
integration-test waits now wait for checks to settle instead of timing
out at about 9 minutes, so a slow matrix reports its real result rather
than "unverified" (max-sixty/tend#1448, max-sixty/tend#1451).
- **Fewer truncated listings.** Pagination now reads every page of
notifications, failed-run jobs, and workflow listings
(max-sixty/tend#1435, max-sixty/tend#1442, max-sixty/tend#1457). The
inline pagination helpers in `tend-mention` and `tend-notifications` now
use `gh api --paginate --slurp`.
- **Weekly dependency review matches Dependabot and Renovate PRs
again.** It now matches on the `app/…` author login that `gh` reports
(max-sixty/tend#1441).
- **Nightly and review behavior.** Repo overlays can now skip advisory
checks, review findings are ranked by severity, and the nightly issue
sweep rotates across issues (max-sixty/tend#1450). `ci-fix` recurrence
comments now lead with what changed (max-sixty/tend#1446).

Also bumps the pinned `uv` from 0.12.17 to 0.12.19 in the pre-check
steps. `.config/tend.yaml` has no model pin, so there was no model to
update.

Co-authored-by: worktrunk-bot <[email protected]>
max-sixty added a commit to max-sixty/leaf that referenced this pull request Oct 1, 2026
#1162)

Update the generated Tend workflows from 0.3.2 to 0.3.5. The 0.3.3
refresh workflow moves credential rotation into a dedicated
`tend-codex-refresh` environment, separate from agent jobs. The 0.3.4
action update makes feature-request triage replies more useful and marks
notifications read after answered relayed PR reviews. It also improves
repository-specific refresh PAT setup and handles shells that force
colored `gh` output. The obsolete `control_plane_owner` generator
setting is removed; the existing CODEOWNERS rule still requires a fresh
owner approval.

0.3.5's CI poll waits for checks to settle rather than giving up after 9
minutes, which [#1441](#1441)
depends on; it also names relayed mention runs for their PR and stops
the relay while Tend is paused.

The refresh credentials are already provisioned: `tend-codex-refresh`
admits only `main` and holds `CODEX_REFRESH_AUTH_JSON` and
`CODEX_REFRESH_PAT`, and `tend` no longer holds copies. Fresh
control-plane owner approval is required.

[Upstream
changes](max-sixty/tend@0.3.2...0.3.5),
including
[max-sixty/tend#1418](max-sixty/tend#1418),
[max-sixty/tend#1448](max-sixty/tend#1448),
[max-sixty/tend#1450](max-sixty/tend#1450), and
[max-sixty/tend#1457](max-sixty/tend#1457).

---------

Co-authored-by: leaf-agent <[email protected]>
Co-authored-by: Maximilian Roos <[email protected]>
Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
max-sixty pushed a commit that referenced this pull request Oct 1, 2026
…1473)

`poll_pr_checks.py` counted a CheckRun in status `WAITING`, a job held
by an environment's protection rules, as pending. Only someone outside
the run can approve that job, so the poll never settled. This PR reports
such a job as settled without a result, so `poll` exits 2 (unverified,
not green) and names it. `approval` lists it as unverified beside an
approval, as it already does for a cancelled check. Three new tests in
`generator/tests/test_poll_scripts.py` cover this, and all three fail on
main.

#1450 removed the poll's deadline "until a real run shows the case needs
handling". Two such runs have now happened on diffplug/dormouse, which
moved to 0.3.5 yesterday:

- [tend-review run
36812253540](https://github.com/diffplug/dormouse/actions/runs/36812253540)
approved diffplug/dormouse#864 at 03:51Z. Its post-approval
`poll_pr_checks.py poll 864 <sha>` then waited on `deploy` (workflow
`Hosted PR preview`), which sat in `WAITING` for the `hosted-preview`
environment. GraphQL still reports `status: WAITING` on that commit.
Every other check was green by 03:54Z.
- The harness killed the command at the 21000s session timeout (exit
137). The review job failed and left a red `review` check on a PR the
bot had approved.
- [tend-review run
36822903849](https://github.com/diffplug/dormouse/actions/runs/36822903849)
approved diffplug/dormouse#856 at 06:06Z. It has been held the same way
ever since, this time by the same workflow's `cleanup` job, which sits
in `WAITING` now that the PR has merged.
- `report_failure.py` then opened diffplug/dormouse#871, "Bot
temporarily unavailable", for a run that had done its work.

Dormouse's `Hosted PR preview` parks `deploy` (on open PRs) and
`cleanup` (on closed ones) like this, so without this change each review
of one costs about six hours of runner time, a red check, and an
outage-tracker row.

The `WAITING` status is kept through the per-name grouping and
classified only when the output lists are built. When an earlier green
attempt of the same check exists, the grouping therefore still prefers
the waiting attempt and doesn't fall back to the green one. One test
covers that case with no `startedAt`. An environment `wait_timer` also
shows as `WAITING`. It would end on its own, but reporting it as
unverified is the fail-closed reading, and a wait timer can last up to
30 days. The `monitor-ci` skill needs no change, because it already
treats any exit other than 0, 1 or 3 as unverified, not green.

Evidence log:
https://gist.github.com/tend-agent/ca54094796f3f5c2370cdda4e3ed32d1

Co-authored-by: tend-agent <[email protected]>
max-sixty pushed a commit that referenced this pull request Nov 13, 2026
A review that approves and then polls CI can be killed by its own
timeout before the poll returns. The poll had no deadline: a hung
consumer job gets GitHub's 360-minute default cap, an abandoned app
check never concludes, and the Claude session's 21000 s bound always
runs out first. Both runs reported on #1524 ended this way. In one, a
red `codecov/patch` stood beside hung Actions jobs, and the approval
stayed up over it for 13 hours. In the other, two Codecov checks sat
`in_progress` until the session was killed. #1450 removed the earlier
deadline "until a real run shows the case needs handling", and these two
runs are that evidence.

What changes:

- `run_claude` exports `TEND_DEADLINE` (epoch seconds) to the agent:
launch time plus `TEND_TIMEOUT_SEC`, the point where the supervisor
stops the run.
- `poll-pr-checks poll` returns once checks still pend within 10 minutes
of that deadline. It uses the `--no-wait` path's existing handling: a
red already standing returns exit 1 with the still-running checks
listed, so `approving.md`'s **After the approval** step can dismiss on
it. Otherwise it returns exit 2, unverified, naming what still pends.
- `poll-pr-checks approval` stays fail-closed. When the deadline
interrupts its wait on a red, it withholds. If the red has cleared by
then but checks still pend, it returns undecided rather than approving.
- `monitor-ci` now lists the deadline as a third early return.

Without `TEND_DEADLINE`, nothing changes: the poll waits as before. Four
new tests in `test_poll_scripts.py` cover a hung check, a red beside a
hung job, an approval cut short on a red, and one cut short after the
red cleared. They fail on `main` and pass here, and the launch test now
asserts the exported deadline. `test_poll_scripts.py` and
`test_run_claude.py` pass (100 tests), and so does the full pre-commit
run.

What this leaves for #1524:

- **Codex** sessions get no deadline. That harness has no session bound
of its own, only the job's `timeout-minutes`, which the runner doesn't
read today.
- **`rerun-failed-jobs`** still waits without a bound.

#1584 edits the same `_settle` loop for confirmed external reds.
Whichever lands second needs a small rebase.

Refs #1524 — automated triage

---------

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