tumwater 0.4.3 → 0.4.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.
Files changed (164) hide show
  1. package/README.md +1 -1
  2. package/dist/build-info.json +2 -2
  3. package/dist/src/agent/agent-run.js +2 -1
  4. package/dist/src/agent/claude/claude-account.js +6 -20
  5. package/dist/src/agent/codex/codex-account.js +5 -6
  6. package/dist/src/agent/codex/codex-args.js +5 -5
  7. package/dist/src/agent/codex/codex-rollout.js +1 -1
  8. package/dist/src/agent/opencode/opencode-backend.js +24 -22
  9. package/dist/src/agent/opencode/opencode-catalog.js +35 -9
  10. package/dist/src/agent/session-ledger.js +22 -26
  11. package/dist/src/agent/subscription-account.js +2 -83
  12. package/dist/src/backlog/backlog-archive.js +3 -4
  13. package/dist/src/backlog/backlog-eligibility.js +14 -36
  14. package/dist/src/backlog/backlog-question-answer.js +1 -1
  15. package/dist/src/backlog/backlog.js +2 -1
  16. package/dist/src/baseline/main-guardrails.js +2 -2
  17. package/dist/src/baseline/main-watch.js +84 -50
  18. package/dist/src/brief/brief.js +26 -13
  19. package/dist/src/budget/budget.js +4 -5
  20. package/dist/src/build/build-check-report.js +10 -0
  21. package/dist/src/build/build-check-scoped.js +0 -2
  22. package/dist/src/build/build-stage.js +6 -4
  23. package/dist/src/change/change-data.js +1 -4
  24. package/dist/src/cli/cli-completion-command.js +75 -0
  25. package/dist/src/cli/cli-doctor-command.js +103 -0
  26. package/dist/src/cli/cli-init.js +2 -2
  27. package/dist/src/cli/cli-query-commands.js +1 -1
  28. package/dist/src/cli/cli-role-command.js +2 -41
  29. package/dist/src/cli/cli-start-summary.js +4 -3
  30. package/dist/src/cli/cli-start-supervisor.js +190 -0
  31. package/dist/src/cli/cli-start.js +4 -187
  32. package/dist/src/cli/completion.js +3 -3
  33. package/dist/src/cli/follow-view.js +20 -2
  34. package/dist/src/cli/help.js +2 -7
  35. package/dist/src/cli.js +19 -171
  36. package/dist/src/collections.js +11 -14
  37. package/dist/src/concurrency/lock.js +1 -1
  38. package/dist/src/config/config-keys.js +61 -20
  39. package/dist/src/config/config-request.js +11 -1
  40. package/dist/src/config/config-schema.js +1 -1
  41. package/dist/src/config/config-validation-roles.js +6 -22
  42. package/dist/src/config/config-validation.js +0 -1
  43. package/dist/src/config/config-views.js +17 -16
  44. package/dist/src/config/config-write.js +122 -79
  45. package/dist/src/config/config.js +1 -9
  46. package/dist/src/doctor/doctor-backlog-plans.js +29 -96
  47. package/dist/src/doctor/doctor-backlog.js +10 -10
  48. package/dist/src/doctor/doctor-checks.js +4 -4
  49. package/dist/src/doctor/doctor-claude-checks.js +27 -9
  50. package/dist/src/doctor/doctor-contention-checks.js +13 -5
  51. package/dist/src/doctor/doctor-fallback-checks.js +46 -24
  52. package/dist/src/doctor/doctor-holds.js +2 -2
  53. package/dist/src/doctor/doctor-orphans.js +3 -2
  54. package/dist/src/doctor/doctor-project-checks.js +21 -8
  55. package/dist/src/events/event-format.js +15 -11
  56. package/dist/src/events/event-legacy.js +2 -2
  57. package/dist/src/events/event-notify.js +4 -4
  58. package/dist/src/events/event-window.js +1 -1
  59. package/dist/src/events/events.js +8 -0
  60. package/dist/src/failure/failure-cluster.js +4 -13
  61. package/dist/src/failure/failure-data.js +4 -4
  62. package/dist/src/failure/failure-render.js +2 -2
  63. package/dist/src/failure/failure-state-change.js +50 -86
  64. package/dist/src/gates/gate-polls.js +5 -6
  65. package/dist/src/gates/startup-gates.js +2 -1
  66. package/dist/src/git/git-diff.js +6 -2
  67. package/dist/src/gui/gui-args.js +12 -0
  68. package/dist/src/gui/gui-config-commands.js +2 -64
  69. package/dist/src/gui/gui-endpoint-commands.js +1 -1
  70. package/dist/src/gui/gui-endpoint-common.js +19 -1
  71. package/dist/src/gui/gui-operator-commands.js +21 -25
  72. package/dist/src/gui/gui-prompt-commands.js +2 -2
  73. package/dist/src/gui/gui-server.js +1 -2
  74. package/dist/src/gui/gui-team-commands.js +2 -1
  75. package/dist/src/history/history.js +4 -4
  76. package/dist/src/merge/merge-check-failures.js +12 -9
  77. package/dist/src/merge/merge-core.js +6 -31
  78. package/dist/src/merge/merge-drain.js +3 -2
  79. package/dist/src/merge/merge-post-review-drain.js +1 -1
  80. package/dist/src/merge/merge-queue-render.js +3 -3
  81. package/dist/src/merge/merge-stack.js +17 -18
  82. package/dist/src/merge/merge-to-main.js +13 -58
  83. package/dist/src/merge/merge-verify.js +4 -3
  84. package/dist/src/operator/operator-commands.js +4 -3
  85. package/dist/src/orchestrator/orchestrator-poll.js +18 -38
  86. package/dist/src/orchestrator/orchestrator-scheduling.js +5 -9
  87. package/dist/src/orchestrator/scheduling-scope.js +17 -26
  88. package/dist/src/orchestrator/scheduling-skip.js +9 -13
  89. package/dist/src/paths.js +2 -2
  90. package/dist/src/pi/pi-event-line.js +27 -0
  91. package/dist/src/pi/pi-listed-models.js +13 -0
  92. package/dist/src/pi/pi-stream.js +9 -2
  93. package/dist/src/pi/pi-watchdogs.js +31 -10
  94. package/dist/src/process/process-group.js +2 -21
  95. package/dist/src/process/process.js +12 -4
  96. package/dist/src/process/run-marker.js +2 -2
  97. package/dist/src/prompt/gate-prompts.js +1 -44
  98. package/dist/src/redeploy/redeployer.js +21 -1
  99. package/dist/src/review/diff-rules.js +35 -21
  100. package/dist/src/review/post-merge-review.js +47 -40
  101. package/dist/src/review/review-precheck.js +3 -3
  102. package/dist/src/review/review.js +13 -22
  103. package/dist/src/roles/legacy-role-migration.js +6 -3
  104. package/dist/src/roles/role-render.js +6 -32
  105. package/dist/src/roles/role-view.js +2 -13
  106. package/dist/src/run/ci-parity.js +19 -8
  107. package/dist/src/run/run-apply.js +0 -9
  108. package/dist/src/run/run-stage.js +6 -6
  109. package/dist/src/run/run-verdict.js +13 -4
  110. package/dist/src/run/stage-check.js +17 -24
  111. package/dist/src/runner/runner-leftover.js +9 -26
  112. package/dist/src/runner/runner-outcome.js +1 -1
  113. package/dist/src/runner/runner-pi.js +6 -12
  114. package/dist/src/runner/runner-recovery.js +4 -12
  115. package/dist/src/runner/runner-revision.js +1 -2
  116. package/dist/src/runner/runner-run.js +7 -16
  117. package/dist/src/runner/runner-state-load.js +6 -19
  118. package/dist/src/runner/runner-state.js +0 -14
  119. package/dist/src/scheduling/backoff.js +8 -3
  120. package/dist/src/scheduling/claim-entries.js +2 -1
  121. package/dist/src/status/status-budget.js +4 -43
  122. package/dist/src/status/status-data.js +34 -38
  123. package/dist/src/status/status-roles.js +1 -2
  124. package/dist/src/team/team-hold.js +7 -5
  125. package/dist/src/team/team-orchestrator-info.js +53 -21
  126. package/dist/src/team/team-polls.js +36 -86
  127. package/dist/src/text/datetime.js +16 -7
  128. package/dist/src/text/phrases.js +9 -0
  129. package/dist/src/text/suggest.js +1 -1
  130. package/dist/src/text/text.js +3 -2
  131. package/dist/src/ui/alert-feeds.js +0 -41
  132. package/dist/src/ui/badges.js +14 -75
  133. package/dist/src/ui/gui/gui-client-boot.js +0 -6
  134. package/dist/src/ui/gui/gui-client-drawer-config.js +1 -16
  135. package/dist/src/ui/gui/gui-client-feed.js +1 -1
  136. package/dist/src/ui/gui/gui-client-operator.js +7 -5
  137. package/dist/src/ui/gui/gui-client-team.js +8 -2
  138. package/dist/src/ui/progress-data.js +54 -4
  139. package/dist/src/ui/run-progress-model.js +12 -3
  140. package/dist/src/ui/status-payload.js +10 -25
  141. package/dist/src/ui/status-render.js +10 -17
  142. package/dist/src/ui/team-alert-backlog.js +15 -205
  143. package/dist/src/ui/team-alert-shared.js +6 -29
  144. package/dist/src/ui/team-alerts.js +4 -10
  145. package/dist/src/ui/tui/tui-backlog.js +2 -2
  146. package/dist/src/ui/tui/tui-editors.js +5 -4
  147. package/dist/src/ui/tui/tui-input.js +8 -6
  148. package/dist/src/ui/tui/tui-pane-activity.js +2 -1
  149. package/dist/src/ui/tui/tui-pane-health.js +21 -23
  150. package/dist/src/ui/tui/tui-pane-history.js +7 -5
  151. package/dist/src/ui/tui/tui-pane-pending.js +19 -15
  152. package/dist/src/ui/tui/tui-pane-session.js +4 -3
  153. package/dist/src/ui/tui/tui-panes.js +9 -1
  154. package/dist/src/ui/tui/tui.js +3 -5
  155. package/dist/src/verdict/fix-claim.js +36 -7
  156. package/dist/src/verdict/reply-contract.js +3 -4
  157. package/package.json +2 -2
  158. package/dist/src/review/review-followup.js +0 -87
  159. package/dist/src/review/review-run.js +0 -395
  160. /package/dist/src/cli/{brief-command.js → cli-brief-command.js} +0 -0
  161. /package/dist/src/cli/{config-commands.js → cli-config-commands.js} +0 -0
  162. /package/dist/src/cli/{log-commands.js → cli-log-commands.js} +0 -0
  163. /package/dist/src/cli/{notify-command.js → cli-notify-command.js} +0 -0
  164. /package/dist/src/cli/{question-commands.js → cli-question-commands.js} +0 -0
@@ -6,10 +6,9 @@ import { ensureDetachedWorktree } from "../git/worktree.js";
6
6
  import { useWorktree } from "../git/worktree-use.js";
7
7
  import { mergeToMain } from "./merge-to-main.js";
8
8
  import { rebaseOntoMain } from "./merge-git.js";
9
- import { mergeCheckRed, mergeBlocked, noteMergeRetryPassed } from "./merge-check-failures.js";
9
+ import { mergeCheckRed, noteMergeRetryPassed } from "./merge-check-failures.js";
10
10
  import { reviewAheadOfMain } from "../review/review.js";
11
- import { reviewRunConfig, modelSelectorField } from "../config/config-views.js";
12
- import { warnEventBestEffort, logEventBestEffort } from "../events/events.js";
11
+ import { logEventBestEffort } from "../events/events.js";
13
12
  import { saveRunnerStateBestEffort } from "../runner/runner-state.js";
14
13
  import { REVISION_FINAL_ON_REPEAT, REVISION_BACKSTOP, holdEntryAfterExhaustion } from "../runner/runner-revision.js";
15
14
  import { priorObjectionNumber } from "../review/review-verdict.js";
@@ -89,16 +88,14 @@ function reviewContextFor(ctx, req, wt, foldUsage) {
89
88
  * merge (a restart hand-off past its deadline, BUGS.md 2026-09-23) would otherwise sail
90
89
  * through its gate into the check. */
91
90
  export async function reviewPinnedChange(ctx, req, wt, state, foldUsage) {
92
- const { root, config } = ctx;
91
+ const { root } = ctx;
93
92
  const { role } = req;
94
93
  const ref = mergeRefName(role);
95
94
  // Both uses below — a rejection and a strike-cap discard — end a pinned change without
96
- // keeping it: drop the held-selector note and the pin ref together, so the two-part cleanup
97
- // cannot drift between them. The verify's checkout is a pooled slot (plans/worktree-pool.md,
95
+ // keeping it: drop the pin ref. The verify's checkout is a pooled slot (plans/worktree-pool.md,
98
96
  // "Vets and merges"): verifyRequest releases the lease in its finally, and a slot is reused, so
99
97
  // this path must not remove the worktree it ran in.
100
98
  const discardPin = async () => {
101
- state.mergeReviewError = undefined;
102
99
  await deleteRef(root, ref);
103
100
  };
104
101
  // Already stopping: the gate never starts, so nothing is persisted or folded — the ref stays
@@ -163,19 +160,6 @@ export async function reviewPinnedChange(ctx, req, wt, state, foldUsage) {
163
160
  }
164
161
  if (gate.decision === "failed") {
165
162
  state.lastError = `review failed: ${gate.detail}`;
166
- // A permanent provider configuration error can never succeed until the config changes, so
167
- // record the held pin with the reviewer selector that failed: leftover recovery refuses to
168
- // re-queue while that selector stands and clears the hold once it changes (BUGS.md
169
- // 2026-10-06). A discarded pin is gone, so no hold is recorded for it.
170
- if (gate.configError && !gate.discarded) {
171
- const selector = modelSelectorField(reviewRunConfig(config)).model;
172
- state.mergeReviewError = {
173
- sha: req.sha,
174
- ...(selector ? { selector } : {}),
175
- message: state.lastError,
176
- };
177
- warnEventBestEffort(root, role, `review blocked by a permanent provider configuration error${selector ? ` on ${selector}` : ""}: ${gate.detail} — the pinned change is held until the model config changes`);
178
- }
179
163
  // Strike-cap discard: the gate says so directly (it reset the worktree off the pin) — the
180
164
  // commit is gone and the ref goes too. An under-cap failure — a dead reviewer — keeps the
181
165
  // pin as it is: the gate never commits, so the pin still names the tree the next re-merge
@@ -195,8 +179,6 @@ export async function reviewPinnedChange(ctx, req, wt, state, foldUsage) {
195
179
  await setRef(root, ref, sha);
196
180
  req = { ...req, sha };
197
181
  }
198
- // The change may merge: nothing is held against the previous reviewer selector any more.
199
- state.mergeReviewError = undefined;
200
182
  return { kind: "gate", gate, sha };
201
183
  }
202
184
  /** The failed merge outcomes that KEEP the pin for another attempt: an under-cap review
@@ -291,7 +273,6 @@ async function mergeApprovedChangeIn(ctx, req) {
291
273
  const wt = await ensureDetachedWorktree(ctx.root, mergeWorktreePath(ctx.root), req.sha);
292
274
  const pinPatch = await patchId(wt, ctx.mainBranch, req.sha).catch(() => null);
293
275
  let red;
294
- let blocked;
295
276
  const result = await mergeToMain({
296
277
  root: ctx.root,
297
278
  role: req.role,
@@ -303,9 +284,6 @@ async function mergeApprovedChangeIn(ctx, req) {
303
284
  onMergeCheckRed: (check, outcome) => {
304
285
  red = { check, outcome };
305
286
  },
306
- onMergeBlocked: (reason) => {
307
- blocked = reason;
308
- },
309
287
  recheckResolved: async (resolvedWt) => {
310
288
  if (ctx.signal().aborted)
311
289
  return { verdict: "retry" };
@@ -357,12 +335,9 @@ async function mergeApprovedChangeIn(ctx, req) {
357
335
  }
358
336
  if (result === "merge_blocked" && red)
359
337
  return mergeCheckRed(ctx, req.role, wt, red);
360
- if (result === "merge_blocked" && blocked !== undefined) {
361
- return mergeBlocked(ctx, req.role, wt, blocked);
362
- }
363
338
  // merge_conflict / merge_blocked: keep the ref — the next run's recovery re-merges it.
364
- // (Cross-check blocks no longer come through here: merge-check-failures.ts's mergeBlocked
365
- // counts them.)
339
+ // (The deterministic cross-check blocks — fix-claim and backlog structure — no longer come
340
+ // through here: since part 3m/3 they are repairable and land for the main watch.)
366
341
  // A rejected recheck already wrote its own lastError and deleted its ref — leave it.
367
342
  if (result !== "rejected")
368
343
  ctx.state.lastError = `merge failed: ${result}`;
@@ -22,8 +22,9 @@ async function postReviewDue(config, root, commit) {
22
22
  return files === null || !isExemptDiff(files, config.review.exemptPaths);
23
23
  }
24
24
  /** One poll of the merge queue (the scheduler's WHEN: after the gates, never while a restart
25
- * or a disk hold is pending — a reviewer-provider hold does not stop the whole drain, it parks
26
- * only the entries a pre-merge review gates, per the role-scoped startHeld): start a
25
+ * or a disk hold is pending — a reviewer-provider hold does not stop the whole drain: it parks
26
+ * only the post-merge review drain, whose no-role startHeld reads it, never a merge entry, so
27
+ * no verify or landing waits on the reviewer): start a
27
28
  * verification for every queued change the pipeline does not already hold (drainVerify, in
28
29
  * merge-verify.ts), and start the merge when the slot is free and something is approved
29
30
  * (drainMerge). A queued merge is COMMITTED work awaiting completion, not a new run, so the
@@ -13,7 +13,7 @@ import { abortOnShutdown, acquireUnlessAborted, guardMergeTask } from "./merge-p
13
13
  import { resolveWaitStage } from "./merge-slot.js";
14
14
  import { mergeToMain } from "./merge-to-main.js";
15
15
  import { MERGE_TIER, resolveAuthor, VERIFY_TIER } from "./merge-verify.js";
16
- /** One poll of the post-merge reviews (review.afterMerge): a rejected-and-not-fixed commit is
16
+ /** One poll of the post-merge reviews: a rejected-and-not-fixed commit is
17
17
  * answered by the reviewer's own landed fix (Forward, never back 1/6) — never by a revert — and
18
18
  * the next unreviewed commit starts its review when a permit is free right now. One review at a
19
19
  * time; starts a task and returns. */
@@ -3,7 +3,7 @@
3
3
  * in execution order, plus the count of queue files the reader skipped. Pure function of the
4
4
  * collected view and a `now` instant — no I/O, no clock reads — so the age it prints can be
5
5
  * pinned by a test. */
6
- import { humanAgo, humanSeconds, secondsSince, secondsUntil } from "../text/datetime.js";
6
+ import { humanAgo, humanSeconds, humanSince, secondsUntil } from "../text/datetime.js";
7
7
  import { roleLabel } from "../roles/role-labels.js";
8
8
  import { shortSha } from "../text/format.js";
9
9
  import { filterKeepPositions } from "../collections.js";
@@ -24,11 +24,11 @@ export function queueEntryMergeLabel(sha, inFlight, now) {
24
24
  return "approved, waiting to merge";
25
25
  let label = "merging";
26
26
  if (change.startedAt)
27
- label += ` ${humanSeconds(secondsSince(change.startedAt, now))}`;
27
+ label += ` ${humanSince(change.startedAt, now)}`;
28
28
  if (change.stage)
29
29
  label += ` · ${MERGE_STAGE_LABELS[change.stage]}`;
30
30
  if (change.stageSince !== undefined)
31
- label += ` ${humanSeconds(secondsSince(change.stageSince, now))}`;
31
+ label += ` ${humanSince(change.stageSince, now)}`;
32
32
  return label;
33
33
  }
34
34
  /** One re-submitted change's revision note (plans/revise-rejected.md): `revision <round>`,
@@ -2,8 +2,8 @@
2
2
  * merge-batch.ts, whose header scopes that file to the verify and merge halves): assemble the
3
3
  * approved changes as a cherry-picked stack on main's current tip, run ONE scope-`batch` build
4
4
  * check over the combined tree, and fast-forward main through the captured shas — with the
5
- * re-stack loop for a main that moves mid-check, the doc-only exemption and its cross-checks,
6
- * and the per-attempt abort observation. The bisect over a red stack (mergeApproved, in
5
+ * re-stack loop for a main that moves mid-check, the doc-only exemption, and the per-attempt
6
+ * abort observation. The bisect over a red stack (mergeApproved, in
7
7
  * merge-batch.ts) drives this file's mergeStack one prefix at a time. */
8
8
  import { committerIdentArgs, gitTry } from "../git/git-run.js";
9
9
  import { branchHead, deleteRef, headOf } from "../git/git.js";
@@ -11,7 +11,6 @@ import { treeDiffFiles } from "../git/git-diff.js";
11
11
  import { mergeRefName, mergeLockDir } from "../paths.js";
12
12
  import { ensureDetachedWorktree } from "../git/worktree.js";
13
13
  import { useWorktree } from "../git/worktree-use.js";
14
- import { exemptSkipBlockReason } from "./merge-to-main.js";
15
14
  import { logNewQuestions } from "./merge-questions.js";
16
15
  import { openQuestions } from "../backlog/backlog.js";
17
16
  import { logEventBestEffort, warnEventBestEffort } from "../events/events.js";
@@ -81,11 +80,13 @@ async function assembleStack(root, mainBranch, wtPath, entries) {
81
80
  * the gate's own doc-only test (isExemptDiff over config.review.exemptPaths). A re-stack whose
82
81
  * new commits from main were doc-only rebuilds the checked tree with nothing but doc bytes
83
82
  * changed, and a doc-only delta cannot break the build: the reasoning verifyMerge
84
- * (src/merge/merge-to-main.ts) applies when it skips its in-lock re-check for a moved
85
- * doc-only merge. Its false-fix cross-check has no counterpart here — the delta is
86
- * commits main already merged through their own gate, not a claim this batch makes.
87
- * --no-renames so a rename out of a code path lists the deleted source, not only its exempt
88
- * destination. An unreadable diff is not exempt: the caller runs the check. */
83
+ * (src/merge/merge-to-main.ts) applies when it lets a moved doc-only merge through with no
84
+ * check. Since part 3m/3 that arm runs no cross-check, and neither does this delta — a false
85
+ * fix claim and a broken backlog structure are repairable by a later commit and reported by
86
+ * the main watch, and this delta is commits main already merged through their own gate, not a
87
+ * claim this batch makes. --no-renames so a rename out of a code path lists the deleted
88
+ * source, not only its exempt destination. An unreadable diff is not exempt: the caller runs
89
+ * the check. */
89
90
  async function exemptTreeDelta(root, from, to, exemptPaths) {
90
91
  const files = await treeDiffFiles(root, from, to);
91
92
  return files !== null && isExemptDiff(files, exemptPaths);
@@ -97,9 +98,10 @@ async function exemptTreeDelta(root, from, to, exemptPaths) {
97
98
  * won, up to BATCH_RESTACK_ATTEMPTS times, and a re-stack whose tree is the checked tree plus
98
99
  * doc-only commits skips its re-check (exemptTreeDelta). A stack whose whole delta ahead of
99
100
  * its assembly base is review-exempt skips the check too — a doc-only delta cannot break the
100
- * build (the reasoning verifyMerge's exempt arm applies) — and runs the same cross-checks
101
- * that arm runs, the backlog heading structure and the false-fix claim; one that fails either
102
- * returns `conflict`, so the per-change fallback applies the gate's own verdict per change.
101
+ * build (the reasoning verifyMerge's exempt arm applies). Since part 3m/3 that arm runs no
102
+ * cross-check and neither does this skip: a false fix claim and a broken backlog structure are
103
+ * repairable by a later commit and reported by the main watch, so the doc-only stack merges on
104
+ * the exemption for the watch to report on main's tip.
103
105
  * A primary checkout on main that holds uncommitted or untracked files the stack changes
104
106
  * returns `blocked` before any check runs, with no re-stack.
105
107
  * On `landed` every entry's ref is deleted and the red-main baseline is seeded with the tip
@@ -146,13 +148,10 @@ async function mergeStackIn(ctx, wtPath, entries) {
146
148
  // exemption instead of paying a suite run no code change asked for).
147
149
  const stackFiles = await treeDiffFiles(ctx.root, base, tip);
148
150
  if (stackFiles !== null && isExemptDiff(stackFiles, exemptPaths)) {
149
- // The same cross-checks verifyMerge's exempt arm runs (merge-to-main.ts's
150
- // exemptSkipBlockReason): the skip must not wave through an md-only edit the gate would
151
- // have rejected. A failure here cannot name a red check (none ran), so it hands the
152
- // stack to the one-at-a-time fallback, whose exempt arm blocks or rejects each change
153
- // with the proper handling. No baseline seeds — nothing ran on this tip.
154
- if (await exemptSkipBlockReason({ root: ctx.root, role: entries[0].role, mainBranch: ctx.mainBranch }, wtPath, stackFiles))
155
- return { kind: "conflict" };
151
+ // Since part 3m/3 an md-only stack's repairable findings (a false fix claim, a broken
152
+ // backlog structure) no longer refuse anything — the main watch reports them on main's
153
+ // tip after the merge — so the skip runs no cross-check and no check: doc-only cannot
154
+ // break the build. No baseline seeds — nothing ran on this tip.
156
155
  }
157
156
  else {
158
157
  // The merge cell names the check while it runs, then the merge steps after it — the ff
@@ -10,12 +10,10 @@ import { runScopedBuildCheck } from "../build/build-check-scoped.js";
10
10
  import { detectBuildCheck, gateCommandOf, mergeCommandOf } from "../build/build-check-detect.js";
11
11
  import { onlyKnownMainFailures } from "../baseline/main-watch.js";
12
12
  import { unverifiedTreeOutcome } from "../build/build-check-events.js";
13
- import { describeCheck, failureHeadline } from "../build/build-check-report.js";
13
+ import { redCheckHeadline } from "../build/build-check-report.js";
14
14
  import { MERGE_FLAKY_WARNING_PREFIX, quarantineTests } from "../review/known-flakes.js";
15
15
  import { noteGreenBaseline, noteInheritedGreen } from "../baseline/main-baseline.js";
16
16
  import { isExemptDiff } from "../review/exemptions.js";
17
- import { falseFixReason } from "../verdict/fix-claim.js";
18
- import { backlogStructureReason } from "../backlog/backlog-structure.js";
19
17
  import { withLock } from "../concurrency/lock.js";
20
18
  import { buildConflictPrompt } from "../prompt/gate-prompts.js";
21
19
  import { mergeLockDir } from "../paths.js";
@@ -121,42 +119,13 @@ async function tryMerge(ctx, wt, summary, verifiedHead) {
121
119
  return "changed";
122
120
  }, ctx.lockTimeoutMs);
123
121
  }
124
- /** The backlog-structure cross-check both verifyMerge paths run (exempt and code diffs
125
- * alike): when the tree ahead of main duplicates or drops a `## ` section heading, warn on the
126
- * role's feed with the one "merge blocked:" phrasing and return the reason (null when the
127
- * headings are intact). Shared so the wording and the block action cannot drift between the
128
- * paths. */
129
- async function structureBlocked(ctx, wt, files) {
130
- const structure = await backlogStructureReason(wt, ctx.mainBranch, files);
131
- if (!structure)
132
- return null;
133
- warnEventBestEffort(ctx.root, ctx.role, `merge blocked: ${structure}`);
134
- return structure;
135
- }
136
- /** The exempt arm's full cross-check — backlog structure, then fix-claim — shared by
137
- * verifyMerge and merge-batch.ts's stack skip: an md-only tree delta that skips the build
138
- * check must not wave through an edit the gate would have rejected. Returns the first blocking
139
- * reason (a structure reason already warned as "merge blocked: ..."), or null when the skip
140
- * may proceed. */
141
- export async function exemptSkipBlockReason(ctx, wt, files) {
142
- const structure = await structureBlocked(ctx, wt, files);
143
- if (structure)
144
- return structure;
145
- const fix = await falseFixReason(wt, ctx.mainBranch, files);
146
- // Warn like structureBlocked does: a fix-claim block that used to be silent read as five
147
- // unexplained merge_blocked retries on the feed (BUGS.md 2026-10-02). The batch stack-skip
148
- // caller may warn twice for one change (here, then again when the fallback's exempt arm
149
- // blocks it) — a duplicated line is harmless next to a silent block.
150
- if (fix)
151
- warnEventBestEffort(ctx.root, ctx.role, `merge blocked: ${fix}`);
152
- return fix ?? null;
153
- }
154
122
  /** Verify the exact tree about to reach main — the post-rebase head (BUGS.md 2026-09-08: the
155
123
  * gate's pre-check ran outside this lock against a head the rebase may have rewritten, so the
156
- * bytes that become main were never run through a check). Returns false when the tree is
157
- * structurally unsound (backlogStructureReason: a duplicated or dropped `## ` section heading,
158
- * with a warning event so a broken conflict resolution shows on the dashboards) or when the
159
- * project's declared check FAILS on the rebased tree; every other outcome merges. Skips:
124
+ * bytes that become main were never run through a check). Returns false only when the project's
125
+ * declared check FAILS on the rebased tree; every other outcome merges. Since part 3m/3 no
126
+ * other finding refuses a diff here: a conflict resolution that duplicates or drops a `## `
127
+ * section heading, or a false fix claim, is repairable by a later commit, so it lands and the
128
+ * main watch reports it on main's tip after the merge. Skips:
160
129
  * - a no-op rebase whose exact tree the gate verified (`rebasedHead === verifiedHead`): main
161
130
  * did not move under us, so the merge tree is byte-identical to what the gate's pre-check
162
131
  * already ran green. Seed the red-main baseline with the SHA that becomes main: every role's
@@ -200,27 +169,13 @@ async function verifyMerge(ctx, wt, rebasedHead, verifiedHead) {
200
169
  return true;
201
170
  }
202
171
  const files = await aheadOfMainFiles(wt, ctx.mainBranch);
203
- if (isExemptDiff(files, ctx.exemptPaths)) {
204
- // Same cross-checks as the gate (fix-claim.ts, backlog-structure.ts): the in-lock re-check
205
- // must not wave through an md-only edit the gate would have rejected — and this is the
206
- // site that catches what the gate cannot see: a conflict resolution happens AFTER the
207
- // gate, inside this lock, so a resolution that kept both sides of a `## Done` conflict and
208
- // duplicated the heading merges here or not at all (PLANS.md 2026-09-25, 9eaae5ac).
209
- const reason = await exemptSkipBlockReason(ctx, wt, files);
210
- if (reason !== null) {
211
- ctx.onMergeBlocked?.(reason);
212
- return false;
213
- }
172
+ // An exempt (md-only) diff cannot break the build and — since part 3m/3 — carries no finding
173
+ // this merge must refuse: a false fix claim and a broken backlog structure are repairable by
174
+ // a later commit, so they land for the main watch to report on main's tip. The old rationale —
175
+ // "must not wave through an md-only edit the gate would have rejected" — is gone with the
176
+ // gate's narrowing: the gate no longer rejects those findings.
177
+ if (isExemptDiff(files, ctx.exemptPaths))
214
178
  return true;
215
- }
216
- // The heading check for code diffs too, before the build check: a conflict resolution that
217
- // broke backlog structure reads as an explained block on the dashboards, not as an
218
- // unexplained red check run on a tree that could never merge.
219
- const structure = await structureBlocked(ctx, wt, files);
220
- if (structure) {
221
- ctx.onMergeBlocked?.(structure);
222
- return false;
223
- }
224
179
  if (await onlyExemptDriftFromVerified(ctx, wt, rebasedHead, verifiedHead))
225
180
  return true;
226
181
  // The run itself (build_check event, environmental-skip warning) lives in
@@ -235,7 +190,7 @@ async function verifyMerge(ctx, wt, rebasedHead, verifiedHead) {
235
190
  const failed = check.outcome;
236
191
  const retry = await runMergeCheck();
237
192
  if (retry?.outcome.status === "passed") {
238
- warnEventBestEffort(ctx.root, ctx.role, `${MERGE_FLAKY_WARNING_PREFIX}${failureHeadline(failed.outputTail) ?? describeCheck(check.check)}`);
193
+ warnEventBestEffort(ctx.root, ctx.role, `${MERGE_FLAKY_WARNING_PREFIX}${redCheckHeadline(check.check, failed.outputTail)}`);
239
194
  quarantineTests(ctx.root, failed.failingTests, failed.outputTail);
240
195
  check = retry;
241
196
  }
@@ -158,9 +158,10 @@ export async function drainVerify(ctx, p) {
158
158
  // (its role was busy when the queue was listed) or claimed its role. Start nothing for it.
159
159
  if (!fs.existsSync(file) || liveRoles(p).has(entry.role))
160
160
  continue;
161
- // A pre-merge entry during a reviewer hold stays queued instead of starting a parked verify
162
- // that fills the verify limit; a review.afterMerge role's entry keeps draining (its review
163
- // runs after merging, so the hold is not for it) — ctx's role-scoped start gate decides.
161
+ // A reviewer hold parks no named entry — every entry keeps draining (no verify, start or
162
+ // landing waits on the reviewer); only a restart or disk hold (the start gate's other legs)
163
+ // parks it here, and a parked verification re-checks the gate when its permit comes. The
164
+ // start gate decides.
164
165
  if (ctx.startHeld(entry.role))
165
166
  continue;
166
167
  startVerify(ctx, p, entry, file);
@@ -5,6 +5,7 @@ import { errorMessage, splitCommaList } from "../text/text.js";
5
5
  import { PAUSE_FOR_OVERFLOW_HINT, REASON_VALUE_ERROR, ROLE_VALUE_ERROR } from "../cli/cli-flag-specs.js";
6
6
  import { artifactPhrase, hasRetirableLeftovers, previewRetire, retireRole } from "./operator-retire.js";
7
7
  import { previewRevert, revertFollowUp, revertMergedCommit, runRevertSha } from "./operator-revert.js";
8
+ import { distinctOrdered } from "../collections.js";
8
9
  import { runNotFoundMessage } from "../run/run-detail.js";
9
10
  import { readRunDetail } from "../run/run-detail-data.js";
10
11
  import { readRunRows } from "../history/history-data.js";
@@ -27,7 +28,7 @@ import { markerApplyNote, NO_HARNESS_ERROR, PAUSE_FOR_MAX_MS, cancelScheduledSto
27
28
  * the `prompt` command, which drives the durable per-role queues rather than the marker
28
29
  * protocol, lives beside them in src/inbox/prompt-commands.ts, and the `config` command,
29
30
  * which reads and writes tumwater.json directly rather than touching team state, in
30
- * src/cli/config-commands.ts. Every command here is deliberately usable without a live
31
+ * src/cli/cli-config-commands.ts. Every command here is deliberately usable without a live
31
32
  * harness except `abort` and `stop`, which have nothing to reach when no team is up. */
32
33
  /** The `--role <id>` value when given, resolved WITHOUT tumwater.json when it names a
33
34
  * built-in catalog role: the team itself tolerates a broken config (the live reload keeps
@@ -67,7 +68,7 @@ function namedRoleList(root, args) {
67
68
  const pieces = rolePieces(args);
68
69
  if (pieces === null)
69
70
  return null;
70
- return [...new Set(pieces.map((piece) => namedRole(root, ["--role", piece])))];
71
+ return distinctOrdered(pieces.map((piece) => namedRole(root, ["--role", piece])));
71
72
  }
72
73
  /** namedRole for the commands that write or lift the per-role pause marker, over a comma list
73
74
  * (`--role clean,dedupe`, like `history --role`): `feature-1` (`bugfix-1`) is the pause key of
@@ -80,7 +81,7 @@ function pauseTargetRoles(root, args) {
80
81
  if (pieces === null)
81
82
  return null;
82
83
  const roles = pieces.map((piece) => [...INSTANCE_ROLES].some((base) => piece === `${base}-1`) ? piece : namedRole(root, ["--role", piece]));
83
- return [...new Set(roles)];
84
+ return distinctOrdered(roles);
84
85
  }
85
86
  /** The `--role <id>` value a marker command requires: namedRole's resolution plus the
86
87
  * command-specific "requires --role" failure. retire needs a target (unlike
@@ -1,5 +1,5 @@
1
1
  import { publishInfoFields } from "../team/team-orchestrator-info.js";
2
- import { baseRoleOf, runnerEnabled } from "../roles/runner-ids.js";
2
+ import { runnerEnabled } from "../roles/runner-ids.js";
3
3
  import { DIRECTOR_ROLE } from "../roles/roles.js";
4
4
  import { reviewHoldKey, pollDeferralInputs, pollRunnerReasons } from "./orchestrator-scheduling.js";
5
5
  import { launchDueRuns } from "./orchestrator-launch.js";
@@ -23,7 +23,7 @@ export function newPollState() {
23
23
  }
24
24
  /** How often the orchestrator's poll loop stands down the orphan reap — a once-per-interval
25
25
  * throttle so a slow process-table scan never runs on the busy per-poll hot path. */
26
- export const ORPHAN_REAP_INTERVAL_MS = 15 * 60 * 1000;
26
+ export const ORPHAN_REAP_INTERVAL_MS = 15 * 60_000;
27
27
  /** Whether the orphan reap is due now, given the last poll it ran: true at and after
28
28
  * `now >= last + intervalMs`. Purely a clock comparison so tests pin it from literal
29
29
  * numbers. A fresh state's `last` of 0 is always due against a real `now`. */
@@ -38,20 +38,13 @@ function runStartHeld(state) {
38
38
  return state.holdForRestart || state.restart || state.diskHeld;
39
39
  }
40
40
  /** The one start-gate rule for merges: a restart/disk hold's `held` counts against every role,
41
- * while a hold on the reviewer's provider (`reviewHeld`) parks only the entries a pre-merge
42
- * review gates — a role on `review.afterMerge` keeps draining (it merges without a reviewer),
43
- * and no role at all (the conservative team-wide verdict a caller that cannot name a role
44
- * reads) still holds. Shared by pollMergeDrain's startHeld and the merge tests, so the
45
- * production wiring and its coverage cannot drift. */
46
- export function mergeStartHeld(held, reviewHeld, afterMergeRoles, role) {
47
- return held || (reviewHeld && (role === undefined || !afterMergeRoles.has(baseRoleOf(role))));
48
- }
49
- /** The base roles whose review runs after merging — the config's `review.afterMerge` list, mapped
50
- * through `baseRoleOf` so a listed base id stands for all its parallel instances. The one build of
51
- * the set pollMergeDrain's start gate and pollSchedule's launch gate both exempt from a
52
- * reviewer-hold, so the two passes cannot read the standing differently. */
53
- function afterMergeRoleIds(config) {
54
- return new Set((config.review.afterMerge ?? []).map(baseRoleOf));
41
+ * while a hold on the reviewer's provider (`reviewHeld`) parks only the entries a caller that
42
+ * names no role admits — the post-merge review drain. A role named (every merge entry) is never
43
+ * held by the reviewer: no role start or landing waits on the reviewer. Shared by
44
+ * pollMergeDrain's startHeld and the merge tests, so the production wiring and its coverage
45
+ * cannot drift. */
46
+ export function mergeStartHeld(held, reviewHeld, role) {
47
+ return held || (reviewHeld && role === undefined);
55
48
  }
56
49
  /** Live-reload, notify/retention/launchservices, CLI request markers, abort settling and the
57
50
  * branch-divergence watch. Writes state.warnedBranchDivergence. */
@@ -148,17 +141,15 @@ export function pollGatesAndHolds(ctx, state, { liveConfig, now }) {
148
141
  ["slotPool", slotPoolSnapshot(root)],
149
142
  ]);
150
143
  // The failure hold, keyed per provider (PLANS.md 2026-10-05): a role is held when ITS
151
- // run model's provider stands under a hold, and the roles a pre-merge review gates are held
152
- // when the reviewer's provider is (with the review gate on their approved change could not
153
- // merge without a reviewer — while a role on `review.afterMerge` merges without one, so it is
154
- // exempt, and the merge queue reads the same scoped reviewHeld verdict). Key presence in the
144
+ // run model's provider stands under a hold. A hold on the reviewer's provider parks only
145
+ // the post-merge review drain, never a role start, verify or landing. Key presence in the
155
146
  // map is relapse memory, not a hold: heldProviders() reads only standing holds (`until`
156
147
  // non-null), so a lifted hold never keeps blocking.
157
148
  const teamHeldProviders = heldProviders(gateStates.teamHold);
158
149
  const teamHeldNow = () => heldProviders(gateStates.teamHold);
159
150
  // The reviewer's seam is read from the config merges actually review under — the poll's
160
151
  // roleConfig, which a used-up claude window or the cap has already moved to a fallback —
161
- // so a reviewer that left claude no longer holds the roles a pre-merge review gates on the
152
+ // so a reviewer that left claude no longer parks the post-merge review drain on the
162
153
  // claude hold.
163
154
  const reviewSeamKey = reviewHoldKey(gates.roleConfig);
164
155
  return {
@@ -166,7 +157,6 @@ export function pollGatesAndHolds(ctx, state, { liveConfig, now }) {
166
157
  teamHeldProviders,
167
158
  teamHeldNow,
168
159
  reviewHeldNow: () => liveConfig.review.enabled && teamHeldNow().has(reviewSeamKey),
169
- reviewHeld: liveConfig.review.enabled && teamHeldProviders.has(reviewSeamKey),
170
160
  roleProviders: new Map(runners.map((r) => [r.role, r.runProvider()])),
171
161
  };
172
162
  }
@@ -197,6 +187,8 @@ export async function pollRedeploy(ctx, state, { liveConfig, mainHead, now }) {
197
187
  directorInFlight: ctx.directorInFlight.size,
198
188
  roleRunP75Ms: p75RunDurationMs(ctx.roleRunDurationsMs),
199
189
  }, liveConfig.autoRestart, now);
190
+ // The tip beside the target: a tip no passing check covers yet is published as waitingForCheck.
191
+ await redeploy.noteTip(mainHead);
200
192
  publishInfoFields(ctx.root, ctx.info, [["build", redeploy.status(now)]]);
201
193
  if (action === "restart") {
202
194
  state.restart = true;
@@ -218,16 +210,12 @@ export async function pollRedeploy(ctx, state, { liveConfig, mainHead, now }) {
218
210
  * merge slot, and the dedupe against main). A restart or disk hold stops the whole drain, as it
219
211
  * starts no run; what is already in flight carries on, and a verify parked for its permit
220
212
  * meets the same start gate as a parked run when the permit comes. A hold on the reviewer's
221
- * provider parks only the entries a pre-merge review gates, per the role-scoped mergeStartHeld:
222
- * a `review.afterMerge` role's approved/queued changes keep draining. */
213
+ * provider parks nothing in the drain — no merge entry is held by the reviewer (its hold parks
214
+ * only the post-merge review drain, whose no-role start gate reads it). */
223
215
  export async function pollMergeDrain(ctx, state, { liveConfig, mainHead }, gates) {
224
216
  if (state.holdForRestart || state.diskHeld)
225
217
  return;
226
218
  const { root, mainBranch } = ctx;
227
- // The roles whose review runs after merging (plans post-merge-review role): while the
228
- // reviewer is held, their approved/queued changes keep draining, so the per-entry start gate
229
- // exempts them from the reviewer-hold leg below.
230
- const afterMergeRoles = afterMergeRoleIds(liveConfig);
231
219
  // A `main_red` pin the pipeline kept goes back on the queue once main's head has moved.
232
220
  for (const r of ctx.runners)
233
221
  await requeueMainRedPin(root, mainBranch, r.state, mainHead);
@@ -240,7 +228,7 @@ export async function pollMergeDrain(ctx, state, { liveConfig, mainHead }, gates
240
228
  liveConfig,
241
229
  roleConfig: gates.roleConfig,
242
230
  directorConfig: liveConfig,
243
- startHeld: (role) => mergeStartHeld(runStartHeld(state), gates.reviewHeldNow(), afterMergeRoles, role),
231
+ startHeld: (role) => mergeStartHeld(runStartHeld(state), gates.reviewHeldNow(), role),
244
232
  }, ctx.merges);
245
233
  }
246
234
  /** The scheduling pass: the deferral inputs feed pollRunnerReasons, whose reasons map
@@ -248,10 +236,6 @@ export async function pollMergeDrain(ctx, state, { liveConfig, mainHead }, gates
248
236
  export async function pollSchedule(ctx, state, { liveConfig, mainHead, now }, gates) {
249
237
  const { root, runners, gateStates } = ctx;
250
238
  const inputs = pollDeferralInputs(root, runners, liveConfig, gateStates, gates, ctx.breakerNow());
251
- // The roles whose review runs after merging: while the reviewer is held their runs stay
252
- // launchable (the pre-merge gate skips their review), so the permit-time start gate exempts
253
- // them from the reviewer-hold leg below, exactly as the scheduling pass and merge drain do.
254
- const afterMergeRoles = afterMergeRoleIds(liveConfig);
255
239
  const reasons = await pollRunnerReasons({
256
240
  root,
257
241
  runners,
@@ -268,14 +252,11 @@ export async function pollSchedule(ctx, state, { liveConfig, mainHead, now }, ga
268
252
  bootstrapHeld: gates.bootstrapHeld,
269
253
  budgetPausedRoles: gates.budgetPausedRoles,
270
254
  probeRoles: inputs.probeRoles,
271
- reviewStrongPaused: inputs.reviewStrongPaused,
272
255
  roleQuietHeld: gates.roleQuietHeld,
273
256
  holdForRestart: state.holdForRestart,
274
257
  diskHeld: state.diskHeld,
275
258
  heldProviders: gates.teamHeldProviders,
276
259
  windowHeldProviders: windowHeldProviders(gateStates.teamHold),
277
- reviewHeld: gates.reviewHeld,
278
- afterMergeRoles,
279
260
  roleProviders: gates.roleProviders,
280
261
  openBugsNow: inputs.openBugsNow,
281
262
  workBacklogOpen: inputs.workBacklogOpen,
@@ -303,8 +284,7 @@ export async function pollSchedule(ctx, state, { liveConfig, mainHead, now }, ga
303
284
  roleRunDurationsMs: ctx.roleRunDurationsMs,
304
285
  startHeld: (role) => runStartHeld(state) ||
305
286
  (role !== DIRECTOR_ROLE
306
- ? (!afterMergeRoles.has(baseRoleOf(role)) && gates.reviewHeldNow()) ||
307
- gates.teamHeldNow().has(gates.roleProviders.get(role))
287
+ ? gates.teamHeldNow().has(gates.roleProviders.get(role))
308
288
  : windowHeldProviders(gateStates.teamHold).has(gates.roleProviders.get(role))),
309
289
  });
310
290
  }
@@ -48,8 +48,8 @@ export async function pollRunnerReasons(ctx) {
48
48
  }
49
49
  /** The team-hold key of the reviewer's seam, read from the config merges actually review under
50
50
  * (the poll's roleConfig, which a used-up claude window or the cap has moved to a fallback), so
51
- * a reviewer that left claude no longer holds the roles a pre-merge review gates on the claude
52
- * hold. */
51
+ * a reviewer that left claude no longer parks the no-role post-merge review drain on the claude
52
+ * hold — no named entry (start, verify or landing) waits on the reviewer. */
53
53
  export function reviewHoldKey(roleConfig) {
54
54
  return seamHoldKey(reviewRunConfig(roleConfig));
55
55
  }
@@ -65,11 +65,8 @@ export function reviewHoldKey(roleConfig) {
65
65
  * exactly why it is being probed). Only those roles pierce the budget hold, and the launch
66
66
  * pass admits exactly one of them as the probe — a probe blind to the pair's tier would lift
67
67
  * the pause for every role, and a probe with no eligible runner must not hijack the poll's
68
- * other launches. The review-on strong pause (budgetGate): with the review gate on, an
69
- * unresolvable strong tier means nothing could merge, so every role a pre-merge review gates is
70
- * held (a `review.afterMerge` role is exempt — its review runs after merging) — the per-tier
71
- * pause set alone would let small/default roles author changes no reviewer could judge. The
72
- * probe of the strong pair pierces this hold for exactly the probed tier's roles too. */
68
+ * other launches. The probe of a demoted pair pierces the hold for
69
+ * exactly the probed tier's roles too. */
73
70
  export function pollDeferralInputs(root, runners, liveConfig, gateStates, gates, breakerNowMs) {
74
71
  const openBugsNow = openBugs(root).length > 0;
75
72
  const workBacklogOpen = eligibleEntries(root, "feature").length > 0 || eligibleEntries(root, "bugfix").length > 0;
@@ -85,6 +82,5 @@ export function pollDeferralInputs(root, runners, liveConfig, gateStates, gates,
85
82
  probeRoles.add(r.role);
86
83
  }
87
84
  }
88
- const reviewStrongPaused = gates.budgetActive && liveConfig.review.enabled && gates.servingResolved.strong.pair === null;
89
- return { openBugsNow, workBacklogOpen, plansFull, probePair, probeRoles, reviewStrongPaused };
85
+ return { openBugsNow, workBacklogOpen, plansFull, probePair, probeRoles };
90
86
  }