@codedrifters/configulator 0.0.354 → 0.0.355

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
@@ -13440,7 +13440,36 @@ function renderIssueWorkerSkillBody(task, lines) {
13440
13440
  "",
13441
13441
  `Route matched issues to \`.claude/agents/${task.agent}.md\` and`,
13442
13442
  "execute its phase-specific workflow.",
13443
- "",
13443
+ ""
13444
+ );
13445
+ if (task.taskId === "worker-issue") {
13446
+ lines.push(
13447
+ "## Feedback-pull scan (runs before issue selection)",
13448
+ "",
13449
+ "Because you run autonomously (scheduled mode), **also scan for PRs",
13450
+ "needing feedback work before scanning the issue queue** \u2014 and",
13451
+ "prefer them. The pr-reviewer hands fixes off by applying a durable",
13452
+ "`review:needs-worker` marker on the PR (it cannot spawn you in",
13453
+ "session). Pull that marker instead of waiting for an explicit push:",
13454
+ "",
13455
+ "```bash",
13456
+ "gh pr list --state open --label 'review:needs-worker' \\",
13457
+ " --json number,labels,headRefName,updatedAt",
13458
+ "```",
13459
+ "",
13460
+ "If any open PR carries an unconsumed `review:needs-worker` fix-list,",
13461
+ "enter **feedback mode** for the highest-priority match (no explicit",
13462
+ "`feedback mode: PR #<n>` push required) and run the issue-worker's",
13463
+ "feedback-mode phases: apply the fix-list, push, write the",
13464
+ "worker-report comment, and **clear `review:needs-worker`** (leave",
13465
+ "`review:fixing` for the reviewer's confirm pass). Only when no PR",
13466
+ "needs a worker do you fall through to the issue-queue selection",
13467
+ "above. See the **Invocation Mode** and **Phase 1** sections of",
13468
+ "`.claude/agents/issue-worker.md` for the full contract.",
13469
+ ""
13470
+ );
13471
+ }
13472
+ lines.push(
13444
13473
  "## Recommended model",
13445
13474
  "",
13446
13475
  `**${capitalize(task.recommendedModel)}** \u2014 see`,
@@ -15786,15 +15815,31 @@ var issueWorkerSubAgent = {
15786
15815
  " **not** create a new branch and you do **not** open a new PR \u2014 you",
15787
15816
  " push additional commits to the same branch.",
15788
15817
  "",
15789
- "**You are in feedback mode if and only if the invocation prompt that",
15790
- "started this session contains the literal phrase `feedback mode: PR #<n>`",
15791
- "(where `<n>` is the PR number).** This mirrors the `scheduled mode` /",
15792
- "`non-interactive` string-match convention above. Otherwise, default to",
15793
- "normal mode.",
15818
+ "You enter feedback mode in one of **two** ways:",
15819
+ "",
15820
+ "1. **Pushed (explicit).** The invocation prompt that started this",
15821
+ " session contains the literal phrase `feedback mode: PR #<n>`",
15822
+ " (where `<n>` is the PR number). This mirrors the `scheduled",
15823
+ " mode` / `non-interactive` string-match convention above and works",
15824
+ " in both interactive and scheduled invocations (a human asks you",
15825
+ " to fix a PR, or the orchestrator hands one off as a stopgap).",
15826
+ "2. **Pulled (autonomous, scheduled only).** In **scheduled mode**,",
15827
+ " even without an explicit `feedback mode: PR #<n>` push, you also",
15828
+ " discover PRs needing feedback work by scanning open PRs for the",
15829
+ " durable `review:needs-worker` marker (see Phase 1). When you pick",
15830
+ " one up, you enter feedback mode for that PR autonomously. This is",
15831
+ " how the reviewer's pull-based hand-off completes without any",
15832
+ " depth-2 sub-agent spawn \u2014 the reviewer applies the marker, you",
15833
+ " pull it.",
15834
+ "",
15835
+ "Otherwise, default to normal mode. The explicit `feedback mode: PR",
15836
+ "#<n>` push path always wins: when present, work that PR and do not",
15837
+ "scan the queue.",
15794
15838
  "",
15795
15839
  "Interactive vs scheduled and normal vs feedback are independent axes.",
15796
15840
  "Feedback mode can run interactively (a human asks you to fix a PR) or",
15797
- "on a schedule (the pr-reviewer hands off the PR). The interactive",
15841
+ "on a schedule (autonomously pulled from the `review:needs-worker`",
15842
+ "queue, or pushed by the orchestrator). The interactive",
15798
15843
  "pause-before-commit rule (Phase 6) applies in either work mode.",
15799
15844
  "",
15800
15845
  "When in feedback mode, the per-phase behaviour changes as documented",
@@ -15802,12 +15847,13 @@ var issueWorkerSubAgent = {
15802
15847
  "",
15803
15848
  "| Phase | Normal mode | Feedback mode |",
15804
15849
  "|-------|-------------|---------------|",
15805
- "| 1. Select an Issue | Pick from queue or use provided issue number | **Skip.** Use the PR number from the invocation prompt. |",
15850
+ "| 1. Select an Issue | Pick from queue or use provided issue number | **Pushed:** use the PR number from the prompt. **Pulled (scheduled):** scan open PRs for `review:needs-worker`, pick the highest-priority match. Feedback PRs are preferred over fresh issues. |",
15806
15851
  "| 2. Claim the Issue | Toggle status labels on the issue | **Skip.** The issue is already `status:in-progress`. |",
15807
15852
  "| 3. Set Up | Checkout default branch, create new branch | Checkout the existing PR branch via `gh pr view` and `git checkout <headRefName>`. |",
15808
15853
  "| 4. Implement | Read issue AC, implement | Read most-recent reviewer-authored fix-list comment on the PR, parse JSON, apply each item. |",
15809
15854
  "| 5. Verify | Unchanged | Unchanged. |",
15810
15855
  "| 6. Commit and Push | Conventional commit, interactive pause | Commit message `fix(review): <summary> (PR #<n>)`. Pause behaviour unchanged. `git push` (no `-u`). |",
15856
+ "| 6.5. Complete the hand-off | n/a | Write the structured worker-report comment, then **clear `review:needs-worker`** (leave `review:fixing` for the reviewer's confirm pass). |",
15811
15857
  "| 7. Open a PR | Open a new PR | **Skip.** |",
15812
15858
  "| 8. Update Status | Set issue to `status:ready-for-review` | **Skip.** PR is still open; issue stays `status:in-progress`. |",
15813
15859
  "| 9. Branch Cleanup | Poll for merge, delete branch | **Skip.** Return control to the pr-reviewer without polling. |",
@@ -15817,9 +15863,40 @@ var issueWorkerSubAgent = {
15817
15863
  ...PROJECT_CONTEXT_READER_SECTION,
15818
15864
  "## Phase 1: Select an Issue",
15819
15865
  "",
15820
- "**Feedback mode:** Skip this phase entirely. Extract the PR number from",
15821
- "the `feedback mode: PR #<n>` phrase in your invocation prompt and use",
15822
- "it for the rest of the workflow.",
15866
+ "**Feedback mode (pushed):** When the invocation prompt contains an",
15867
+ "explicit `feedback mode: PR #<n>` phrase, skip the rest of this phase.",
15868
+ "Extract the PR number from that phrase and use it for the rest of the",
15869
+ "workflow. The explicit push always wins \u2014 do not scan the queue.",
15870
+ "",
15871
+ "**Feedback-pull discovery (scheduled mode, no explicit push).** Before",
15872
+ "scanning the issue queue, check for PRs needing feedback work. This is",
15873
+ "how the pr-reviewer's pull-based hand-off completes: the reviewer",
15874
+ "applies a durable `review:needs-worker` marker and exits; you discover",
15875
+ "it here. **Feedback PRs are preferred over fresh issues** \u2014 a queued",
15876
+ "fix-list is a half-finished unit of work and should land before a new",
15877
+ "one starts.",
15878
+ "",
15879
+ "Scan open PRs carrying the marker, sorted highest-priority first:",
15880
+ "",
15881
+ "```bash",
15882
+ "gh pr list --state open --label 'review:needs-worker' \\",
15883
+ " --json number,labels,headRefName,updatedAt",
15884
+ "```",
15885
+ "",
15886
+ "For each candidate, confirm it carries an **unconsumed** reviewer",
15887
+ "fix-list \u2014 a `review:needs-worker` label that the reviewer applied",
15888
+ "alongside a `## Reviewer: fix list for @issue-worker` comment whose",
15889
+ "` ```json fix-list ` block has not yet been applied by a worker",
15890
+ "(no newer worker-report comment from you). Pick the **highest-priority**",
15891
+ "match (use the linked issue's `priority:*` label; break ties by oldest",
15892
+ "`updatedAt`). Enter feedback mode for that PR **without** requiring an",
15893
+ "explicit `feedback mode: PR #<n>` push, and run Phases 3\u20136.5 against",
15894
+ "it. If no PR carries an unconsumed `review:needs-worker` marker, fall",
15895
+ "through to normal-mode issue selection below.",
15896
+ "",
15897
+ "(Interactive sessions do **not** auto-pull \u2014 a human who wants a",
15898
+ "specific PR fixed passes `feedback mode: PR #<n>` explicitly. The",
15899
+ "autonomous pull is scheduled-mode only.)",
15823
15900
  "",
15824
15901
  "**Normal mode:**",
15825
15902
  "If an issue number was provided in your instructions, use that issue.",
@@ -16173,6 +16250,47 @@ var issueWorkerSubAgent = {
16173
16250
  "git push -u origin <branch-name>",
16174
16251
  "```",
16175
16252
  "",
16253
+ "## Phase 6.5: Complete the Feedback Hand-off",
16254
+ "",
16255
+ "**Normal mode:** Skip this phase entirely.",
16256
+ "",
16257
+ "**Feedback mode:** After the fix commits are pushed (Phase 6), close",
16258
+ "the pull-based hand-off so the pr-reviewer's confirm pass can pick it",
16259
+ "up.",
16260
+ "",
16261
+ "1. **Write the structured worker-report comment** on the PR. It is",
16262
+ " the record the reviewer's confirm pass reads to react on source",
16263
+ " comments and re-evaluate AC/CI. Include: the PR number, the commit",
16264
+ " SHAs you pushed (or the rebased head SHA for a synthetic-rebase",
16265
+ " item), and a per-item outcome keyed by `comment_id` \u2014 `handled`",
16266
+ " or `failed` (with a short reason for each failure). This is the",
16267
+ " same structured report you would otherwise return to the caller in",
16268
+ " the pushed-feedback case; post it as a PR comment so a separate",
16269
+ " reviewer session can consume it.",
16270
+ "",
16271
+ " ```bash",
16272
+ " gh pr comment <pr-number> --body-file <worker-report-path>",
16273
+ " ```",
16274
+ "",
16275
+ "2. **Clear the `review:needs-worker` marker.** This signals the",
16276
+ " reviewer that the delegation has been consumed. Leave the",
16277
+ " `review:fixing` lease in place \u2014 the reviewer's confirm pass",
16278
+ " releases it after reacting and re-evaluating. Clearing the marker",
16279
+ " is what flips the PR into the lease-without-marker state the",
16280
+ " confirm pass keys on.",
16281
+ "",
16282
+ " ```bash",
16283
+ " gh pr edit <pr-number> --remove-label 'review:needs-worker'",
16284
+ " ```",
16285
+ "",
16286
+ "Do **not** remove `review:fixing` yourself, and do **not** re-enable",
16287
+ "auto-merge \u2014 both belong to the reviewer's confirm pass. If you could",
16288
+ "not apply any item (every item `failed`), still write the report and",
16289
+ "still clear `review:needs-worker`: the reviewer's confirm pass reacts",
16290
+ "`thinking_face` on the failed items and falls through to the",
16291
+ "human-required hand-off via `review:awaiting-human`. Leaving the",
16292
+ "marker applied on a total failure would wedge the PR.",
16293
+ "",
16176
16294
  "## Phase 7: Open a PR",
16177
16295
  "",
16178
16296
  "**Feedback mode:** Skip this phase entirely. The PR already exists; you",
@@ -16219,9 +16337,13 @@ var issueWorkerSubAgent = {
16219
16337
  "## Phase 9: Branch Cleanup",
16220
16338
  "",
16221
16339
  "**Feedback mode:** Skip this phase entirely. Do not poll the PR state",
16222
- "and do not delete the local branch. Return control to the pr-reviewer",
16223
- "with the structured report from Phase 4 (PR number, commit SHAs pushed,",
16224
- "items handled by `comment_id`, items that failed to apply).",
16340
+ "and do not delete the local branch. You have already posted the",
16341
+ "structured worker-report comment and cleared `review:needs-worker` in",
16342
+ "Phase 6.5 \u2014 the pr-reviewer's confirm pass picks up the hand-off from",
16343
+ "the lease-without-marker label state. Return control to the caller",
16344
+ "with the same structured report (PR number, commit SHAs pushed, items",
16345
+ "handled by `comment_id`, items that failed to apply) so a pushing",
16346
+ "orchestrator can log it.",
16225
16347
  "",
16226
16348
  "**Normal mode:**",
16227
16349
  "",
@@ -16289,7 +16411,24 @@ var issueWorkerSubAgent = {
16289
16411
  " with a `BLOCKED_ON_SCOPE` report if the classifier returns",
16290
16412
  " `large`. Never claim, branch, or implement a `large` issue \u2014",
16291
16413
  " the orchestrator must decompose it first. See the **Scope gate**",
16292
- " section in `CLAUDE.md` for the contract."
16414
+ " section in `CLAUDE.md` for the contract.",
16415
+ "15. **Prefer feedback PRs over fresh issues (scheduled mode).** When",
16416
+ " running autonomously, scan open PRs for the `review:needs-worker`",
16417
+ " marker **before** scanning the issue queue, and pick up the",
16418
+ " highest-priority unconsumed fix-list first. A half-finished PR",
16419
+ " should land before a new unit of work starts. The explicit",
16420
+ " `feedback mode: PR #<n>` push always overrides both scans.",
16421
+ "16. **Clear `review:needs-worker`, never `review:fixing`.** On",
16422
+ " completing a feedback hand-off (Phase 6.5), write the structured",
16423
+ " worker-report comment and remove **only** the",
16424
+ " `review:needs-worker` marker. The `review:fixing` lease belongs",
16425
+ " to the reviewer's confirm pass \u2014 never remove it yourself, and",
16426
+ " never re-enable auto-merge. Clear the marker even when every item",
16427
+ " failed, so a crashed delegation does not wedge the PR.",
16428
+ "17. **Auto-pull only in scheduled mode.** The autonomous",
16429
+ " `review:needs-worker` scan is scheduled-mode only. In an",
16430
+ " interactive session, never auto-pull a feedback PR \u2014 a human who",
16431
+ " wants one fixed passes `feedback mode: PR #<n>` explicitly."
16293
16432
  ].join("\n")
16294
16433
  };
16295
16434
  var ORCHESTRATOR_CONVENTIONS_PREAMBLE = [
@@ -17845,8 +17984,12 @@ var prReviewerSubAgent = {
17845
17984
  " conflicting files). The guards and classification are identical to",
17846
17985
  " the Phase 4 entry point.",
17847
17986
  "- **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.",
17987
+ " durably queued for `issue-worker` (the PR now carries",
17988
+ " `review:needs-worker` and the `review:fixing` lease); stop this",
17989
+ " pass. A top-level `issue-worker` session pulls the marker and",
17990
+ " pushes the rebased branch, then a follow-up reviewer pass confirms",
17991
+ " the result and releases the lease \u2014 no human re-invocation is",
17992
+ " required for the loop to complete.",
17850
17993
  "- **On the procedure returning `skipped` (a guard denied delegation",
17851
17994
  " or the guards failed):** fall back to the original hard reject \u2014",
17852
17995
  " post the merge-conflict rejection comment and stop. Use this",
@@ -18267,14 +18410,20 @@ var prReviewerSubAgent = {
18267
18410
  "",
18268
18411
  "When the invocation guard above permits delegation **and** Phase 3.5",
18269
18412
  "queued one or more `in-scope` items, the reviewer hands the fix work",
18270
- "off to `issue-worker` in feedback mode. The reviewer never edits the",
18271
- "PR's branch itself.",
18272
- "",
18273
- "Run the steps below in order. Steps (a) through (g) apply in **both**",
18274
- "`auto-merge` and `human-required` review modes. Step (h) is",
18275
- "auto-merge-only \u2014 in `human-required` mode the reviewer skips it,",
18276
- "leaves `review:awaiting-human` applied, and lets the human own the",
18277
- "final merge.",
18413
+ "off to `issue-worker` via a **pull-based** marker. The reviewer never",
18414
+ "edits the PR's branch itself and never spawns `issue-worker` in",
18415
+ "session \u2014 it posts the fix-list, applies the `review:needs-worker`",
18416
+ "marker, holds the `review:fixing` lease across sessions, and exits.",
18417
+ "A top-level `issue-worker` session pulls the work; a later reviewer",
18418
+ "pass confirms it via the **Shared Procedure: Confirm a Completed",
18419
+ "Delegation**.",
18420
+ "",
18421
+ "Run steps (a) through (e) below in order. They apply in **both**",
18422
+ "`auto-merge` and `human-required` review modes \u2014 the mode-specific",
18423
+ "auto-merge decision is deferred to the confirm pass, which only",
18424
+ "re-enables auto-merge in `auto-merge` mode (in `human-required` mode",
18425
+ "the confirm pass leaves `review:awaiting-human` applied and lets the",
18426
+ "human own the final merge).",
18278
18427
  "",
18279
18428
  "#### a. Handle AC drift first",
18280
18429
  "",
@@ -18373,103 +18522,48 @@ var prReviewerSubAgent = {
18373
18522
  "(or `--body` if the body is short). Capture the resulting comment id",
18374
18523
  "in memory so Phase 4.5 can cite the fix-list URL in the sticky.",
18375
18524
  "",
18376
- "#### e. Invoke `issue-worker` in feedback mode",
18377
- "",
18378
- "Hand the fix work off to the `issue-worker` sub-agent. The invocation",
18379
- "prompt **must** contain the literal phrase `feedback mode: PR #<n>`",
18380
- "(with the actual PR number substituted) so the worker enters its",
18381
- "feedback-mode branch instead of selecting a new issue. The prompt",
18382
- "must also include the repository (`{{repository.owner}}/{{repository.name}}`)",
18383
- "and the PR number explicitly \u2014 do not rely on the worker inferring",
18384
- "either from context.",
18385
- "",
18386
- "Wait for the worker to return its structured report. The report",
18387
- "lists, per item, the `comment_id` and a status of `handled` or",
18388
- "`failed` (with a short failure reason for the latter). If the worker",
18389
- "errors out without returning a report, treat **every** item as failed",
18390
- "and proceed to step (f) so source comments still get a reaction.",
18391
- "",
18392
- "#### f. Process the worker's report",
18393
- "",
18394
- "For every item the worker reports:",
18525
+ "#### e. Apply the `review:needs-worker` marker and exit `delegated`",
18395
18526
  "",
18396
- "- **`handled`** \u2014 react `rocket` on the original source comment to",
18397
- " signal the accepted change has landed. Use the same comment",
18398
- " endpoint the comment originated from (`issues/comments/...` for",
18399
- " PR-level, `pulls/comments/...` for inline).",
18400
- "- **`failed`** \u2014 react `thinking_face` (`content=confused`) on the",
18401
- " original source comment **and** post a reply on the same thread",
18402
- " explaining why the fix could not be applied (cite the failure",
18403
- " reason returned by the worker).",
18527
+ "Hand the fix work off to `issue-worker` **by marker, not by spawn**.",
18528
+ "Do **not** invoke `issue-worker` via the `Agent` tool from this pass:",
18529
+ "the reviewer frequently runs at depth-1 (the orchestrator's PR sweep",
18530
+ "dispatches it as a sub-agent), and the runtime forbids a depth-1",
18531
+ "sub-agent from spawning a depth-2 sub-agent \u2014 an in-session dispatch",
18532
+ "would silently abort and the fix-list would never be consumed.",
18533
+ "Instead, apply the durable `review:needs-worker` marker so a",
18534
+ "top-level `issue-worker` session discovers the PR and pulls the",
18535
+ "fix-list:",
18404
18536
  "",
18405
18537
  "```bash",
18406
- "# Rocket reaction on a successfully handled PR-level comment",
18407
- "gh api repos/{{repository.owner}}/{{repository.name}}/issues/comments/<comment-id>/reactions \\",
18408
- " -X POST -f content=rocket",
18409
- "",
18410
- "# thinking_face + reply on a failed item",
18411
- "gh api repos/{{repository.owner}}/{{repository.name}}/issues/comments/<comment-id>/reactions \\",
18412
- " -X POST -f content=confused",
18413
- "gh pr comment <pr-number> --body '<failure explanation citing the worker report>'",
18414
- "```",
18415
- "",
18416
- "#### g. Release the `review:fixing` lease",
18417
- "",
18418
- "Remove the lease label so the PR is open for the next delegation",
18419
- "pass. Always run this step \u2014 even when the worker reported every",
18420
- "item as failed:",
18421
- "",
18422
- "```bash",
18423
- "gh pr edit <pr-number> --remove-label 'review:fixing'",
18538
+ "gh pr edit <pr-number> --add-label 'review:needs-worker'",
18424
18539
  "```",
18425
18540
  "",
18426
- "#### h. Conditionally re-enable auto-merge (auto-merge mode only)",
18427
- "",
18428
- "Re-enable squash auto-merge **only if all four** of the following",
18429
- "conditions hold. If any condition fails, leave auto-merge disabled",
18430
- "and let the next reviewer pass re-evaluate:",
18431
- "",
18432
- "1. The review mode decided in Phase 2.75 is still `auto-merge`",
18433
- " (re-evaluate against the current PR labels in case a maintainer",
18434
- " added `review:human-required` between passes).",
18435
- "2. **All** acceptance criteria are met against the **updated** diff",
18436
- " produced by the worker \u2014 re-run the Phase 3 comparison; do not",
18437
- " reuse the pre-delegation result.",
18438
- "3. **No** unresolved `thinking_face` reactions authored by the",
18439
- " reviewer remain on any PR comment \u2014 including the AC-drift",
18440
- " pushbacks added in step (a) and the failure pushbacks added in",
18441
- " step (f).",
18442
- "4. CI is green or still pending (any failing required check",
18443
- " disqualifies re-enablement). Resolve CI via the **CI",
18444
- " Verification** section, including the Actions-runs fallback on a",
18445
- " fine-grained-PAT 403.",
18446
- "",
18447
- "When all four hold, re-enable auto-merge with the same command used",
18448
- "in the auto-merge branch below:",
18449
- "",
18450
- "```bash",
18451
- "gh pr merge <pr-number> --auto --squash --delete-branch \\",
18452
- " --subject '<conventional-commit-title>' \\",
18453
- " --body '<extended-description>'",
18454
- "```",
18455
- "",
18456
- "In `human-required` mode, **skip step (h) entirely**. The",
18457
- "`review:awaiting-human` label stays applied (re-add it if a previous",
18458
- "step removed it), and the human reviewer owns the final merge",
18459
- "decision.",
18460
- "",
18461
- "#### i. Update the sticky summary",
18462
- "",
18463
- "After step (g) (and step (h) when applicable) completes, fall through",
18464
- "to Phase 4.5 to update the sticky `## Reviewer notes` comment with",
18465
- "the new state. Cite at minimum:",
18541
+ "Then **exit this pass returning `delegated`**, holding the",
18542
+ "`review:fixing` lease across sessions. Do **not** wait for the",
18543
+ "worker, do **not** process a report, and do **not** re-enable",
18544
+ "auto-merge in this pass. The worker applies the fix-list in its own",
18545
+ "top-level session, pushes, writes a structured worker-report comment,",
18546
+ "and clears `review:needs-worker`. A **subsequent** reviewer pass",
18547
+ "detects the lease-without-marker state and runs the **Shared",
18548
+ "Procedure: Confirm a Completed Delegation** below \u2014 that is where the",
18549
+ "`rocket` / `thinking_face` reactions, the AC/CI re-evaluation, the",
18550
+ "auto-merge re-enablement, and the `review:fixing` release happen.",
18551
+ "",
18552
+ "Before exiting, fall through to Phase 4.5 to update the sticky",
18553
+ "`## Reviewer notes` comment with the delegation state. Cite at",
18554
+ "minimum:",
18466
18555
  "",
18467
18556
  "- The fix-list comment URL produced in step (d).",
18468
- "- The commit SHAs the worker pushed (from its structured report).",
18469
- "- Per-item outcome (`handled` / `failed`) with the source comment URL.",
18470
- "- The auto-merge re-enablement decision and reason (which of the",
18471
- " four conditions, if any, blocked it).",
18472
- "- The next-step the human or the next reviewer pass should take.",
18557
+ "- That the PR now carries `review:needs-worker` and is awaiting a",
18558
+ " top-level `issue-worker` pass.",
18559
+ "- That `review:fixing` is held across sessions until a confirm pass",
18560
+ " releases it.",
18561
+ "- The next-step: a top-level `issue-worker` run pulls the fix-list,",
18562
+ " then a follow-up reviewer pass confirms.",
18563
+ "",
18564
+ "Per-item `handled` / `failed` outcomes, the pushed commit SHAs, and",
18565
+ "the auto-merge decision are recorded on the **confirm pass**, not",
18566
+ "here \u2014 this pass has not yet seen the worker's result.",
18473
18567
  "",
18474
18568
  "### If all acceptance criteria are met and CI is green",
18475
18569
  "",
@@ -18901,28 +18995,37 @@ var prReviewerSubAgent = {
18901
18995
  " ```",
18902
18996
  " ```",
18903
18997
  "",
18904
- "4. **Invoke `issue-worker` in feedback mode** with the same prompt",
18905
- " shape used by the in-scope-fix flow: include the literal phrase",
18906
- " `feedback mode: PR #<n>` plus the repository identifier",
18907
- " (`{{repository.owner}}/{{repository.name}}`).",
18908
- "",
18909
- "5. **Process the worker's report** for the synthetic item using the",
18910
- " same logic as step (f) of the in-scope-fix flow \u2014 `handled` reacts",
18911
- " `rocket` on the fix-list comment; `failed` reacts `thinking_face`",
18912
- " and posts a reply citing the worker's failure reason.",
18913
- "",
18914
- "6. **Release the `review:fixing` lease** with",
18915
- " `gh pr edit <pr-number> --remove-label 'review:fixing'`. Always",
18916
- " run this step.",
18998
+ "4. **Apply the durable `review:needs-worker` marker** so a",
18999
+ " subsequent (top-level) `issue-worker` pass discovers the PR and",
19000
+ " pulls the fix-list. Do **not** spawn `issue-worker` yourself \u2014 the",
19001
+ " reviewer often runs at depth-1 (the orchestrator's PR sweep",
19002
+ " dispatches it as a sub-agent) where nested sub-agent spawning is",
19003
+ " forbidden, so an in-session `Agent` dispatch would silently abort.",
19004
+ " The hand-off is pull-based: the marker is the signal, the",
19005
+ " `review:fixing` lease (acquired in step 2) is held **across",
19006
+ " sessions** until the worker clears the marker and a later reviewer",
19007
+ " pass confirms.",
18917
19008
  "",
18918
- "7. **Do not re-enable auto-merge in the same pass.** After delegation,",
18919
- " exit and let a human re-invoke the reviewer. The next pass will",
18920
- " re-evaluate `mergeStateStatus` (or `mergeable`) against the",
18921
- " rebased branch and re-enable auto-merge through the normal flow.",
19009
+ " ```bash",
19010
+ " gh pr edit <pr-number> --add-label 'review:needs-worker'",
19011
+ " ```",
18922
19012
  "",
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).",
19013
+ "5. **Exit returning `delegated`.** The delegation is complete for",
19014
+ " this pass: the fix-list is posted, the lease is held, and the",
19015
+ " marker is set. Do **not** wait for the worker, do **not** process",
19016
+ " a worker report, and do **not** re-enable auto-merge in this pass.",
19017
+ " The worker runs in its own top-level session; a **subsequent**",
19018
+ " reviewer pass detects the worker finished (PR carries",
19019
+ " `review:fixing` but **not** `review:needs-worker`), reacts on the",
19020
+ " source comment, re-evaluates AC/CI against the rebased branch,",
19021
+ " re-enables auto-merge, and releases the `review:fixing` lease. See",
19022
+ " the **Confirm pass** section below.",
19023
+ "",
19024
+ "Return `delegated` to the caller once the marker is applied and the",
19025
+ "fix-list posted \u2014 the delegation itself is the action taken. Unlike a",
19026
+ "merge, `delegated` does **not** imply the fix landed in this pass; it",
19027
+ "means the work is durably queued for the pull-based consumer and a",
19028
+ "later confirm pass will finish the loop.",
18926
19029
  "",
18927
19030
  "### Fallback",
18928
19031
  "",
@@ -18936,6 +19039,89 @@ var prReviewerSubAgent = {
18936
19039
  "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.'",
18937
19040
  "```",
18938
19041
  "",
19042
+ "## Shared Procedure: Confirm a Completed Delegation",
19043
+ "",
19044
+ "Delegation is **pull-based and spans sessions**: the reviewer that",
19045
+ "posts a fix-list never finishes the loop in the same pass. It posts",
19046
+ "the fix-list, acquires the `review:fixing` lease, applies the durable",
19047
+ "`review:needs-worker` marker, and exits returning `delegated`. A",
19048
+ "**separate** top-level `issue-worker` session then discovers the",
19049
+ "marker, applies the fix-list (an editorial fix or a rebase), pushes,",
19050
+ "writes a structured worker-report comment, and **clears**",
19051
+ "`review:needs-worker` \u2014 leaving `review:fixing` in place for the",
19052
+ "reviewer to release. The confirm pass below is how a later reviewer",
19053
+ "pass closes the loop. It runs in **both** delegation flows (the",
19054
+ "Phase 4 in-scope-fix flow and the Shared Conflict-Resolution",
19055
+ "Procedure) \u2014 the marker, not the flow, is what a confirm pass keys",
19056
+ "on.",
19057
+ "",
19058
+ "### Detecting a completed delegation",
19059
+ "",
19060
+ "Early in any reviewer pass (after Phase 2 gathers labels), inspect",
19061
+ "the PR's labels for the **lease-without-marker** state:",
19062
+ "",
19063
+ "- `review:fixing` is **present** (a delegation lease is held), **and**",
19064
+ "- `review:needs-worker` is **absent** (the worker cleared its marker",
19065
+ " on completion).",
19066
+ "",
19067
+ "When both hold, a delegation the previous pass kicked off has been",
19068
+ "consumed and pushed by the worker. Run the confirm steps below before",
19069
+ "proceeding with the rest of the pass.",
19070
+ "",
19071
+ "When **both** `review:fixing` and `review:needs-worker` are present,",
19072
+ "the delegation is still in flight (the worker has not yet picked it",
19073
+ "up or has not finished). Do **not** re-post the fix-list and do",
19074
+ "**not** re-acquire the lease \u2014 log the in-flight state to the sticky",
19075
+ "summary and exit; a later pass confirms once the worker clears the",
19076
+ "marker.",
19077
+ "",
19078
+ "### Confirm steps",
19079
+ "",
19080
+ "1. **Read the worker's report.** Find the most recent structured",
19081
+ " worker-report comment the `issue-worker` posted on the PR (it",
19082
+ " cites the pushed commit SHAs and a per-item `handled` / `failed`",
19083
+ " outcome keyed by `comment_id`). Use it to drive the reactions",
19084
+ " below \u2014 the same per-item logic the in-session report processing",
19085
+ " used to perform.",
19086
+ "2. **React on the source comments.** For each item:",
19087
+ " - **`handled`** \u2014 react `rocket` on the original source comment",
19088
+ " (the fix-list comment for a synthetic rebase item) to signal the",
19089
+ " accepted change has landed.",
19090
+ " - **`failed`** \u2014 react `thinking_face` (`content=confused`) on the",
19091
+ " source comment and post a reply citing the worker's failure",
19092
+ " reason.",
19093
+ "3. **Re-evaluate AC/CI against the rebased branch.** Re-run the Phase",
19094
+ " 3 acceptance-criteria comparison and the **CI Verification** check",
19095
+ " against the **updated** head SHA the worker pushed \u2014 do not reuse",
19096
+ " any pre-delegation result.",
19097
+ "4. **Conditionally re-enable auto-merge** under the same four",
19098
+ " conditions as the in-scope-fix flow's step (h): mode still",
19099
+ " `auto-merge`, all AC met against the updated diff, no unresolved",
19100
+ " `thinking_face` pushbacks, and CI green-or-pending.",
19101
+ "5. **Release the `review:fixing` lease** \u2014 always, even when an item",
19102
+ " failed:",
19103
+ "",
19104
+ " ```bash",
19105
+ " gh pr edit <pr-number> --remove-label 'review:fixing'",
19106
+ " ```",
19107
+ "",
19108
+ "6. **Update the sticky summary** with the per-item outcomes, the",
19109
+ " commit SHAs from the worker report, and the auto-merge decision.",
19110
+ "",
19111
+ "### Stale-lease reclaim",
19112
+ "",
19113
+ "A crashed worker must not wedge a PR forever. A `review:fixing` lease",
19114
+ "is **reclaimable** when it has no `review:needs-worker` companion",
19115
+ "**and** no consuming worker is making progress \u2014 i.e. the lease is",
19116
+ "older than the stale threshold (the same in-progress threshold the",
19117
+ "maintenance sweep applies, 72h by default) with no worker-report",
19118
+ "comment newer than the fix-list. The reclaim is wired into the",
19119
+ "maintenance sweep, not a reviewer pass: the sweep flags such a PR",
19120
+ "with `status:needs-attention` so a human clears the orphaned",
19121
+ "`review:fixing` lease and re-triggers the reviewer. See the",
19122
+ "**Stale-lease reclaim** subsection of the `pr-review-feedback-protocol`",
19123
+ "rule for the full lifecycle.",
19124
+ "",
18939
19125
  "## Phase 5: Branch Cleanup and Issue Closure Verification",
18940
19126
  "",
18941
19127
  "Skip this phase entirely when the review mode from Phase 2.75 is",
@@ -18999,7 +19185,7 @@ var prReviewerSubAgent = {
18999
19185
  "Linked issue: #<issue-number>",
19000
19186
  "Review mode: <auto-merge | human-required>",
19001
19187
  "Reason: <short explanation from Phase 2.75>",
19002
- "Verdict: AUTO_MERGE_ENABLED | AWAITING_HUMAN | NEEDS_CHANGES | INELIGIBLE | BLOCKED",
19188
+ "Verdict: AUTO_MERGE_ENABLED | AWAITING_HUMAN | DELEGATED_TO_WORKER | NEEDS_CHANGES | INELIGIBLE | BLOCKED",
19003
19189
  "",
19004
19190
  "Acceptance criteria:",
19005
19191
  " [x] <criterion> \u2014 <evidence>",
@@ -19011,12 +19197,22 @@ var prReviewerSubAgent = {
19011
19197
  " - Suggested: <items>",
19012
19198
  " - Nitpick: <items>",
19013
19199
  "",
19014
- "Action taken: <enable-auto-merge | label-awaiting-human | commented-on-the-pr | none>",
19200
+ "Action taken: <enable-auto-merge | label-awaiting-human | delegated-to-worker | confirmed-delegation | commented-on-the-pr | none>",
19015
19201
  "Branch updated: <yes | not needed | failed (<reason>) | delegated (PR #<n>) | n/a>",
19016
19202
  "Branch state: <merged | open | closed>",
19017
19203
  "Issue state: <closed | open>",
19018
19204
  "```",
19019
19205
  "",
19206
+ "**`DELEGATED_TO_WORKER` semantics.** This verdict means the reviewer",
19207
+ "posted a fix-list, applied the `review:needs-worker` marker, and",
19208
+ "exited holding the `review:fixing` lease \u2014 the fix-list is **durably",
19209
+ "queued** for a top-level `issue-worker` pass, but it has **not** yet",
19210
+ "been applied in this pass. `delegated` is never a terminal",
19211
+ "completion: the loop closes only when a top-level worker consumes the",
19212
+ "marker and a later reviewer confirm pass releases the lease. Likewise",
19213
+ "`Branch updated: delegated (PR #<n>)` records that a rebase was",
19214
+ "queued for the worker, not that the branch is already current.",
19215
+ "",
19020
19216
  "---",
19021
19217
  "",
19022
19218
  "## Rules",
@@ -19038,7 +19234,7 @@ var prReviewerSubAgent = {
19038
19234
  " to `human-required`, Phase 4 applies `review:awaiting-human` and",
19039
19235
  " exits. Even if every acceptance criterion is met and CI is green,",
19040
19236
  " `gh pr merge --auto` is forbidden in that mode.",
19041
- "6. **Never push commits to the PR's branch yourself.** The reviewer is a decision-maker and orchestrator, not an implementer. When in-scope review comments require code changes **and** the PR carries the `origin:issue-worker` label (or the invocation prompt explicitly allows human-authored PRs via `--allow-human-author`), delegate the fix by posting a fix-list comment on the PR and invoking `issue-worker` in feedback mode. You must never call `git commit`, `git push`, `git rebase`, or `gh pr edit` against the head branch from this agent \u2014 all branch mutations belong to `issue-worker`.",
19237
+ "6. **Never push commits to the PR's branch yourself.** The reviewer is a decision-maker and orchestrator, not an implementer. When in-scope review comments require code changes **and** the PR carries the `origin:issue-worker` label (or the invocation prompt explicitly allows human-authored PRs via `--allow-human-author`), delegate the fix **by marker, not by spawn**: post a fix-list comment on the PR, apply the `review:needs-worker` label, hold the `review:fixing` lease, and exit returning `delegated`. Do **not** invoke `issue-worker` via the `Agent` tool \u2014 the reviewer often runs at depth-1 where nested sub-agent spawning is forbidden, so an in-session dispatch would silently abort. A top-level `issue-worker` session pulls the marker and applies the fix; a later reviewer confirm pass releases the lease. You must never call `git commit`, `git push`, `git rebase`, or `gh pr edit` against the head branch from this agent \u2014 all branch mutations belong to `issue-worker`.",
19042
19238
  "7. **Do not implement code.** You review, decide, and orchestrate. If",
19043
19239
  " the PR needs code changes and delegation is not permitted by Rule",
19044
19240
  " #6, comment and stop \u2014 do not attempt to fix it yourself.",
@@ -19074,15 +19270,21 @@ var prReviewerSubAgent = {
19074
19270
  " in a way that satisfies the reviewer (who then replaces the",
19075
19271
  " `thinking_face` with `+1`), or by applying the `review:auto-ok`",
19076
19272
  " label as an explicit override.",
19077
- "14. **Never re-enable auto-merge while disputes or human-required",
19078
- " hand-offs are still in flight.** After delegating fixes via the",
19079
- " Phase 4 flow, the reviewer may only run `gh pr merge --auto`",
19080
- " again when **no** unresolved `thinking_face` reactions authored",
19081
- " by the reviewer remain on any PR comment **and** the",
19082
- " `review:awaiting-human` label is **not** present on the PR. Any",
19083
- " AC-drift pushback, any failed-fix pushback, and any human-required",
19084
- " hand-off all keep auto-merge disabled until the human resolves",
19085
- " the underlying state.",
19273
+ "14. **Never re-enable auto-merge while disputes, human-required",
19274
+ " hand-offs, or an in-flight delegation are still pending.** The",
19275
+ " auto-merge re-enable happens on the **confirm pass** (the Shared",
19276
+ " Procedure: Confirm a Completed Delegation), never on the pass",
19277
+ " that posts the fix-list. A confirm pass may only run",
19278
+ " `gh pr merge --auto` when the PR carries `review:fixing` but",
19279
+ " **not** `review:needs-worker` (the worker finished and cleared",
19280
+ " its marker), **and** **no** unresolved `thinking_face` reactions",
19281
+ " authored by the reviewer remain on any PR comment, **and** the",
19282
+ " `review:awaiting-human` label is **not** present. While",
19283
+ " `review:needs-worker` is still applied the delegation is",
19284
+ " unconsumed and auto-merge stays disabled. Any AC-drift pushback,",
19285
+ " any failed-fix pushback, and any human-required hand-off all keep",
19286
+ " auto-merge disabled until the human resolves the underlying",
19287
+ " state.",
19086
19288
  "15. **Restrict `gh pr update-branch` on `human-required` PRs.** The",
19087
19289
  " `update-branch` step is permitted when the review mode is",
19088
19290
  " `auto-merge`, **or** when the mode is `human-required` **and**",
@@ -19578,20 +19780,36 @@ function buildPrReviewBundle(policy = resolvePrReviewPolicy()) {
19578
19780
  "PR state. The sections below document the conventions humans need",
19579
19781
  "to read and drive that loop.",
19580
19782
  "",
19581
- "### Trigger Model: Human-Triggered, Single-Pass",
19783
+ "### Trigger Model: Single-Pass, Pull-Based Delegation",
19582
19784
  "",
19583
19785
  "Each reviewer pass runs exactly once and does not self-chain. A",
19584
- "human re-invokes `/review-pr <n>` (or `/review-prs`) whenever the",
19585
- "PR state changes enough to warrant another look \u2014 a new comment,",
19586
- "a new commit, a resolved pushback, a label flip. The reviewer",
19587
- "never reschedules itself and never loops back after handing off to",
19588
- "`issue-worker`: the worker's run is the terminal step of that",
19589
- "pass, and a human must re-invoke the reviewer to see the follow-up",
19590
- "reactions and the auto-merge re-enablement decision.",
19591
- "",
19592
- "This keeps the loop cheap to reason about: every agent action is",
19593
- "traceable to a specific human invocation, and there is no",
19594
- "background automation to pause or cancel.",
19786
+ "human (or a scheduled PR-review sweep) re-invokes",
19787
+ "`/review-pr <n>` (or `/review-prs`) whenever the PR state changes",
19788
+ "enough to warrant another look \u2014 a new comment, a new commit, a",
19789
+ "resolved pushback, a label flip, or a worker clearing the",
19790
+ "`review:needs-worker` marker. The reviewer never reschedules",
19791
+ "itself.",
19792
+ "",
19793
+ "Delegation is **pull-based, not push-based**. The reviewer does",
19794
+ "**not** spawn `issue-worker` in session \u2014 it frequently runs at",
19795
+ "depth-1 (the orchestrator's PR sweep dispatches it as a",
19796
+ "sub-agent), and the runtime forbids a depth-1 sub-agent from",
19797
+ "spawning a depth-2 sub-agent, so an in-session dispatch would",
19798
+ "silently abort. Instead the pass that decides to delegate posts a",
19799
+ "fix-list, applies the durable `review:needs-worker` marker, holds",
19800
+ "the `review:fixing` lease, and exits. A **separate** top-level",
19801
+ "`issue-worker` session discovers the marker, applies the",
19802
+ "fix-list, pushes, writes a worker-report comment, and clears",
19803
+ "`review:needs-worker`. A later reviewer pass then confirms the",
19804
+ "result and releases the lease. The worker's run is therefore",
19805
+ "**not** the terminal step of the delegating reviewer pass \u2014 the",
19806
+ "loop spans three passes (delegate \u2192 worker \u2192 confirm).",
19807
+ "",
19808
+ "This keeps the loop cheap to reason about: every step is",
19809
+ "traceable to a label state on the PR, and the producer",
19810
+ "(`pr-reviewer`, at any depth) never depends on a depth-2",
19811
+ "sub-agent spawn to reach the consumer (`issue-worker`, always",
19812
+ "top-level).",
19595
19813
  "",
19596
19814
  "### Reaction State Machine",
19597
19815
  "",
@@ -19673,6 +19891,60 @@ function buildPrReviewBundle(policy = resolvePrReviewPolicy()) {
19673
19891
  "report per-item outcomes and the reviewer can apply `rocket` or",
19674
19892
  "`thinking_face` to the correct source comment on the next pass.",
19675
19893
  "",
19894
+ "### Cross-Session `review:fixing` Lease Lifecycle",
19895
+ "",
19896
+ "Delegation hand-off is **pull-based and spans three passes**. Two",
19897
+ "labels coordinate it: the `review:fixing` lease (mutual exclusion)",
19898
+ "and the `review:needs-worker` marker (durable work signal). The",
19899
+ "lease is held **across sessions** \u2014 it is acquired by the",
19900
+ "reviewer pass that posts the fix-list and released only by a",
19901
+ "later reviewer confirm pass, never within a single pass.",
19902
+ "",
19903
+ "| Step | Actor | Labels after the step |",
19904
+ "|------|-------|-----------------------|",
19905
+ "| **1. Delegate** | `pr-reviewer` | Posts the fix-list, **acquires** `review:fixing`, **applies** `review:needs-worker`, exits `delegated`. PR carries both labels. |",
19906
+ "| **2. Consume** | `issue-worker` (top-level) | Discovers `review:needs-worker`, applies the fix-list, pushes, writes a worker-report comment, **clears** `review:needs-worker`. PR carries `review:fixing` only. |",
19907
+ "| **3. Confirm** | `pr-reviewer` | Detects `review:fixing` **without** `review:needs-worker`, reacts on source comments from the worker report, re-evaluates AC/CI, re-enables auto-merge (auto-merge mode), **releases** `review:fixing`. PR carries neither label. |",
19908
+ "",
19909
+ "Key invariants:",
19910
+ "",
19911
+ "- The producer (`pr-reviewer`) **never spawns** the consumer",
19912
+ " (`issue-worker`) in session. The reviewer can run at depth-1,",
19913
+ " where nested sub-agent spawning is forbidden; the marker is the",
19914
+ " hand-off, not an `Agent` dispatch.",
19915
+ "- The lease being held while `review:needs-worker` is still",
19916
+ " present means the delegation is **in flight** \u2014 a reviewer pass",
19917
+ " that sees both labels logs the in-flight state and exits without",
19918
+ " re-posting the fix-list or re-acquiring the lease.",
19919
+ "- The lease being held **without** `review:needs-worker` is the",
19920
+ " **confirm trigger** \u2014 exactly one delegation has been consumed",
19921
+ " and is awaiting confirmation.",
19922
+ "- `delegated` is never a terminal completion. A PR is only done",
19923
+ " when the confirm pass releases the lease and (in auto-merge",
19924
+ " mode) re-enables auto-merge.",
19925
+ "",
19926
+ "#### Stale-lease reclaim",
19927
+ "",
19928
+ "A crashed or never-launched worker must not wedge a PR by holding",
19929
+ "the lease forever. The **maintenance sweep** (not a reviewer pass)",
19930
+ "owns reclaim. A `review:fixing` lease is **reclaimable** when",
19931
+ "**both** hold:",
19932
+ "",
19933
+ "- The PR carries `review:fixing` but **not**",
19934
+ " `review:needs-worker` \u2014 there is no in-flight worker still",
19935
+ " expected to clear the marker, **yet**",
19936
+ "- No worker-report comment newer than the fix-list exists, **and**",
19937
+ " the fix-list comment is older than the stale in-progress",
19938
+ " threshold the maintenance sweep applies (72h by default).",
19939
+ "",
19940
+ "Together these mean a delegation was kicked off, the marker was",
19941
+ "consumed-or-dropped, but no worker result ever landed \u2014 the lease",
19942
+ "is orphaned. The maintenance sweep flags such a PR with",
19943
+ "`status:needs-attention` so a human clears the orphaned",
19944
+ "`review:fixing` label and re-triggers the reviewer; the sweep",
19945
+ "never silently force-releases the lease, mirroring the",
19946
+ "stale-issue policy of flagging rather than auto-resetting.",
19947
+ "",
19676
19948
  "### Sticky `## Reviewer notes` Comment",
19677
19949
  "",
19678
19950
  "Every PR has **one** canonical reviewer-notes comment. The",
@@ -19704,10 +19976,13 @@ function buildPrReviewBundle(policy = resolvePrReviewPolicy()) {
19704
19976
  "",
19705
19977
  "### Label Glossary",
19706
19978
  "",
19707
- "Five review-workflow labels drive the feedback loop. Consumers",
19708
- "that adopt this workflow are responsible for creating them in",
19709
- "their own repos (the same way they create `priority:*` and",
19710
- "`status:*` labels).",
19979
+ "Six review-workflow labels drive the feedback loop. They are",
19980
+ "**contributed by the pr-review bundle's label set** and auto-sync",
19981
+ "into every consumer's label registry \u2014 the same way the",
19982
+ "`type:*` / `priority:*` / `status:*` taxonomy ships. Consumers do",
19983
+ "**not** hand-declare them, so they survive a label sync run with",
19984
+ "`deleteOtherLabels: true` that would otherwise prune a",
19985
+ "locally-created label.",
19711
19986
  "",
19712
19987
  "| Label | Purpose |",
19713
19988
  "|-------|---------|",
@@ -19715,7 +19990,8 @@ function buildPrReviewBundle(policy = resolvePrReviewPolicy()) {
19715
19990
  "| `review:human-required` | Force human review regardless of what the policy would otherwise decide. The reviewer never enables auto-merge on a PR carrying this label. |",
19716
19991
  "| `review:auto-ok` | Force auto-merge regardless of what the policy would otherwise decide. **Also resolves outstanding `thinking_face` pushbacks** as an explicit maintainer override; the reviewer logs the override in the sticky summary. |",
19717
19992
  "| `review:awaiting-human` | Set by the reviewer when it completes its work on a `human-required` PR and is handing off the final merge decision. Cleared by a human (or by `review:auto-ok` flipping the PR back to `auto-merge` mode). |",
19718
- "| `review:fixing` | Short-lived lease held by the reviewer while an `issue-worker` feedback-mode delegation is mid-run. Released automatically at the end of Phase 4 step (g). Contention on this label means a prior delegation crashed without releasing it and needs human investigation. |",
19993
+ "| `review:fixing` | **Cross-session** delegation lease. Acquired by the reviewer pass that posts a fix-list; held across the worker's run; released only by a later reviewer **confirm** pass (PR carries `review:fixing` but not `review:needs-worker`). A lease held without `review:needs-worker` past the stale threshold with no worker report is orphaned and is flagged by the maintenance sweep for human reclaim. |",
19994
+ "| `review:needs-worker` | **Durable hand-off marker.** Applied by the reviewer alongside the fix-list so a top-level `issue-worker` session discovers the PR and pulls the work (the reviewer cannot spawn the worker in session \u2014 it may run at depth-1). Cleared by the worker when it finishes applying the fix-list, which is what triggers the reviewer's confirm pass. |",
19719
19995
  "",
19720
19996
  "### Reviewing Human-Authored PRs: the `--allow-human-author` Flag",
19721
19997
  "",
@@ -19777,7 +20053,12 @@ function buildPrReviewBundle(policy = resolvePrReviewPolicy()) {
19777
20053
  {
19778
20054
  name: "review:fixing",
19779
20055
  color: "D4C5F9",
19780
- description: "Short-lived lease while issue-worker applies feedback fixes"
20056
+ description: "Cross-session lease held from fix-list post until a confirm pass releases it"
20057
+ },
20058
+ {
20059
+ name: "review:needs-worker",
20060
+ color: "1D76DB",
20061
+ description: "Durable marker: a reviewer fix-list awaits a top-level issue-worker pass"
19781
20062
  }
19782
20063
  ]
19783
20064
  };