Repository navigation
fix(review-runs): re-query the closure read before reporting a path as still red - #1210
Conversation
…s still red Closes #1209
tend-agent
left a comment
There was a problem hiding this comment.
Two trims, and they have to land together — the test pins the sentence the first one removes.
The rule is one sentence; the rest of the paragraph restates the in-block comment directly above it and then explains what can't go wrong. CLAUDE.md's Authoring skills section asks for the opposite ("cut motivation, anecdotes, and historical context unless required to apply the rule", "prefer recipe over narrative"), and this paragraph loads into every review-runs session. The direction is worth keeping — "staleness only moves the answer backwards" is what makes "take the newer answer" follow — but the reassurance that a live red row can never be wrongly closed isn't needed to apply the rule, and #1209 holds it durably.
Pinning that sentence in the contract test is the part that bites: it couples the test to rationale prose, so trimming the narrative later fails a test that isn't about the behavior. The two remaining asserts already cover the comment and the rule.
Since this is a bot-authored PR I'll push both as a commit rather than leave them for someone to apply.
…rries The paragraph restated the in-block comment and then explained what could not go wrong; only the rule and the direction it rests on are needed to apply it. Drop the contract assert that pinned the removed sentence.
Regenerates the `tend-*.yaml` workflows for tend 0.2.7 (from 0.2.6). The diff is the version comment and the `max-sixty/tend/claude@` action pin in all eight workflows; no job, trigger, or permission changed. What adopters get from the upgrade: - **The sandbox can write zsh here-documents again.** Scratch files for heredocs now go to the writable temp dir instead of a path the sandbox denies, so a session that shells out through zsh no longer fails on them (max-sixty/tend#1211). This run hit exactly that failure while composing this description. - **`review-runs` stops reporting paths that have since gone green.** It re-queries the closure read before calling a path still red, so a run fixed between the scan and the report is no longer written up as an outstanding failure (max-sixty/tend#1210). - **`review-runs` now checks open Dependabot alerts** as part of its live repository scan, so unaddressed security advisories surface in the daily sweep (max-sixty/tend#1214). - **Sessions load less bundled guidance.** `running-in-ci` and `review` keep the rules every session needs and move the rarer actions — opening a PR, pushing, monitoring CI, posting, draft mode — into `references/` files read on demand, dropping from 52 KB to 20 KB and 41 KB to 25 KB respectively. That leaves more of each session's context for the actual work (max-sixty/tend#1215). - **PR review decides its pre-approval check in a script** rather than re-deriving it from prose each session, which makes the approve/don't-approve call consistent run to run (max-sixty/tend#1217). Full comparison: max-sixty/tend@0.2.6...0.2.7 `.config/tend.yaml` pins no model, so nothing there needed to move. Co-authored-by: worktrunk-bot <[email protected]>
…it (#1243) ## Problem `review-runs`'s live-work sweep decides whether the default branch is red right now from three `status=`-filtered run listings. #1210 gave the per-path closure call below them a freshness check; the listing that *produces* the rows still had none, and nothing downstream can recover a row it never returned. The two calls fail in opposite directions, which is why one fix did not cover the other. On the closure read a stale answer is a too-old green: it fails to close a path that is already fixed, and the sweep over-reports. On the red listing the omitted rows are the *newest* ones, so the sweep under-reports — a stale page supports "`main` is green" while a failure stands on it. The skill instructs the session to publish that claim with its scope stated, so the wrong answer ships as a published claim rather than an internal miss. The reporter's evidence checks out against the API: on `max-sixty/worktrunk` the cold call at ~07:58Z on 2026-09-14 returned a newest red row of `2026-09-05T20:32:15Z`, while `nightly` run [34808417481](https://github.com/max-sixty/worktrunk/actions/runs/34808417481) — `push` on `main`, `conclusion: failure`, created `2026-09-14T05:06:36Z` — was live at that moment: the re-run that cleared the path ([34810650044](https://github.com/max-sixty/worktrunk/actions/runs/34810650044)) only concluded `success` at `2026-09-14T08:05:24Z`. Calls two and three to the byte-identical URL, minutes later, returned it. ## Solution Re-read each `status=` filter until two consecutive pages agree — capped at four reads — and union what they returned. On an endpoint answering consistently that is two calls, the same cost as reading each filter once more unconditionally; it spends more only where the answers are still moving, which is the case that escapes a fixed pair. A fixed pair was the first shape here, and review found it insufficient. Probing untouched repos, `astral-sh/uv` went stale-then-fresh across two adjacent reads of the identical URL (newest row `2026-08-18T15:55:41Z`, then `2026-09-14T02:15:41Z`), but `openai/codex` took three — `2026-08-15T05:55:10Z`, `2026-08-28T00:09:18Z`, `2026-09-14T04:37:18Z` — so stopping at two would have published a newest red row of `2026-08-28` with a `2026-09-14` failure standing. A later single read of that same URL returned the `2026-08-15` snapshot again, so this is not a cold-start cost a session pays once: each call independently gets whichever snapshot it gets. A stale page is internally coherent, so the rows cannot tell a session it has converged, and `total_count` is not a signal — #1241 recorded it identical at 587 across a stale and a fresh page. Agreement between consecutive reads is what is left. The union is `sort -ru` rather than `sort -u`: gojq sorts object keys, so the lines lead with `conclusion` then `created_at`, and descending puts each conclusion group's newest row first — the row the section's published claim is about. The prose that carried the reassurance is rescoped. It previously read "staleness only moves the answer backwards" attached to the closure paragraph, where a session scanning the section could take it as covering the sweep; it now names the direction each call fails in and what the loop waits for. I considered the reporter's alternative — one unfiltered `?branch=main&per_page=100` pass filtered client-side — and it does not carry the case on its own. It serves stale pages too (a first read of it on this repo returned a newest row of `2026-08-28T00:36:57Z` with `total_count` 9372, against 17039 live), and on a busy repo it reaches back only hours. It would have to be unioned *in addition to* the filtered calls. ## Testing No test. #1212 removed the 34 tests that pinned wording in skills and docs, including the one #1210 added for the closure read, on the grounds that a substring assertion constrains phrasing without constraining behavior — so adding one here would reinstate exactly what that change deleted. Instead I ran the amended recipe against `openai/codex`, the repo where the drift was widest: it returns 71 rows, no blank lines from the empty-page guard, and its newest `failure` row is the `2026-09-14T04:37:18Z` one that the first read had dropped. Against `max-sixty/tend` the doubled reads collapse cleanly under `sort -u` — 100 lines to 51 distinct run IDs — since `gh api --jq` emits one compact object per line with sorted keys. `pre-commit` passes on the file, and the tests that touch this skill (`test_review_runs_corrections.py`, `test_evidence_scripts.py`, `test_list_recent_runs.py`) pass at 39. Closes #1241 — automated triage --------- Co-authored-by: tend-agent <[email protected]> Co-authored-by: tend-agent <[email protected]>
Problem
review-runs's live-work closure read — the per-workflowstatus=success&per_page=1call that decides whether a red default-branch row is already fixed — sometimes serves a cached row weeks behind the true latest green. An immediate re-query of the identical URL returns the current row. The recipe had no freshness check, so a stale answer decided the verdict on its own.I reproduced it on
PRQL/prqlwhile triaging: the first call fortests.yamlreturned2026-08-16T10:53:22Z, the next two returned2026-09-11T03:35:45Z. That first value is byte-identical to what the reporter saw on two separate days, which rules out random jitter and points at a durable cached entry.Staleness only moves the answer backwards, so it can never wrongly close a live red row. The single failure direction is the other one: a green older than the red row it has to close leaves that row uncloseable, and the sweep publishes "this workflow has been red on
mainsince X with no green since" about a workflow that is green.Solution
A one-line condition on the existing call rather than new machinery: when the returned green predates the red row it has to close, re-run the call once and take the newer answer. That is exactly the case where a stale read is indistinguishable from a real unfixed failure, and the only case where the extra call can change the verdict.
Testing
test_review_runs_rechecks_a_stale_closure_readingenerator/tests/test_cross_file_contracts.pypins the re-query instruction in the closure recipe, matching the existing contract tests over this skill. It fails onmainand passes here.Closes #1209 — automated triage