Skip to content

fix: don't treat stale cancellation-cascade FAILURE as red in pre-APPROVE guard - #798

Merged
max-sixty merged 2 commits into
mainfrom
hourly/review-30654362957
Jul 31, 2026
Merged

max-sixty merged 2 commits into
mainfrom
hourly/review-30654362957

Conversation

@tend-agent

Copy link
Copy Markdown
Collaborator

Problem

tend-review's pre-APPROVE guard (review/SKILL.md) treats any terminal FAILURE in the check rollup as a blocker and skips the APPROVE. That misfires on a stale cancellation-cascade FAILURE: when several events fire near-simultaneously (classically Dependabot opening a PR), the tests concurrency group cancels all but the latest run, and a cancelled contributor makes an if: always() merge-gate omnibus (PRQL's check-ok-to-merge) resolve to conclusion FAILURE — not cancelled. 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":

  • PR #6121 (chore: bump docker/login-action from 4 to 4.5.2, author app/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-merge showed FAILURE — a cancellation-cascade artifact from the concurrency-cancelled sibling run 30650608570, with a fresh tests batch already QUEUED/IN_PROGRESS. The bot withheld APPROVE and posted a bare +1 reaction 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.
  • Occurrence 1 was PR #6063 (chore: bump minijinja), run 28813989233 — same guard, same stale-cancellation check-ok-to-merge FAILURE, 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 FAILURE produced the missing verdict. The fallback differed (silent vs +1) but the root cause is identical — the guard's select((.conclusion // .state) == "FAILURE") has no carve-out for a cancellation-cascade omnibus.

Fix

In the pre-APPROVE peek, compute $PENDING alongside $FAILED and decide on the settled rollup rather than a mid-flight snapshot:

  • $FAILED set and $PENDING > 0 → rollup not settled; foreground-poll (the Step 6 / running-in-ci CI-monitoring loop) until non-own checks are terminal, then re-peek. A stale cancellation-cascade FAILURE clears once the replacement run's omnibus goes green.
  • $FAILED set 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.
  • $FAILED empty → 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

  • Evidence level: High — consistent structural pattern across two independent sessions (#6063, #6121).
  • Occurrences: 2 (meets the High band's 2–3 threshold). Structural (the written guard produces the outcome deterministically given a cancellation-cascade FAILURE + in-flight replacement), so recurrence is reliable; prior runs recorded it as "act on 2nd occurrence."
  • Magnitude: Targeted fix (Normal Gate 1 bar), not a structural rewrite — refines one guard block and its fallback branch.

Full accumulated evidence: https://gist.github.com/3e3196fb3100d65d79eac98668586140

…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 tend-agent added the claude-behavior Behavioral issues found by review-reviewers label Jul 31, 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.

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.
@max-sixty
max-sixty merged commit 09e856c into main Jul 31, 2026
7 checks passed
@max-sixty
max-sixty deleted the hourly/review-30654362957 branch July 31, 2026 21:15
max-sixty added a commit that referenced this pull request Aug 13, 2026
…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]>
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