Skip to content

docs: mirror closing issue's triage labels onto every PR - #11

Closed
cristim wants to merge 1 commit into
mainfrom
docs/mirror-issue-labels-on-pr
Closed

docs: mirror closing issue's triage labels onto every PR#11
cristim wants to merge 1 commit into
mainfrom
docs/mirror-issue-labels-on-pr

Conversation

@cristim

@cristim cristim commented May 3, 2026

Copy link
Copy Markdown
Member

Summary

Adds a bullet to CLAUDE.md §"Subagent Strategy" requiring that every gh pr create mirror the closing issue's triage labels onto the new PR.

The full set: priority/*, severity/*, urgency/*, impact/*, effort/*, type/*, plus triaged (only if the issue carries it — never invent it).

Why: PRs that lack triage labels are invisible to the same priority queries that surface the issues, so an unlabeled PR is effectively unreviewable in priority order — the same class of bug as forgetting the post-push CI watcher. Treat label-mirroring as part of the open-PR step, not a follow-up.

Multi-issue PRs: take the highest priority/* and severity/* across the closed set, union the rest.

Delegation: when delegating PR shipping to a subagent, include the label-mirror step in the prompt explicitly — don't assume inference. Project-level CLAUDE.md may add the exact gh invocation; this global rule is the requirement itself.

This complements the always-on per-item triage rule (already on main) and the explicit-model + Sonnet-default-for-PR-shipping rules (PR #10) — together they form the complete shipping discipline: every issue triaged, every PR labelled to match, every subagent dispatched at the right tier.

Test plan

  • Read CLAUDE.md §"Subagent Strategy" lines 213–217 — the new bullet sits between "Default: delegate down" and the rubric block, and reads as a natural continuation of the shipping discipline
  • Confirm the rule references existing labels from triage.md §"Default label set" (no new labels invented)
  • `git diff --stat origin/main` shows exactly one file changed (`CLAUDE.md`), 1 insertion, 0 deletions

Summary by CodeRabbit

  • Documentation
    • Updated guidelines for PR creation to automatically apply triage labels from closed issues to newly created PRs.

Adds a bullet to CLAUDE.md §"Subagent Strategy" requiring that every
`gh pr create` mirror the closing issue's triage labels onto the new
PR — `priority/*`, `severity/*`, `urgency/*`, `impact/*`, `effort/*`,
`type/*`, plus `triaged` only if the issue carries it.

PRs that lack triage labels are invisible to the priority queries that
surface the issues, so an unlabeled PR is effectively unreviewable in
priority order — the same class of bug as forgetting the post-push CI
watcher.

Multi-issue PRs: take the highest `priority/*` and `severity/*` across
the closed set, union the rest. When delegating PR shipping to a
subagent, include the label-mirror step in the prompt explicitly.
Project-level CLAUDE.md may add the exact `gh` invocation; this global
rule is the requirement itself.
@coderabbitai

coderabbitai Bot commented May 3, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

A new mandatory workflow rule is added to CLAUDE.md requiring that after creating a PR via gh pr create, triage labels from the closing issue must be mirrored onto the newly created PR, with union behavior for multiple issues.

Changes

Documentation Update

Layer / File(s) Summary
Workflow Rule Addition
CLAUDE.md
New mandatory rule: mirror closing issue's triage labels (including triaged only when present) onto newly created PRs via gh pr create, applying union logic when multiple issues are closed.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related issues

Possibly related PRs

Suggested labels

triaged, type/docs, effort/xs, impact/internal, severity/low, urgency/eventually, priority/p3

Poem

🐰 A label hops from issue to PR,
Following the rules written in our star,
No triage left behind, mirror shines bright,
CLAUDE.md guides us through the night.

🚥 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 'docs: mirror closing issue's triage labels onto every PR' directly and clearly summarizes the main change: adding a documentation rule requiring PR label mirroring from issues.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✏️ 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/mirror-issue-labels-on-pr
⚔️ Resolve merge conflicts
  • Resolve merge conflict in branch docs/mirror-issue-labels-on-pr

Review rate limit: 3/5 reviews remaining, refill in 22 minutes and 40 seconds.

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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`:
- Line 215: Clarify the precedence conflict between the "never invent `triaged`"
statement and the later PR-creation requirement to add `triaged`: update
CLAUDE.md so the rule is explicit that the PR label-mirroring rule (the `gh pr
create` paragraph listing required labels) only adds the `triaged` label if and
only if the closed issue(s) already carry `triaged` (and never fabricates it);
conversely state that automation should always mirror other listed labels per
the existing merge/union logic for multi-issue PRs — reference the phrases
"never invent `triaged`" and the PR-creation triage rule so readers and bots
know the precise precedence.
🪄 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: e54a70f1-cc15-4bff-b6c7-e8ee20a91264

📥 Commits

Reviewing files that changed from the base of the PR and between 670ee2f and 4c792d2.

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

Comment thread CLAUDE.md
- **Parallel vs background**: multiple independent queries → send them in one message as parallel `Agent` tool calls. Long-running watchers (CI, builds) → `run_in_background: true`, then read output when notified.
- **Multi-agent coordination**: see `~/.claude/multi-agent-comms.md` for lock patterns (e.g., `git-push` lock before pushing shared-branch fixes).
- **Default: delegate to the cheapest sufficient tier — actively, not just when in doubt.** Before doing a piece of work in the main session (or spawning a subagent at the same tier as the main session), ask: *can a cheaper Claude, OpenAI, or Gemini subagent handle this per the rubric below?* If yes, spawn that subagent using the `Agent` tool's `model` parameter. The main session's tier is typically the most expensive option available, so reserving it for work that genuinely needs it is the single biggest cost lever. Treat the rubric as a positive obligation to delegate down, not just a tie-breaker. This applies recursively — when a subagent itself needs to spawn further subagents, it should also default to the cheapest sufficient tier.
- **Every `gh pr create` MUST be followed by mirroring the closing issue's triage labels onto the new PR.** The full set: `priority/*`, `severity/*`, `urgency/*`, `impact/*`, `effort/*`, `type/*`, plus `triaged` (only if the issue carries it — never invent it). PRs that lack triage labels are invisible to the same priority queries that surface the issues, so an unlabeled PR is effectively unreviewable in priority order — the same shape of bug as forgetting the post-push CI watcher. Treat label-mirroring as part of the `open-PR` step, not a follow-up. For PRs that close multiple issues, take the highest `priority/*` and `severity/*` across the closed set, and union the rest. When delegating PR shipping to a subagent, include the label-mirror step in the prompt explicitly (don't assume the subagent will infer it). Project-level CLAUDE.md may add the exact `gh` invocation; the global rule is the requirement itself.

Copy link
Copy Markdown
Contributor

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

Clarify precedence vs the existing PR-creation triage rule

Line 215 says “never invent triaged,” but Line 295 says PR creation should include triaged. Please add an explicit exception/preference here so automation can’t interpret these rules differently.

Suggested wording tweak
- **Every `gh pr create` MUST be followed by mirroring the closing issue's triage labels onto the new PR.** The full set: `priority/*`, `severity/*`, `urgency/*`, `impact/*`, `effort/*`, `type/*`, plus `triaged` (only if the issue carries it — never invent it). PRs that lack triage labels are invisible to the same priority queries that surface the issues, so an unlabeled PR is effectively unreviewable in priority order — the same shape of bug as forgetting the post-push CI watcher. Treat label-mirroring as part of the `open-PR` step, not a follow-up. For PRs that close multiple issues, take the highest `priority/*` and `severity/*` across the closed set, and union the rest. When delegating PR shipping to a subagent, include the label-mirror step in the prompt explicitly (don't assume the subagent will infer it). Project-level CLAUDE.md may add the exact `gh` invocation; the global rule is the requirement itself.
+ **Every `gh pr create` MUST be followed by mirroring the closing issue's triage labels onto the new PR.** The full set: `priority/*`, `severity/*`, `urgency/*`, `impact/*`, `effort/*`, `type/*`, plus `triaged` (only if at least one closing issue carries it — never invent it). **This is a scoped exception to §7's default “always add `triaged` on create” rule for issue-closing PRs.** PRs that lack triage labels are invisible to the same priority queries that surface the issues, so an unlabeled PR is effectively unreviewable in priority order — the same shape of bug as forgetting the post-push CI watcher. Treat label-mirroring as part of the `open-PR` step, not a follow-up. For PRs that close multiple issues, take the highest `priority/*` and `severity/*` across the closed set, and union the rest. When delegating PR shipping to a subagent, include the label-mirror step in the prompt explicitly (don't assume the subagent will infer it). Project-level CLAUDE.md may add the exact `gh` invocation; the global rule is the requirement itself.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@CLAUDE.md` at line 215, Clarify the precedence conflict between the "never
invent `triaged`" statement and the later PR-creation requirement to add
`triaged`: update CLAUDE.md so the rule is explicit that the PR label-mirroring
rule (the `gh pr create` paragraph listing required labels) only adds the
`triaged` label if and only if the closed issue(s) already carry `triaged` (and
never fabricates it); conversely state that automation should always mirror
other listed labels per the existing merge/union logic for multi-issue PRs —
reference the phrases "never invent `triaged`" and the PR-creation triage rule
so readers and bots know the precise precedence.

@cristim

cristim commented May 3, 2026

Copy link
Copy Markdown
Member Author

Superseded by commit b3f64d6 ("docs(claude): codify model-selection + PR-labeling rules", closes #8) — main already contains the mirror-labels bullet verbatim. Closing rather than rebasing into a no-op merge.

@cristim cristim closed this May 3, 2026
@cristim
cristim deleted the docs/mirror-issue-labels-on-pr branch May 3, 2026 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant