@codedrifters/configulator 0.0.352 → 0.0.354

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.mjs CHANGED
@@ -17787,7 +17787,11 @@ var prReviewerSubAgent = {
17787
17787
  "",
17788
17788
  "The PR is **eligible** only when **all** of the following hold:",
17789
17789
  "",
17790
- '1. `mergeable == "MERGEABLE"` (no merge conflicts).',
17790
+ '1. `mergeable == "MERGEABLE"` (no merge conflicts). A',
17791
+ ' `mergeable == "CONFLICTING"` PR is **not** an automatic',
17792
+ " disqualification \u2014 see the **already-`CONFLICTING` handling**",
17793
+ " below, which may auto-correct it via delegation before falling",
17794
+ " back to a hard reject.",
17791
17795
  "2. No **failing** required checks in `statusCheckRollup` \u2014 CI must be",
17792
17796
  " green or still pending. Any `FAILURE`, `TIMED_OUT`, `CANCELLED`, or",
17793
17797
  " `ERROR` conclusion on a required check disqualifies the PR. If the",
@@ -17799,8 +17803,9 @@ var prReviewerSubAgent = {
17799
17803
  "3. The PR body contains a linked issue via one of the closing keywords:",
17800
17804
  " `Closes #N`, `Fixes #N`, or `Resolves #N` (case-insensitive).",
17801
17805
  "",
17802
- "If **any** check fails, post a short comment explaining the reason and",
17803
- "stop. Do not proceed to full review.",
17806
+ "If the **CI** check (2) or the **linked-issue** check (3) fails, post",
17807
+ "a short comment explaining the reason and stop. Do not proceed to",
17808
+ "full review.",
17804
17809
  "",
17805
17810
  "```bash",
17806
17811
  "gh pr comment <pr-number> --body '<reason>'",
@@ -17808,10 +17813,50 @@ var prReviewerSubAgent = {
17808
17813
  "",
17809
17814
  "Typical reasons:",
17810
17815
  "",
17811
- "- `Not reviewable: merge conflicts \u2014 please rebase onto the default branch.`",
17812
17816
  "- `Not reviewable: required CI check <name> is failing.`",
17813
17817
  "- `Not reviewable: PR body is missing a linked issue (Closes #N / Fixes #N / Resolves #N).`",
17814
17818
  "",
17819
+ "### Already-`CONFLICTING` handling (auto-correct, then reject)",
17820
+ "",
17821
+ 'When the merge check (1) reports `mergeable == "CONFLICTING"`, do',
17822
+ "**not** unconditionally reject. A bot-authored PR that is already",
17823
+ "conflicting when the orchestrator finds it is exactly the case the",
17824
+ "conflict-resolution delegation flow exists to auto-correct \u2014 there",
17825
+ "is no reason to make a human rebase it by hand when `issue-worker`",
17826
+ "can. Before rejecting, evaluate checks (2) and (3) above first: a",
17827
+ "`CONFLICTING` PR that **also** has failing CI or no linked issue is",
17828
+ "rejected for that reason via the comment-and-stop path above, since",
17829
+ "the delegation cannot succeed without a linked issue and green-able",
17830
+ "CI anyway.",
17831
+ "",
17832
+ "Otherwise, hand off to the **Shared Procedure: Conflict-Resolution",
17833
+ "Delegation** section. It evaluates the guards (auto-merge mode, the",
17834
+ "delegation invocation guard, a free `review:fixing` lease, no",
17835
+ "generated / projen / lockfile conflicts), classifies the conflicting",
17836
+ "files, and either delegates a rebase to `issue-worker` or falls",
17837
+ "through to its own fallback. Invoke it with this entry point's",
17838
+ "parameters:",
17839
+ "",
17840
+ "- **Entry point:** `already-conflicting`. There is no failed",
17841
+ " `gh pr update-branch` to read conflicting paths from \u2014 identify",
17842
+ " the conflicting files from the PR's merge state as documented in",
17843
+ " the shared procedure's entry-point step (a local rebase attempt",
17844
+ " whose `<<<<<<<` / `=======` / `>>>>>>>` markers name the",
17845
+ " conflicting files). The guards and classification are identical to",
17846
+ " the Phase 4 entry point.",
17847
+ "- **On the procedure returning `delegated`:** a rebase has been",
17848
+ " delegated to `issue-worker`; stop this pass. A human re-invokes",
17849
+ " the reviewer once the worker pushes the rebased branch.",
17850
+ "- **On the procedure returning `skipped` (a guard denied delegation",
17851
+ " or the guards failed):** fall back to the original hard reject \u2014",
17852
+ " post the merge-conflict rejection comment and stop. Use this",
17853
+ " comment **only** in the skipped case, never before the shared",
17854
+ " procedure has had its chance to auto-correct:",
17855
+ "",
17856
+ "```bash",
17857
+ "gh pr comment <pr-number> --body 'Not reviewable: merge conflicts \u2014 please rebase onto the default branch.'",
17858
+ "```",
17859
+ "",
17815
17860
  "## Phase 2: Gather Context",
17816
17861
  "",
17817
17862
  "```bash",
@@ -17945,7 +17990,12 @@ var prReviewerSubAgent = {
17945
17990
  " `review:human-required` label, set `mode = human-required`.",
17946
17991
  "3. **Labels that force human** \u2014 if the PR carries any label listed",
17947
17992
  " under `human-required.labels-that-force-human` (e.g.",
17948
- " `priority:critical`), set `mode = human-required`.",
17993
+ " `review:human-required`), set `mode = human-required`. Evaluate",
17994
+ " the PR's **own** labels only \u2014 rules 1\u20133 never traverse the",
17995
+ " `Closes #N` link to read the linked issue's labels. `priority:*`",
17996
+ " and `status:*` are issue-triage labels for the orchestrator's",
17997
+ " scheduling queue, not merge-risk signals, and are never listed",
17998
+ " here.",
17949
17999
  "4. **Path globs** \u2014 if any file in the PR diff matches any glob in",
17950
18000
  " `human-required.paths`, set `mode = human-required`. Record the",
17951
18001
  " first matching path + glob pair as the reason.",
@@ -18463,7 +18513,7 @@ var prReviewerSubAgent = {
18463
18513
  "when the mode is `human-required` and any of the following fired:",
18464
18514
  "",
18465
18515
  "- rule 2 (`review:human-required` label),",
18466
- "- rule 3 (any `labels-that-force-human` label such as `priority:critical`),",
18516
+ "- rule 3 (any `labels-that-force-human` label),",
18467
18517
  "- rule 4 (`human-required.paths` glob match), or",
18468
18518
  "- rule 5 (`human-required.issue-types` match).",
18469
18519
  "",
@@ -18513,37 +18563,215 @@ var prReviewerSubAgent = {
18513
18563
  "##### Conflict-resolution delegation (BEHIND + conflicts)",
18514
18564
  "",
18515
18565
  "When `gh pr update-branch <pr-number>` fails because the merge would",
18516
- "produce conflicts, the reviewer **may** delegate conflict resolution to",
18517
- "`issue-worker` via the existing feedback-mode delegation contract (the",
18518
- "same path Phase 4's in-scope-fix delegation uses). The reviewer never",
18519
- "hand-resolves conflicts itself \u2014 branch mutations always belong to",
18520
- "`issue-worker`.",
18566
+ "produce conflicts, hand off to the **Shared Procedure:",
18567
+ "Conflict-Resolution Delegation** section below. That procedure owns",
18568
+ "the guards, the `shared-index` vs `generic` classification, the two",
18569
+ "typed recipes, and the fallback \u2014 defined once and shared with the",
18570
+ "Phase 1.5 already-`CONFLICTING` entry point. Invoke it with this",
18571
+ "entry point's parameters:",
18572
+ "",
18573
+ "- **Entry point:** `update-branch-conflict`. The set of conflicting",
18574
+ " files is the list reported by the failed `gh pr update-branch`",
18575
+ " (cross-referenced with `gh pr view <pr-number> --json files`).",
18576
+ "- **On the procedure returning `delegated`:** record",
18577
+ " `Branch updated: delegated (PR #<n>)` for the per-PR report.",
18578
+ "- **On the procedure returning `skipped` (a guard denied delegation",
18579
+ " or the guards failed):** the procedure has already posted the",
18580
+ " fallback comment and recorded",
18581
+ " `Branch updated: failed (conflicts; <short reason>)`. Stop.",
18582
+ "",
18583
+ "#### Mode `human-required`",
18584
+ "",
18585
+ "Do **not** run `gh pr merge --auto`. Instead, hand the PR off to a",
18586
+ "human reviewer:",
18587
+ "",
18588
+ "1. Apply the `review:awaiting-human` label so the PR is discoverable",
18589
+ " in the human-review queue:",
18590
+ "",
18591
+ " ```bash",
18592
+ " gh pr edit <pr-number> --add-label 'review:awaiting-human'",
18593
+ " ```",
18594
+ "",
18595
+ "2. **If `matched_rule == 6`** (size threshold was the sole trigger),",
18596
+ " run the `Update the branch when `mergeStateStatus` is `BEHIND``",
18597
+ " step from the `Mode auto-merge` branch above before exiting. The",
18598
+ " eligibility gate documented in that sub-section explicitly permits",
18599
+ " `gh pr update-branch` on size-only human-required PRs so the bot",
18600
+ " keeps the branch fresh against the default branch while the human",
18601
+ " reviews. Skip this sub-step for `matched_rule` in 2\u20135 \u2014 the gate",
18602
+ " denies `update-branch` there and the human owns branch-lifecycle.",
18603
+ "",
18604
+ "3. Exit cleanly after the acceptance-criteria check completes and any",
18605
+ " summary comment the reviewer posts. Proceed to Phase 5 only if a",
18606
+ " merge occurred \u2014 in `human-required` mode the reviewer stops at",
18607
+ " the hand-off and does not poll for merge.",
18608
+ "",
18609
+ "The reason captured in Phase 2.75 should be included in any summary",
18610
+ "comment so maintainers know why human review was required (path hit,",
18611
+ "issue type, size threshold, label, or default).",
18612
+ "",
18613
+ "### If any criterion is missing, partial, or CI is failing",
18614
+ "",
18615
+ "Post a plain comment (not a formal review block) with grouped findings:",
18616
+ "",
18617
+ "```bash",
18618
+ "gh pr comment <pr-number> --body '<grouped findings>'",
18619
+ "```",
18620
+ "",
18621
+ "Group findings by severity (**Blocking** / **Suggested** / **Nitpick**).",
18622
+ "For each blocking finding, cite the unmet acceptance criterion and the",
18623
+ "file or function the gap lives in. Do **not** merge, and do **not** push",
18624
+ "any commits to the PR's branch.",
18625
+ "",
18626
+ "Rationale for using a plain comment rather than `gh pr review",
18627
+ "--request-changes`: it is lighter-weight, doesn't require the author to",
18628
+ "dismiss a formal review, and composes cleanly with the multi-PR loop.",
18629
+ "",
18630
+ "## Phase 4.5: Update Sticky Summary",
18631
+ "",
18632
+ "On **every pass**, create or update a single **`## Reviewer notes`**",
18633
+ "comment on the PR. This sticky comment is the human-facing single",
18634
+ "source of truth for the PR's state \u2014 one comment per PR, edited in",
18635
+ "place across passes, never duplicated. Do not post a fresh",
18636
+ '"pass N summary" on each iteration.',
18637
+ "",
18638
+ "### Step 1: Find the existing sticky comment (if any)",
18639
+ "",
18640
+ "List PR-level comments and look for one authored by the reviewer",
18641
+ "whose body starts with `## Reviewer notes`:",
18642
+ "",
18643
+ "```bash",
18644
+ "gh api repos/{{repository.owner}}/{{repository.name}}/issues/<pr-number>/comments",
18645
+ "```",
18646
+ "",
18647
+ "If multiple candidates exist (an older run double-posted before this",
18648
+ "phase existed), keep the earliest and plan to delete the duplicates",
18649
+ "on a later pass. Never delete another author's comment.",
18650
+ "",
18651
+ "### Step 2: Compose the sticky body",
18652
+ "",
18653
+ "The body uses the following shape:",
18654
+ "",
18655
+ "```",
18656
+ "## Reviewer notes",
18657
+ "",
18658
+ "**Mode:** auto-merge | human-required \u2014 <reason from Phase 2.75>",
18659
+ "**AC status:** <met / partial / missing> (evidence links)",
18660
+ "**CI status:** green | pending | red",
18661
+ "**Outstanding:** <list of comments still open with their classification and author>",
18662
+ "**Pushbacks:** <list of disputes with reasons>",
18663
+ "**Last pass:** <ISO timestamp>",
18664
+ "```",
18665
+ "",
18666
+ "Populate each field from the phases above:",
18667
+ "",
18668
+ "- **Mode / reason** \u2014 the mode and reason recorded in Phase 2.75.",
18669
+ "- **AC status** \u2014 the checklist produced in Phase 3 (met, partial,",
18670
+ " or missing), with links to the files or tests that provide the",
18671
+ " evidence.",
18672
+ "- **CI status** \u2014 the verdict from the **CI Verification** section",
18673
+ " (primary check-runs read, or the Actions-runs fallback when",
18674
+ " check-runs returns a fine-grained-PAT 403).",
18675
+ "- **Outstanding** \u2014 the comments still carrying a non-terminal",
18676
+ " reviewer reaction from Phase 3.5 (typically `eyes` for queued",
18677
+ " in-scope items and `nit` / `question` items that remain open).",
18678
+ " List each as `<classification>: <author> \u2014 <short summary> (<url>)`.",
18679
+ "- **Pushbacks** \u2014 every comment the reviewer reacted",
18680
+ " `thinking_face` to on this or any prior pass, with the reason",
18681
+ " captured in the pushback reply. Empty list when there are none.",
18682
+ "- **Last pass** \u2014 the ISO 8601 timestamp of this run.",
18683
+ "",
18684
+ "### Step 3: Create or edit in place",
18685
+ "",
18686
+ "If no existing sticky comment was found in Step 1, create one:",
18687
+ "",
18688
+ "```bash",
18689
+ "gh pr comment <pr-number> --body '<sticky body>'",
18690
+ "```",
18691
+ "",
18692
+ "If an existing sticky comment was found, edit it in place using the",
18693
+ "comment id. Do not delete and re-create \u2014 editing preserves the",
18694
+ "comment's URL and any reactions humans have added to the summary:",
18695
+ "",
18696
+ "```bash",
18697
+ "gh api repos/{{repository.owner}}/{{repository.name}}/issues/comments/<sticky-comment-id> \\",
18698
+ " -X PATCH -f body='<sticky body>'",
18699
+ "```",
18700
+ "",
18701
+ "The sticky summary must be updated on every pass through Phase 4.5,",
18702
+ "including passes that ended in a pushback-gated skip, a",
18703
+ "`NEEDS_CHANGES` findings comment, or the `human-required` hand-off.",
18704
+ "Humans rely on the sticky comment to see the current state of the",
18705
+ "PR at a glance \u2014 it must never go stale while the reviewer is",
18706
+ "actively processing the PR.",
18707
+ "",
18708
+ "## Shared Procedure: Conflict-Resolution Delegation",
18709
+ "",
18710
+ "This procedure resolves a PR that cannot land because its head",
18711
+ "branch conflicts with the default branch. It is invoked from **two**",
18712
+ "entry points, both of which reuse the identical guards,",
18713
+ "classification, typed recipes, and fallback defined here \u2014 the flow",
18714
+ "is defined **once** and shared:",
18715
+ "",
18716
+ "- **Phase 4 `update-branch-conflict`** \u2014 a PR that was MERGEABLE at",
18717
+ " Phase 1.5 went BEHIND, and `gh pr update-branch` then failed",
18718
+ " because the merge would conflict.",
18719
+ "- **Phase 1.5 `already-conflicting`** \u2014 the orchestrator handed the",
18720
+ " reviewer a PR that is **already** `CONFLICTING` (its",
18721
+ ' `mergeable == "CONFLICTING"`) before any review work began.',
18722
+ "",
18723
+ "The reviewer **may** delegate conflict resolution to `issue-worker`",
18724
+ "via the feedback-mode delegation contract (the same path Phase 4's",
18725
+ "in-scope-fix delegation uses). The reviewer never hand-resolves",
18726
+ "conflicts itself \u2014 branch mutations always belong to `issue-worker`.",
18727
+ "",
18728
+ "### Entry-point parameters",
18729
+ "",
18730
+ "The caller supplies which entry point it is and how the conflicting",
18731
+ "files are identified. Everything after this step is identical across",
18732
+ "both entry points.",
18733
+ "",
18734
+ "- **`update-branch-conflict`** \u2014 the conflicting-file set is the",
18735
+ " list reported by the failed `gh pr update-branch` (cross-referenced",
18736
+ " with `gh pr view <pr-number> --json files`).",
18737
+ "- **`already-conflicting`** \u2014 there is no failed `update-branch` to",
18738
+ " read conflicting paths from. Identify the conflicting files from",
18739
+ " the PR's merge state instead: attempt a local rebase of the head",
18740
+ " branch onto the default branch in a scratch checkout (or read the",
18741
+ " conflicting paths git reports) and collect the files that carry",
18742
+ " `<<<<<<<` / `=======` / `>>>>>>>` conflict markers. Use that set",
18743
+ " as the conflicting-file list. The reviewer inspects these markers",
18744
+ " read-only to classify; it does **not** stage, commit, or push any",
18745
+ " resolution \u2014 the actual rebase-and-resolve is delegated to",
18746
+ " `issue-worker` exactly as in the other entry point.",
18747
+ "",
18748
+ "### Guards",
18521
18749
  "",
18522
18750
  "Delegate **only when all** of the following hold. If any guard fails,",
18523
- "fall through to the fallback at the end of this sub-section instead.",
18751
+ "fall through to the **Fallback** at the end of this procedure and",
18752
+ "return `skipped`.",
18524
18753
  "",
18525
18754
  "1. **Review mode is `auto-merge`.** Never delegate conflict",
18526
18755
  " resolution on `human-required` PRs \u2014 pushing worker-resolved",
18527
18756
  " merge content into them expands the diff under review without",
18528
- " the human reviewer's consent. (Unlike the `update-branch` step",
18529
- " above, which permits a size-only `human-required` carve-out, the",
18757
+ " the human reviewer's consent. (Unlike the `update-branch` step,",
18758
+ " which permits a size-only `human-required` carve-out, the",
18530
18759
  " conflict-resolution delegation flow is auto-merge-only across",
18531
18760
  " the board: a worker rebase push is a stronger branch mutation",
18532
18761
  " than the merge-commit `gh pr update-branch` performs.)",
18533
18762
  "2. **Delegation invocation guard permits the hand-off** \u2014 the PR",
18534
18763
  " carries the `origin:issue-worker` label, **or** the reviewer was",
18535
18764
  " invoked with `--allow-human-author`. The same guard used for the",
18536
- " in-scope-fix delegation flow above applies here unchanged.",
18765
+ " in-scope-fix delegation flow applies here unchanged.",
18537
18766
  "3. **The `review:fixing` lease is currently free.** If",
18538
18767
  " `review:fixing` is already on the PR, another delegation is",
18539
18768
  " in-flight; skip conflict-resolution delegation, log the contention",
18540
18769
  " to the sticky summary, and fall through to the fallback.",
18541
- "4. **No conflicting file is generated or projen-managed.** Run",
18542
- " `gh pr view <pr-number> --json files --jq '.files[].path'` and",
18543
- " inspect the conflicting paths reported by the failed",
18544
- " `update-branch`. If **any** conflicting path matches one of the",
18545
- " following globs, the conflict is unsafe to resolve mechanically",
18546
- " and the reviewer must skip delegation:",
18770
+ "4. **No conflicting file is generated or projen-managed.** Inspect",
18771
+ " the conflicting paths from the entry-point step above. If **any**",
18772
+ " conflicting path matches one of the following globs, the conflict",
18773
+ " is unsafe to resolve mechanically and the reviewer must skip",
18774
+ " delegation:",
18547
18775
  " - `**/*.lock` and `pnpm-lock.yaml` / `yarn.lock` / `package-lock.json`",
18548
18776
  " - `**/.projen/**`",
18549
18777
  " - any file whose first 5 lines contain the marker",
@@ -18554,17 +18782,18 @@ var prReviewerSubAgent = {
18554
18782
  " and conflicts there should be resolved by re-running synth, not by",
18555
18783
  " merging the conflict markers.",
18556
18784
  "",
18785
+ "### Classify each conflicting file",
18786
+ "",
18557
18787
  "When every guard above passes, **classify each conflicting file**",
18558
18788
  "before composing the fix-list. The classification picks one of two",
18559
18789
  "typed recipes \u2014 a precise `shared-index` resolver when every",
18560
18790
  "conflict is a row-insert race on a registry / index / feature-matrix",
18561
18791
  "file, or the generic rebase recipe in every other case.",
18562
18792
  "",
18563
- "**Classification step.** For each conflicting path reported by the",
18564
- "failed `update-branch`, decide whether the file is `shared-index` or",
18565
- "`generic` against these criteria (the shared-index glob set comes",
18566
- "from the `shared-editing-safety` rule \u2014 see the bundle's",
18567
- "`shared-editing.ts` for the canonical constant):",
18793
+ "**Classification step.** For each conflicting path, decide whether",
18794
+ "the file is `shared-index` or `generic` against these criteria (the",
18795
+ "shared-index glob set comes from the `shared-editing-safety` rule \u2014",
18796
+ "see the bundle's `shared-editing.ts` for the canonical constant):",
18568
18797
  "",
18569
18798
  "- `shared-index` \u2014 the path matches one of the shared-editing glob",
18570
18799
  " patterns:",
@@ -18599,6 +18828,8 @@ var prReviewerSubAgent = {
18599
18828
  " (see step 3 below). The worker performs a hand-merge of the",
18600
18829
  " conflict markers.",
18601
18830
  "",
18831
+ "### Hand off to `issue-worker`",
18832
+ "",
18602
18833
  "Hand off to `issue-worker` with the chosen single synthetic",
18603
18834
  "fix-list item:",
18604
18835
  "",
@@ -18686,147 +18917,25 @@ var prReviewerSubAgent = {
18686
18917
  "",
18687
18918
  "7. **Do not re-enable auto-merge in the same pass.** After delegation,",
18688
18919
  " exit and let a human re-invoke the reviewer. The next pass will",
18689
- " re-evaluate `mergeStateStatus` against the rebased branch and",
18690
- " re-enable auto-merge through the normal flow above.",
18920
+ " re-evaluate `mergeStateStatus` (or `mergeable`) against the",
18921
+ " rebased branch and re-enable auto-merge through the normal flow.",
18922
+ "",
18923
+ "Return `delegated` to the caller when delegation completes",
18924
+ "(regardless of the worker's outcome \u2014 the delegation itself is the",
18925
+ "action taken).",
18691
18926
  "",
18692
- "Record `Branch updated: delegated (PR #<n>)` for the per-PR report",
18693
- "when delegation completes (regardless of the worker's outcome \u2014 the",
18694
- "delegation itself is the action taken).",
18927
+ "### Fallback",
18695
18928
  "",
18696
18929
  "**Fallback when delegation is not permitted or guards fail.** Post a",
18697
18930
  "short comment explaining why the branch could not be updated",
18698
18931
  "automatically and stop. Do not push commits, do not force, do not",
18699
- "retry. Record `Branch updated: failed (conflicts; <short reason>)`.",
18932
+ "retry. Record `Branch updated: failed (conflicts; <short reason>)`",
18933
+ "and return `skipped` to the caller.",
18700
18934
  "",
18701
18935
  "```bash",
18702
- "gh pr comment <pr-number> --body 'Auto-merge queued; branch is BEHIND <default-branch> with conflicts. <short reason delegation was skipped \u2014 e.g. human-required mode, generated-file conflicts, or in-flight review:fixing lease>. A human (or the next reviewer pass after rebase) will need to resolve.'",
18936
+ "gh pr comment <pr-number> --body 'Branch is BEHIND <default-branch> with conflicts. <short reason delegation was skipped \u2014 e.g. human-required mode, generated-file conflicts, or in-flight review:fixing lease>. A human (or the next reviewer pass after rebase) will need to resolve.'",
18703
18937
  "```",
18704
18938
  "",
18705
- "#### Mode `human-required`",
18706
- "",
18707
- "Do **not** run `gh pr merge --auto`. Instead, hand the PR off to a",
18708
- "human reviewer:",
18709
- "",
18710
- "1. Apply the `review:awaiting-human` label so the PR is discoverable",
18711
- " in the human-review queue:",
18712
- "",
18713
- " ```bash",
18714
- " gh pr edit <pr-number> --add-label 'review:awaiting-human'",
18715
- " ```",
18716
- "",
18717
- "2. **If `matched_rule == 6`** (size threshold was the sole trigger),",
18718
- " run the `Update the branch when `mergeStateStatus` is `BEHIND``",
18719
- " step from the `Mode auto-merge` branch above before exiting. The",
18720
- " eligibility gate documented in that sub-section explicitly permits",
18721
- " `gh pr update-branch` on size-only human-required PRs so the bot",
18722
- " keeps the branch fresh against the default branch while the human",
18723
- " reviews. Skip this sub-step for `matched_rule` in 2\u20135 \u2014 the gate",
18724
- " denies `update-branch` there and the human owns branch-lifecycle.",
18725
- "",
18726
- "3. Exit cleanly after the acceptance-criteria check completes and any",
18727
- " summary comment the reviewer posts. Proceed to Phase 5 only if a",
18728
- " merge occurred \u2014 in `human-required` mode the reviewer stops at",
18729
- " the hand-off and does not poll for merge.",
18730
- "",
18731
- "The reason captured in Phase 2.75 should be included in any summary",
18732
- "comment so maintainers know why human review was required (path hit,",
18733
- "issue type, size threshold, label, or default).",
18734
- "",
18735
- "### If any criterion is missing, partial, or CI is failing",
18736
- "",
18737
- "Post a plain comment (not a formal review block) with grouped findings:",
18738
- "",
18739
- "```bash",
18740
- "gh pr comment <pr-number> --body '<grouped findings>'",
18741
- "```",
18742
- "",
18743
- "Group findings by severity (**Blocking** / **Suggested** / **Nitpick**).",
18744
- "For each blocking finding, cite the unmet acceptance criterion and the",
18745
- "file or function the gap lives in. Do **not** merge, and do **not** push",
18746
- "any commits to the PR's branch.",
18747
- "",
18748
- "Rationale for using a plain comment rather than `gh pr review",
18749
- "--request-changes`: it is lighter-weight, doesn't require the author to",
18750
- "dismiss a formal review, and composes cleanly with the multi-PR loop.",
18751
- "",
18752
- "## Phase 4.5: Update Sticky Summary",
18753
- "",
18754
- "On **every pass**, create or update a single **`## Reviewer notes`**",
18755
- "comment on the PR. This sticky comment is the human-facing single",
18756
- "source of truth for the PR's state \u2014 one comment per PR, edited in",
18757
- "place across passes, never duplicated. Do not post a fresh",
18758
- '"pass N summary" on each iteration.',
18759
- "",
18760
- "### Step 1: Find the existing sticky comment (if any)",
18761
- "",
18762
- "List PR-level comments and look for one authored by the reviewer",
18763
- "whose body starts with `## Reviewer notes`:",
18764
- "",
18765
- "```bash",
18766
- "gh api repos/{{repository.owner}}/{{repository.name}}/issues/<pr-number>/comments",
18767
- "```",
18768
- "",
18769
- "If multiple candidates exist (an older run double-posted before this",
18770
- "phase existed), keep the earliest and plan to delete the duplicates",
18771
- "on a later pass. Never delete another author's comment.",
18772
- "",
18773
- "### Step 2: Compose the sticky body",
18774
- "",
18775
- "The body uses the following shape:",
18776
- "",
18777
- "```",
18778
- "## Reviewer notes",
18779
- "",
18780
- "**Mode:** auto-merge | human-required \u2014 <reason from Phase 2.75>",
18781
- "**AC status:** <met / partial / missing> (evidence links)",
18782
- "**CI status:** green | pending | red",
18783
- "**Outstanding:** <list of comments still open with their classification and author>",
18784
- "**Pushbacks:** <list of disputes with reasons>",
18785
- "**Last pass:** <ISO timestamp>",
18786
- "```",
18787
- "",
18788
- "Populate each field from the phases above:",
18789
- "",
18790
- "- **Mode / reason** \u2014 the mode and reason recorded in Phase 2.75.",
18791
- "- **AC status** \u2014 the checklist produced in Phase 3 (met, partial,",
18792
- " or missing), with links to the files or tests that provide the",
18793
- " evidence.",
18794
- "- **CI status** \u2014 the verdict from the **CI Verification** section",
18795
- " (primary check-runs read, or the Actions-runs fallback when",
18796
- " check-runs returns a fine-grained-PAT 403).",
18797
- "- **Outstanding** \u2014 the comments still carrying a non-terminal",
18798
- " reviewer reaction from Phase 3.5 (typically `eyes` for queued",
18799
- " in-scope items and `nit` / `question` items that remain open).",
18800
- " List each as `<classification>: <author> \u2014 <short summary> (<url>)`.",
18801
- "- **Pushbacks** \u2014 every comment the reviewer reacted",
18802
- " `thinking_face` to on this or any prior pass, with the reason",
18803
- " captured in the pushback reply. Empty list when there are none.",
18804
- "- **Last pass** \u2014 the ISO 8601 timestamp of this run.",
18805
- "",
18806
- "### Step 3: Create or edit in place",
18807
- "",
18808
- "If no existing sticky comment was found in Step 1, create one:",
18809
- "",
18810
- "```bash",
18811
- "gh pr comment <pr-number> --body '<sticky body>'",
18812
- "```",
18813
- "",
18814
- "If an existing sticky comment was found, edit it in place using the",
18815
- "comment id. Do not delete and re-create \u2014 editing preserves the",
18816
- "comment's URL and any reactions humans have added to the summary:",
18817
- "",
18818
- "```bash",
18819
- "gh api repos/{{repository.owner}}/{{repository.name}}/issues/comments/<sticky-comment-id> \\",
18820
- " -X PATCH -f body='<sticky body>'",
18821
- "```",
18822
- "",
18823
- "The sticky summary must be updated on every pass through Phase 4.5,",
18824
- "including passes that ended in a pushback-gated skip, a",
18825
- "`NEEDS_CHANGES` findings comment, or the `human-required` hand-off.",
18826
- "Humans rely on the sticky comment to see the current state of the",
18827
- "PR at a glance \u2014 it must never go stale while the reviewer is",
18828
- "actively processing the PR.",
18829
- "",
18830
18939
  "## Phase 5: Branch Cleanup and Issue Closure Verification",
18831
18940
  "",
18832
18941
  "Skip this phase entirely when the review mode from Phase 2.75 is",
@@ -19217,7 +19326,6 @@ function buildPrReviewBundle(policy = resolvePrReviewPolicy()) {
19217
19326
  " insertions: 500",
19218
19327
  " labels-that-force-human:",
19219
19328
  ' - "review:human-required"',
19220
- ' - "priority:critical"',
19221
19329
  "",
19222
19330
  "auto-merge:",
19223
19331
  " labels-that-force-auto:",
@@ -19248,8 +19356,9 @@ function buildPrReviewBundle(policy = resolvePrReviewPolicy()) {
19248
19356
  "2. **`review:human-required` label** \u2014 reserved force-human label;",
19249
19357
  " if present (and no force-auto label beat it in step 1), the mode",
19250
19358
  " is `human-required`.",
19251
- "3. **`human-required.labels-that-force-human`** \u2014 any listed label on",
19252
- " the PR (e.g. `priority:critical`) forces `human-required`.",
19359
+ "3. **`human-required.labels-that-force-human`** \u2014 if the PR",
19360
+ " carries any label listed here (e.g. `review:human-required`),",
19361
+ " the mode is `human-required`.",
19253
19362
  "4. **`human-required.paths`** \u2014 if any file in the PR diff matches",
19254
19363
  " any glob here, the mode is `human-required`. Matching uses",
19255
19364
  " standard glob semantics (`**` for recursive directories,",
@@ -19270,6 +19379,24 @@ function buildPrReviewBundle(policy = resolvePrReviewPolicy()) {
19270
19379
  "7. **`default`** \u2014 applied only when no rule above matched",
19271
19380
  " (normally `auto-merge`).",
19272
19381
  "",
19382
+ "**Label-check scope.** All label checks in rules 1\u20133 evaluate",
19383
+ "the PR's **own** labels only. Never traverse the `Closes #N`",
19384
+ "link to read the linked issue's labels for a label rule. Rule 5",
19385
+ "is the only rule that reads the linked issue, and it reads the",
19386
+ "issue **type**, not its labels.",
19387
+ "",
19388
+ "**`priority:*` / `status:*` are not merge-risk signals.**",
19389
+ "`priority:*` and `status:*` are issue-triage labels consumed by",
19390
+ "the orchestrator for scheduling \u2014 `priority:*` sequences the",
19391
+ "work queue and `status:*` tracks workflow position. They say",
19392
+ "nothing about a PR's merge risk and must never appear in any",
19393
+ "`labels-that-force-*` list. Gating merge on `priority:critical`",
19394
+ "in particular inverts the intended behaviour: the most urgent",
19395
+ "work would wait the longest for a human merge. Merge risk is",
19396
+ "already covered by the path globs (rule 4), the",
19397
+ "`release` / `hotfix` issue-types (rule 5), and the size",
19398
+ "thresholds (rule 6).",
19399
+ "",
19273
19400
  "The `auto-merge.paths-exempt-from-size` carve-out exists so",
19274
19401
  "**doc-only PRs** that routinely exceed the 500-insertion size",
19275
19402
  "threshold (large migrations, bulk additions, refresh passes)",
@@ -19301,8 +19428,8 @@ function buildPrReviewBundle(policy = resolvePrReviewPolicy()) {
19301
19428
  "The exception is keyed on the matched-rule index recorded in",
19302
19429
  "Phase 2.75. All other `human-required` triggers \u2014 rule 2",
19303
19430
  "(`review:human-required` label), rule 3 (any",
19304
- "`labels-that-force-human` label such as `priority:critical`),",
19305
- "rule 4 (`human-required.paths` glob match), and rule 5",
19431
+ "`labels-that-force-human` label), rule 4",
19432
+ "(`human-required.paths` glob match), and rule 5",
19306
19433
  "(`human-required.issue-types` match) \u2014 continue to block",
19307
19434
  "`update-branch` because each one signals a human reviewer who",
19308
19435
  "has explicit ownership of the branch's lifecycle.",