@soleur/opencode 3.405.2 → 3.405.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soleur/opencode",
3
- "version": "3.405.2",
3
+ "version": "3.405.4",
4
4
  "description": "Soleur AI organization plugin for OpenCode",
5
5
  "type": "module",
6
6
  "bin": {
@@ -625,7 +625,7 @@ while :; do
625
625
  # the fix that does not need revisiting per-state.
626
626
  if [[ "$queued" != "1" && "$automerge" == "false" && "$state" == "OPEN" \
627
627
  && "$fail" -eq 0 && "$cancel" -eq 0 ]]; then
628
- printf 'CHECKS SETTLED, ALL GREEN, AUTO-MERGE NOT ARMED — PR #%s needs an explicit merge (mergeState=%s). Before any --admin merge, admin-merge-ready.sh <PR> <sha> must exit 0 — this line reads only checks that exist.\n' "$PR" "$mergestate"; exit 0
628
+ printf 'CHECKS SETTLED, ALL GREEN, AUTO-MERGE NOT ARMED — PR #%s needs an explicit merge (mergeState=%s). Arm it only through plugins/soleur/skills/review/references/review-evidence-comment.md#arm-check; an --admin merge only through plugins/soleur/skills/ship/references/settle-then-admin-merge.md (arm check, then admin-merge-ready.sh <PR> <sha> exit 0) — this line reads only checks that exist.\n' "$PR" "$mergestate"; exit 0
629
629
  fi
630
630
  fi
631
631
 
@@ -332,7 +332,7 @@ queue_read_settled() {
332
332
  }
333
333
 
334
334
  # queue_wait_eval — THE ONE copy of the armed-BEHIND predicate (2026-10-09, PR 9839; shared with --step and --queue-wait,
335
- # #9869). Between `gh pr merge --auto` and the enqueue a PR is OPEN, BEHIND, armed and NOT in the queue, so queue_gate (which
335
+ # #9869). Between the auto-merge arm and the enqueue a PR is OPEN, BEHIND, armed and NOT in the queue, so queue_gate (which
336
336
  # only sees an entry) lets it through, and a sync there pushes a commit that restarts every required check for nothing: on a
337
337
  # merge-queue repo the queue makes the PR current itself. Fires when the PR is OPEN, GitHub says BEHIND or UNKNOWN (UNKNOWN is
338
338
  # recompute lag; DIRTY never: a conflicting or kb-index-class PR still resolves) AND auto-merge is armed AND the PR's own base
@@ -388,13 +388,13 @@ queue_wait_eval() { # <state_line: "<STATE> <MERGESTATE>"> <armed|disarmed|-> <
388
388
  # The refusal text shared by every caller that refuses (the standalone loop, a flagless --step): what to do instead of a resync. The
389
389
  # advice differs by the validated base (QW_BASE, always set when a `wait` verdict exists): for `main` the Phase 7 poll's expiry fallback
390
390
  # is the sanctioned sync and a disarm / hand-sync / re-arm is safe; for any other base that sync merges origin/main, which is wrong for
391
- # the PR, so the text says to sync by hand against that base and never to disarm and re-arm. The `main` text is byte-identical to the
392
- # pre-#10832 text (pinned by a golden row in the suite). The echoed base is cut to 60 characters (it is validated, but may be 255 long).
391
+ # the PR, so the text says to sync by hand against that base and never to disarm and re-arm. The `main` text is the pre-#10832 text with the
392
+ # re-arm clause pointed at the arm check (#12656), pinned by a golden row in the suite. The echoed base is cut to 60 characters (it is validated, but may be 255 long).
393
393
  qw_refusal() {
394
394
  local b="${QW_BASE:0:60}" poll hand
395
395
  if [[ "$QW_BASE" == main ]]; then
396
396
  poll="; with no poll running, re-arm the Phase 7 poll with CLAUDE_PLUGIN_ROOT exported — its expiry fallback after 6 idle ticks is the sanctioned sync"
397
- hand="Truly need a hand sync? Disarm first (gh pr merge $PR --disable-auto), sync, then re-arm."
397
+ hand="Truly need a hand sync? Disarm first (gh pr merge $PR --disable-auto), sync, then re-arm through plugins/soleur/skills/review/references/review-evidence-comment.md#arm-check."
398
398
  else
399
399
  poll=""
400
400
  hand="Truly need a hand sync? This script and the Phase 7 poll's expiry fallback only merge origin/main, which is wrong for a PR based on '$b': sync by hand against that base (fetch origin <base>, merge origin/<base>, push) and do not disarm and re-arm."
@@ -567,7 +567,7 @@ queue_gate() {
567
567
  [[ -z "$marker" ]] || rm -f "$marker"
568
568
  reason="removal reason: ${rm#removal=}"
569
569
  [[ "$rm" != removal=none && "$rm" != removal=- ]] || reason="seen in the queue earlier, no removal event read"
570
- tag dequeued 13 "PR #$PR was in the merge queue and is no longer (OPEN, $am, $reason): a failed merge_group run or a removal — NOT syncing. Recover (ONE re-enqueue, procedure: plugins/soleur/skills/ship/references/merge-queue-dequeue.md): (1) read why: gh run list --event merge_group --limit 100 --json databaseId,headBranch,headSha,conclusion,url --jq '.[] | select(.headBranch | startswith(\"gh-readonly-queue/main/pr-$PR-\"))' then gh run view <databaseId> --log-failed — under grouped merging (max_entries_to_merge=3) a member PR's group ref names the DEEPEST member, so if no run matches pr-$PR- list recent merge_group runs and correlate by headSha/createdAt; (2) fix on the branch, git merge origin/main, push; (3) re-arm once: gh pr merge $PR --squash --auto. A second dequeue: stop and report it."
570
+ tag dequeued 13 "PR #$PR was in the merge queue and is no longer (OPEN, $am, $reason): a failed merge_group run or a removal — NOT syncing. Recover (ONE re-enqueue, procedure: plugins/soleur/skills/ship/references/merge-queue-dequeue.md): (1) read why: gh run list --event merge_group --limit 100 --json databaseId,headBranch,headSha,conclusion,url --jq '.[] | select(.headBranch | startswith(\"gh-readonly-queue/main/pr-$PR-\"))' then gh run view <databaseId> --log-failed — under grouped merging (max_entries_to_merge=3) a member PR's group ref names the DEEPEST member, so if no run matches pr-$PR- list recent merge_group runs and correlate by headSha/createdAt; (2) fix on the branch, git merge origin/main, push (read --queue-state first, procedure step 2); (3) re-arm once, only when autoMergeRequest is null, through the arm check (plugins/soleur/skills/review/references/review-evidence-comment.md#arm-check; procedure step 3); a pushed fix needs soleur:review first, and a refusal is reported, never armed around. A second dequeue: stop and report it."
571
571
  exit 13
572
572
  fi
573
573
  return 0 ;;
@@ -25,7 +25,7 @@ Use `merge-pr` for a single named PR. Use `drain-labeled-backlog` for labeled *i
25
25
  <decision_gate>
26
26
  **Merging is outward-facing — confirm before any merge.** This skill confirms tier scope with the operator via `AskUserQuestion` **before merging anything**, and supports per-PR opt-out within a tier (not just per-tier accept/reject). Confirming a tier means **the selected PRs are squash-merged to `main`** — this is not a preview; it lands code (higher irreversibility than the issue-drain, which ends at PR-opened). Respects `wg-zero-agents-until-user-confirms`.
27
27
 
28
- **API budget.** Fixing or reviewing PRs may delegate to `soleur:review` (feature PRs) and spawn review agents, which run autonomously and spend non-trivial Anthropic credit against the key in your session, scaling with PR count and review-cycle depth. The `--dry-run` flag prints the full tier table with zero merges and zero delegation. Soleur does not bill or proxy these calls — Anthropic does. The Soleur LICENSE (BSL 1.1) disclaims warranty for runtime cost; you operate this loop against your own budget.
28
+ **API budget.** Arming any PR that carries no passing review evidence, bot PRs included, delegates to `soleur:review`, which spawns review agents which run autonomously and spend non-trivial Anthropic credit against the key in your session, scaling with PR count and review-cycle depth. The `--dry-run` flag prints the full tier table with zero merges and zero delegation. Soleur does not bill or proxy these calls — Anthropic does. The Soleur LICENSE (BSL 1.1) disclaims warranty for runtime cost; you operate this loop against your own budget.
29
29
  </decision_gate>
30
30
 
31
31
  ## Prerequisites
@@ -61,10 +61,10 @@ The helper runs `gh pr list --state open --json number,title,headRefName,isDraft
61
61
 
62
62
  | Tier | Signal | Default handling |
63
63
  |------|--------|------------------|
64
- | `ready-green` | `mergeable=MERGEABLE`, no failing/pending checks | merge directly |
64
+ | `ready-green` | `mergeable=MERGEABLE`, no failing/pending checks | arm through the arm check (§4) |
65
65
  | `needs-lockfile-fix` | deps PR (`labels` has `dependencies`) failing `guards-ruleset` (its `lockfile-sync` member) / `test-webplat` / `e2e` on a frozen-install step | fix-recipe (a) → merge |
66
66
  | `needs-conflict-resolution` | `mergeable=CONFLICTING`, few/no other failures | fix-recipe (b) → merge |
67
- | `needs-review` | `bot-fix/review-required` label, or a feature PR with no review | review (delegate or inline) → merge |
67
+ | `needs-review` | `bot-fix/review-required` label, or a feature PR with no review | delegate to `soleur:review`, which posts the evidence §4's arm needs (an inline read cannot arm, §5) → merge |
68
68
  | `ready-unarmed` | ready PR whose head verdict (`ci-head-verdict.sh`) is `no-run` or `stalled`: no full CI run exists, the red `test` row is the draft run's. `awaiting-approval` is not here: it lands in `needs-review` (the line shows `ci=awaiting-approval`; a maintainer must approve the fork run) | **recover, never arm**, unless another session is still inside `wait-ready-run` for it: `gh pr ready --undo <N>`, then the whole ready block ([ready-run-wait.md](${CLAUDE_PLUGIN_ROOT}/skills/ship/references/ready-run-wait.md)), then re-triage |
69
69
  | `drafts` | `isDraft=true` | **skip** — author-owned WIP, never merged. A draft that also carries `parked` stays here, flagged `parked: true` in the JSON and `PARKED label (held for the operator)` on its text line, and is never readied even when the operator names it |
70
70
  | `parked` | has the `parked` label ("Reviewed draft held until an approved window; do not merge or arm auto-merge") | **skip** — reviewed and held for the operator; never merged, never armed, never fixed here. The operator removes the label. A parked **draft** is classified under `drafts` (drafts are classified first). The `parked-hold` member step of the required `secret-guards` check ([scripts/ci-parked-hold.sh](../../../../scripts/ci-parked-hold.sh), #12396) fails while the PR carries the label, which binds auto-merge, the merge queue and every non-bypass identity, and `admin-merge-ready.sh` reads it as a red required context; it does not stop an admin-credentialed `gh pr merge --admin`, and anyone with triage access can remove the label. `.claude/hooks/ship-operator-step-gate.sh` stays as local defence in depth on a branch that carries it; a draft PR remains the first hold. The tier prints a `recovery:` line saying to do nothing (no other tier carries one except `ready-unarmed`). The label match is case-insensitive, like the hook's |
@@ -78,22 +78,26 @@ Present the tier table via `AskUserQuestion`. The operator selects which tiers t
78
78
 
79
79
  ### 4. Per in-scope PR — ensure green, then merge
80
80
 
81
- For each selected PR: bring it to green via the fix-recipes below if needed, then arm it (under the merge queue this ENQUEUES the PR; it is not yet merged). A `ready-unarmed` PR (readied, but no full CI run exists) is NOT armed: recover it first (`gh pr ready --undo <N>` with a user token, then the whole block below; `GITHUB_TOKEN` cannot ready a PR). A draft the operator authorizes is readied the same way and armed only once `K=$(bash "${CLAUDE_PLUGIN_ROOT}/scripts/ci-head-verdict.sh" ready-count <N>) && gh pr ready <N> && bash "${CLAUDE_PLUGIN_ROOT}/scripts/ci-head-verdict.sh" wait-ready-run <N> --before-count "$K"` exits 0 (one Bash call, `timeout: 420000`; reasons and recoveries: [ready-run-wait.md](${CLAUDE_PLUGIN_ROOT}/skills/ship/references/ready-run-wait.md)); on non-zero report "readied but unarmed" with the last stdout line and arm nothing:
81
+ For each selected PR: bring it to green via the fix-recipes below if needed, then arm it through the arm check (under the merge queue this ENQUEUES the PR; it is not yet merged). A `ready-unarmed` PR (readied, but no full CI run exists) is NOT armed: recover it first (`gh pr ready --undo <N>` with a user token, then the whole block below; `GITHUB_TOKEN` cannot ready a PR). A draft the operator authorizes is readied the same way and armed only once `K=$(bash "${CLAUDE_PLUGIN_ROOT}/scripts/ci-head-verdict.sh" ready-count <N>) && gh pr ready <N> && bash "${CLAUDE_PLUGIN_ROOT}/scripts/ci-head-verdict.sh" wait-ready-run <N> --before-count "$K"` exits 0 (one Bash call, `timeout: 420000`; reasons and recoveries: [ready-run-wait.md](${CLAUDE_PLUGIN_ROOT}/skills/ship/references/ready-run-wait.md)); on non-zero report "readied but unarmed" with the last stdout line and arm nothing:
82
+
83
+ **The arm.** Every PR takes this one arm. Run the arm check's first statement from [review-evidence-comment.md](${CLAUDE_PLUGIN_ROOT}/skills/review/references/review-evidence-comment.md#arm-check), both `PR_NUMBER` tokens replaced by the PR number, after the fetch, then the arm, all in one Bash call. The fetch puts the PR head in the local object store, which the check's `merge-base` needs:
82
84
 
83
85
  ```bash
84
- gh pr merge <N> --squash --auto
86
+ git fetch -q origin "pull/<N>/head" || { echo "fetch of PR <N>'s head failed: not armed"; exit 1; }
87
+ # REPLACE THIS LINE with the arm check's first statement (linked above), PR_NUMBER replaced by <N>; it exits 1 on refusal
88
+ gh pr merge <N> --squash --auto --match-head-commit "${H:?run the arm check in this call}"
85
89
  ```
86
90
 
91
+ On a refusal, including a bot PR that carries no evidence, run `soleur:review` on the PR (it posts fresh evidence), then the same call again. If it still refuses, skip the PR and list it in the §7 report as `unarmed: evidence=<…> unreviewed=<…>`, copying the two values the refusal line printed (the check's variables do not survive the call). Never arm around it. The check cannot see code written while resolving a merge conflict (it skips merge commits), so a PR onto which drain-prs pushed a hand-resolved merge goes to `soleur:review` before this arm, even when the check passes. First-party bot PRs normally arm themselves server-side; drain-prs arms one only when `autoMergeRequest` is `null`.
92
+
87
93
  - **Never arm a cross-repository (fork) PR, or one touching `.github/**`, without explicit operator confirmation.** `merge_group` runs the candidate's workflows in the base-repo context with repo secrets, so a pre-queue-green fork or workflow edit can exfiltrate them before anyone reads a run. Check each PR before arming: `gh pr view <N> --json isCrossRepository --jq .isCrossRepository` and `gh api repos/{owner}/{repo}/pulls/<N>/files --paginate --jq '.[].filename | select(startswith(".github/"))'` (not `gh pr view --json files`: it stops at 100 files, so a large PR could hide a workflow edit); `true` or any output means stop and ask (the tier confirmation at the decision gate does not cover it).
88
- - **Merge queue is active on `main`** (#9454, ADR-270; the `merge_queue` rule lives in `infra/github/ruleset-ci-required.tf`) — `gh pr merge <N> --squash --auto` **enqueues** the PR (a green PR enqueues, so the bullet and the block above agree); the queue handles the up-to-date merge, serialization and the final merge automatically — do not hand-roll update/wait loops, and never push `gh pr update-branch` or a merge of `origin/main` to a PR that is in the queue (a push dequeues it). An admin-bypass merge (only via [settle-then-admin-merge.md](${CLAUDE_PLUGIN_ROOT}/skills/ship/references/settle-then-admin-merge.md)) is the last resort, not the drain path. CodeQL is advisory on `main` (it reports no status on `merge_group`); the post-merge `codeql-main-alert-gate.yml` run is the signal. History: a first adoption (#5800) was reverted the same day for exactly that reason (ADR-032 amendment, upstream `github/codeql-action#1537`); #5840 stays open as the upstream tracker.
89
- - **Dequeue arm — a PR that leaves the queue.** When CI is red on the queue's temp ref `gh-readonly-queue/main/pr-<N>-<sha>`, the failing check-run is on the queue SHA, not the PR head, so `gh pr checks <N>` still reads green. Read the run instead: `gh run list --event merge_group --limit 100 --json databaseId,headBranch,headSha,conclusion,url --jq '.[] | select(.headBranch | startswith("gh-readonly-queue/main/pr-<N>-"))'`, (about 8 runs per queue entry, so a smaller `--limit` can miss the PR on a busy queue; under grouped merging a member PR's group ref names the DEEPEST member — an empty select means correlate recent `merge_group` runs by `headSha`/`createdAt`, not "no run"), then diagnose the failing job from that run. The dequeue is silent (a `failed_checks` removal is re-queued by GitHub 2 to 3.5 minutes later while auto-merge normally stays armed; a red advisory job does not dequeue, so do not push over it): the PR stays OPEN, so `gh pr view <N> --json state,autoMergeRequest` reads `OPEN` with auto-merge armed (`autoMergeRequest` set) or disarmed (`null`); section 7's wait names it (`LEFT THE MERGE QUEUE UNMERGED`, reason from the queue's removal event). Recipe: [merge-queue-dequeue.md](${CLAUDE_PLUGIN_ROOT}/skills/ship/references/merge-queue-dequeue.md). On a conflict or lockfile / `kb-index` drift, the local arm is: merge `origin/main` into the PR branch (merge-pr §3.1 "Route conflicts"), push only for a failure that will recur, and re-arm `gh pr merge <N> --squash --auto` only when `autoMergeRequest` is `null` (the recipe's steps 2 and 3 win over any shorter inline recovery text). Cap it at ONE re-enqueue per PR before escalating to the operator.
90
- - **Armed on a merge-queue repo, not yet enqueued: leave it alone** until `[ship.phase7.queue_wait_expired]` (an armed PR that merely reads BEHIND is waiting for GitHub to enqueue it; the ship Phase 7 poll prints `[ship.phase7.queue_wait]`, and `sync-pr-behind.sh` itself refuses it with `kind=queue_wait`; never `gh pr update-branch` it). **Otherwise, if the PR is not in the queue** (an admin-bypass path, or a rejection that names "not up to date"), run `gh pr update-branch <N>` — **but never when both sides moved the `knowledge-base/` file count**, which a server-side merge resolves without the `kb-index` driver; merge `origin/main` locally and push instead (see [merge-pr/SKILL.md](../merge-pr/SKILL.md) §3.1 "Route conflicts"), then wait for CI to go green using **Claude: Monitor tool** / **Grok: AwaitShell** (`plugins/soleur/lib/harness.ts` `pollInstructions()`) — NEVER a backgrounded poll loop (`hr-monitor-not-run-in-background-for-polling`, hook-enforced by `background-poll-prefer-monitor.sh`), then merge.
94
+ - **Merge queue is active on `main`** (#9454, ADR-270; the `merge_queue` rule lives in `infra/github/ruleset-ci-required.tf`) — arming **enqueues** the PR (a green PR enqueues, so the bullet and the block above agree); the queue handles the up-to-date merge, serialization and the final merge automatically — do not hand-roll update/wait loops, and never push `gh pr update-branch` or a merge of `origin/main` to a PR that is in the queue (a push dequeues it). An admin-bypass merge (only via [settle-then-admin-merge.md](${CLAUDE_PLUGIN_ROOT}/skills/ship/references/settle-then-admin-merge.md)) is the last resort, not the drain path. CodeQL is advisory on `main` (it reports no status on `merge_group`); the post-merge `codeql-main-alert-gate.yml` run is the signal. History: a first adoption (#5800) was reverted the same day for exactly that reason (ADR-032 amendment, upstream `github/codeql-action#1537`); #5840 stays open as the upstream tracker.
95
+ - **Dequeue arm — a PR that leaves the queue.** When CI is red on the queue's temp ref `gh-readonly-queue/main/pr-<N>-<sha>`, the failing check-run is on the queue SHA, not the PR head, so `gh pr checks <N>` still reads green. Read the run instead: `gh run list --event merge_group --limit 100 --json databaseId,headBranch,headSha,conclusion,url --jq '.[] | select(.headBranch | startswith("gh-readonly-queue/main/pr-<N>-"))'`, (about 8 runs per queue entry, so a smaller `--limit` can miss the PR on a busy queue; under grouped merging a member PR's group ref names the DEEPEST member — an empty select means correlate recent `merge_group` runs by `headSha`/`createdAt`, not "no run"), then diagnose the failing job from that run. The dequeue is silent (a `failed_checks` removal is re-queued by GitHub 2 to 3.5 minutes later while auto-merge normally stays armed; a red advisory job does not dequeue, so do not push over it): the PR stays OPEN, so `gh pr view <N> --json state,autoMergeRequest` reads `OPEN` with auto-merge armed (`autoMergeRequest` set) or disarmed (`null`); section 7's wait names it (`LEFT THE MERGE QUEUE UNMERGED`, reason from the queue's removal event). Recipe: [merge-queue-dequeue.md](${CLAUDE_PLUGIN_ROOT}/skills/ship/references/merge-queue-dequeue.md). On a conflict or lockfile / `kb-index` drift, the local arm is: merge `origin/main` into the PR branch (merge-pr §3.1 "Route conflicts"), push only for a failure that will recur, and re-arm only when `autoMergeRequest` is `null`, through [merge-queue-dequeue.md](${CLAUDE_PLUGIN_ROOT}/skills/ship/references/merge-queue-dequeue.md) step 3 (the recipe's steps 2 and 3 win over any shorter inline recovery text). Cap it at ONE re-enqueue per PR before escalating to the operator.
96
+ - **Armed on a merge-queue repo, not yet enqueued: leave it alone** until `[ship.phase7.queue_wait_expired]` (an armed PR that merely reads BEHIND is waiting for GitHub to enqueue it; the ship Phase 7 poll prints `[ship.phase7.queue_wait]`, and `sync-pr-behind.sh` itself refuses it with `kind=queue_wait`; never `gh pr update-branch` it). **Otherwise, if the PR is not in the queue** (an admin-bypass path, or a rejection that names "not up to date"), run `gh pr update-branch <N>` — **but never when both sides moved the `knowledge-base/` file count**, which a server-side merge resolves without the `kb-index` driver; merge `origin/main` locally and push instead (see [merge-pr/SKILL.md](../merge-pr/SKILL.md) §3.1 "Route conflicts"), then wait for CI to go green using **Claude: Monitor tool** / **Grok: AwaitShell** (`plugins/soleur/lib/harness.ts` `pollInstructions()`) — NEVER a backgrounded poll loop (`hr-monitor-not-run-in-background-for-polling`, hook-enforced by `background-poll-prefer-monitor.sh`), then arm through §4's block above (an admin-bypass PR only through [settle-then-admin-merge.md](${CLAUDE_PLUGIN_ROOT}/skills/ship/references/settle-then-admin-merge.md)).
91
97
 
92
98
  ### 5. Review delegation
93
99
 
94
- - **Feature PRs** (`needs-review`, non-trivial diff): delegate to `soleur:review`. Merge only if it passes.
95
- - **Single-file `priority/p3-low` bot-fixes**: inline diff review (`gh pr diff <N>`) is sufficient; the diff is small and the change is mechanical.
96
- - **Bot-fix PRs that failed the cron gate** (multi-file, or the source issue is not `priority/p3-low`, so the PR carries `bot-fix/review-required`): delegate to `soleur:review`, not an inline read. Inline reading is for single-file `priority/p3-low` PRs only.
100
+ Every PR drain-prs arms needs a passing Review-Evidence comment covering its head, and only `soleur:review` posts one, so a PR without one is delegated to `soleur:review` before §4's arm, whatever its size or author. That includes feature PRs (`needs-review`), single-file `priority/p3-low` bot-fixes, bot-authored scheduled content PRs (community digests, the campaign calendar, content-distribution promotes, weakness digests) and bot-fix PRs carrying `bot-fix/review-required`. A read of `gh pr diff <N>` is triage, not review: it can decide to skip a PR, never to arm one.
97
101
 
98
102
  ### 6. Fix-recipes
99
103
 
@@ -118,7 +122,7 @@ Arming returns at ENQUEUE, not at merge. Run `cleanup-merged` only once the PRs
118
122
  bash "${CLAUDE_PLUGIN_ROOT}/skills/git-worktree/scripts/worktree-manager.sh" cleanup-merged
119
123
  ```
120
124
 
121
- Report the drain delta: before/after open-PR count and the per-tier outcome (merged / enqueued / skipped / deferred), listing an enqueued PR as enqueued until it reads `MERGED`.
125
+ Report the drain delta: before/after open-PR count and the per-tier outcome (merged / enqueued / skipped / deferred), listing an enqueued PR as enqueued until it reads `MERGED`, then one line per PR §4 refused (`#<N> unarmed: …`) and one per PR whose head fetch failed (`#<N> unarmed: fetch failed`; not a refusal, so no `soleur:review` retry).
122
126
 
123
127
  ## Pipeline detection
124
128
 
@@ -128,7 +132,7 @@ If `$ARGUMENTS` contains a `RETURN CONTRACT` section (i.e., this skill is being
128
132
 
129
133
  - **A `parked` PR is never readied, armed or merged, even when the operator names it.** The operator removes the label first, in the GitHub UI or their own terminal.
130
134
  - **Drafts are skipped unless the operator names one.** A draft PR is author-owned WIP; merging it would ship incomplete work. The only exception is a draft the operator explicitly authorizes in the request (readied and armed through the block above); no flag selects drafts. A draft that carries the `parked` label is the one exception to the exception: it is never readied, even when named (the `parked` rule below).
131
- - **`gh pr merge --squash --auto` cannot bypass server-side required checks.** Branch protection enforces `CI Required` and the merge queue re-runs the checks on its own candidate, so a mis-triaged red PR never lands — but under the queue it does not fail at merge time: a red candidate is a SILENT dequeue (the PR stays OPEN, auto-merge disarmed). See it with the dequeue arm in step 4 (`gh run list --event merge_group`, or `gh pr view <N> --json state,autoMergeRequest`); the triage is an optimization, not the safety boundary.
135
+ - **Arming auto-merge cannot bypass server-side required checks.** Branch protection enforces `CI Required` and the merge queue re-runs the checks on its own candidate, so a mis-triaged red PR never lands — but under the queue it does not fail at merge time: a red candidate is a SILENT dequeue (the PR stays OPEN, auto-merge disarmed). See it with the dequeue arm in step 4 (`gh run list --event merge_group`, or `gh pr view <N> --json state,autoMergeRequest`); the triage is an optimization, not the safety boundary.
132
136
  - **An operator-authorized admin merge removes the server-side check the bullet above relies on.** It goes through [settle-then-admin-merge.md](${CLAUDE_PLUGIN_ROOT}/skills/ship/references/settle-then-admin-merge.md) step 2 (`"${CLAUDE_PLUGIN_ROOT}/scripts/admin-merge-ready.sh"`, which must exit 0) and that file's merge block, never through a `gh pr checks --required` watch (#8458, #8500). For a PR that is BEHIND with the new head's checks unsettled, "CI was green" is encoded as `--green-sha <prior-green-sha>`: it certifies the current head only when that head is GitHub's own verified merge of the green sha and the base — see the reference's "was-green carryover" section.
133
137
  - **The two `2026-06-30-*` learnings and ADR-033 §Registration checklist** referenced in the fix-recipes landed in PR #5808 — they are on `main`. If a future reorg moves them, update the paths here.
134
138
  - **Never poll CI from a backgrounded Bash loop.** Use the Monitor tool (Claude) or AwaitShell (Grok) for the post-`update-branch` CI wait (`hr-monitor-not-run-in-background-for-polling`).
@@ -76,7 +76,7 @@
76
76
  - For a **transitive-only or Dependabot lockfile bump**, prescribe `npx --yes npm@11 update <pkg>` against `package-lock.json` — the single lockfile of record since ADR-191. Never prescribe recreating `bun.lock`. (Historical, retained because the trap it names still applies to any bun-based tenant repo: in a directory carrying dual lockfiles, do NOT prescribe `bun update <pkg>` or bare `bun update` — it elevates the target to a **direct** `package.json` dep and can overshoot to a MAJOR (verified: `bun update undici js-yaml` wrote `"undici": "^8.7.0"` / `"js-yaml": "^5.2.1"` while the intended patched versions were `7.28.0` / `3.15.0`). The plan's `bun.lock` phase MUST reference the surgical version+sha edit in [`work-lockfile-bumps.md`](../work/references/work-lockfile-bumps.md) (npm side stays `npx --yes npm@11 update <pkg>`). Same class as `hr-when-a-plan-specifies-relative-paths-e-g` — the plan owns intent, never the literal `bun` command. **Why:** the 8-alert undici/js-yaml Dependabot PR (2026-07-18) — plan Phase 2 prescribed `bun update`, caught and reverted at soleur:work. See `knowledge-base/project/learnings/workflow-patterns/2026-07-18-plan-prescribed-bun-update-for-transitive-bump-is-banned.md`.)
77
77
  - **Before authoring any `### Post-merge (operator)` step, run the automation-feasibility gate.** For each candidate step, check whether a loaded MCP server or CLI can execute it:
78
78
  - Supabase migration apply / `cron.job` verify / bucket-exists check / RLS spot-check → `mcp__plugin_supabase_supabase__*`
79
- - `gh pr ready` / `gh pr merge --squash --auto` / `gh issue close` / `gh workflow run` → `gh` CLI via Bash
79
+ - `gh pr ready` / `gh issue close` / `gh workflow run` → `gh` CLI via Bash; merging a PR → `soleur:ship`, which arms only through the review-evidence arm check
80
80
  - End-to-end UI flow → Playwright MCP (`mcp__plugin_soleur_playwright__*` — dedicated persistent profile; a flow needing stored auth that lives in a different registration's profile uses that registration)
81
81
  - Cloudflare DNS / WAF / Workers / Zero Trust → `mcp__plugin_soleur_cloudflare__*`
82
82
  - Stripe live-state read / customer / subscription → `mcp__plugin_soleur_stripe__*`
@@ -366,3 +366,4 @@ NEVER CODE! Just research and write the plan.
366
366
  - **A copy sentence of the form "X cannot happen unless Y" is an enforcement claim: list every path that can do X before prescribing it.** Enumerate each runner, each flag state (on, off, read failed) and each missing-dependency state, and name the line that enforces Y on each; a path with no such line is a code task or a reworded sentence in the same plan. **Why:** #12197/PR #12567 — `PUSH_DISCLOSURE` said nothing is pushed without Owner approval; the legacy runner's in-memory card let a member approve their own push whenever the approval queue gave no verdict. See `knowledge-base/project/learnings/2026-11-10-a-copy-sentence-that-promises-enforcement-must-be-checked-on-every-runner-and-flag-state.md`.
367
367
  - **Before a plan names a shipped literal (a port, IP, hostname, token, sentinel URL), grep the repo's TEST FIXTURES for it — a value fixtures use as the deliberately-wrong constant poisons the suite when shipped.** `grep -rn '8444' apps/web-platform` showed the port is the assume-invalid sentinel in `apps/web-platform/infra/` firewall fixtures, so the receiver bound 8445 instead of the plan's first-draft "e.g. 8444". Same class for dispatch conditions that mirror an upstream SDK: route on the SDK's TRUTHINESS test (`get("probe")` falsy on `""`), never key presence — an empty `?probe=` is a run request, and `has()` vs `Boolean(get())` differ on exactly the input nobody hand-types. **Why:** #9137/PR #12554 — the presence-gate P1 was caught only by the sequential-fallback review's fix round; the fixture-collision was caught by the work phase's own grep. See `knowledge-base/project/learnings/logic-errors/2026-11-10-empty-probe-param-is-a-run-request-sdk-truthiness-parity.md`.
368
368
  - **A plan that proposes a flag or argv as an implementation lever on a repo script must read the script's actual argv first — "the flag that should exist" is a capability claim verified against the parser, not inferred from the suite's shape.** Grep the script's argument handling (`--only`, `getopts`, the `usage`/help text) or run `--help`; it settles in seconds what a wrong claim costs a ruling cycle to catch. **Why:** #12626 — the plan prescribed a `--rows` row-splitting lever on `approval-guard1-mutation`; the battery's argv is `[--only|--list|--check-anchors]`, and only the batched CTO ruling caught it. See `knowledge-base/project/learnings/2026-11-11-a-completed-but-failing-leg-filed-as-did-not-complete.md` SE#4.
369
+ - **A plan that adds a rule to a gate which reads text another interpreter will expand (a Bash PreToolUse hook, a CI shell lint) must list that interpreter's whole expansion and quoting set first, and close each class in one place rather than deny-listing spellings.** For bash: brace, tilde, parameter/`$[…]`, command, process substitution, pathname/extglob, backslash and `$'…'` quoting, and the target tool's own argv parsing (git long-option prefixes, commit pathspecs). Brief the first fix-round security seat to sweep that whole list, not to find one more instance. **Why:** #12806 — seven fix rounds each found the next form the cron hook read differently from bash; see `knowledge-base/project/learnings/2026-11-16-seven-fix-rounds-each-found-the-next-bash-expansion-the-hook-read-differently.md`.
@@ -316,18 +316,18 @@ Present an output summary listing the document path, milestones created, issues
316
316
 
317
317
  1. Run compound (`skill: soleur:compound`) to capture any learnings from the session.
318
318
  2. Use `soleur:ship` to commit, push, and open a PR with the roadmap and any skill/agent changes.
319
- 3. After the PR is created, queue auto-merge under the merge-main lock. The `--` separator is required (terminates `with_lock`'s positional args).
319
+ 3. After the PR is created, queue auto-merge under the merge-main lock, and only through the arm check in [review-evidence-comment.md](${CLAUDE_PLUGIN_ROOT}/skills/review/references/review-evidence-comment.md#arm-check): run `git fetch -q origin "pull/<number>/head" || { echo "fetch of PR <number>'s head failed: not armed"; exit 1; }` (a failed fetch is reported as itself, not as a missing-evidence refusal that would send you to `soleur:review`; the check's `merge-base` needs the PR head locally, and ship may have moved it), then its first statement, both `PR_NUMBER` tokens replaced by the PR number, then the block below, in one Bash call. Exit 1 whose last line begins `ARM_CHECK refused` is a refusal: follow the check's own refusal rule. By this step ship Phase 6.5/7 may already have armed, queued or merged the PR, so any other non-zero exit except 99 (including the fetch line) means: read `gh pr view <number> --json state,autoMergeRequest` and report it (a merged or already-armed PR is not a failure). The `--` separator is required (terminates `with_lock`'s positional args).
320
320
 
321
321
  ```bash
322
322
  SS_LIB="${CLAUDE_PLUGIN_ROOT}/scripts/lib/session-state.sh"
323
323
  if [[ -r "$SS_LIB" ]] && command -v flock >/dev/null 2>&1; then
324
324
  bash "$SS_LIB" with_lock merge-main 600 -- \
325
- gh pr merge <number> --squash --auto
325
+ gh pr merge <number> --squash --auto --match-head-commit "${H:?run the arm check in this call}"
326
326
  rc=$?
327
327
  else
328
328
  # Degrade open, loudly — the lock is advisory (ADR-178 §5).
329
329
  echo "SOLEUR_SESSION_STATE_UNAVAILABLE path=$SS_LIB reason=running-unlocked"
330
- gh pr merge <number> --squash --auto
330
+ gh pr merge <number> --squash --auto --match-head-commit "${H:?run the arm check in this call}"
331
331
  rc=$?
332
332
  fi
333
333
  # Both arms above capture rc, so something must READ it. Without this branch
@@ -335,11 +335,12 @@ Present an output summary listing the document path, milestones created, issues
335
335
  # as queued — the sibling blocks in merge-pr and ship both carry it.
336
336
  if [[ "$rc" -eq 99 ]]; then
337
337
  echo "merge-main lock could not be taken (contention >600s, or the lock file could not be opened) — the merge was NOT queued. Retry."
338
- exit 1
338
+ exit 99
339
339
  fi
340
+ exit "$rc"
340
341
  ```
341
342
 
342
- rc=99 is reachable only from the LOCKED arm — the degrade-open arm runs `gh pr merge` bare, which has no lock semantics — so a run that emitted `reason=running-unlocked` queued its merge without serialisation rather than failing. Note 99 means "the lock could not be taken", which includes an unopenable lock file, not only >600s contention.
343
+ rc=99 is reachable only from the LOCKED arm — the degrade-open arm runs `gh pr merge` unlocked, with no lock semantics — so a run that emitted `reason=running-unlocked` queued its merge without serialisation rather than failing. Note 99 means "the lock could not be taken", which includes an unopenable lock file, not only >600s contention.
343
344
  4. Poll the PR using the Monitor tool with the same state machine as `soleur:ship` Phase 7 (state+`mergeStateStatus`, BEHIND auto-sync capped at 6, required-check failure exit, DIRTY exit). Naive `gh pr view <number> --json state` is insufficient — it heartbeats silently through BEHIND / BLOCKED-with-CI-failure / DIRTY states. Reuse the loop body from `plugins/soleur/skills/ship/SKILL.md` Phase 7. **Precondition:** must run from inside a worktree (`git rev-parse --is-inside-work-tree`) — the BEHIND auto-sync uses `git merge origin/main && git push`.
344
345
  5. Run `cleanup-merged` to remove the worktree.
345
346
 
@@ -1,7 +1,7 @@
1
1
  # Review-Evidence comment and the agent-review merge gate
2
2
 
3
- Loaded by `soleur:review` step 3 (after `emit-review-trailer.sh` succeeds) and linked from the arm steps of
4
- `soleur:ship` and `soleur:merge-pr`. This is the one copy of the gate text; the skills link here.
3
+ Loaded by `soleur:review` step 3 (after `emit-review-trailer.sh` succeeds) and linked from every arm site listed
4
+ in `## Arm check`. This is the one copy of the gate text; the skills link here.
5
5
 
6
6
  ## The gate
7
7
 
@@ -38,32 +38,51 @@ after the head it names is not a pass; the arm check below enforces all three.
38
38
  Under a merge queue, the head the comment covers must be the head that enters the queue: a fix commit pushed after
39
39
  the comment and left unreviewed rides the queue, and this repo's queue builds one entry at a time
40
40
  (`max_entries_to_build = 1`), so pulling the PR out and re-entering puts it at the back. Re-review the new commits
41
- and post a fresh comment before arming or re-arming `gh pr merge --squash --auto`; when auto-merge is already armed,
41
+ and post a fresh comment before arming or re-arming auto-merge; when auto-merge is already armed,
42
42
  run `gh pr merge <number> --disable-auto` before pushing a fix. **Why:** #12518 — four CI-guard fix commits entered
43
43
  the queue past the evidence head, and their P3 findings had to be fixed forward in #12633.
44
44
 
45
45
  ## Arm check
46
46
 
47
- Ship's arm and CI-fix re-arm and merge-pr's merge gate run this one check; it is the only copy. It takes the
47
+ Ship's arm and CI-fix re-arm, merge-pr's merge gate, drain-prs §4's arm, product-roadmap's locked arm,
48
+ merge-queue-dequeue.md's step 3 re-arm and settle-then-admin-merge.md's step 2 run this one check, and the
49
+ re-arm instructions printed by sync-pr-behind.sh and merge-queue-jump.sh point here; it is the only copy. Never
50
+ assign `H` or `EV` by hand: only the statement sets them.
51
+
52
+ Not covered: first-party bots arm or merge their own PRs with no evidence check:
53
+ `.github/scripts/bump-inngest-bootstrap-pin.sh` (`gh pr merge … --auto`, `enqueuePullRequest`),
54
+ `.github/actions/bot-pr-with-synthetic-checks/action.yml` (`gh_app pr merge … --auto`),
55
+ `apps/web-platform/server/inngest/functions/_cron-safe-commit.ts` (`enablePullRequestAutoMerge`, and a direct
56
+ merge through the REST merge endpoint), `apps/web-platform/server/inngest/functions/cron-bug-fixer.ts` (`enableAutoMergeSquash`)
57
+ and workflows generated by `soleur:schedule` (`gh pr merge --squash --auto`). Nor is the enqueue in
58
+ `scripts/merge-queue-jump.sh`, which pins the head it reads, not the head evidence covers. Tracked in #12739.
59
+
60
+ The check takes the
48
61
  latest `Review-Evidence:` comment, requires its first line to say `coverage=full` and `unresolved-P1-P2=0` (each
49
62
  field exactly once), requires its `head=` to be an ancestor of the PR head, and requires that no non-merge commit
50
63
  sits on the branch's first-parent line between the two. The first statement is the check and exits 1 on refusal;
51
- the second is the arm:
64
+ the second is the arm. Replace every `PR_NUMBER` token with the PR number before running either:
52
65
 
53
66
  ```bash
54
67
  EV=$(gh pr view PR_NUMBER --json comments --jq '[.comments[].body|select(test("^\\s*review-evidence:";"i"))]|last // ""|split("\n")[0]|select(test("; coverage=full[; ]") and test("; unresolved-P1-P2=0([; ]|$)") and ([scan("coverage=")]|length==1) and ([scan("unresolved-P1-P2=")]|length==1))|capture("^Review-Evidence: head=(?<h>[0-9a-f]{7,40})[; ]").h') \
55
68
  && H=$(gh pr view PR_NUMBER --json headRefOid --jq .headRefOid) \
56
69
  && git merge-base --is-ancestor "$EV" "$H" \
57
70
  && R=$(git rev-list --first-parent --no-merges "$EV..$H") && [ -z "$R" ] \
58
- || { echo "ARM_CHECK refused: no passing evidence covers the PR head"; exit 1; }
71
+ || { echo "ARM_CHECK refused: no passing evidence covers the PR head; evidence=${EV:-none}; unreviewed=$(echo ${R:-none})"; exit 1; }
59
72
  gh pr merge PR_NUMBER --squash --auto --match-head-commit "${H:?run the arm check in this call}"
60
73
  ```
61
74
 
62
75
  Where a skill wraps the merge in the merge-main lock, run the first statement and then the lock block in place of
63
76
  the second, all in one Bash call: the `exit 1` stops the call before the lock block, and the lock block's
64
77
  `${H:?…}` aborts if it runs without the check. On refusal, run `soleur:review`, which posts fresh evidence, then
65
- run the check again; never arm around it.
66
- `git rev-list --first-parent --no-merges "$EV..$H"` names the unreviewed commits.
78
+ run the check again; never arm around it. If it refuses again after that review, stop and report the PR unarmed
79
+ with the `evidence=` and `unreviewed=` values its refusal line prints: shell state does not survive the call, so
80
+ that line is the only record of them. `unreviewed=` lists `git rev-list --first-parent --no-merges "$EV..$H"`, the
81
+ commits after the evidence head; `evidence=none` means no passing comment (or the first `gh pr view` read failed), and `unreviewed=none` beside a real
82
+ `evidence=` head means the check stopped before it could list commits: the evidence head is not an ancestor of the
83
+ PR head (a rebase or force-push), a head is missing from the local object store, or the `gh` read of the PR head (`headRefOid`) or a `git` call failed.
84
+ A `fatal:` or `gh` line above the refusal names a missing object or a failed call; no line above it means the evidence head is not an ancestor (`merge-base --is-ancestor` exits 1 silently). Run one check per Bash call: the statement assigns `R` only
85
+ when it reaches `git rev-list`, so a shell that already holds `R` from another PR's check reports that PR's commits.
67
86
 
68
87
  - A main-sync merge (`git merge origin/main`, or GitHub's update-branch) passes: `--first-parent` keeps main's
69
88
  commits, which arrive through the merge's second parent, out of the range. Without it every synced PR refuses.
@@ -66,6 +66,7 @@ Fix commits are the least-audited surface in the pipeline (learnings 2026-09-23,
66
66
  3. **Report-only spawn** against `git diff $PANEL_SHA..HEAD` — the FIX diff, not the branch diff. **Tally (#9403):** fix-round seats are review seats — `gate seats <N>` (N = the resolved seat count) before dispatch and `incr seats <N>` after, on the branch ledger; a `STOP` verdict is the classified-stop path (write `status: budget-capped` + `budget-capped: seats=<n>/<cap>` to the feature's `session-state.md` and halt — do not silently shrink the round).
67
67
  4. **Cap two targeted rounds.** A third needed round escalates to the full class panel over the cumulative fix diff — an unbounded targeted loop is the treadmill this mechanism exists to prevent.
68
68
  When a round's findings against a pin test are SIBLING shapes of the last round's, the defect is the test's claim, not its coverage: rule its contract (what it guards, what it leaves open) and state the residuals in its header before fixing more shapes; a later shape inside a stated residual is recorded as "covered by R<n>". **Why:** #12348/PR #12561 — three rounds each re-found "a prior step or the env replaces what the gate runs"; stating the residuals (plus two class fixes) let the final pass terminate. See `knowledge-base/project/learnings/2026-11-11-each-fix-round-found-the-next-sibling-until-the-test-stated-its-residuals.md`.
69
+ When the pinned artifact is gate text an agent pastes or runs (a fenced check, a refusal line, a tie), require the whole block (indent-stripped, line for line, plus a cardinality check) in the first fix: a substring or per-line pin is satisfied by a commented or neutered copy of the text it looks for, and each finer grain only moves the bypass one level out. **Why:** #12656/PR #12706 — two consecutive rounds found a commented-out tie, then a commented-out refusal. See `knowledge-base/project/learnings/2026-11-13-a-pin-on-gate-text-was-satisfied-by-a-commented-out-line-twice.md`.
69
70
  5. **One verification pass** after the last round: a single fresh-eyes verifier seat answers "does each fix commit close its finding, and did any fix introduce a defect in its own area?", plus the lead's affected-gate run (`scripts/test-all.sh --affected`; `TEST_GROUP=affected` is its deprecated alias, #8621).
70
71
  6. **Invocation:** `soleur:review <PR> --fix-round --since <sha>` runs only the targeted round + verification pass — `soleur:one-shot` Step 5 calls this after its resolver-agent commits land. `--since` is the panel snapshot; when it is absent (a bare invocation, or a rebase invalidated it) recover the base as **the parent of the oldest `review:`/`fix`-subject commit since the merge-base, else the merge-base itself** — and report which base was used. The fix round attests via `emit-review-trailer.sh --fix-round --since <base>` (`Reviewed-Fix-Round:`/`Reviewed-Fix-Range:` keys — never `Reviewed-Coverage:`). The range's effective head is derived by attestation-TRAILER presence, never by `review:`-prefixed subjects — `review: <summary> (P<N>)` is this repo's prescribed fix-commit subject, so a subject filter silently excludes real fixes. A standalone/fresh-session invocation has no access to the prior session's dedup ledger — without it the round degrades to path-mapped seats only (no `--finding-seats` union); that is the known, fail-safe direction and should be reported. A fix round attests ONLY via `--fix-round` keys: the branch-level `Reviewed-By-Soleur`/`Reviewed-Coverage` trailer must already exist from the main panel — absent, that is the anomaly (a fix round without a panel), report it, never emit a main trailer for a targeted round. Its commit subject is `review-fix-round:`, deliberately NOT matching the merge gate's legacy `review:` evidence regex — a targeted round is not branch-level review evidence.
71
72
 
@@ -470,7 +470,7 @@ it. The battery you start on the final tree is the only local run there will be.
470
470
 
471
471
  - **The merge gate is CI, not this run.** The required `test` context (ruleset 14145388) aggregates the same three `test-all.sh` shards on the PR head and blocks merge — CI still runs the FULL battery (bar the five ADR-262 `--pr-gated` mutation batteries, which `pull_request` declines when the diff misses their subject paths and `push` runs in full). Do not describe this local run as the merge gate — that over-claim licenses a future PR to shard it.
472
472
  - **This is the LAST LOCAL fail-fast checkpoint** — Phase 5.5 still runs code-mutating gates after it.
473
- - **It is the sole BLOCKING gate for `apps/web-platform/infra/`** — `no required status check runs that shard`, so nothing here stops `gh pr merge --auto`. Under `--affected` the infra runner is selected by its declared consumed edge whenever the diff touches `apps/web-platform/infra/`, so this claim survives the mode change. It is NOT the only place those suites run: `infra-validation.yml`'s `deploy-script-tests` job executes the same registered set on every PR touching `apps/*/infra/**` (it carries no `needs:`/`if:`), and `main-health-monitor` re-runs `TEST_GROUP=infra` on `main` every six hours. Both are visible, neither blocks — an infra regression can reach `main` past a red-but-non-required check, never unobserved. The real fix is promoting `infra-validate-required` into the required set (#6480).
473
+ - **It is the sole BLOCKING gate for `apps/web-platform/infra/`** — `no required status check runs that shard`, so nothing here stops the auto-merge arm. Under `--affected` the infra runner is selected by its declared consumed edge whenever the diff touches `apps/web-platform/infra/`, so this claim survives the mode change. It is NOT the only place those suites run: `infra-validation.yml`'s `deploy-script-tests` job executes the same registered set on every PR touching `apps/*/infra/**` (it carries no `needs:`/`if:`), and `main-health-monitor` re-runs `TEST_GROUP=infra` on `main` every six hours. Both are visible, neither blocks — an infra regression can reach `main` past a red-but-non-required check, never unobserved. The real fix is promoting `infra-validate-required` into the required set (#6480).
474
474
  - **A local `--affected` run is not, and is not meant to be, the full battery.** Suites the diff does not reach decline as counted `not-affected` skips — a healthy affected run reads `N-k/N` with a `not-affected` breakdown field, not `N/N`. Affected+ratchets does not exercise suite×suite interaction; the backstop for that class is CI's sharded full battery on the PR head, so a green affected run is not a full-coverage claim. Selection fails toward coverage: an undecidable diff, a missing declarations index, or a diff touching the runner or index itself degrades the run to the full battery and prints `AFFECTED_FALLBACK reason=…`. If the declined suites must execute, that is `--full` (or legacy `SOLEUR_TEST_FORCE_ALL=1`); `SOLEUR_INCIDENT_SKIP=1` drops the infra set while leaving this pin satisfied.
475
475
  - **Push time runs a ratchet lane (#9400):** [scripts/pre-push-ratchet-lane.sh](../../../../scripts/pre-push-ratchet-lane.sh) — the diff-reachable ratchets on a scratch `origin/main` merge; supplemental only.
476
476
 
@@ -1605,7 +1605,7 @@ Run `echo 'SOLEUR_RULE_APPLIED rule=hr-technical-fork-is-not-an-operator-questio
1605
1605
 
1606
1606
  [skill-enforced: ship Phase 6.4 + hook ship-unpushed-commits-gate.sh]
1607
1607
 
1608
- Before queueing `gh pr merge --squash --auto` (Phase 6.5's CI Status Check below), verify every local commit is on `origin/<branch>`. GitHub's auto-merge consumes the PR head ref on origin — local-only commits are silently dropped from the squash. (PR #3624 → #3627 → #3630: 2 of 5 commits never landed.)
1608
+ Before arming auto-merge (Phase 6.5's CI Status Check below), verify every local commit is on `origin/<branch>`. GitHub's auto-merge consumes the PR head ref on origin — local-only commits are silently dropped from the squash. (PR #3624 → #3627 → #3630: 2 of 5 commits never landed.)
1609
1609
 
1610
1610
  The PreToolUse hook [`.claude/hooks/ship-unpushed-commits-gate.sh`](../../../../.claude/hooks/ship-unpushed-commits-gate.sh) enforces this gate mechanically — it intercepts every `gh pr merge` (chained forms too) and denies the tool call when `git rev-list origin/<branch>..HEAD --count` returns > 0. The deny message lists the unpushed SHAs so the operator can `git push` and re-issue. Run the Phase 6 secret scan before the `git push` it asks for.
1611
1611
 
@@ -1624,7 +1624,7 @@ fi
1624
1624
 
1625
1625
  **Fail-open conditions** (the hook exits silently): branch is `main`/`master`, detached HEAD, no upstream tracking ref, bare-repo context, branch name fails refname validation. **Fail-closed on fetch failure** (a stale ref hides the miss). See rule `wg-ship-push-before-merge` in `AGENTS.rules.md` for the canonical contract.
1626
1626
 
1627
- **PUSHED IS NOT THE SAME AS FINISHED — BATCH EVERY FORESEEABLE COMMIT BEFORE QUEUEING `--auto`.** The gate above asks whether what you have is pushed; it cannot ask whether what you have is all you will need. Any commit you can foresee wanting — a late ADR, a review fix you already know is coming, a measurement you have not yet written down — belongs in the tree BEFORE `gh pr merge --squash --auto` is queued, and the place to do that work is the review-agent wait. **Anything you land during that wait is outside the snapshot the reviewers read** (`rf-before-spawning-review-agents-push-the`: subagents analyse remote state at spawn time), so push it and re-cover it before you accept their findings. Pushing after `--auto` is queued resets the head ref and restarts the entire required-check set when the PR is one check from merging; the restarted cycle is gated by a single job that runs roughly 5-9x longer than any other (see [settle-then-admin-merge.md](${CLAUDE_PLUGIN_ROOT}/skills/ship/references/settle-then-admin-merge.md) for the measured figure and its derivation). **Why:** #7896 burned ~6 CI cycles (a late ADR commit at 65 of 67 checks).
1627
+ **PUSHED IS NOT THE SAME AS FINISHED — BATCH EVERY FORESEEABLE COMMIT BEFORE QUEUEING `--auto`.** The gate above asks whether what you have is pushed; it cannot ask whether what you have is all you will need. Any commit you can foresee wanting — a late ADR, a review fix you already know is coming, a measurement you have not yet written down — belongs in the tree BEFORE auto-merge is armed, and the place to do that work is the review-agent wait. **Anything you land during that wait is outside the snapshot the reviewers read** (`rf-before-spawning-review-agents-push-the`: subagents analyse remote state at spawn time), so push it and re-cover it before you accept their findings. Pushing after `--auto` is queued resets the head ref and restarts the entire required-check set when the PR is one check from merging; the restarted cycle is gated by a single job that runs roughly 5-9x longer than any other (see [settle-then-admin-merge.md](${CLAUDE_PLUGIN_ROOT}/skills/ship/references/settle-then-admin-merge.md) for the measured figure and its derivation). **Why:** #7896 burned ~6 CI cycles (a late ADR commit at 65 of 67 checks).
1628
1628
 
1629
1629
  **Hook ordering:** the gate is wired AFTER [`pre-merge-rebase.sh`](../../../../.claude/hooks/pre-merge-rebase.sh) in [`.claude/settings.json`](../../../../.claude/settings.json), so an auto-sync push has updated the tracking ref before this gate counts; `T11` in [`ship-unpushed-commits-gate.test.sh`](../../../../.claude/hooks/ship-unpushed-commits-gate.test.sh) enforces it.
1630
1630
 
@@ -23,11 +23,11 @@ bash "${CLAUDE_PLUGIN_ROOT}/scripts/sync-pr-behind.sh" "$N" --queue-state # <q
23
23
 
24
24
  `dequeued` (any `armed` value, `removal=` naming the reason) is a dequeue. `not_queued` with `removal=none` is not, by itself: it is not queued yet (including a PR you just re-armed), or a push dequeued it and it re-enqueues itself once green. The exception is a second read right after a reported dequeue (see step 2).
25
25
 
26
- **Recover (agent-run, ONE re-enqueue).** The short recovery printed on the exit-13 line summarises these steps; where they differ, these steps win.
26
+ **Recover (agent-run, ONE re-enqueue).** The short recovery printed on the exit-13 line summarises these steps; where they differ, these steps win. Start every Bash call below that uses `$N` with `N=<pr-number>;`: each call is a fresh shell, and an empty `N` makes `gh pr view ""` read the current branch's PR instead.
27
27
 
28
28
  1. Read why: `gh run list --event merge_group --limit 100 --json databaseId,headBranch,headSha,conclusion,url --jq '.[] | select(.headBranch | startswith("gh-readonly-queue/main/pr-'"$N"'-"))'`, then `gh run view <databaseId> --log-failed` for the failing job. The limit is 100 because one queue entry runs about 8 workflows. Grouped merging (max_entries_to_merge=3): a member PR's group ref is named for the group's DEEPEST member, so a member's own `pr-<N>-` lookup can return zero runs while the group build ran under another member's number — if the select is empty, drop it and correlate the recent `merge_group` runs by `headSha`/`createdAt`.
29
29
  2. Before pushing, read `--queue-state` (a dequeue reached through the marker alone, with no removal event yet, reads `not_queued removal=none` on a second read because the first print consumed the marker: treat that read as still dequeued; after a push or re-arm of your own it means not queued yet). `queued` means GitHub already re-queued the PR: a flake needs no push, and a push removes it from the queue again (`reason=manual`, a full re-queue). `dequeued` with auto-merge armed after a `failed_checks` removal and a flake: wait about 4 minutes and read again, expecting `queued`; do not push. If it still reads `dequeued`, the re-queue is not coming: report it with the failing run URL (step 4) or push a fix for a failure that will recur. Push only a fix for a failure that will recur. Fix it on the PR branch. A conflict or lockfile / `kb-index` drift: `git merge origin/main` locally (merge-pr §3.1 "Route conflicts"), resolve, commit, push.
30
- 3. Re-arm once, only when `gh pr view "$N" --json autoMergeRequest --jq '.autoMergeRequest'` prints `null`: `gh pr merge "$N" --squash --auto`. When it is armed, do not re-arm. Either way, re-run the Phase 7 poll and wait.
30
+ 3. Re-arm once, only when `gh pr view "$N" --json autoMergeRequest --jq '.autoMergeRequest'` prints `null`, and only through the arm check in [review-evidence-comment.md](${CLAUDE_PLUGIN_ROOT}/skills/review/references/review-evidence-comment.md#arm-check): start the call with `N=<pr-number>`, then run `git fetch -q origin "pull/$N/head" || { echo "fetch of PR $N's head failed: not re-armed"; exit 1; }` (a failed fetch is reported as itself, not as a missing-evidence refusal; step 2 or a server-side update may have moved the head, and the check's `merge-base` needs it locally), then its first statement with both `PR_NUMBER` tokens replaced by the PR number, then `gh pr merge "$N" --squash --auto --match-head-commit "${H:?run the arm check in this call}"`, in one Bash call. A fix pushed in step 2, including a merge whose conflict you resolved by hand (the check skips merge commits), needs `soleur:review` first; a refusal after that review is reported, never armed around. When it is armed, do not re-arm. A failed fetch (last line `fetch of PR <N>'s head failed: not re-armed`) armed nothing: report the PR as not re-armed with that line and do not poll it. Otherwise, re-run the Phase 7 poll and wait.
31
31
  4. A second dequeue of the same PR: stop and report it to the operator with the failing run URL. Do not loop.
32
32
 
33
33
  Never `gh pr update-branch`, push, or `--admin` a PR that is IN the queue. A push dequeues it, and `--admin` skips the `merge_group` verification the queue exists to run.
@@ -55,10 +55,15 @@ At that trigger or at the 6-sync cap, if this change has **zero conflict surface
55
55
  ```bash
56
56
  _top=$(git rev-parse --show-toplevel 2>/dev/null); [[ "${CLAUDE_PLUGIN_ROOT}" == /* && -r "${CLAUDE_PLUGIN_ROOT}/.claude-plugin/plugin.json" && ( -z "$_top" || "$(realpath "${CLAUDE_PLUGIN_ROOT}")/" != "$_top/"* ) ]] || { echo "ADMIN-MERGE ABORTED: plugin root unresolved or inside this checkout"; exit 5; }
57
57
  SHA=$(gh pr view <N> --json headRefOid --jq .headRefOid)
58
+ git fetch -q origin "pull/<N>/head" || { echo "ADMIN-MERGE ABORTED: could not fetch the PR head"; exit 1; }
59
+ # REPLACE THIS LINE with the arm check's first statement (review-evidence-comment.md#arm-check), PR_NUMBER replaced by <N>
60
+ [ "${H:?run the arm check in this call}" = "$SHA" ] || { echo "ADMIN-MERGE ABORTED: evidence head check read a different head"; exit 4; }
58
61
  bash "${CLAUDE_PLUGIN_ROOT}/scripts/admin-merge-ready.sh" <N> "$SHA" --wait --timeout 3600
59
62
  ```
60
63
 
61
- Branch on the exit code alone: 0 → go to step 3; 4 → the head moved or the PR closed, so re-read `SHA` and restart this step; 5 → the block's first line refused the plugin root (unset, relative, or inside this checkout — the gate would then be the PR's own copy), so resolve it as this file's first paragraph says and rerun, or hand the merge to the operator, never export a repository path to get past it; anything else → stop and report the ABSENT/PENDING/FAILED contexts it names, and never merge. A PR that edits `.github/workflows/` or `.github/actions/` always exits 1 (`UNTRUSTED-CI`): it has no agent admin-merge path, and the operator merges it by hand. How the script decides (the required set from every ruleset, the latest run by check-run id, app pinning) is documented once, in its header. The property is the same one `gh pr checks <N>` cannot express alone: it must show every required context **present and green on the current SHA**, not merely absent from the `pending` and `fail` buckets: an empty rollup on a just-pushed head satisfies "nothing is failing" vacuously, and after a conflict-resolved sync merge (whose commit the `bun-test` pre-commit hook skips by configuration) that head's ONLY execution is this CI run. **`--admin` bypasses the ENTIRE `required_status_checks` rule — every `required_check` context as well as the up-to-date gate — so nothing server-side will stop a red, pending or absent merge; this step is the only check that exists.** Measured against `infra/github/ruleset-ci-required.tf`: `strict_required_status_checks_policy` and every `required_check` are sibling parameters of ONE rule, and `ci-required-ruleset-canonical-bypass-actors.json` grants OrganizationAdmin and RepositoryRole 5 `bypass_mode: "pull_request"`. Ruleset bypass is granted per rule, never per parameter. This paragraph previously claimed `--admin` bypassed "ONLY the up-to-date gate, NOT the checks"; that was false for this repo, and it was the sole thing standing between the hatch and an unverified merge.
64
+ The [arm check](../../review/references/review-evidence-comment.md#arm-check) runs before the readiness script because `--admin` bypasses review as well as checks: green CI on a head no passing evidence covers is not a merge. Its refusal exits 1 before the readiness script runs, and its last line begins `ARM_CHECK refused` (the check's own text plus the 7-40 hex SHAs it captured, never free PR text; git may print a `fatal:` line before it when the PR has no evidence or the evidence head is not in the local object store): run `soleur:review`, which posts fresh evidence, then restart this step once. A second refusal: stop and report it. Never admin-merge around it.
65
+
66
+ Branch on the exit code: 0 → go to step 3; 1 whose last line begins `ARM_CHECK refused` → the review route above; 4 → the head moved or the PR closed, so re-read `SHA` and restart this step; 5 → the block's first line refused the plugin root (unset, relative, or inside this checkout — the gate would then be the PR's own copy), so resolve it as this file's first paragraph says and rerun, or hand the merge to the operator, never export a repository path to get past it; anything else → stop and report the ABSENT/PENDING/FAILED contexts it names, and never merge. A PR that edits `.github/workflows/` or `.github/actions/` always exits 1 (`UNTRUSTED-CI`): it has no agent admin-merge path, and the operator merges it by hand. How the script decides (the required set from every ruleset, the latest run by check-run id, app pinning) is documented once, in its header. The property is the same one `gh pr checks <N>` cannot express alone: it must show every required context **present and green on the current SHA**, not merely absent from the `pending` and `fail` buckets: an empty rollup on a just-pushed head satisfies "nothing is failing" vacuously, and after a conflict-resolved sync merge (whose commit the `bun-test` pre-commit hook skips by configuration) that head's ONLY execution is this CI run. **`--admin` bypasses the ENTIRE `required_status_checks` rule — every `required_check` context as well as the up-to-date gate — so nothing server-side will stop a red, pending or absent merge; this step is the only check that exists.** Measured against `infra/github/ruleset-ci-required.tf`: `strict_required_status_checks_policy` and every `required_check` are sibling parameters of ONE rule, and `ci-required-ruleset-canonical-bypass-actors.json` grants OrganizationAdmin and RepositoryRole 5 `bypass_mode: "pull_request"`. Ruleset bypass is granted per rule, never per parameter. This paragraph previously claimed `--admin` bypassed "ONLY the up-to-date gate, NOT the checks"; that was false for this repo, and it was the sole thing standing between the hatch and an unverified merge.
62
67
  A ready PR whose newest `test` row is the DRAFT run's red one (CI_DRAFT_LIGHT) is not failed: the script asks [ci-head-verdict.sh](../../../scripts/ci-head-verdict.sh) and reads `pending-full`/`no-run` as PENDING, `stalled`/`stale-row` as terminal not-ready with `gh pr ready --undo <N>` then `gh pr ready <N>` (user token) as the recovery, after a look at the Actions tab (a run still in flight is not stalled, and the undo cancels it); a re-run of the draft run is not one.
63
68
  3. **Sync local → origin** so the local ref is fast-forward with the pushed head: `git fetch origin && git reset --hard origin/<branch>` (this discards any uncommitted or un-pushed local work on the branch — confirm `git status` is clean first).
64
69
  4. **Admin-merge, re-checking before every attempt.** `--admin` bypasses the whole `required_status_checks` rule, not just its "branch must be up to date with base" parameter — step 2 is what makes it safe, and step 2 is discipline, not enforcement. Run this block inside a Monitor (a foreground `sleep` is blocked). A Monitor task does not inherit step 2's shell, so set `SHA` to the head you read in step 2, from a run that exited 0 — never from text that merely looks like a marker line. The script runs again immediately before every attempt, only GitHub's `Base branch was modified` race is retried, and success is read from the PR's state (`MERGED` at `$SHA`), never from the merge command's exit status, which cannot prove the PR landed at that commit:
@@ -100,9 +105,14 @@ The hatch above is *agent-initiated*, which is why it is scoped to zero-conflict
100
105
  ```bash
101
106
  _top=$(git rev-parse --show-toplevel 2>/dev/null); [[ "${CLAUDE_PLUGIN_ROOT}" == /* && -r "${CLAUDE_PLUGIN_ROOT}/.claude-plugin/plugin.json" && ( -z "$_top" || "$(realpath "${CLAUDE_PLUGIN_ROOT}")/" != "$_top/"* ) ]] || { echo "ADMIN-MERGE ABORTED: plugin root unresolved or inside this checkout"; exit 5; }
102
107
  SHA=$(gh pr view <N> --json headRefOid --jq .headRefOid)
108
+ git fetch -q origin "pull/<N>/head" || { echo "ADMIN-MERGE ABORTED: could not fetch the PR head"; exit 1; }
109
+ # REPLACE THIS LINE with the arm check's first statement (review-evidence-comment.md#arm-check), PR_NUMBER replaced by <N>
110
+ [ "${H:?run the arm check in this call}" = "$SHA" ] || { echo "ADMIN-MERGE ABORTED: evidence head check read a different head"; exit 4; }
103
111
  bash "${CLAUDE_PLUGIN_ROOT}/scripts/admin-merge-ready.sh" <N> "$SHA" --green-sha "$G"
104
112
  ```
105
113
 
114
+ Operator authorization covers the merge decision, not review: the arm check gates this block exactly as in hatch step 2, with the same exit-code routes. The `gh pr update-branch` merge passes it, because the check skips a main-sync merge.
115
+
106
116
  `--green-sha` certifies `$SHA` only if it is a verified 2-parent GitHub merge whose first parent is `G` and whose second parent is an ancestor-or-equal of `origin/<base>` — then grades `G`'s required contexts. A `gh pr update-branch` merge always has this shape; any head that isn't a merge, has a different first parent, or merged anything that isn't on the base is refused (`carryover-not-merge` / `carryover-first-parent` / `carryover-not-base`). A **locally-created** merge is unsigned and is refused as `carryover-unverified` UNLESS you also pass `--allow-local-merge` (#9401): the second arm then replaces the signature with a diff proof — every file the merge added over `G` must be a byte-identical replay of the base-side delta (`compare(G…SHA)` ⊆ `compare(G…parents[1])` on name+status+patch), docs-only (`knowledge-base/`, `docs/`, `plugins/soleur/skills/`, `*.md`), and disjoint from the PR's own file list. Note the disjoint-skip's own path needs NO carryover at all — the hook left the green head alone, so `admin-merge-ready.sh <N> <G>` grades `G` directly and `--admin --match-head-commit <G>` lands it; `--allow-local-merge` is the rescue for a hand-made local merge (and it can never certify a hook-produced sync merge — that delta overlaps the PR's files by construction, so `-overlap` refuses). A refusal (`carryover-local-not-clean` / `-nondocs` / `-overlap`, or `carryover-unverified` without the flag) is not an error — it means wait for the new head's own suite like the normal path.
107
117
  3. Steps 3–5 of the hatch apply verbatim: sync local, merge block with `--match-head-commit "$SHA"`, decide from the exit code.
108
118
 
@@ -487,8 +487,8 @@ Run these checks before proceeding to Phase 1. A FAIL blocks execution with a re
487
487
  [`sql-security-definer-rpc-scaffold.sql`](./references/sql-security-definer-rpc-scaffold.sql)
488
488
  — it encodes the `search_path` pin + 4-role REVOKE + `auth.uid()`
489
489
  authorization pin that `test/migration-rpc-grants.test.ts` enforces.
490
- - `gh pr ready` / `gh pr merge --squash --auto` / `gh issue close`
491
- → Bash via `gh` CLI
490
+ - `gh pr ready` / `gh issue close` → Bash via `gh` CLI
491
+ - Merge → `soleur:ship` (review-evidence arm check)
492
492
  - End-to-end UI flow → Playwright MCP (`mcp__plugin_soleur_playwright__*` — dedicated persistent profile; a flow needing stored auth that lives in a different registration's profile uses that registration)
493
493
  - Cloudflare DNS / WAF / Workers → `mcp__plugin_soleur_cloudflare__*`
494
494
  - Live Stripe state → `mcp__plugin_soleur_stripe__*`