Skip to content

docs(workflow): require PRs to mirror their closing issue's triage labels (closes #237)#238

Open
cristim wants to merge 2 commits intofeat/multicloud-web-frontendfrom
docs/issue-237-codify-pr-labeling
Open

docs(workflow): require PRs to mirror their closing issue's triage labels (closes #237)#238
cristim wants to merge 2 commits intofeat/multicloud-web-frontendfrom
docs/issue-237-codify-pr-labeling

Conversation

@cristim
Copy link
Copy Markdown
Member

@cristim cristim commented May 3, 2026

Summary

  • Closes docs(workflow): require PRs to mirror their closing issue's triage labels #237: codifies three mandatory workflow rules that were present in the system-prompt CLAUDE.md but absent from the feat/multicloud-web-frontend base branch.
  • Post-push CI watcher — arm a background watcher after every git push so CI failures surface within the same turn.
  • CodeRabbit loop — iterate CR passes until zero Actionable items remain before declaring a PR done.
  • PR labeling — mirror the closing issue's triage labels (priority/*, severity/*, urgency/*, impact/*, effort/*, type/*, triaged) onto every new PR via gh pr edit --add-label, before pinging CodeRabbit. Unlabeled PRs are invisible to priority-ordered is: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.md contains ## PR labeling — mirror closing-issue labels (MANDATORY) between ## CodeRabbit loop and ## Security Rules
  • Section includes the gh invocation with jq filter for all label classes
  • Multi-close handling (highest priority/severity, union the rest) is documented
  • No-triaged-lie rule is present
  • Closing checkpoint paragraph matches the CI-watcher pattern
  • Post-push CI watcher and CodeRabbit loop sections also present (they were absent from base branch)

Summary by CodeRabbit

Release Notes

No user-facing changes in this release. This update consists of internal documentation improvements to development procedures and workflows.

…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.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 3, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c5a839d0-1450-4d01-bf2d-51d37ae47d31

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Documentation added to CLAUDE.md requiring three mandatory workflow procedures: automated post-push CI watchers for triggered runs, CodeRabbit review iteration with triage classification, and PR label mirroring from closing issues. All procedures include verification steps and continuation rules.

Changes

Workflow Procedure Documentation

Layer / File(s) Summary
Post-Push CI Watcher
CLAUDE.md (lines 69–107)
Procedure for listing GitHub Actions runs triggered by a push, launching background watchers for queued/in_progress runs, and automatically pushing fixes on failure. Includes checkpoint verification that at least one ci-watch-* task is armed.
CodeRabbit Review Loop
CLAUDE.md (lines 108–136)
Mandatory review loop: deterministic @coderabbitai review triggering, triage classification rules (Actionable/Outside-diff/Nitpick), batching and fix-push mechanics, rebase/force-with-lease handling on conflicts, and loop-exit criteria requiring zero Actionable items and resolved/justified nitpicks.
PR Labeling — Mirror Closing Issue
CLAUDE.md (lines 137–185)
Rules requiring PRs to inherit triage label sets (priority/severity/urgency/impact/effort/type and optional triaged) from closing issues via gh commands. Includes mechanics for multi-issue label unioning, conditional triaged handling, label creation when missing, and verification checkpoints.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested labels

type/chore


🐰 Three workflows woven tight,
CI watchers stand the midnight watch,
CodeRabbit hops with might,
And labels match from issue-notch!
A rabbit's quest for procedural light, 🎯

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding a rule requiring PRs to mirror their closing issue's triage labels.
Linked Issues check ✅ Passed The PR adds the mandatory PR labeling section with gh invocation and multi-close handling to CLAUDE.md, directly addressing all coding requirements from issue #237.
Out of Scope Changes check ✅ Passed All changes are scoped to CLAUDE.md documentation updates required by issue #237; no unrelated modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/issue-237-codify-pr-labeling

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

@cristim cristim added type/docs Documentation priority/p3 Polish / idea / may never ship severity/low Minor harm urgency/eventually No deadline impact/internal Team-internal only effort/xs Trivial / one-liner triaged Item has been triaged labels May 3, 2026
@cristim
Copy link
Copy Markdown
Member Author

cristim commented May 3, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 3, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

)

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.
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
CLAUDE.md (1)

150-153: ⚡ Quick win

Avoid manual PR_NUM entry 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

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 00bc1995-90e3-4a99-982a-b2b93e9aaacd

📥 Commits

Reviewing files that changed from the base of the PR and between c84fd02 and 7dbe911.

📒 Files selected for processing (1)
  • CLAUDE.md

Comment thread CLAUDE.md
Comment on lines +154 to +160
LABELS=$(gh issue view "$ISSUE_NUM" --repo LeanerCloud/CUDly --json labels \
--jq '[.labels[].name | select(test("^(priority|severity|urgency|impact|effort|type)/")) ]
+ (if [.labels[].name] | any(. == "triaged") then ["triaged"] else [] end)
| join(",")')

gh pr edit "$PR_NUM" --repo LeanerCloud/CUDly --add-label "$LABELS"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Handle empty $LABELS before calling gh pr edit --add-label.

If the closing issue has none of the selected label classes, this command can fail on an empty label payload and break the mandatory flow. Add a guard so the workflow stays deterministic and still surfaces the triage gap.

Proposed hardening
 LABELS=$(gh issue view "$ISSUE_NUM" --repo LeanerCloud/CUDly --json labels \
   --jq '[.labels[].name | select(test("^(priority|severity|urgency|impact|effort|type)/")) ]
         + (if [.labels[].name] | any(. == "triaged") then ["triaged"] else [] end)
         | join(",")')
 
-gh pr edit "$PR_NUM" --repo LeanerCloud/CUDly --add-label "$LABELS"
+if [ -n "$LABELS" ]; then
+  gh pr edit "$PR_NUM" --repo LeanerCloud/CUDly --add-label "$LABELS"
+else
+  echo "No matching triage labels found on issue #$ISSUE_NUM; surface this in PR body/comment for human triage."
+fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
LABELS=$(gh issue view "$ISSUE_NUM" --repo LeanerCloud/CUDly --json labels \
--jq '[.labels[].name | select(test("^(priority|severity|urgency|impact|effort|type)/")) ]
+ (if [.labels[].name] | any(. == "triaged") then ["triaged"] else [] end)
| join(",")')
gh pr edit "$PR_NUM" --repo LeanerCloud/CUDly --add-label "$LABELS"
LABELS=$(gh issue view "$ISSUE_NUM" --repo LeanerCloud/CUDly --json labels \
(if [.labels[].name] | any(. == "triaged") then ["triaged"] else [] end)
| join(",")')
if [ -n "$LABELS" ]; then
gh pr edit "$PR_NUM" --repo LeanerCloud/CUDly --add-label "$LABELS"
else
echo "No matching triage labels found on issue #$ISSUE_NUM; surface this in PR body/comment for human triage."
fi
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@CLAUDE.md` around lines 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.

@cristim
Copy link
Copy Markdown
Member Author

cristim commented May 3, 2026

Added a follow-up commit (188012004) extending the CR-loop section with explicit subagent-delegation guidance — exit criteria for fork prompts, not just human workflows. Surfaced by the catch-up CR-loop pass on PRs #227#236 (none of those forks ran the CR loop because my prompts stopped at the @coderabbitai review ping). @coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 3, 2026

Tip

For best results, initiate chat on the files or code changes.

@cristim: Understood — triggering a review pass to cover commit 188012004 and the subagent-delegation exit-criteria additions to the CR-loop section.

[review]

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

Labels

effort/xs Trivial / one-liner impact/internal Team-internal only priority/p3 Polish / idea / may never ship severity/low Minor harm triaged Item has been triaged type/docs Documentation urgency/eventually No deadline

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant