@codedrifters/configulator 0.0.222 → 0.0.224

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.js CHANGED
@@ -4313,7 +4313,10 @@ var issueWorkerSubAgent = {
4313
4313
  "",
4314
4314
  "## Invocation Mode",
4315
4315
  "",
4316
- "You operate in one of two modes:",
4316
+ "You operate in one of two **invocation modes** (interactive vs scheduled)",
4317
+ "and one of two **work modes** (normal vs feedback).",
4318
+ "",
4319
+ "### Interactive vs Scheduled",
4317
4320
  "",
4318
4321
  "- **Interactive mode (default):** A human invoked you directly. You must",
4319
4322
  " pause and request explicit user approval before committing code (Phase 6).",
@@ -4326,11 +4329,52 @@ var issueWorkerSubAgent = {
4326
4329
  "doubt, treat the session as interactive \u2014 pausing for approval is always",
4327
4330
  "safe; committing without approval is not.",
4328
4331
  "",
4332
+ "### Normal vs Feedback",
4333
+ "",
4334
+ "- **Normal mode (default):** You select an issue from the queue (or use a",
4335
+ " provided issue number), create a new branch, implement the change, and",
4336
+ " open a new PR. Phases 1\u20139 all run.",
4337
+ "- **Feedback mode:** You are given an existing PR number and asked to",
4338
+ " apply reviewer-requested fixes to the PR's existing branch. You do",
4339
+ " **not** create a new branch and you do **not** open a new PR \u2014 you",
4340
+ " push additional commits to the same branch.",
4341
+ "",
4342
+ "**You are in feedback mode if and only if the invocation prompt that",
4343
+ "started this session contains the literal phrase `feedback mode: PR #<n>`",
4344
+ "(where `<n>` is the PR number).** This mirrors the `scheduled mode` /",
4345
+ "`non-interactive` string-match convention above. Otherwise, default to",
4346
+ "normal mode.",
4347
+ "",
4348
+ "Interactive vs scheduled and normal vs feedback are independent axes.",
4349
+ "Feedback mode can run interactively (a human asks you to fix a PR) or",
4350
+ "on a schedule (the pr-reviewer hands off the PR). The interactive",
4351
+ "pause-before-commit rule (Phase 6) applies in either work mode.",
4352
+ "",
4353
+ "When in feedback mode, the per-phase behaviour changes as documented",
4354
+ "in each phase below. In summary:",
4355
+ "",
4356
+ "| Phase | Normal mode | Feedback mode |",
4357
+ "|-------|-------------|---------------|",
4358
+ "| 1. Select an Issue | Pick from queue or use provided issue number | **Skip.** Use the PR number from the invocation prompt. |",
4359
+ "| 2. Claim the Issue | Toggle status labels on the issue | **Skip.** The issue is already `status:in-progress`. |",
4360
+ "| 3. Set Up | Checkout default branch, create new branch | Checkout the existing PR branch via `gh pr view` and `git checkout <headRefName>`. |",
4361
+ "| 4. Implement | Read issue AC, implement | Read most-recent reviewer-authored fix-list comment on the PR, parse JSON, apply each item. |",
4362
+ "| 5. Verify | Unchanged | Unchanged. |",
4363
+ "| 6. Commit and Push | Conventional commit, interactive pause | Commit message `fix(review): <summary> (PR #<n>)`. Pause behaviour unchanged. `git push` (no `-u`). |",
4364
+ "| 7. Open a PR | Open a new PR | **Skip.** |",
4365
+ "| 8. Update Status | Set issue to `status:ready-for-review` | **Skip.** PR is still open; issue stays `status:in-progress`. |",
4366
+ "| 9. Branch Cleanup | Poll for merge, delete branch | **Skip.** Return control to the pr-reviewer without polling. |",
4367
+ "",
4329
4368
  "---",
4330
4369
  "",
4331
4370
  ...PROJECT_CONTEXT_READER_SECTION,
4332
4371
  "## Phase 1: Select an Issue",
4333
4372
  "",
4373
+ "**Feedback mode:** Skip this phase entirely. Extract the PR number from",
4374
+ "the `feedback mode: PR #<n>` phrase in your invocation prompt and use",
4375
+ "it for the rest of the workflow.",
4376
+ "",
4377
+ "**Normal mode:**",
4334
4378
  "If an issue number was provided in your instructions, use that issue.",
4335
4379
  "Otherwise, find the next issue to work on:",
4336
4380
  "",
@@ -4347,6 +4391,12 @@ var issueWorkerSubAgent = {
4347
4391
  "",
4348
4392
  "## Phase 2: Claim the Issue",
4349
4393
  "",
4394
+ "**Feedback mode:** Skip this phase entirely. The issue linked to the PR",
4395
+ "is already in `status:in-progress` from when the original PR was opened.",
4396
+ "Do not toggle any status labels on the issue.",
4397
+ "",
4398
+ "**Normal mode:**",
4399
+ "",
4350
4400
  "```bash",
4351
4401
  'gh issue edit <number> --remove-label "status:ready" --add-label "status:in-progress"',
4352
4402
  "```",
@@ -4358,6 +4408,31 @@ var issueWorkerSubAgent = {
4358
4408
  "",
4359
4409
  "## Phase 3: Set Up",
4360
4410
  "",
4411
+ "**Feedback mode:** Do **not** check out the default branch and do **not**",
4412
+ "create a new branch. Instead, look up the PR's head branch and check it out:",
4413
+ "",
4414
+ "```bash",
4415
+ "gh pr view <pr-number> --json state,headRefName,baseRefName,author",
4416
+ "```",
4417
+ "",
4418
+ "First verify the PR `state` is `OPEN`. If the state is `MERGED` or",
4419
+ "`CLOSED`, abort immediately \u2014 do not modify the branch. Report the",
4420
+ "state to the caller and stop.",
4421
+ "",
4422
+ "Then fetch and check out the existing branch:",
4423
+ "",
4424
+ "```bash",
4425
+ "git fetch origin",
4426
+ "git checkout <headRefName>",
4427
+ "git pull --rebase origin <headRefName>",
4428
+ "```",
4429
+ "",
4430
+ "If the rebase produces a conflict, abort and report failure \u2014 do not",
4431
+ "force-push and do not attempt to resolve conflicts in feedback mode.",
4432
+ "Skip the remainder of this phase (no new branch, no status comment).",
4433
+ "",
4434
+ "**Normal mode:**",
4435
+ "",
4361
4436
  "```bash",
4362
4437
  "git checkout {{repository.defaultBranch}} && git pull origin {{repository.defaultBranch}}",
4363
4438
  "```",
@@ -4389,6 +4464,52 @@ var issueWorkerSubAgent = {
4389
4464
  "",
4390
4465
  "## Phase 4: Implement",
4391
4466
  "",
4467
+ "**Feedback mode:** Read PR comments and apply the reviewer's fix list.",
4468
+ "",
4469
+ "1. List the PR's issue comments newest-first and pick the **most recent**",
4470
+ " comment authored by the reviewer account that contains a fenced",
4471
+ " code block with the language tag `fix-list`:",
4472
+ "",
4473
+ " ```bash",
4474
+ " gh pr view <pr-number> --json comments",
4475
+ " ```",
4476
+ "",
4477
+ "2. Extract the JSON body of the ` ```json fix-list ` block. The reviewer",
4478
+ " writes the comment in this exact shape:",
4479
+ "",
4480
+ " ````markdown",
4481
+ " ## Reviewer: fix list for @issue-worker",
4482
+ "",
4483
+ " - [ ] @<author> \u2014 <instruction summary> (<file>:<line>)",
4484
+ "",
4485
+ " ```json fix-list",
4486
+ " {",
4487
+ ' "pr": 123,',
4488
+ ' "branch": "feat/42-add-foo",',
4489
+ ' "generated_at": "2026-04-16T14:02:00Z",',
4490
+ ' "items": [',
4491
+ ' {"comment_id": "IC_abc", "author": "alice", "file": "src/foo.ts", "line": 42, "instruction": "rename getFoo to fetchFoo"},',
4492
+ ' {"comment_id": "IC_def", "author": "bob", "file": "src/foo.test.ts", "instruction": "add a test for the null branch"}',
4493
+ " ]",
4494
+ " }",
4495
+ " ```",
4496
+ " ````",
4497
+ "",
4498
+ " The JSON block is the **authoritative** list of work \u2014 the checkbox",
4499
+ " summary above it is for humans only and must be ignored. If multiple",
4500
+ " reviewer-authored fix-list comments exist, use the most recent one.",
4501
+ " If the JSON cannot be parsed, abort and report failure.",
4502
+ "",
4503
+ "3. Apply each `items[].instruction` in order. Each item references a",
4504
+ " `file` (and optional `line`). Track `comment_id` per item so you can",
4505
+ " report which items were handled and which (if any) failed.",
4506
+ "",
4507
+ "4. When complete, prepare a short structured report (PR number, commit",
4508
+ " SHAs you will push, items handled by `comment_id`, items that failed",
4509
+ " to apply) \u2014 you will return this after Phase 6.",
4510
+ "",
4511
+ "**Normal mode:**",
4512
+ "",
4392
4513
  "Read the issue body carefully. Understand the acceptance criteria.",
4393
4514
  "",
4394
4515
  "Implement the change following these guidelines based on issue type:",
@@ -4430,7 +4551,23 @@ var issueWorkerSubAgent = {
4430
4551
  "",
4431
4552
  "**If you are in scheduled mode, skip the pause and proceed directly.**",
4432
4553
  "",
4433
- "Use conventional commit messages:",
4554
+ "**Feedback mode:** Use a `fix(review)` commit message that references",
4555
+ "the PR number, and push to the existing branch **without** `-u` (the",
4556
+ "branch is already tracking origin). Before pushing, re-run",
4557
+ "`git pull --rebase origin <branch-name>` to incorporate any commits",
4558
+ "that landed on the branch while you were working. **Never force-push.**",
4559
+ "If the rebase conflicts, abort and report failure.",
4560
+ "",
4561
+ "```bash",
4562
+ "git add <files>",
4563
+ 'git commit -m "fix(review): <summary> (PR #<pr-number>)"',
4564
+ "git pull --rebase origin <branch-name>",
4565
+ "git push origin <branch-name>",
4566
+ "```",
4567
+ "",
4568
+ "**Normal mode:** Use conventional commit messages and push with `-u`",
4569
+ "to set up branch tracking:",
4570
+ "",
4434
4571
  "```bash",
4435
4572
  "git add <files>",
4436
4573
  'git commit -m "<type>: <description>"',
@@ -4439,6 +4576,12 @@ var issueWorkerSubAgent = {
4439
4576
  "",
4440
4577
  "## Phase 7: Open a PR",
4441
4578
  "",
4579
+ "**Feedback mode:** Skip this phase entirely. The PR already exists; you",
4580
+ "have pushed additional commits to its existing branch. Do not open a new",
4581
+ "PR.",
4582
+ "",
4583
+ "**Normal mode:**",
4584
+ "",
4442
4585
  "Every PR you open must carry the `origin:issue-worker` label so downstream",
4443
4586
  "agents can identify bot-authored PRs. Always include",
4444
4587
  "`--label 'origin:issue-worker'` in the `gh pr create` invocation:",
@@ -4460,6 +4603,12 @@ var issueWorkerSubAgent = {
4460
4603
  "",
4461
4604
  "## Phase 8: Update Status",
4462
4605
  "",
4606
+ "**Feedback mode:** Skip this phase entirely. The linked issue stays in",
4607
+ "`status:in-progress` while the PR is still open \u2014 do not toggle any",
4608
+ "labels.",
4609
+ "",
4610
+ "**Normal mode:**",
4611
+ "",
4463
4612
  "After the PR is created, transition the issue to the review phase:",
4464
4613
  "```bash",
4465
4614
  'gh issue edit <number> --remove-label "status:in-progress" --add-label "status:ready-for-review"',
@@ -4470,6 +4619,13 @@ var issueWorkerSubAgent = {
4470
4619
  "",
4471
4620
  "## Phase 9: Branch Cleanup",
4472
4621
  "",
4622
+ "**Feedback mode:** Skip this phase entirely. Do not poll the PR state",
4623
+ "and do not delete the local branch. Return control to the pr-reviewer",
4624
+ "with the structured report from Phase 4 (PR number, commit SHAs pushed,",
4625
+ "items handled by `comment_id`, items that failed to apply).",
4626
+ "",
4627
+ "**Normal mode:**",
4628
+ "",
4473
4629
  "The PR will not auto-merge until the `pr-reviewer` enables it. Poll the PR",
4474
4630
  "state up to 10 times, waiting 30 seconds between polls, until it either",
4475
4631
  "merges, closes, or the timeout is reached:",
@@ -4507,7 +4663,23 @@ var issueWorkerSubAgent = {
4507
4663
  " ```bash",
4508
4664
  ' gh issue edit <number> --remove-label "status:in-progress" --add-label "status:needs-attention"',
4509
4665
  ' gh issue comment <number> --body "Worker could not complete: <reason>"',
4510
- " ```"
4666
+ " ```",
4667
+ "8. **Never force-push in feedback mode.** If a `git pull --rebase`",
4668
+ " produces conflicts, abort and report failure. Do not pass",
4669
+ " `--force` or `--force-with-lease` to `git push`.",
4670
+ "9. **Abort if the PR is not OPEN in feedback mode.** Before checking",
4671
+ " out the head branch, verify `gh pr view <pr> --json state` returns",
4672
+ " `OPEN`. If the state is `MERGED` or `CLOSED`, stop immediately \u2014",
4673
+ " do not modify the branch.",
4674
+ "10. **Use the most-recent reviewer-authored fix-list comment.** If",
4675
+ " multiple `fix-list` comments exist on the PR, use the most recent",
4676
+ " one authored by the reviewer account. Ignore older fix-list",
4677
+ " comments and any fix-list comments authored by other accounts.",
4678
+ "11. **Never create a new branch in feedback mode.** Always check out",
4679
+ " the existing PR head branch returned by `gh pr view`. Do not run",
4680
+ " `git checkout -b` while in feedback mode.",
4681
+ "12. **Never `git push -u` in feedback mode.** The existing PR branch",
4682
+ " already tracks origin. Use plain `git push origin <branch-name>`."
4511
4683
  ].join("\n")
4512
4684
  };
4513
4685
  var orchestratorBundle = {
@@ -5454,6 +5626,81 @@ var prReviewerSubAgent = {
5454
5626
  "gh issue view <issue-number> --json number,title,body,labels,state,issueType",
5455
5627
  "```",
5456
5628
  "",
5629
+ "## Phase 2.5: Gather Comments",
5630
+ "",
5631
+ "Before deciding review mode, collect every human comment on the PR so",
5632
+ "that Phase 3.5 can classify each one and Phase 4.5 can render the",
5633
+ "sticky **Reviewer notes** summary. GitHub exposes PR comments across",
5634
+ "three distinct endpoints; the reviewer merges all three into a single",
5635
+ "queue.",
5636
+ "",
5637
+ "### Step 1: Fetch all three comment sources",
5638
+ "",
5639
+ "```bash",
5640
+ "# PR-level issue comments (top-level discussion thread)",
5641
+ "gh pr view <pr-number> --json comments",
5642
+ "",
5643
+ "# Inline code-review comments (line-anchored in the diff)",
5644
+ "gh api repos/{{repository.owner}}/{{repository.name}}/pulls/<pr-number>/comments",
5645
+ "",
5646
+ "# Formal review bodies and their APPROVED / CHANGES_REQUESTED / COMMENTED state",
5647
+ "gh api repos/{{repository.owner}}/{{repository.name}}/pulls/<pr-number>/reviews",
5648
+ "```",
5649
+ "",
5650
+ "For each item, capture: the comment id, author login, body, creation",
5651
+ "time, the URL, and any reactions already present (including which",
5652
+ "reactions the reviewer itself has previously applied). For inline",
5653
+ "review comments, also capture the thread / conversation resolution",
5654
+ "state so Step 2 can drop resolved threads.",
5655
+ "",
5656
+ "### Step 2: Apply filtering rules",
5657
+ "",
5658
+ "Drop a comment from classification when **any** of the following hold:",
5659
+ "",
5660
+ "1. **Reviewer's own comments.** The author login matches the invoking",
5661
+ " agent identity (for example, the bot account used to post prior",
5662
+ " reviewer replies, sticky summaries, or fix-list comments). The",
5663
+ " reviewer never classifies or reacts to its own output.",
5664
+ "2. **Bot authors.** The author login matches `*[bot]` \u2014 CI bots,",
5665
+ " Dependabot, CodeRabbit, GitHub Actions, and similar automation.",
5666
+ "3. **Terminal reviewer reactions already present.** The comment",
5667
+ " already carries a reaction **authored by the reviewer** in the set",
5668
+ " `+1` (accepted), `rocket` (landed), or `-1` (declined as",
5669
+ " out-of-scope). These signal the item has reached a terminal state",
5670
+ " on a previous pass and requires no further action.",
5671
+ "4. **Resolved threads.** Inline comments belonging to a conversation",
5672
+ " that GitHub marks as resolved.",
5673
+ "",
5674
+ "A comment whose only reviewer-authored reaction is `eyes` is **not**",
5675
+ 'terminal. `eyes` means "seen on a previous pass but not yet resolved"',
5676
+ "\u2014 keep it in the queue so Phase 3.5 can re-evaluate and possibly",
5677
+ "promote it to a terminal state once the corresponding action",
5678
+ "completes.",
5679
+ "",
5680
+ "A comment whose only reviewer-authored reaction is `thinking_face` is",
5681
+ "also **not** terminal \u2014 it indicates an open dispute the reviewer",
5682
+ "raised on a prior pass that has not yet been resolved by the human.",
5683
+ "Phase 4 uses the presence of unresolved `thinking_face` reactions as",
5684
+ "the pushback gate.",
5685
+ "",
5686
+ "### Step 3: Record the gathered set",
5687
+ "",
5688
+ "Persist the filtered comment list in memory for Phase 3.5 and Phase",
5689
+ "4.5. For each surviving comment record at minimum:",
5690
+ "",
5691
+ "```",
5692
+ "- id: <comment or review id>",
5693
+ " source: <pr-comment | inline-comment | review-body>",
5694
+ " author: <login>",
5695
+ " url: <html_url>",
5696
+ " body: <text>",
5697
+ " reactions: <list of reactions with authors>",
5698
+ "```",
5699
+ "",
5700
+ "If there are no unhandled comments after filtering, record that fact",
5701
+ "and proceed \u2014 Phase 3.5 will short-circuit, and the Phase 4.5 sticky",
5702
+ "summary will simply list no outstanding items.",
5703
+ "",
5457
5704
  "## Phase 2.75: Determine Review Mode",
5458
5705
  "",
5459
5706
  "Before comparing the diff to the acceptance criteria, evaluate the PR",
@@ -5542,8 +5789,175 @@ var prReviewerSubAgent = {
5542
5789
  "- **CI status** \u2014 `gh pr checks` reports all required checks passing",
5543
5790
  "- **Scope creep** \u2014 diff stays within the issue's stated scope",
5544
5791
  "",
5792
+ "## Phase 3.5: Classify Comments",
5793
+ "",
5794
+ "For every comment that survived Phase 2.5 filtering, assign exactly",
5795
+ "one classification and take the corresponding action. The reviewer",
5796
+ "acts only on unhandled comments; anything already in a terminal state",
5797
+ "was dropped in Phase 2.5 and is left alone.",
5798
+ "",
5799
+ "### Classifications",
5800
+ "",
5801
+ "#### `in-scope`",
5802
+ "",
5803
+ "The comment requests a change that falls **inside** the linked",
5804
+ "issue's acceptance criteria (or is an obvious defect in code the PR",
5805
+ "itself introduced).",
5806
+ "",
5807
+ "Action on this pass:",
5808
+ "",
5809
+ "- React `eyes` on the comment to mark it seen.",
5810
+ "- Queue the comment for later delegation. **Delegation wiring is out",
5811
+ " of scope for this phase** \u2014 the fix-list comment and the",
5812
+ " issue-worker hand-off land in a follow-up issue. For now, record",
5813
+ " the queued items in memory so Phase 4.5 can list them as",
5814
+ " outstanding.",
5815
+ "- Do **not** apply `+1` or `rocket` yet. Those are terminal",
5816
+ " reactions reserved for later passes once the fix has been accepted",
5817
+ " into the PR (`+1`) and actually landed on the branch (`rocket`).",
5818
+ "",
5819
+ "```bash",
5820
+ "# React eyes on a PR-level issue comment",
5821
+ "gh api repos/{{repository.owner}}/{{repository.name}}/issues/comments/<comment-id>/reactions \\",
5822
+ " -X POST -f content=eyes",
5823
+ "",
5824
+ "# React eyes on an inline code-review comment",
5825
+ "gh api repos/{{repository.owner}}/{{repository.name}}/pulls/comments/<comment-id>/reactions \\",
5826
+ " -X POST -f content=eyes",
5827
+ "```",
5828
+ "",
5829
+ "#### `out-of-scope`",
5830
+ "",
5831
+ "The comment requests work that falls **outside** the linked issue's",
5832
+ "acceptance criteria \u2014 new functionality, a refactor that would",
5833
+ "expand the diff, a cleanup in a neighbouring module, and so on. It",
5834
+ "is a legitimate request, just not for this PR.",
5835
+ "",
5836
+ "Action:",
5837
+ "",
5838
+ "1. Create a new tracking issue following the `Create Issue Workflow`",
5839
+ " in CLAUDE.md. Derive the title prefix (`feat:`, `fix:`, `chore:`,",
5840
+ " etc.) from the content of the comment. Apply the correct",
5841
+ " `type:*`, `priority:*`, and `status:*` labels and assign the",
5842
+ " GitHub issue type via the documented GraphQL mutation.",
5843
+ "2. Reply to the original comment with a link to the new issue:",
5844
+ " `Tracked separately in #<new-issue>.`",
5845
+ "3. React `-1` on the original comment. `-1` is the terminal",
5846
+ " reaction for out-of-scope and is only applied **after** the new",
5847
+ " issue has been successfully created and the reply posted.",
5848
+ "",
5849
+ "```bash",
5850
+ "# Reply on the same thread",
5851
+ "gh pr comment <pr-number> --body 'Tracked separately in #<new-issue>.'",
5852
+ "",
5853
+ "# React -1 on the original comment once the new issue exists",
5854
+ "gh api repos/{{repository.owner}}/{{repository.name}}/issues/comments/<comment-id>/reactions \\",
5855
+ " -X POST -f content=-1",
5856
+ "```",
5857
+ "",
5858
+ "#### `dispute`",
5859
+ "",
5860
+ "The comment conflicts with an acceptance criterion, a documented",
5861
+ "CLAUDE.md convention, or the project-context doc; or it is ambiguous",
5862
+ "enough that implementation would require guessing at intent. The",
5863
+ "reviewer pushes back rather than silently complying.",
5864
+ "",
5865
+ "Action:",
5866
+ "",
5867
+ "1. React `thinking_face` on the comment to mark it as disputed.",
5868
+ " This reaction is **not** terminal \u2014 it persists until the human",
5869
+ " resolves the dispute.",
5870
+ "2. Post a reply on the same thread explaining the pushback. Cite",
5871
+ " the specific acceptance criterion, convention, or project-context",
5872
+ " section that the comment conflicts with, or name the ambiguity",
5873
+ " that needs resolution.",
5874
+ "3. The presence of an unresolved `thinking_face` reaction by the",
5875
+ " reviewer blocks auto-merge in Phase 4 regardless of the review",
5876
+ " mode decided in Phase 2.75.",
5877
+ "",
5878
+ "```bash",
5879
+ "# React thinking_face on the disputed comment",
5880
+ "gh api repos/{{repository.owner}}/{{repository.name}}/issues/comments/<comment-id>/reactions \\",
5881
+ " -X POST -f content=confused",
5882
+ "",
5883
+ "# Post the pushback reply",
5884
+ "gh pr comment <pr-number> --body '<pushback explanation>'",
5885
+ "```",
5886
+ "",
5887
+ "Note: GitHub's reactions API uses `confused` as the content string",
5888
+ "for the `thinking_face` reaction; use `content=confused` when",
5889
+ "POSTing the reaction.",
5890
+ "",
5891
+ "#### `nit` / `question`",
5892
+ "",
5893
+ "The comment is a minor stylistic preference, a clarifying question",
5894
+ "with a short answer, or a drive-by note that does not request a",
5895
+ "code change.",
5896
+ "",
5897
+ "Action:",
5898
+ "",
5899
+ "- React `eyes` to mark the comment seen.",
5900
+ "- Optionally post a brief reply when the question has a short,",
5901
+ " factual answer. Skip the reply when there is nothing useful to",
5902
+ " add \u2014 an `eyes` reaction alone is sufficient.",
5903
+ "- Never apply `+1`, `rocket`, or `-1` to a `nit` / `question`",
5904
+ " comment; those reactions are reserved for their documented",
5905
+ " terminal meanings.",
5906
+ "",
5907
+ "### Reaction protocol summary",
5908
+ "",
5909
+ "| Reaction | Meaning | Terminal? |",
5910
+ "|----------|---------|-----------|",
5911
+ "| `eyes` | Seen by reviewer; awaiting further action | No |",
5912
+ "| `thinking_face` (`confused`) | Reviewer disputes this comment | No |",
5913
+ "| `+1` | Reviewer accepts the comment's request | **Yes** |",
5914
+ "| `rocket` | The accepted change has landed on the branch | **Yes** |",
5915
+ "| `-1` | Reviewer declined as out-of-scope; tracked in a new issue | **Yes** |",
5916
+ "",
5917
+ "Terminal reactions (`+1`, `rocket`, `-1`) **must only be applied**",
5918
+ "when the corresponding action is truly complete:",
5919
+ "",
5920
+ "- `+1` \u2014 only after the reviewer has confirmed the comment's",
5921
+ " request is in-scope and the fix has been accepted for this PR.",
5922
+ "- `rocket` \u2014 only after the accepted fix has actually landed on the",
5923
+ " PR's branch (a commit addressing the comment is present).",
5924
+ "- `-1` \u2014 only after a new tracking issue has been successfully",
5925
+ " created for the out-of-scope request and the reply linking to it",
5926
+ " has been posted.",
5927
+ "",
5928
+ "Never pre-emptively apply a terminal reaction. Applying one signals",
5929
+ "to humans and to future reviewer passes that the item is closed;",
5930
+ "applying it early creates a false record of completion.",
5931
+ "",
5545
5932
  "## Phase 4: Decide and Act",
5546
5933
  "",
5934
+ "### Pushback gate (runs before every merge decision)",
5935
+ "",
5936
+ "Before taking any merge-enabling action in this phase, verify that no",
5937
+ "**unresolved `thinking_face` reactions by the reviewer** remain on",
5938
+ "any comment gathered in Phase 2.5.",
5939
+ "",
5940
+ "A `thinking_face` reaction is considered **unresolved** when:",
5941
+ "",
5942
+ "- The reviewer applied it on this pass or a prior pass, and",
5943
+ "- The underlying comment has not since received a resolution signal",
5944
+ " from the human \u2014 for example, the comment has not been withdrawn,",
5945
+ " the human has not posted a clarifying reply that the reviewer has",
5946
+ " since marked `+1`, and no `review:auto-ok` label has been applied",
5947
+ " to the PR as an explicit override.",
5948
+ "",
5949
+ "If any unresolved `thinking_face` reaction exists, **do not enable",
5950
+ "auto-merge** and **do not apply `review:awaiting-human` as a success",
5951
+ "hand-off**. This gate fires regardless of the review mode decided in",
5952
+ "Phase 2.75 \u2014 pushback blocks the merge pathway even when the mode is",
5953
+ "`auto-merge`. Skip straight to Phase 4.5 to update the sticky summary",
5954
+ "with the outstanding pushbacks, then stop. A downstream issue",
5955
+ "refines this gate further; for now, pushback simply blocks the",
5956
+ "merge pathway.",
5957
+ "",
5958
+ "If no unresolved `thinking_face` reactions exist, proceed with the",
5959
+ "branches below based on the review mode decided in Phase 2.75.",
5960
+ "",
5547
5961
  "### If all acceptance criteria are met and CI is green",
5548
5962
  "",
5549
5963
  "Branch on the **review mode** decided in Phase 2.75:",
@@ -5601,6 +6015,82 @@ var prReviewerSubAgent = {
5601
6015
  "--request-changes`: it is lighter-weight, doesn't require the author to",
5602
6016
  "dismiss a formal review, and composes cleanly with the multi-PR loop.",
5603
6017
  "",
6018
+ "## Phase 4.5: Update Sticky Summary",
6019
+ "",
6020
+ "On **every pass**, create or update a single **`## Reviewer notes`**",
6021
+ "comment on the PR. This sticky comment is the human-facing single",
6022
+ "source of truth for the PR's state \u2014 one comment per PR, edited in",
6023
+ "place across passes, never duplicated. Do not post a fresh",
6024
+ '"pass N summary" on each iteration.',
6025
+ "",
6026
+ "### Step 1: Find the existing sticky comment (if any)",
6027
+ "",
6028
+ "List PR-level comments and look for one authored by the reviewer",
6029
+ "whose body starts with `## Reviewer notes`:",
6030
+ "",
6031
+ "```bash",
6032
+ "gh api repos/{{repository.owner}}/{{repository.name}}/issues/<pr-number>/comments",
6033
+ "```",
6034
+ "",
6035
+ "If multiple candidates exist (an older run double-posted before this",
6036
+ "phase existed), keep the earliest and plan to delete the duplicates",
6037
+ "on a later pass. Never delete another author's comment.",
6038
+ "",
6039
+ "### Step 2: Compose the sticky body",
6040
+ "",
6041
+ "The body uses the following shape:",
6042
+ "",
6043
+ "```",
6044
+ "## Reviewer notes",
6045
+ "",
6046
+ "**Mode:** auto-merge | human-required \u2014 <reason from Phase 2.75>",
6047
+ "**AC status:** <met / partial / missing> (evidence links)",
6048
+ "**CI status:** green | pending | red",
6049
+ "**Outstanding:** <list of comments still open with their classification and author>",
6050
+ "**Pushbacks:** <list of disputes with reasons>",
6051
+ "**Last pass:** <ISO timestamp>",
6052
+ "```",
6053
+ "",
6054
+ "Populate each field from the phases above:",
6055
+ "",
6056
+ "- **Mode / reason** \u2014 the mode and reason recorded in Phase 2.75.",
6057
+ "- **AC status** \u2014 the checklist produced in Phase 3 (met, partial,",
6058
+ " or missing), with links to the files or tests that provide the",
6059
+ " evidence.",
6060
+ "- **CI status** \u2014 derived from `gh pr checks`.",
6061
+ "- **Outstanding** \u2014 the comments still carrying a non-terminal",
6062
+ " reviewer reaction from Phase 3.5 (typically `eyes` for queued",
6063
+ " in-scope items and `nit` / `question` items that remain open).",
6064
+ " List each as `<classification>: <author> \u2014 <short summary> (<url>)`.",
6065
+ "- **Pushbacks** \u2014 every comment the reviewer reacted",
6066
+ " `thinking_face` to on this or any prior pass, with the reason",
6067
+ " captured in the pushback reply. Empty list when there are none.",
6068
+ "- **Last pass** \u2014 the ISO 8601 timestamp of this run.",
6069
+ "",
6070
+ "### Step 3: Create or edit in place",
6071
+ "",
6072
+ "If no existing sticky comment was found in Step 1, create one:",
6073
+ "",
6074
+ "```bash",
6075
+ "gh pr comment <pr-number> --body '<sticky body>'",
6076
+ "```",
6077
+ "",
6078
+ "If an existing sticky comment was found, edit it in place using the",
6079
+ "comment id. Do not delete and re-create \u2014 editing preserves the",
6080
+ "comment's URL and any reactions humans have added to the summary:",
6081
+ "",
6082
+ "```bash",
6083
+ "gh api repos/{{repository.owner}}/{{repository.name}}/issues/comments/<sticky-comment-id> \\",
6084
+ " -X PATCH -f body='<sticky body>'",
6085
+ "```",
6086
+ "",
6087
+ "The sticky summary must be updated on every pass through Phase 4.5,",
6088
+ "including passes that ended in a pushback-gated skip, a",
6089
+ "`NEEDS_CHANGES` findings comment, or the `human-required` hand-off.",
6090
+ "Humans rely on the sticky comment to see the current state of the",
6091
+ "PR at a glance \u2014 it must never go stale while the reviewer is",
6092
+ "actively processing the PR.",
6093
+ "",
5604
6094
  "## Phase 5: Branch Cleanup and Issue Closure Verification",
5605
6095
  "",
5606
6096
  "Skip this phase entirely when the review mode from Phase 2.75 is",
@@ -5695,7 +6185,35 @@ var prReviewerSubAgent = {
5695
6185
  "8. **In loop mode (`/review-prs`), never stop early.** If any review",
5696
6186
  " fails, comment and move to the next PR. Only abort the loop on a",
5697
6187
  " fatal error (e.g. `gh` auth failure, network outage).",
5698
- "9. **Follow CLAUDE.md conventions** for all `git` and `gh` operations."
6188
+ "9. **Follow CLAUDE.md conventions** for all `git` and `gh` operations.",
6189
+ "10. **Follow the reaction protocol.** Use `eyes` to mark a comment",
6190
+ " seen, `thinking_face` (`confused`) to dispute it, `+1` to accept",
6191
+ " its request, `rocket` when the accepted change has landed, and",
6192
+ " `-1` when the request is out-of-scope and has been tracked in a",
6193
+ " new issue. Apply reactions on the same comment endpoint the",
6194
+ " comment came from (`issues/comments/...` for PR-level, ",
6195
+ " `pulls/comments/...` for inline).",
6196
+ "11. **Terminal reactions require completed actions.** `+1`, `rocket`,",
6197
+ " and `-1` must only be applied once the corresponding action is",
6198
+ " truly complete (respectively: the fix accepted, the fix landed,",
6199
+ " or the new out-of-scope issue created and linked in a reply).",
6200
+ " Never apply a terminal reaction pre-emptively; doing so falsely",
6201
+ " signals to humans and to future reviewer passes that the item",
6202
+ " is closed.",
6203
+ "12. **Maintain one sticky `## Reviewer notes` comment per PR.** On",
6204
+ " each pass, find the existing sticky comment authored by the",
6205
+ " reviewer and edit it in place with `gh api ... -X PATCH`;",
6206
+ " create it only when none exists. Never post per-pass summary",
6207
+ " comments alongside the sticky \u2014 the sticky is the single",
6208
+ " human-facing source of truth for PR state.",
6209
+ "13. **Pushback blocks auto-merge.** Any unresolved `thinking_face`",
6210
+ " reaction authored by the reviewer on any comment must prevent",
6211
+ " Phase 4 from enabling auto-merge, regardless of the review mode",
6212
+ " decided in Phase 2.75. The gate clears only when the human has",
6213
+ " resolved the dispute \u2014 by withdrawing the comment, by replying",
6214
+ " in a way that satisfies the reviewer (who then replaces the",
6215
+ " `thinking_face` with `+1`), or by applying the `review:auto-ok`",
6216
+ " label as an explicit override."
5699
6217
  ].join("\n")
5700
6218
  };
5701
6219
  var reviewPrSkill = {