Skip to content

feat: implement issue #1548 — pr-review: forced re-review dispatches die to sweep concurrency, then unforced sweeps skip 'already reviewed at head' with no verdict posted — PRs strand - #1558

Merged
don-petry merged 6 commits into
mainfrom
dev-lead/issue-1548-20260820-0212
Aug 30, 2026
Merged

don-petry merged 6 commits into
mainfrom
dev-lead/issue-1548-20260820-0212

Conversation

@don-petry

@don-petry don-petry commented Aug 20, 2026 •

Copy link
Copy Markdown
Collaborator

User description

Closes #1548

Implemented by dev-lead agent. Please review.

Summary by CodeRabbit

  • Bug Fixes

    • Improved handling of incomplete review records so eligible reviews can be re-dispatched instead of remaining stuck.
    • Completed review decisions continue to prevent unnecessary duplicate dispatches.
    • Rate-limit recovery now correctly retries incomplete reviews.
    • Non-standard review text no longer incorrectly counts as a completed decision.
  • Tests

    • Added coverage for orphaned reviews, completed decisions, forced re-dispatches, and scheduled review behavior.

CodeAnt-AI Description

Rescue pull requests when a review started but never posted a decision

What Changed

  • Detects reviews that marked the current commit but ended without an approval, escalation, or fix-requested decision
  • Re-dispatches these incomplete reviews with a forced retry, including during scheduled sweeps
  • Continues to skip reviews that already have a valid decision and avoids forcing normal re-reviews
  • Adds coverage for orphaned markers, valid decisions, rate-limit recovery, and scheduled rescue behavior

Impact

✅ Fewer pull requests stranded without a review verdict
✅ Automatic recovery after interrupted reviews
✅ No duplicate retries for completed reviews

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@codeant-ai

codeant-ai Bot commented Aug 20, 2026 •

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Incremental review completed e50c9df Aug 30, 2026 · 21:38 21:38
✅ Incremental review completed faea15c Aug 27, 2026 · 22:16 22:17
✅ Incremental review completed 61d9ae0 Aug 20, 2026 · 20:47 20:47
✅ Reviewed your PR 758fea9 Aug 20, 2026 · 02:35 02:38

@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing

@codeant-ai

codeant-ai Bot commented Aug 20, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@coderabbitai

coderabbitai Bot commented Aug 20, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: baf30438-4da0-4eff-8180-b5213f52a866

📥 Commits

Reviewing files that changed from the base of the PR and between ee1f39b and 5030930.

📒 Files selected for processing (2)
  • scripts/sweep-stuck-reviews.sh
  • tests/test_sweep_stuck_reviews.bats

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


Important

Approval pending

CodeRabbit has no unresolved comments, but it has not reviewed the latest commit.

Use the checkbox below to review the latest commit. CodeRabbit will approve the changes if it finds no blocking issues.

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The sweep now distinguishes canonical verdicts from head markers. Orphaned markers trigger forced re-dispatch, while completed verdicts suppress re-review. Tests cover orphan recovery, rate-limit retries, and normal unforced dispatches.

Changes

Orphaned review recovery

Layer / File(s) Summary
Verdict classification and retry eligibility
scripts/sweep-stuck-reviews.sh, tests/test_sweep_stuck_reviews.bats
The sweep recognizes canonical approved, escalated, and fix-requested verdicts separately from head markers. Rate-limit markers remain retryable until a verdict exists.
Forced orphan dispatch and validation
scripts/sweep-stuck-reviews.sh, tests/test_sweep_stuck_reviews.bats
Orphaned markers trigger force_review=true before scheduled narrowing. Tests verify forced rescue, verdict suppression, and unforced normal dispatches.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 50309

The change is localized to review-sweep behavior and its tests; no actionable merge-blocking risk remains after the requested normal validation checks.

Sequence Diagram(s)

sequenceDiagram
  participant Sweep as pr-review-sweep
  participant Markers as Review markers
  participant Dispatch as dispatch_review
  participant Trigger as pr-review-trigger.yml
  Sweep->>Markers: Inspect head marker and canonical verdict
  Markers-->>Sweep: Return marker and verdict counts
  Sweep->>Dispatch: Rescue orphan marker with force mode
  Dispatch->>Trigger: Dispatch with force_review=true
Loading

Possibly related PRs

Suggested labels: needs-human-review

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the main change and impact but omits the required Interaction contract and Checklist sections. Add the template's Interaction contract section and complete the shellcheck and documentation checklist.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes treat at-head markers without verdicts as orphaned reviews and force re-dispatches, satisfying issue #1548's recovery objective.
Out of Scope Changes check ✅ Passed The script and test changes directly support orphaned-review detection, forced recovery, verdict handling, and related coverage.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Title check ✅ Passed The title accurately describes the orphaned-review recovery and forced re-dispatch changes, but it is longer than necessary.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev-lead/issue-1548-20260820-0212

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@codeant-ai codeant-ai Bot added the size:L This PR changes 100-499 lines, ignoring generated files label Aug 20, 2026

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request addresses issue #1548 by updating scripts/sweep-stuck-reviews.sh to detect and handle orphaned review markers—where a review run stamped the head SHA but crashed before posting a final verdict. These orphaned reviews are now re-dispatched with force_review=true to bypass idempotency checks. Corresponding tests have been added to tests/test_sweep_stuck_reviews.bats. The review feedback recommends improving a negative assertion in the tests by asserting that grep exits with exactly status 1 instead of using ! grep, which prevents false passes on unexpected execution errors.

Comment thread tests/test_sweep_stuck_reviews.bats Resolved
Comment thread scripts/sweep-stuck-reviews.sh Resolved
Comment thread scripts/sweep-stuck-reviews.sh Resolved
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — review-changes (applied)

Changes committed and pushed.

@don-petry
don-petry enabled auto-merge (squash) August 20, 2026 02:56
@don-petry
don-petry disabled auto-merge August 20, 2026 02:58
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — fix-bot-comment (no-changes)

Agent reasoning
Issues addressed: 0
- Quality gate passed with 0 issues (informational — no actionable defects found)
Files changed: none
Skipped (informational): 1
```
The PR is ready—all required checks pass and the quality gate is green.

@don-petry
don-petry enabled auto-merge (squash) August 20, 2026 02:58
@donpetry-bot

Copy link
Copy Markdown
Contributor

CI checks on this PR are still running. Once they complete, re-mention @donpetry-bot to trigger a fresh review.

Posted by the donpetry-bot PR-review cascade.

@donpetry-bot

Copy link
Copy Markdown
Contributor

Advisory bots were rate-limited; auto-approval is withheld until they recover. pr-review-sweep will re-review this PR after 2026-08-20T03:59:51Z.

@don-petry
don-petry disabled auto-merge August 20, 2026 03:17
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — fix-bot-comment (no-changes)

Agent reasoning
Issues addressed: 0
Files changed: none
Notes: Quality gate passed with 0 new issues — no actionable defects identified
```
The PR is ready to merge.

@don-petry
don-petry enabled auto-merge (squash) August 20, 2026 03:18
@donpetry-bot

Copy link
Copy Markdown
Contributor

Advisory bots were rate-limited; auto-approval is withheld until they recover. pr-review-sweep will re-review this PR after 2026-08-20T04:18:16Z.

@don-petry

Copy link
Copy Markdown
Collaborator Author

Auto-rebase failed — merge conflict — this branch has conflicts with main that must be resolved.

dev-lead will attempt to resolve this automatically. If it cannot, a follow-up comment will explain what needs manual attention.

To resolve manually instead:

git fetch origin
git merge origin/main
# resolve conflicts, then:
git add .
git commit
git push

@don-petry
don-petry disabled auto-merge August 20, 2026 04:18
…die to sweep concurrency, then unforced sweeps skip 'already reviewed at head' with no verdict posted — PRs strand
@don-petry
don-petry force-pushed the dev-lead/issue-1548-20260820-0212 branch from 5d10439 to 5030930 Compare August 20, 2026 04:25
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — rebase (applied)

Rebase completed and pushed.

@don-petry
don-petry enabled auto-merge (squash) August 20, 2026 04:26
@donpetry-bot

donpetry-bot commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor
Superseded by automated re-review at 5030930408cd75aa8348f77158b392b1605164cd — click to expand prior review.

Review — fix requested (cycle 1/3)

The automated review identified the following issues. Please address each one:

Findings to fix

Automated review — NEEDS HUMAN REVIEW

Risk: MEDIUM
Reviewed commit: 5d1043923ceeb01f47f101a0fbb62570f56eeef1
Review mode: triage-approved (single reviewer)

Summary

PR #1558 rescues PRs stranded by orphaned review markers (issue #1548): the sweep now distinguishes a bare at-head marker (crashed review) from a marker carrying a canonical decision= verdict token, and re-dispatches orphans with force_review to bypass the idempotency no-op. The logic is sound and well-tested (7 new bats cases covering orphans, verdicts, canonical-token binding, scheduled narrowing bypass, and non-forced normal dispatch), and all CI checks are green. However, two approval gates fail: (1) an unresolved Major-severity review thread on the force_review scope, and (2) the branch is in a CONFLICTING merge state after a failed auto-rebase.

Linked issue analysis

Closes #1548. The issue describes PRs stranding when a review crashes after stamping the reviewed-at-head marker but before posting a verdict, and forced manual re-dispatches dying to sweep concurrency-group cancellation. The PR implements the first requested fix option: treat marker-without-verdict as needing re-review, dispatching WITH force_review so review-one-pr.sh's idempotency no-op is bypassed. The verdict test is correctly bound to the canonical marker shapes (decision token inside the head marker for approved/escalated; companion fix-requested marker) rather than loose prose matching, and a regression test covers the quoted-prose false-positive. The rate-limited-retry path was also correctly updated to key on verdict_at_head so an orphan marker cannot suppress the retry. The issue is substantively addressed. The concurrency-group fix option was not taken but the issue allowed any of the listed fixes.

Findings

  1. UNRESOLVED REVIEW THREAD (blocking gate): codeant-ai flagged (Major) that force_review bypasses CI-failing/CI-pending/advisory gates in review-one-pr.sh, not just the idempotency marker, so a check turning red between snapshot and dispatch would still get a forced review. The author's reply is reasoned — a scoped bypass_idempotency input cannot be forwarded across the pr-review/next channel pin without the AGENTS.md three-step promotion sequence (out of scope here), and the sweep re-gates on a fresh CI snapshot in the same loop iteration immediately before the forced dispatch (verified: compute_ci_status runs before the marker check in the loop). The residual TOCTOU window is narrow, but the thread remains open and the deferral deserves a human/owner judgment call.
  2. MERGE CONFLICT (blocking): mergeable=CONFLICTING, mergeStateStatus=DIRTY — auto-rebase failed at 04:17 UTC. The branch must be rebased/conflict-resolved, which will change the head SHA and require re-review anyway. Approving at this SHA would be premature.
  3. Prior rate-limited withhold: a pr-review-agent rate-limited marker exists at this head (advisory bots Codex/CodeRabbit/Qodo were limited). CodeAnt did complete its review, and SonarCloud/CodeQL/Semgrep-equivalents are green.
  4. Secret scan: the run_secret_scanning MCP tool is unavailable in this environment; gitleaks CI check passed. Diff contains shell + bats test changes only — no secret-like content observed.
  5. No security anti-patterns: array-based flag construction for the gh workflow run call avoids injection; force_review still respects the per-PR automation budget (Runaway PR #860: agents self-triggering — add per-PR churn breaker, human-gated cap resets, and self-trigger guards #926) and the needs-human-review escalation gate.

CI status

All required checks green at 5d10439: shellcheck, bats (unit tests), actionlint, CodeQL, SonarCloud quality gate, gitleaks, agent-shield, template-drift, caller-stub-freeze, and all validators passed. Skipped checks are ecosystem-conditional audits (npm/pip/cargo/go). Merge state: CONFLICTING (auto-rebase failed) — not a CI failure but blocks merge.


Reviewed automatically by the PR-review agent (single-reviewer mode: fable 5). Reply if you need a human review.

Additional tasks

  1. Resolve all unresolved review thread comments from other reviewers
  2. Ensure all CI checks pass after your changes
  3. Rebase on the target branch if behind
  4. Do NOT modify files unrelated to the findings above

The review cascade will automatically re-review after new commits are pushed.

@don-petry
don-petry disabled auto-merge August 20, 2026 04:27
@codeant-ai

codeant-ai Bot commented Aug 27, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@codeant-ai codeant-ai Bot added size:L This PR changes 100-499 lines, ignoring generated files and removed size:L This PR changes 100-499 lines, ignoring generated files labels Aug 27, 2026
@codeant-ai

codeant-ai Bot commented Aug 30, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@donpetry-bot

Copy link
Copy Markdown
Contributor

Advisory bots were rate-limited; auto-approval is withheld until they recover. pr-review-sweep will re-review this PR after 2026-08-30T22:43:25Z.

@don-petry
don-petry disabled auto-merge August 30, 2026 21:43
@don-petry
don-petry enabled auto-merge (squash) August 30, 2026 21:44
@sonarqubecloud

Copy link
Copy Markdown

@donpetry-bot

Copy link
Copy Markdown
Contributor

Advisory bots were rate-limited; auto-approval is withheld until they recover. pr-review-sweep will re-review this PR after 2026-08-30T22:53:36Z.

@don-petry
don-petry disabled auto-merge August 30, 2026 21:54
@don-petry

Copy link
Copy Markdown
Collaborator Author

Dev-Lead — fix-bot-comment (no-changes)

Agent reasoning
Issues addressed: 0
- Quality gate passed with 0 new issues; no actionable defects reported
Files changed: scripts/sweep-stuck-reviews.sh, tests/test_sweep_stuck_reviews.bats (existing changes)
Skipped (informational): 0
```
**Status:** ✅ **No changes needed.** The PR is ready to merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

2 participants