Skip to content

fix(skills): flip PR to ready before waiting on CodeRabbit to avoid a draft deadlock#3976

Merged
PierreBrisorgueil merged 3 commits into
masterfrom
fix/3956-pr-ready-before-coderabbit
Jul 17, 2026
Merged

fix(skills): flip PR to ready before waiting on CodeRabbit to avoid a draft deadlock#3976
PierreBrisorgueil merged 3 commits into
masterfrom
fix/3956-pr-ready-before-coderabbit

Conversation

@PierreBrisorgueil

@PierreBrisorgueil PierreBrisorgueil commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Summary

  • What changed: Added a hard ordering invariant to the /pull-request skill's monitor loop — flip the PR to ready (gh pr ready <n>) as soon as draft CI is green, before any CodeRabbit/threads wait. Also added a belt-and-braces per-pass draft-guard (step 0 in the monitor loop, references/monitor-loop.md §6-guard) that flips ready if a pass ever observes isDraft: true with CI green.
  • Why: CodeRabbit never reviews DRAFT PRs. The monitor loop could end up waiting forever on the CodeRabbit signal while the PR was still a draft — a silent deadlock. Observed 2026-07-16: a converging PR sat in draft with all checks green and the CodeRabbit check pending indefinitely until manually un-drafted.
  • Related issues: Closes 🔧 pull-request skill: mark PR ready before waiting on CodeRabbit #3956

Scope

  • Module(s) impacted: .claude/skills/pull-request/SKILL.md, .claude/skills/pull-request/references/monitor-loop.md
  • Cross-module impact: none — skill documentation only, no runtime code
  • Risk level: low

Validation

  • npm run lint (no runtime code touched; lint clean)
  • npm test (no runtime code touched; no test impact)
  • Manual checks done (if applicable)

Guardrails check

  • No secrets or credentials introduced (.env*, secrets/**, keys, tokens)
  • No risky rename/move of core stack paths
  • Changes remain merge-friendly for downstream projects
  • Tests added or updated when behavior changed — N/A, doc/skill-only change, no behavior under test

Notes for reviewers

  • Security considerations: none
  • Mergeability considerations: doc-only; no runtime code
  • Follow-up tasks (optional): none

https://claude.ai/code/session_01WfNC8bt1TgL4AsiYgCEGup

Summary by CodeRabbit

  • Documentation
    • Updated pull request guidance to ensure ready status is applied immediately after successful CI checks.
    • Added safeguards to detect draft pull requests during monitoring and automatically mark them ready when CI passes.
    • Clarified that pull requests with failing checks remain drafts until CI succeeds.

… draft deadlock

CodeRabbit never reviews a draft PR. The pull-request skill's monitor loop
could enter (or continue) the CodeRabbit/threads wait while the PR was still
draft, deadlocking silently — observed 2026-07-16: a converging PR sat in
draft with CI green and the CodeRabbit check pending indefinitely, until
manually un-drafted.

- SKILL.md §5: emphasize the ordering invariant — `gh pr ready` MUST run as
  soon as draft CI is green, before section 6 starts waiting on any review
  signal.
- SKILL.md §6 / monitor-loop.md: add a belt-and-braces draft guard at the top
  of every poll pass — if `isDraft: true` and CI is green, flip to ready
  immediately. Covers a loop started before the flip, or a rebase/force-push
  that reverted the PR back to draft.

Closes #3956

Claude-Session: https://claude.ai/code/session_01WfNC8bt1TgL4AsiYgCEGup
@PierreBrisorgueil PierreBrisorgueil added the Fix A bug fix label Jul 17, 2026
@PierreBrisorgueil PierreBrisorgueil self-assigned this Jul 17, 2026
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@PierreBrisorgueil, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 49 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 68326082-db71-4096-bfe8-b8a07c15b094

📥 Commits

Reviewing files that changed from the base of the PR and between d49a574 and 5c705cc.

📒 Files selected for processing (1)
  • .claude/skills/pull-request/references/monitor-loop.md

Walkthrough

The pull-request skill now requires marking a PR ready immediately after draft CI becomes green, before waiting for review signals. The autonomous monitor loop also rechecks draft status and readiness on each pass.

Changes

Draft readiness ordering

Layer / File(s) Summary
PR creation ordering
.claude/skills/pull-request/SKILL.md
Requires gh pr ready immediately after green draft CI and before review-waiting behavior begins.
Monitor loop draft guard
.claude/skills/pull-request/SKILL.md, .claude/skills/pull-request/references/monitor-loop.md
Adds an initial guard that checks isDraft and CI status, marking the PR ready when it remains draft with green CI.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related issues

Possibly related PRs

Suggested labels: Docs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: making the PR ready before waiting on CodeRabbit.
Description check ✅ Passed The description matches the template with summary, scope, validation, guardrails, and reviewer notes filled in.
Linked Issues check ✅ Passed The changes implement #3956 by adding the ready-before-wait ordering guard and per-pass draft guard.
Out of Scope Changes check ✅ Passed The edits stay within the documented skill files and do not introduce unrelated scope.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/3956-pr-ready-before-coderabbit

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.

@PierreBrisorgueil
PierreBrisorgueil marked this pull request as ready for review July 17, 2026 08:20

@coderabbitai coderabbitai 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.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.claude/skills/pull-request/references/monitor-loop.md:
- Around line 55-56: Update the monitor loop’s draft-and-CI handling so that
when step 1 observes CI becoming green after initially being red, it returns to
or re-executes the draft guard from step 0 before proceeding to mergeability,
grace, or review checks. Preserve the existing no-op behavior while CI remains
red and ensure a draft PR is converted on the next pass.
- Around line 46-52: Update the CI_GREEN calculation in the monitor loop to
require a non-empty statusCheckRollup before evaluating whether all checks
succeeded. Preserve the existing SUCCESS/state handling and ensure an empty
check list evaluates to false, preventing gh pr ready from running before any
check completes.
- Around line 50-52: Update the draft-to-ready branch in the monitor loop so
failures from gh pr ready "$PR" are detected and handled before entering the
review-wait path. Stop the loop or retry the command on failure, and continue
only after the PR is successfully marked ready.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: d1c15528-49b6-4174-837d-915a781430be

📥 Commits

Reviewing files that changed from the base of the PR and between 319a675 and d49a574.

📒 Files selected for processing (2)
  • .claude/skills/pull-request/SKILL.md
  • .claude/skills/pull-request/references/monitor-loop.md

Comment thread .claude/skills/pull-request/references/monitor-loop.md
Comment thread .claude/skills/pull-request/references/monitor-loop.md
Comment thread .claude/skills/pull-request/references/monitor-loop.md Outdated
@PierreBrisorgueil
PierreBrisorgueil merged commit d89f05c into master Jul 17, 2026
3 checks passed
@PierreBrisorgueil
PierreBrisorgueil deleted the fix/3956-pr-ready-before-coderabbit branch July 17, 2026 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Fix A bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🔧 pull-request skill: mark PR ready before waiting on CodeRabbit

1 participant