docs(workflow): require PRs to mirror their closing issue's triage labels (closes #237)#238
docs(workflow): require PRs to mirror their closing issue's triage labels (closes #237)#238cristim wants to merge 4 commits into
Conversation
|
Warning Review limit reached
More reviews will be available in 10 minutes and 26 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the 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 credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. 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, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. 📝 WalkthroughWalkthroughDocumentation adds three mandatory workflow procedures to CLAUDE.md: a post-push CI watcher that arms background watchers and can auto-fix failures; a CodeRabbit review loop with triage and repeat-until-clean rules; and a PR-labeling procedure that mirrors closing-issue triage labels via ChangesWorkflow Procedure Documentation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
CLAUDE.md (1)
150-153: ⚡ Quick winAvoid manual
PR_NUMentry in a mandatory path.Using a hand-copied PR number is brittle and easy to misapply to the wrong PR. Prefer deriving it directly from the current branch context.
Safer PR number resolution
-PR_NUM=<the number gh just printed> +PR_NUM=$(gh pr view --repo LeanerCloud/CUDly --json number --jq '.number') ISSUE_NUM=<the issue this PR closes>🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@CLAUDE.md` around lines 150 - 153, Replace the brittle manual PR_NUM assignment after `gh pr create` with automatic resolution: capture the created PR number programmatically (e.g., parse `gh pr create` output or call `gh pr view` for the current branch) and set PR_NUM from that value; reference the variables PR_NUM and ISSUE_NUM and the command `gh pr create` in your changes so the script derives PR_NUM from the current branch/PR context rather than requiring manual entry.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@CLAUDE.md`:
- Around line 154-160: The script currently unconditionally runs gh pr edit
"$PR_NUM" --add-label "$LABELS", which fails when LABELS is empty; change it to
guard the call by checking the LABELS variable first (the LABELS assignment and
the gh pr edit "$PR_NUM" --add-label "$LABELS" invocation), e.g., only call gh
pr edit with --add-label when LABELS is non-empty and otherwise surface the
triage gap deterministically (for example add a specific fallback label like
"triage-needed" or post a comment) so the workflow does not break on empty label
payloads.
---
Nitpick comments:
In `@CLAUDE.md`:
- Around line 150-153: Replace the brittle manual PR_NUM assignment after `gh pr
create` with automatic resolution: capture the created PR number
programmatically (e.g., parse `gh pr create` output or call `gh pr view` for the
current branch) and set PR_NUM from that value; reference the variables PR_NUM
and ISSUE_NUM and the command `gh pr create` in your changes so the script
derives PR_NUM from the current branch/PR context rather than requiring manual
entry.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
|
Added a follow-up commit ( |
|
Tip For best results, initiate chat on the files or code changes.
[review] |
…nd manual PR_NUM Address CodeRabbit review on PR #238: 1. Actionable (Major): `gh pr edit --add-label ""` fails on empty payload, silently breaking the MANDATORY label-mirror flow when the closing issue has no priority/severity/urgency/impact/effort/type labels. Guard the call with `if [ -n "$LABELS" ]` and emit a clear WARN otherwise that directs the operator to triage the issue first and surface the gap. 2. Nitpick (Quick win): `PR_NUM=<the number gh just printed>` is brittle and easy to misapply to the wrong PR. Derive it from the current branch context via `gh pr view --json number --jq '.number'` instead, so the snippet works without any hand-editing after `gh pr create`. Both changes are in the prescriptive CLAUDE.md snippet only. The labels flow itself is unchanged behaviorally for the happy path (issue has the expected triage labels); the new branches harden the unhappy paths. Refs #237.
CodeRabbit pass 1 — both findings addressedPushed commit Actionable (Major) — empty
|
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 19004
Review summary✅ Empty
|
| Criterion | Status |
|---|---|
| "PR labeling — mirror closing-issue labels (MANDATORY)" section | ✅ |
Exact gh invocation with jq filter for all label classes |
✅ |
| Multi-close handling (highest priority/severity, union rest) | ✅ |
| No-triaged-lie rule | ✅ |
| "Before declaring done" checkpoint mirrors CI-watcher pattern | ✅ |
| Post-push CI watcher section present | ✅ |
| CodeRabbit loop section present | ✅ |
| Subagent-delegation exit criteria in CR-loop | ✅ |
No actionable items remain. The PR is ready to merge.
[approve]
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
@coderabbitai resolve |
✅ Actions performedComments resolved. Approval is disabled; enable |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
CR finding verification - PR_NUM auto-derivationBoth findings from the CodeRabbit review (2026-05-03) against commit 7dbe911 are already addressed in commit 64fc92a: Nitpick (lines 150-153): brittle manual PR_NUM PR_NUM=$(gh pr view --repo LeanerCloud/CUDly --json number --jq '.number')This derives the PR number automatically from the current branch context. Major (lines 165-180): unconditional gh pr edit --add-label on empty LABELS No new commits are needed. Current HEAD is 64fc92a on branch docs/issue-237-codify-pr-labeling. @coderabbitai review |
|
Both fixes were already validated in the prior review, all acceptance criteria from ✅ Actions performedReview triggered.
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
@coderabbitai review |
Rate Limit Exceeded
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai full review |
✅ Action performedFull review finished. |
…bels (closes #237) Adds three mandatory workflow sections to CLAUDE.md: - Post-push CI watcher: arm a background watcher after every push so CI failures are caught and fixed within the same turn rather than sitting overnight. This rule already existed in the system-prompt CLAUDE.md but was absent from the base branch. - CodeRabbit loop: iterate CR passes to silence before declaring a PR done. Same gap — the rule existed locally but not on feat/multicloud-web-frontend. - PR labeling: every PR must carry the same triage labels as the issue it closes (priority/*, severity/*, urgency/*, impact/*, effort/*, type/*, triaged). Unlabeled PRs are invisible to priority-ordered queries. The section codifies the gh invocation, multi-close merge logic, and a closing checkpoint with the same shape as the CI-watcher rule. All three sections are inserted between ## Build & Test and ## Security Rules, matching the layout already present in the working-tree checkout.
) A fork that pushes a PR, pings CodeRabbit, then exits leaves CR threads unresolved — exactly what happened to PRs #228, #229, #230, etc., where CR posted Actionable findings + Nitpicks that were never triaged. This adds a paragraph to the CR-loop section explicitly addressing the delegation case: subagent prompts MUST include the full loop with the exit criteria spelled out. Stops the failure mode where the rule is correctly stated for humans but doesn't get mirrored into fork prompts.
…nd manual PR_NUM Address CodeRabbit review on PR #238: 1. Actionable (Major): `gh pr edit --add-label ""` fails on empty payload, silently breaking the MANDATORY label-mirror flow when the closing issue has no priority/severity/urgency/impact/effort/type labels. Guard the call with `if [ -n "$LABELS" ]` and emit a clear WARN otherwise that directs the operator to triage the issue first and surface the gap. 2. Nitpick (Quick win): `PR_NUM=<the number gh just printed>` is brittle and easy to misapply to the wrong PR. Derive it from the current branch context via `gh pr view --json number --jq '.number'` instead, so the snippet works without any hand-editing after `gh pr create`. Both changes are in the prescriptive CLAUDE.md snippet only. The labels flow itself is unchanged behaviorally for the happy path (issue has the expected triage labels); the new branches harden the unhappy paths. Refs #237.
gh pr view --repo LeanerCloud/CUDly requires a positional argument (number, URL, or branch) when --repo is specified; without one it errors out and leaves PR_NUM empty, silently breaking the mandatory label-mirror flow. Pass the current branch explicitly via $(git rev-parse --abbrev-ref HEAD) to make it robust.
bbba22b to
c3ae487
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
Summary
feat/multicloud-web-frontendbase branch.git pushso CI failures surface within the same turn.priority/*,severity/*,urgency/*,impact/*,effort/*,type/*,triaged) onto every new PR viagh pr edit --add-label, before pinging CodeRabbit. Unlabeled PRs are invisible to priority-orderedis:open label:priority/p*queries.The silent failure that motivated this PR: 10 PRs shipped in two recent batches, all merged-eligible after CR sign-off, none labeled — making them invisible to triage ordering.
Dogfooding
This PR itself is labeled with the issue's triage labels per the new rule (
type/docs,priority/p3,severity/low,urgency/eventually,impact/internal,effort/xs,triaged).Test plan
CLAUDE.mdcontains## PR labeling — mirror closing-issue labels (MANDATORY)between## CodeRabbit loopand## Security Rulesghinvocation with jq filter for all label classesSummary by CodeRabbit