Skip to content

fix(cursor-review): pass Panel integrity on a cancelled run only when a push superseded it - #440

Merged
mattmillerai merged 2 commits into
mainfrom
cursor/panel-integrity-skip-cancelled-run-c60d
Oct 22, 2026
Merged

mattmillerai merged 2 commits into
mainfrom
cursor/panel-integrity-skip-cancelled-run-c60d

Conversation

@mattmillerai

@mattmillerai mattmillerai commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

ELI5

When a code-review run gets cancelled because someone pushed newer code, the review check no longer shows a confusing red "re-run the failed job". A run cancelled for any other reason, such as a manual cancel, still fails. A required check can't quietly go green when nobody finished the review.

Before

Panel integrity used if: always() && (…). always() still starts the job after cancel-in-progress cancels the run. The decision jobs (gate, round-cap, diff-size, preflight, ledger) then report cancelled, not failure, and the guard failed the check:

Panel integrity cannot be judged: the jobs that decide whether a panel should run did not succeed (gate: cancelled, …) … re-run the failed job.

That is a false failure when the run was superseded by a newer push. The same red happened when a cancel landed mid-panel, because consolidate / post-review come back cancelled.

After

The job stays on always(). Skipping it with !cancelled() (this PR's first revision) would be a fail-open: cancelled() is true for every workflow cancel. A manual cancel has no replacement run, and a same-SHA replacement can decline to review. A skipped required check passes, so that skip would hand the head a green completeness gate over an unfinished panel.

Instead, a new first step, Judge a cancelled run, runs only when the run was cancelled and re-reads the PR's live head:

  • Head moved past this run's SHA (superseded by a push): the step passes and sets superseded. The guard and report steps stand down, so the check is green on a head nobody can merge any more, and required checks are read on the new head.
  • Head unchanged, no PR head in the event, or the read fails: exit 1. The check stays red, as before.

The job's permissions go from {} to pull-requests: read for that one API read.

Fail-closed is unchanged for a run that was not cancelled

  • A decision job whose result is failure still satisfies != 'success', and the guard still exits 1.
  • A job that hits its own timeout-minutes fails closed whichever way GitHub reports cancelled() for it. Either the guard reads its cancelled result, or the head check finds the head unmoved.
  • Deliberate no-panel branches (no label, already reviewed, max_rounds, over the diff-size cap) still skip.

A same-SHA re-trigger under cancel-in-progress (re-applying the label while a panel runs) still paints the cancelled run red on that SHA, which is the fail-closed side. The replacement run's later result is the one to read. The Blocking gate is untouched and still uses always().

Not in this PR

Two runs a few seconds apart for one event is the caller (or the app delivery) starting the workflow twice. This reusable's concurrency group already cancels the earlier one, which is what stops both panels from posting. Collapsing the duplicate trigger is not something the reusable can do safely; letting both runs finish would post two reviews.

Provenance

Verified:

  • python3 -m unittest discover -s .github/cursor-review/tests -p 'test_*.py': 1740 tests OK, including the new CancelledRunTest, which runs the step against a stub gh (head moved / unmoved / unreadable / no PR head)
  • cursor-approve suite (339 OK), workflow-pins suite (551 OK), check_workflow_pins.py OK
  • org-repo literal lint OK, check_agents_md.py passed, shellcheck on the new step's script OK, workflow YAML parses

Deviations:

  • Replaced the first revision's !cancelled() job skip with an in-job head-moved check, per the review panel's High finding (raised by all six reviewers) that the skip was a fail-open on a manual or same-SHA cancel
  • Panel integrity now holds pull-requests: read instead of no permissions
Open in Web Open in Cursor 

cancel-in-progress leaves the decision jobs `cancelled`. Panel integrity's
`always()` then ran and failed the check ("re-run the failed job") on a run
that was superseded. `!cancelled()` skips that run. A failed decision job, or
a job timeout (result `cancelled` while the workflow is still running), still
fails the check.

Co-authored-by: Matt Miller <mattmillerai@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Warning

Review limit reached

  • Run on-demand review

This review includes 5 billable files and costs up to $1.25.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 2 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used all 6 included reviews currently available. Your 47 included PR review attempts over the past 7 days set your current allowance at 6 reviews per hour.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Team
  • Run ID: 3b09b544-4023-4f2d-bf5e-a4c34d187373
📥 Commits

Reviewing files that changed from the base of the PR and between 061a2ca and 4c51389.

📒 Files selected for processing: 5
  • .github/cursor-review/README.md
  • .github/cursor-review/tests/test_workflow_panel_integrity.py
  • .github/workflows/cursor-review.yml
  • README.md
  • docs/callers/cursor-review.md

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Team
  • Run ID: b922f8db-1b07-4123-b112-857f670ad33d
📥 Commits

Reviewing files that changed from the base of the PR and between 6af4cb8 and 061a2ca.

📒 Files selected for processing: 5
  • .github/cursor-review/README.md
  • .github/cursor-review/tests/test_workflow_panel_integrity.py
  • .github/workflows/cursor-review.yml
  • README.md
  • docs/callers/cursor-review.md

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 6 reviews per hour.

📝 Walkthrough

The panel-integrity job now skips when the workflow is cancelled. On active workflows, failed or timed-out decision jobs still fail the check. Tests and documentation distinguish workflow cancellation from a cancelled job result.

Changes: Panel integrity cancellation handling

Layer / File(s) Summary
Apply and verify cancellation handling
.github/workflows/cursor-review.yml, .github/cursor-review/tests/test_workflow_panel_integrity.py, .github/cursor-review/README.md, README.md, docs/callers/cursor-review.md
The job condition now uses !cancelled() while retaining the existing decision-job conditions. Tests cover workflow-level cancellation and cancelled decision-job results on active workflows. The documentation describes this distinction; the Blocking gate remains unchanged.

Suggested reviewers: huntcsg, luke-mino-altherr

Priority: ⬇️ Low

Merge Risk: 🟡 Moderate · up to 061a2

A cancelled review can be followed by a same-commit run that passes the required checks without completing the panel. Resolve that path before merging unless this behavior is explicitly accepted.

Pre-merge checks: Passed 2
Check name Status Explanation
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
✨ Simplify code
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@mattmillerai mattmillerai added the cursor-review Multi-model cursor review label Oct 21, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Cursor Review — Consolidated panel

Triggered by @mattmillerai.

Found 3 finding(s).

Severity Count
🟠 High 1
🟢 Low 2

Panel: 6/6 reviewers contributed findings.

Comment thread .github/workflows/cursor-review.yml Outdated
Comment thread docs/callers/cursor-review.md Outdated
Comment thread .github/workflows/cursor-review.yml Outdated
@mattmillerai
mattmillerai marked this pull request as ready for review October 21, 2026 23:52
…nly after the head moved

`!cancelled()` skipped the check on EVERY workflow cancel. A manual cancel has
no replacement run, and a same-SHA replacement can decline to review, so the
skip handed that head a green required check over an unfinished panel.

The job is back on `always()`. A new first step, `Judge a cancelled run`,
runs only on a cancelled run and re-reads the PR's live head: it passes (and
the guard and report steps stand down) only when the head moved past the SHA
the run was reviewing. Head unchanged, no PR head in the event, or an
unreadable head all exit 1. The job now holds `pull-requests: read` for that
one read. The supersede case stays green and the fail-open is closed. A job
timeout fails closed whichever way GitHub reports `cancelled()` for it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mattmillerai mattmillerai changed the title fix(cursor-review): skip Panel integrity on a cancelled run fix(cursor-review): pass Panel integrity on a cancelled run only when a push superseded it Oct 22, 2026
@mattmillerai
mattmillerai merged commit 60faaa7 into main Oct 22, 2026
8 checks passed
@mattmillerai
mattmillerai deleted the cursor/panel-integrity-skip-cancelled-run-c60d branch October 22, 2026 03:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cursor-review Multi-model cursor review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants