Repository navigation
fix: don't treat stale cancellation-cascade FAILURE as red in pre-APPROVE guard - #798
Conversation
…ILURE as red tend-review skipped APPROVE on green-on-merits Dependabot PRs (#6121, #6063) because a cancelled `needs:` omnibus (`if: always()`) reports conclusion FAILURE — not `cancelled` — while a fresh replacement run was still in flight. The guard now computes $PENDING alongside $FAILED and decides on the settled rollup: wait out in-flight checks before judging, and when a genuine red remains with no prior review, post a brief COMMENT instead of exiting silent or leaving a bare +1. Co-Authored-By: Claude Opus 4.8 <[email protected]>
tend-agent
left a comment
There was a problem hiding this comment.
One precision note on the new $PENDING snapshot (inline). The fix is otherwise sound — the settled-rollup framing correctly stops treating a superseded cancellation-cascade FAILURE as real red.
The snapshot counts the tend-review job's own in-flight review check, which is always present in statusCheckRollup as IN_PROGRESS during the peek (visible in this very PR's rollup right now). So $PENDING is ~always ≥ 1 at the initial peek, which makes the "$FAILED set and $PENDING == 0 → genuine terminal red" fast-path effectively unreachable — every FAILED case is forced through the poll branch. It still converges correctly (the poll loop filters own/same-workflow and the re-peek settles $FAILED), so this is precision, not a wrong verdict — but on a genuinely-red PR it burns a poll cycle before holding, and the documented decision tree describes a state the single computed $PENDING never has. Filtering own-run + same-workflow (as the running-in-ci CI-monitoring loop already does, and for this exact reason) makes the snapshot reflect the other checks and the == 0 arm reachable. Note this switches from gh --jq (gojq, no --arg) to a | jq --arg pipe.
…shot The $PENDING snapshot counted the tend-review job's own in-flight 'review' check (always IN_PROGRESS during the peek), so $PENDING was ~always >= 1 and the '$FAILED set and $PENDING == 0 -> genuine red' fast-path was unreachable. Filter own-run and same-workflow checks (as the running-in-ci CI-monitoring loop does) so the snapshot reflects the other checks and the == 0 arm becomes reachable. Switches from gh --jq (gojq, no --arg) to a real-jq pipe.
…eck (#966) Drops the `47 * * * *` cron from `review-reviewers`, leaving `workflow_dispatch`. Its recent output had converged on maintaining its own evidence machinery, at the fleet's highest per-run cost and a seven-day quota ceiling that twice took the user-facing workflows down with it; each adopter's daily `tend-review-runs` already reviews that repo's runs from the inside and routes bundled-skill defects upstream, so this removes the direct loop rather than the only one. The skill is scoped to match: it described itself as hourly and told the session to analyze "the past hour". It now states the window `list-recent-runs.sh` actually hands it — floor at the previous successful run of the workflow, clamped 6h back — which with no cron makes the clamp the normal case rather than an outage signal, and scopes its claims to that window. (An earlier revision of this PR described a cron-payload branch; #965 replaced that logic while this branch was open, and the text was rebased onto what merges.) <details><summary>What the sweep caught, and when</summary> Its unique catches — the ones no inside-out session would have found — cluster in April–June: rubber-stamped APPROVEs over visibly failing checks (#667), backslash-backtick corruption in already-published comment bodies across repos (#359, #405, #424, #562), stale PRs silently dropping mentions (#391), and the stale/re-anchored approval family (#798, #821, #884). The last two weeks are dominated by fixes to its own machinery — evidence-gist plumbing, survey-window arithmetic, matrix branch naming, run→output attribution — while per-run cost climbed from $5.31 to $10.49. That is the shape the cost gate in #960 was written for. </details> Re-enable by dispatching it after a change that could move bot behavior fleet-wide: a release, a harness switch, a model bump — within the hour of that change, per the window note in the overlay. > _This was written by Claude Code on behalf of max-sixty_ --------- Co-authored-by: Claude Fable 5 <[email protected]>
Problem
tend-review's pre-APPROVE guard (review/SKILL.md) treats any terminalFAILUREin the check rollup as a blocker and skips the APPROVE. That misfires on a stale cancellation-cascadeFAILURE: when several events fire near-simultaneously (classically Dependabot opening a PR), thetestsconcurrency group cancels all but the latest run, and a cancelled contributor makes anif: always()merge-gate omnibus (PRQL'scheck-ok-to-merge) resolve to conclusionFAILURE— notcancelled. So it slips past the post-approve cancellation awareness (review/SKILL.md"A check was cancelled -> do nothing") and reads as genuine red, even though a fresh replacement run is already in flight and will clear it.Result: a clean, green-on-merits dependency bump is denied its APPROVE and the maintainer loses the bot's review signal.
Outcome evidence
Observed this run on
PRQL/prql, occurrence 2 of a structural pattern the evidence gist flagged as "act on 2nd occurrence":chore: bump docker/login-action from 4 to 4.5.2, authorapp/dependabot), run 30650608832. The reviewer ran a full session, correctly judged the diff "clean, correct, consistently-applied", then hit the pre-APPROVE guard:check-ok-to-mergeshowedFAILURE— a cancellation-cascade artifact from the concurrency-cancelled sibling run 30650608570, with a freshtestsbatch alreadyQUEUED/IN_PROGRESS. The bot withheld APPROVE and posted a bare+1reaction instead. Its near-identical sibling PR #6120 (chore: bump github/codeql-action), reviewed minutes earlier once its omnibus had settled green, got a full APPROVE.chore: bump minijinja), run 28813989233 — same guard, same stale-cancellationcheck-ok-to-mergeFAILURE, but the reviewer exited fully silent (no prior review, no+1).Both cases: the reviewer's diagnosis was correct (clean diff, red is stale); only the guard's handling of a superseded
FAILUREproduced the missing verdict. The fallback differed (silent vs+1) but the root cause is identical — the guard'sselect((.conclusion // .state) == "FAILURE")has no carve-out for a cancellation-cascade omnibus.Fix
In the pre-APPROVE peek, compute
$PENDINGalongside$FAILEDand decide on the settled rollup rather than a mid-flight snapshot:$FAILEDset and$PENDING > 0→ rollup not settled; foreground-poll (the Step 6 /running-in-ciCI-monitoring loop) until non-own checks are terminal, then re-peek. A stale cancellation-cascadeFAILUREclears once the replacement run's omnibus goes green.$FAILEDset and$PENDING == 0→ genuine terminal red; hold APPROVE. If no prior substantive bot review stands, post a brief COMMENT recording the diff assessment and why approval is held, rather than exiting silent or leaving only a+1— a clean external-dependency bump otherwise carries zero review signal.$FAILEDempty → APPROVE.This keeps the "never rubber-stamp over genuine red" rule while no longer mistaking a superseded red for a real one, and guarantees a green-on-merits PR always leaves a visible verdict.
Gate assessment
FAILURE+ in-flight replacement), so recurrence is reliable; prior runs recorded it as "act on 2nd occurrence."Full accumulated evidence: https://gist.github.com/3e3196fb3100d65d79eac98668586140