Repository navigation
fix(running-in-ci): make the CI-monitor poll cap terminal - #876
Conversation
pending() counts advisory checks, so a repo with a long non-required matrix can never reach 0 inside the 9-minute cap. Two tend-review sessions re-entered the loop three times each rather than taking the step 4 terminal branch.
8731f97 to
e63697c
Compare
tend-agent
left a comment
There was a problem hiding this comment.
Self-authored, so this is a COMMENT rather than an approval. The rule itself lands — "the cap is the whole poll budget, not one attempt" is exactly the sentence the two re-entering sessions were missing. Two things on the wording, plus a merge-order note.
Required-ness isn't derivable from the recipe. The new text asks the unverified-checks comment to name "whether it's required", but the poll deliberately avoids --required (the block comment above pending() explains why) and the rollup it does read carries no required flag. So the step asks for a fact nothing in the section surfaces, and a session will improvise it — the failure mode this skill file spends most of its length guarding against. Naming the source costs a clause; the inline suggestion adds it, along with the caveat the recipe already establishes (an omnibus that hasn't registered yet won't appear in --required output, and is the one most likely to be required).
"A second pass buys nothing" is broader than the mechanism behind it. The mechanism given — pending() counting an hour-long advisory matrix — makes re-entry futile in that case, which is the case in the evidence. It doesn't cover a session gated on its own push whose required suite runs 12 minutes: there a second pass would settle it and let the gated follow-up (fix the red, dismiss the approval) fire, where ending ships a comment and leaves the push unverified. That's not a regression — the old text ended at the cap too — and the trade is defensible given the sessions burning 28 minutes on advisory jobs. But stating it as an unconditional "buys nothing" makes the rule rest on a claim that isn't true in the required-check case; the suggestion drops that clause and keeps the structural reason, which carries the rule on its own.
Merge-order note: #870 inserts a subsection immediately after this step and carries the old step-4 text as a context line, so whichever of the two lands second will need a trivial rebase.
…onal claim Review feedback: step 4 asked the unverified-checks comment to mark each check required, but the poll reads statusCheckRollup, which carries no required flag — so the fact had no source and a session would improvise it. Point at `gh pr checks --required` and carry over the caveat the recipe already establishes about unregistered omnibus checks. Also drop "a second pass buys nothing": true for the advisory matrix in the evidence, not for a session gated on its own push whose required suite would settle in a second pass. The structural reason carries the rule alone.
…nst tend before filing upstream (#891) ## Problem Two dedup blocks were blind in two different ways, and the cited duplicate needed both fixed. **State filter.** `review-runs` Step 5 and `review-reviewers` Step 4 both deduped against PRs with `gh pr list --state open`. A merged PR is never returned by that query, so a finding whose fix already landed reads as undeduped and gets filed again. `running-in-ci`'s PR-creation dedup recheck already gets this right ("with `--state all` so closed and merged siblings show up"); these two recipes contradicted it. **Repo scope.** `review-runs` is a generated workflow ([`generator/src/tend/config.py:24`](https://github.com/max-sixty/tend/blob/f65f49f/generator/src/tend/config.py#L24) lists it in the enabled set), so it runs in each adopter's checkout and an unqualified `gh pr list` returns *the adopter's* PRs. Step 6 routes bundled-skill defects upstream to tend, but neither Step 5 nor any of `running-in-ci`'s dedup recipes — all local-repo — told the agent to dedup in the target repo before filing there. `--state all` alone does not close this: the adopter's PR list never contained the upstream fix at any state. `review-reviewers` is unaffected by the second half. It runs in `max-sixty/tend` and files onto tend, so its unqualified `gh pr list` already resolves to the right repo; only the state filter was wrong there. This bites hardest on tend specifically, because of the pinning model: adopters call `max-sixty/tend/<harness>@X.Y.Z`, so a merged skill fix stays dormant on their repos until the next release tags. The bug keeps reproducing after the fix merges — which is exactly the window in which the analysis legs are looking at it, and exactly when the dedup queries are blind to the fix. ## What happened `max-sixty/cargo-affected`'s `tend-review-runs` run [31160677649](https://github.com/max-sixty/cargo-affected/actions/runs/31160677649) (08:11:33Z → 08:21:41Z) hit the `| last` evidence-log mis-selection: it appended ~12 KB of run evidence into the nightly's unrelated comment on target [#73](max-sixty/cargo-affected#73), noticed on its post-verify read, restored comment `5188771252`, and re-appended to the real log `5150650688`. Good recovery. It then filed [#883](#883) upstream, whose "Proposed fix" is a `## Run ` heading predicate on the comment selector. [#875](#875) merged that exact fix at 07:34:40Z — 46 minutes before the issue was filed — as `test("^## Run [0-9]")` on the same selector, in the same file. #883 is a duplicate of a merged PR. The run made three dedup queries before filing (`gh issue list --state all --search "tracking issue comment append"`, a broader `gh issue list --state all` title regex, and a final `gh issue list --state open` recheck). All three were `gh issue list`, which never returns PRs — and all three ran against `max-sixty/cargo-affected`. Even had it run Step 5's PR line verbatim, it would not have returned #875, for both reasons: the state filter excluded merged PRs, and the query's repo was the adopter's, not tend's. ## The fix - Both skills: `gh pr list --state open` → `--state all`, projecting `state,mergedAt` so a merged hit is legible. - `review-runs` only: add the cross-repo pair (`gh pr list`/`gh issue list --repo max-sixty/tend --state all`) so a finding heading upstream under Step 6 is deduped against tend first. - `review-runs` only: the pinning note is scoped to the upstream repo, since in that skill the reader is the adopter and the local `gh pr list` above it has nothing to do with pinned refs. `review-reviewers` keeps the original wording, where tend is the reader and "on adopters" is the correct direction. Both added commands were run against this repo to confirm they parse and return the expected shape. ## Gate assessment - **Evidence level**: High. **Occurrences: 1** direct, verified end to end (session log, both dedup query sets, #875's merge time and diff, #883's body). - **Structural, not stochastic.** `gh pr list --state open` deterministically cannot return a merged PR, and a query scoped to the adopter's repo deterministically cannot return a tend PR; replayed ten times it misses #875 ten times. There is no decision point. - **Change type**: targeted fix — query lines plus one sentence naming the pinning consequence. It brings both recipes into line with a rule the same plugin already states in `running-in-ci`, rather than introducing new policy. - **Why act at one occurrence**: the six-PR batch merged at 07:34:40Z ([#875](#875), [#834](#834), [#868](#868), [#818](#818), [#877](#877), [#858](#858)) is all unreleased, so six distinct bugs remain observable on every adopter until the next release. The first analysis leg after that batch produced the first duplicate. The exposure is six-wide and standing, not one-off. ## Not covered by No open PR touches either dedup block. [#845](https://github.com/max-sixty/tend/pull/845)/[#850](https://github.com/max-sixty/tend/pull/850)/[#838](https://github.com/max-sixty/tend/pull/838) are the run-window cluster; [#849](#849), [#856](#856), [#857](#857), [#864](#864), [#869](#869), [#876](#876), [#809](#809), [#837](#837), [#821](#821), [#836](#836) are elsewhere. #883 stays open as a maintainer call — it is redundant with #875 but the option-2 half of its body (finish the gist migration for `review-runs`) is not. Evidence: https://gist.github.com/dca23a6e6a0d8cae2665944ba31676fb --------- Co-authored-by: tend-agent <[email protected]>
…t one by position (#899) A session verifying its own skill edit closed a live maintainer-facing issue and posted a false status comment. The bot caught it and self-healed within ~2.5 minutes, but the close/reopen is permanent in the timeline and the deleted comment had already fired a workflow run. The guidance that produced the behaviour is still unguarded, so the next session hits the same shape. ## What happened Run [31257558939](https://github.com/max-sixty/tend/actions/runs/31257558939) (`tend-mention`, `repository_dispatch`) was answering a review question on #898 — a change to `plugins/tend-ci-runner/skills/nightly/SKILL.md`. To verify the edit it extracted a code block from that file **by fence ordinal** and ran it: ````bash awk '/^```bash$/{n++} n==3 && !/^```/{print} /^```$/{if(n==3) exit}' \ plugins/tend-ci-runner/skills/nightly/SKILL.md > /tmp/step3.sh bash /tmp/step3.sh ```` The third `bash` fence in that file is not the step-3 recipe it was aiming at. It is the drift-issue closer: ```bash gh issue list --state open --author '@me' \ --search '"configuration drift" in:title' \ --json number --jq '.[].number' \ | xargs -r -I {} gh issue close {} --comment 'tend check now passes.' ``` Issue #822 (`tend check: configuration drift on max-sixty/tend`) matched. It was closed at `12:38:56Z` with the comment `tend check now passes.` — false; the check still fails. The session noticed, reopened at `12:39:04Z`, deleted the comment, and [left a correction on the thread](#822 (comment)) plus a flag in its PR reply. Its own words from the session log: *"My mistake — I ran an extracted block without reading it first."* What did not recover: `#822`'s timeline still shows `closed by tend-agent` / `reopened by tend-agent`, and the deleted comment had already fired `issue_comment`, so run [31257716552](https://github.com/max-sixty/tend/actions/runs/31257716552) exists and always will. ## Root cause Two things compose, and only the second is a slip: 1. **Structural — the verification mandate has no write carve-out.** [`running-in-ci`'s "Verifying external-tool behavior"](https://github.com/max-sixty/tend/blob/03f8e0d/plugins/tend-ci-runner/skills/running-in-ci/SKILL.md#L610) says *"verify by running the code"* and ranks running the tool above reading the source, with an example scolding a session for trusting docs instead of running the thing. That instruction is right, and the session was obeying it. Nothing anywhere says the recipes it points at include `gh issue close`, `gh pr comment`, and `git push`, or that "run it" needs to mean something different when the recipe writes. Every adopter's `nightly` skill ships that same closer, so this is a bundled gap, not a tend-local one. 2. **Stochastic — selecting the block by ordinal and not reading it.** A different session might have read it. But the ordinal is a trap independent of judgment: it moves with every edit to the file, so the block that runs is by construction not guaranteed to be the one under test. ## The change One paragraph plus a two-line example in the section that created the pressure. It names the write surface, kills positional extraction, and gives the read-half recipe. No new section, no reorganisation. ## Gate assessment - **Evidence level: Critical, 1 occurrence** — this is the gate table's own example, *"clearly wrong outcome (closed wrong issue)"*, which acts at 1. It is also genuinely new: every one of the 124 prior windows in the evidence log records `0 reopened issue` under negative signals, so there is no historical count to add to. - **Classification: structural pressure, stochastic trigger.** I'm not claiming the failure is fully structural — a session that read the block first would have avoided it. What is structural is the instruction that sent it there with no mention of side effects, and the ordinal extraction that makes "the block I meant" unknowable. - **Magnitude: targeted fix.** Gate 2 would put a *new* section at the 3+ bar. This is a guard attached to an existing instruction that demonstrably produced a public wrong write, held to one paragraph to stay proportionate. Flagging the tension rather than hiding it: if you read this as a new-paragraph change wanting 3 occurrences, the counter-argument is that the three occurrences would each be another wrongly-closed issue. - **Dedup:** no open or closed issue/PR covers it. The three open `running-in-ci` PRs (#837, #870, #876) are all the CI-monitor poll, a different section. ## Verified, not inferred - Both claims in the new text were checked against this incident rather than assumed: `#822`'s events API shows the close and the reopen both retained; run `31257716552` fired from the since-deleted comment and is still listed. - The extraction command and `bash /tmp/step3.sh` are read verbatim from the session log's `tool_use` entries, not reconstructed from the bot's summary. - The third-fence block is reproduced by re-running the same `awk` against `nightly/SKILL.md` at `03f8e0d`. Evidence log: https://gist.github.com/e08f6e62d6478163cb425a75648eb7e4 --------- Co-authored-by: tend-agent <[email protected]>
Automated nightly regeneration of tend's workflow files. **tend version:** 0.1.14 → 0.1.15 **Notable changes** - **Rate-limit handling**: a maintainer can approve past the spike limit (max-sixty/tend#874), and `tend-mention` now skips comments on `tend-rate-limit`-labelled issues as well as `tend-outage` ones — the same self-trigger loop guard, widened to every issue tend files about its own health. - **Review flow**: a push is queued behind an examined-HEAD gate instead of cancelling the in-flight review (max-sixty/tend#903), the review is submitted before a fix is pushed (max-sixty/tend#834), a force-push triggers a re-review rather than trusting the re-anchored SHA (max-sixty/tend#884), and the `/code-review` second pass is unconditional (max-sixty/tend#937). - **CI monitoring**: both the check poll and the `gh run rerun --failed` poll now end terminally when the cap is hit instead of reading as done (max-sixty/tend#876, max-sixty/tend#951), and a failed GitHub-status probe no longer reads as "no incident" (max-sixty/tend#913). - **Nightly**: conflicted bot PRs are test-merged locally instead of filtered on the lazy `mergeable` field (max-sixty/tend#898), and mention runs skip the bot's own review and a third party's content-free approval (max-sixty/tend#916, max-sixty/tend#955). - **`tend check`**: an unreadable ruleset bypass list is reported as unknown rather than ungated (max-sixty/tend#825), environment names are read one per line and addressed encoded (max-sixty/tend#879), and `credential-environments` no longer points at the setting it rejects (max-sixty/tend#900) — this repo currently `SKIP`s that check, so its wording should improve here. Full comparison: max-sixty/tend@0.1.14...0.1.15 Co-authored-by: worktrunk-bot <[email protected]>
…essed limits (#1448) The CI poll gave up after 9 minutes. That figure came from #695, which trimmed the poll loop to fit Claude Code's default 10-minute ceiling on one Bash call; #876 then forbade re-running it. So a harness default set how long every session waits for a consumer's CI. On the last 30 merged PRs of each consumer, the slowest check outlasted it on every PR in leaf (15 min), numbagg (17 min) and worktrunk, and on about a third of PRQL's and Faber2026's. There the poll reports UNVERIFIED, so under `merge: yolo` the bot never merges (leaf-agent has merged none of its PRs), and a red check never dismisses a bot approval. This PR removes the limit, and fixes the other places where a guessed count or window bounded a decision. ### The CI poll waits for the checks, not a fixed time `poll_pr_checks.py` now waits until the checks settle, however long the repo's CI runs: a running check ends by its own job timeout. Three states have no such end, and each is ended by the event that shows it: - checks still pend and the PR head moves off the pinned commit: exit 3, UNVERIFIED. The commit can no longer merge, and a review of the new head is queued behind this session. `review/SKILL.md` already asked for this. - no check registers within 5 minutes: exit 2. A docs-only PR whose workflows are all path-filtered looks the same as checks not registered yet; the margin covers GitHub's registration lag, not CI. - the session nears its end: exit 3, UNVERIFIED. A check that registers and never finishes (a CLA status left pending, a job waiting on an environment approval) would otherwise hold the wait until the session is killed, with nothing reported on the PR and an outage issue filed. Each harness exports `TEND_DEADLINE`, when the session will be stopped: Claude's supervisor bound, or for Codex GitHub's 6-hour job cap less 10 minutes. The poll hands back 10 minutes before it, so the session can still report. The harness ceiling was configurable all along. Claude runs set `BASH_MAX_TIMEOUT_MS` to the run's timeout, and Codex runs raise `background_terminal_max_timeout`. Codex's instructions (`codex/agents-tail.md`) now say to wait on a running command in one `write_stdin` call: leaf's session polled every 30 s, 19 model turns of ~100k cached tokens for one 9-minute wait. The skills give the poll the longest command timeout the harness allows, and a test keeps a numeric one from coming back. `approval()` loses its cancelled-run heuristic, which existed only to decide a red still standing at the cap; waiting now reaches the replacement run's result. `rerun_failed_jobs.py` waits for its jobs the same way, and ends at the same deadline. ### Other fixed caps - **Dedup by search, not a recent-N scan.** ci-fix, triage, review-runs and review-reviewers listed the newest 200 issues or PRs and scanned the titles. On leaf the newest 200 PRs reach back two days, so ci-fix's "was this fix already rejected?" check missed anything older, and triage's open-issue list already truncates on PRQL (234 open). They now search by keyword, which matches titles and bodies at any age. ground-claims states the rule. open-pr's sibling recheck keeps its recency listing, with a projection small enough to show in full. - **`bot_review_state.py`** read the first 100 review threads, oldest first; it now follows every page. - **`review_runs_corrections.py`** took the newest 200 bot PRs and then filtered to those closed in the window, missing an older PR a maintainer closed that day. It now searches `closed:>=<since>`. - **nightly** reviewed `git log --since='24 hours ago' main`: a skipped night lost its commits, and a repo whose default branch isn't `main` reviewed nothing. It now reviews from the last successful nightly's head. - **review-runs** paginates its waiting-run and Dependabot-alert reads, and ci-fix's tracker lookups read 100 rather than 10. Tests pin each change; the poll tests run on a fake clock that raises if a wait never ends. A local `codex exec` probe confirmed a 400 s command waited out in 3 tool calls rather than about 13. > _This was written by Claude Code on behalf of max-sixty_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
Problem
The gated CI poll in CI Monitoring caps at ~9 minutes, but nothing says the cap is the whole budget. Two
tend-reviewsessions onmax-sixty/worktrunkhave now hit the cap and simply run the loop again — three full passes each, ~28 minutes of post-approval polling — because re-entering reads as diligence rather than as waiting on something that already proved it won't settle.It can't settle.
pending()deliberately reads the wholestatusCheckRolluprather than--required, so it counts advisory jobs too. worktrunk'snightlyworkflow runsfeature-powersetandbenchmarksfor 80+ minutes on a PR head — the repo's own overlay documents the benchmark job's runtime — so on any PR that triggers thempending()structurally cannot return 0 inside a 9-minute cap, no matter how many times the loop is re-entered.Evidence
feature-powerset(started 08:49:11Z, still running an hour later)feature-powerset,codecov/patch(never registered)In run 31086241862 every required check was terminal by 09:00:25Z; the remaining 16 minutes of polling watched one advisory job. The session's own log shows it saw
feature-powerset IN_PROGRESSon all nine iterations of the final pass and then ended with the reasoning"One non-required nightly job, feature-powerset, was still running when I hit the polling cap (~28 min) — I didn't wait it out; it's advisory and a failure there couldn't stem from a comment-only diff."— a sound call, but it stayed in the session log. Step 4 asks for that as a comment; nothing was posted, so the PR carries an approval with no record of what went unverified. The 30833412090 session did post the comment, so the two runs resolved the same state differently.Change
Step 4 now says the cap is terminal, gives the structural reason (
pending()counts advisory jobs, so a long matrix can never reach 0), and specifies what the unverified-checks comment should carry — each pending check, marked required or advisory, withgh pr checks --requirednamed as the source since the rollup the poll reads carries no required flag. An advisory-only tail becomes one cheap line rather than a judgment call about whether to say anything at all.Gate assessment
pending()counts non-required checks by design (the recipe explains why it avoids--required), so any repo with a long advisory matrix reproduces this on every gated poll.Not covered elsewhere
#821 addresses the pre-APPROVE rollup guard in
review/SKILL.md(provenance of a stale red when the cap expires); this is the post-approve dismiss-on-red poll inrunning-in-ci, where a terminal rule already exists and is being skipped rather than improvised. #870 adds a subsection after step 4 about reviews landing mid-poll and does not touch the step itself.Evidence log: https://gist.github.com/a88c03f4d0c3fb1791060ff3dd97d1c4