Skip to content

feat(cursor-review): link every auto-approve review to the cursor-approve card (BE-20246) - #412

Merged
mattmillerai merged 3 commits into
mainfrom
matt/be-20246-card-link-in-auto-approve-reviews
Oct 12, 2026
Merged

mattmillerai merged 3 commits into
mainfrom
matt/be-20246-card-link-in-auto-approve-reviews

Conversation

@mattmillerai

@mattmillerai mattmillerai commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

ELI-5

Each round, the bot posts a review that approves a PR or blocks it. It also keeps one status card comment on the PR, updated every round, showing what it decided and why. Until now those reviews didn't link to the card, so people had to scroll the PR to find it. Every one of those reviews now links straight to the card.

What changed

  • Every auto-approve review links the card. That covers decide's APPROVE, its REQUEST_CHANGES and its standing block, plus the standing block approve-external leaves when it withholds. approve-external's approval already linked the card. The link line reads: Live status: the [cursor-approve card](…), updated in place every round. It sits below the decision and above the scope and threshold notes. The markers at the top of each review are unchanged, so staleness, the recorded base and the auto-retry budget all parse the same way. The URL check (https only, nothing that can close the link) is now one helper, safe_card_url, and render_external_body uses it too.
  • First round: the card is created just before the review. On a PR's first round there is no card yet. Decide now calls a new card.ensure just before posting its first review of the round. ensure returns the existing card, or creates a pending one (render_pending: "Deciding this round…" with pass / none, the pair the start phase already writes for a round in progress, so agents read it as nothing to do) when there is none. The round's card replaces the pending one in the same step, after the review, as before. This is the same pattern cursor-approve.yml's Find the card step already uses for its approval link.
  • The round's card edits the pending card by its comment id. upsert(..., card=) skips the second comment listing. A listing taken seconds after the card was created could miss it and post a second card.
  • Never fatal. If the card cannot be found or created, the review is posted without the link and the run logs a warning.
  • No new pending card where it would get stuck:
    • rounds that post no review (a deferred pass, or capped);
    • a PR the approver authored. GitHub refuses that review, so decide skips the card. If an empty or stale --pr-author lets the round through to the refused POST, decide deletes the pending card it created.
    • a review body that fails to render. The body is rendered before the card is looked up or created.
    • runs without --card true.
  • A pending card is never left pointing at the wrong review. If decide cannot withdraw the review it just posted after the head or base moved (or after a hand-off), it writes a no_decision / human card. card.ensure also lists the comments again after a create that failed ambiguously, so the caller edits a card that did land rather than posting a second one.
  • Docs: docs/callers/cursor-review.md, the status-card contract in docs/callers/cursor-approve.md (the pending card and what none means there), both module docstrings and the cursor-review README row.

Why not edit the review afterwards

The ticket's first plan was to post the review, write the card, then edit the review to add the link. That would break the dismissal model. _review_node treats any review with lastEditedAt as edited, and:

  • an edited approval is always treated as stale, so dismiss-stale withdraws it on the next event;
  • an edited request for changes is never withdrawn by the bot, so the standing block would have to be dismissed by hand.

So the link has to be in the review when it is posted, and on the first round that means the card must exist first. A test pins that no review is ever edited.

Why

On a recent four-round PR in a private caller repo, the bot posted four auto-approve reviews and none of them linked the card. One standing block said "Address the axis verdicts above, push, then start a new round". The verdicts it meant are on the card, which nothing in the review linked to.

Testing

  • python3 -m unittest discover -s .github/cursor-review/tests -p 'test_*.py': 1543 tests, OK.
  • python3 -m unittest discover -s .github/cursor-approve/tests -p 'test_*.py': 246 tests, OK. The 1 skip ("needs /proc") is a pre-existing macOS-only skip.
  • check_workflow_pins.py OK. check-org-repo-literals.sh (and its shellcheck) OK. check_agents_md.py passed with 2 warnings that were already there.
  • New tests:
    • each review type links the card, and its markers still parse;
    • unsafe or missing URLs are never linked;
    • first round: pending card, then the review, then a PATCH of that same comment, and never a second card;
    • a later round links the card it finds without writing it first;
    • an APPROVE withdrawn after a head move, and the block that replaces it, link one card that was looked up once;
    • a card lookup that fails only costs the link;
    • the approver's own PR, deferred-pass and capped rounds create no pending card;
    • an own-PR refusal that gets past the author check deletes the pending card; a body that cannot render creates none; a review that cannot be withdrawn gets a no_decision / human card;
    • card.ensure returns a card that landed after an ambiguous create, and raises when none did;
    • no review is ever edited;
    • the auto-retry block still passes the gate's own-line marker check;
    • card.ensure found and created paths, the ensure phase's card_url output and its never-fatal failure, and upsert(card=).
  • Mutation-checked: dropping the by-id edit, the pending card, the own-PR guard or the standing-block link each fails the suite.
  • Existing test fixtures changed:
    • StatusCard tests now check that every card write lands on one comment, rather than that there was exactly one write;
    • AutoRetry tests run on round 2 with that round's existing card.
  • Not run end to end on a live PR. The first-round path should be confirmed on the first caller round after the pin bumps.

Notes for callers

Only assets loaded at run time change (auto-approve.py, card.py). There are no new inputs, secrets or permissions, because decide already writes the card. A caller gets this when uses: and workflows_ref: are bumped together.

Provenance

Authored by: agent-work loop
Verified:

  • Both script suites pass at the current head: cursor-review (1543 tests) and cursor-approve (246 tests).
  • check_workflow_pins.py, check-org-repo-literals.sh and check_agents_md.py all pass (2 warnings that were already there).
  • The review round's stranded-pending-card, own-PR and ambiguous-create fixes each have a test.

Deviations:

  • Not run end to end on a live PR. The first-round path needs confirming on the first caller round after the pin bump.
  • Not changed: the overlapping-runs card race. The per-PR concurrency group prevents it, and upsert has always listed and then POSTed.

🤖 Generated with Claude Code

…rove card (BE-20246)

Every review the approver posts (decide's APPROVE, REQUEST_CHANGES and
standing block, and approve-external's standing block) now carries a link
to the status card. approve-external's approval already linked it.

The link has to be in the review when it is posted. Editing a review
afterwards would break it: an edited approval reads as stale, and the bot
never withdraws an edited request for changes. So on a PR's first round,
before any card exists, decide creates a pending card (no_decision/none)
just before the review. The round's card replaces it in the same step, by
comment id rather than a re-list, so a lagging listing cannot produce a
second card. Rounds that post no review create no pending card, and
neither does a PR the approver authored. A card that cannot be found or
created only costs the review its link.
@coderabbitai

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Warning

Review limit reached

  • Run on-demand review

This review includes 6 billable files and costs up to $1.50.

  • 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 44 minutes for your next included review.

Check out review usage here.

View limit details

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

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Team
  • Run ID: cc73a4ab-4b40-4fe5-a675-3d1ce2048723

📥 Commits

Reviewing files that changed from the base of the PR and between 4b5a056 and 7e285f2.


📒 Files selected for processing (6)
  • .github/cursor-approve/card.py
  • .github/cursor-approve/tests/test_card.py
  • .github/cursor-review/auto-approve.py
  • .github/cursor-review/tests/test_auto_approve.py
  • docs/callers/cursor-approve.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: 423dedb5-b71a-407c-98ee-d3719c74b6fe



📥 Commits

Reviewing files that changed from the base of the PR and between 095550c and 4b5a056.




📒 Files selected for processing (8)
  • .github/cursor-approve/card.py
  • .github/cursor-approve/tests/test_card.py
  • .github/cursor-review/README.md
  • .github/cursor-review/auto-approve.py
  • .github/cursor-review/tests/test_approve_external.py
  • .github/cursor-review/tests/test_auto_approve.py
  • docs/callers/cursor-approve.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 1 review per hour.





📝 Walkthrough
📝 Walkthrough
📝 Walkthrough

Walkthrough

Review decisions now link to cursor-approve status cards. On a first round, cursor-review creates a pending card before posting the review, then updates it with the round result. External approval bodies also use the card link when its URL passes validation.

Changes

Status card links

Layer / File(s) Summary
Pending card creation and update
.github/cursor-approve/card.py, .github/cursor-approve/tests/test_card.py
The card module can render a pending state, find or create the bot-authored card, and update a supplied card without listing comments again. Tests cover rendering, lookup, creation, and output handling.
Review decision links and card updates
.github/cursor-review/auto-approve.py, .github/cursor-review/tests/test_auto_approve.py, .github/cursor-review/README.md, docs/callers/cursor-approve.md, docs/callers/cursor-review.md
Review bodies include a validated card link. The first-round path creates a pending card before posting a review and then updates it with the round result. Tests and documentation cover these behaviors.
External approval links
.github/cursor-review/auto-approve.py, .github/cursor-review/tests/test_approve_external.py
External approval and standing request bodies use the shared URL validator. Tests cover request-for-changes links and unsafe URLs.

Sequence Diagram(s)

sequenceDiagram
  participant cmd_decide
  participant review_card_url
  participant cardensure as card.ensure
  participant render_body
  participant ReviewsAPI as GitHub Reviews API
  participant cardupsert as card.upsert
  cmd_decide->>review_card_url: obtain status-card URL
  review_card_url->>cardensure: find or create pending card
  cmd_decide->>render_body: render review with card URL
  cmd_decide->>ReviewsAPI: post review
  cmd_decide->>cardupsert: update card with round result
Loading




Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to 4b5a0

No merge-blocking issue is established. The first-round card-link flow can proceed through normal checks.

Pre-merge checks | Passed 2
✅ Passed checks (2 passed)
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 12, 2026
…e pair (BE-20246)

The pending card a first round creates before its review carried
no_decision/none. Agent lane readers escalate that pair to a human: one
applies needs-human-review, which withdraws the bot's approvals. A card
read in the few seconds before the round's own card replaced it could
therefore hand a PR that was being approved to a human. pass/none is the
pair render_start already writes while the axes are pending, a round in
progress with nothing to do, and every current consumer reads it that way.
The text stays "Deciding this round". A test pins the pending card's
markers to render_start's non-capped pair.

@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 5 finding(s).

Severity Count
🟡 Medium 1
🟢 Low 4

Panel: 6/6 reviewers contributed findings.

Comment thread .github/cursor-review/auto-approve.py Resolved
Comment thread .github/cursor-approve/card.py Resolved
Comment thread .github/cursor-approve/card.py Resolved
Comment thread .github/cursor-review/auto-approve.py Resolved
Comment thread .github/cursor-review/auto-approve.py Resolved
…es (BE-20246)

Review round on #412:
- decide renders the review body before it looks up or creates the card,
  so a body that fails to render creates no pending card.
- A review GitHub refuses as the approver's own PR deletes the pending card
  it created. An empty or stale --pr-author gets past the up-front check.
- A review that could not be withdrawn after the head/base moved, or after
  a hand-off, now writes a no_decision/human card. The pending card would
  otherwise keep pointing readers at that review as the decision.
- card.ensure looks again after a create that failed ambiguously, so the
  caller edits a card that did land instead of posting a second one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mattmillerai
mattmillerai merged commit ebd6a64 into main Oct 12, 2026
8 checks passed
@mattmillerai
mattmillerai deleted the matt/be-20246-card-link-in-auto-approve-reviews branch October 12, 2026 04:47
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.

2 participants