tumwater 0.4.1 → 0.4.2

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 (186) hide show
  1. package/README.md +4 -6
  2. package/dist/build-info.json +2 -2
  3. package/dist/src/agent/backend-traits.js +14 -0
  4. package/dist/src/agent/claude/claude-stream.js +27 -31
  5. package/dist/src/agent/codex/codex-rollout.js +38 -24
  6. package/dist/src/agent/codex/codex-stream.js +71 -38
  7. package/dist/src/agent/image-input.js +18 -87
  8. package/dist/src/agent/opencode/opencode-catalog.js +2 -2
  9. package/dist/src/agent/opencode/opencode-stream.js +4 -4
  10. package/dist/src/agent/run-agent.js +11 -2
  11. package/dist/src/agent/run-settle.js +22 -13
  12. package/dist/src/agent/run-spawn.js +3 -12
  13. package/dist/src/agent/run-stream.js +2 -10
  14. package/dist/src/agent/session-ledger.js +16 -0
  15. package/dist/src/backlog/backlog-archive.js +64 -165
  16. package/dist/src/backlog/backlog-eligibility.js +50 -58
  17. package/dist/src/backlog/backlog-file-bugs.js +133 -0
  18. package/dist/src/backlog/backlog-index-data.js +2 -2
  19. package/dist/src/backlog/backlog-md.js +38 -27
  20. package/dist/src/backlog/backlog-release.js +11 -19
  21. package/dist/src/backlog/backlog-structure.js +14 -1
  22. package/dist/src/backlog/backlog-write.js +1 -1
  23. package/dist/src/backlog/backlog.js +5 -4
  24. package/dist/src/backlog/question-answer.js +30 -14
  25. package/dist/src/baseline/main-baseline.js +30 -20
  26. package/dist/src/baseline/main-guardrails.js +54 -17
  27. package/dist/src/baseline/main-watch.js +1 -1
  28. package/dist/src/budget/budget-wiring.js +0 -5
  29. package/dist/src/budget/budget.js +2 -1
  30. package/dist/src/build/build-check-scoped.js +70 -41
  31. package/dist/src/change/change-data.js +4 -2
  32. package/dist/src/cli/cli-command-args.js +199 -98
  33. package/dist/src/cli/cli-flag-specs.js +1 -4
  34. package/dist/src/cli/cli-review-commands.js +2 -1
  35. package/dist/src/cli/cli-role-command.js +27 -50
  36. package/dist/src/cli/cli-start.js +62 -12
  37. package/dist/src/cli/follow-view.js +3 -1
  38. package/dist/src/cli/help.js +6 -7
  39. package/dist/src/cli/log-commands.js +3 -1
  40. package/dist/src/cli.js +3 -7
  41. package/dist/src/collections.js +21 -7
  42. package/dist/src/config/config-fallbacks.js +0 -4
  43. package/dist/src/config/config-live.js +179 -147
  44. package/dist/src/config/config-views.js +2 -7
  45. package/dist/src/config/config-write.js +19 -26
  46. package/dist/src/doctor/doctor-backlog-bugs.js +17 -115
  47. package/dist/src/doctor/doctor-backlog-plans.js +8 -8
  48. package/dist/src/doctor/doctor-backlog.js +22 -36
  49. package/dist/src/doctor/doctor-check-names.js +2 -2
  50. package/dist/src/doctor/doctor-claude-checks.js +2 -2
  51. package/dist/src/doctor/doctor-contention-checks.js +1 -1
  52. package/dist/src/doctor/doctor-holds.js +13 -11
  53. package/dist/src/doctor/doctor-model-checks.js +8 -184
  54. package/dist/src/doctor/doctor-notify.js +2 -5
  55. package/dist/src/doctor/doctor-opencode-checks.js +85 -48
  56. package/dist/src/doctor/doctor-project-checks.js +66 -17
  57. package/dist/src/doctor/doctor-role-notes.js +6 -24
  58. package/dist/src/doctor/doctor.js +6 -6
  59. package/dist/src/doctor/probe.js +1 -1
  60. package/dist/src/events/event-format.js +5 -15
  61. package/dist/src/events/event-labels.js +0 -1
  62. package/dist/src/events/event-legacy.js +1 -1
  63. package/dist/src/events/event-window.js +1 -1
  64. package/dist/src/events/events.js +15 -2
  65. package/dist/src/failure/failure-state-change.js +183 -68
  66. package/dist/src/failure/time-spend.js +1 -1
  67. package/dist/src/files/json-object.js +15 -2
  68. package/dist/src/gates/startup-gate.js +28 -28
  69. package/dist/src/git/slot-salvage.js +5 -4
  70. package/dist/src/gui/gui-admin-endpoints.js +2 -3
  71. package/dist/src/gui/gui-backlog-commands.js +1 -1
  72. package/dist/src/gui/gui-backlog-endpoints.js +1 -7
  73. package/dist/src/gui/gui-endpoint-commands.js +1 -1
  74. package/dist/src/gui/gui-operator-commands.js +0 -12
  75. package/dist/src/gui/gui-prompt-commands.js +26 -20
  76. package/dist/src/gui/gui-report-endpoints.js +2 -1
  77. package/dist/src/gui/gui-server.js +1 -2
  78. package/dist/src/history/history.js +102 -67
  79. package/dist/src/inbox/inbox-submit.js +1 -5
  80. package/dist/src/inbox/prompt-commands.js +24 -19
  81. package/dist/src/init/init.js +68 -15
  82. package/dist/src/merge/merge-core.js +1 -1
  83. package/dist/src/merge/merge-post-review-drain.js +1 -1
  84. package/dist/src/operator/operator-commands.js +68 -47
  85. package/dist/src/operator/retire.js +2 -1
  86. package/dist/src/orchestrator/retention.js +6 -5
  87. package/dist/src/paths.js +0 -6
  88. package/dist/src/pi/pi-watchdogs.js +20 -1
  89. package/dist/src/pi-extension/context-shake.js +55 -31
  90. package/dist/src/process/process.js +23 -0
  91. package/dist/src/process/supervisor.js +17 -1
  92. package/dist/src/prompt/gate-notes.js +9 -9
  93. package/dist/src/prompt/notes-backlog.js +11 -24
  94. package/dist/src/prompt/prompt-followup.js +4 -12
  95. package/dist/src/prompt/prompt.js +4 -5
  96. package/dist/src/report/report-data.js +10 -225
  97. package/dist/src/report/report-fold.js +20 -295
  98. package/dist/src/report/report-main-red.js +45 -42
  99. package/dist/src/report/report-render.js +66 -39
  100. package/dist/src/report/report-since-data.js +218 -0
  101. package/dist/src/report/report-usage-fold.js +288 -0
  102. package/dist/src/report/report.js +2 -1
  103. package/dist/src/review/known-flakes.js +3 -3
  104. package/dist/src/review/post-merge-review-accept.js +3 -2
  105. package/dist/src/review/post-merge-review.js +9 -9
  106. package/dist/src/review/quarantine-render.js +2 -1
  107. package/dist/src/roles/role-catalog.js +18 -30
  108. package/dist/src/roles/role-guidance.js +18 -43
  109. package/dist/src/roles/role-view.js +1 -2
  110. package/dist/src/run/ci-parity.js +5 -6
  111. package/dist/src/run/qa-coverage.js +4 -4
  112. package/dist/src/run/run-detail-data.js +23 -7
  113. package/dist/src/run/run-detail-render.js +6 -0
  114. package/dist/src/run/run-detail.js +44 -22
  115. package/dist/src/run/run-dismiss.js +43 -0
  116. package/dist/src/run/run-prompt.js +100 -56
  117. package/dist/src/run/run-resume.js +32 -31
  118. package/dist/src/run/run-stage.js +4 -21
  119. package/dist/src/run/run-timing.js +18 -4
  120. package/dist/src/run/run-verdict.js +8 -73
  121. package/dist/src/run/stage-backlog-checks.js +2 -29
  122. package/dist/src/run/stage-check.js +4 -12
  123. package/dist/src/runner/runner-outcome.js +0 -5
  124. package/dist/src/runner/runner-run.js +2 -79
  125. package/dist/src/runner/runner-state-load.js +0 -10
  126. package/dist/src/runner/runner.js +1 -32
  127. package/dist/src/scheduling/claims.js +3 -10
  128. package/dist/src/status/status-data.js +5 -9
  129. package/dist/src/status/status-role-notes.js +18 -14
  130. package/dist/src/status/status-roles.js +2 -35
  131. package/dist/src/text/datetime.js +8 -1
  132. package/dist/src/text/text.js +12 -0
  133. package/dist/src/ui/alert-feeds.js +7 -212
  134. package/dist/src/ui/badges.js +2 -3
  135. package/dist/src/ui/gui/gui-client-boot.js +19 -4
  136. package/dist/src/ui/gui/gui-client-drawer.js +1 -1
  137. package/dist/src/ui/gui/gui-client-report-chart.js +10 -8
  138. package/dist/src/ui/gui/gui-client-report.js +1 -2
  139. package/dist/src/ui/gui/gui-client-settings.js +0 -23
  140. package/dist/src/ui/gui/gui-client-team.js +26 -0
  141. package/dist/src/ui/gui/gui-icons.js +7 -1
  142. package/dist/src/ui/status-model.js +2 -2
  143. package/dist/src/ui/status-payload.js +3 -3
  144. package/dist/src/ui/status-render.js +3 -3
  145. package/dist/src/ui/team-alert-backlog.js +23 -54
  146. package/dist/src/ui/team-alert-shared.js +23 -10
  147. package/dist/src/ui/team-alert-status.js +8 -3
  148. package/dist/src/ui/team-alert-tail.js +1 -14
  149. package/dist/src/ui/team-alerts.js +6 -17
  150. package/dist/src/ui/transcript-tail.js +137 -94
  151. package/dist/src/ui/tui/tui-editor-answer.js +54 -44
  152. package/dist/src/ui/tui/tui-editor-attach.js +74 -63
  153. package/dist/src/ui/tui/tui-editor-backends.js +62 -56
  154. package/dist/src/ui/tui/tui-editor-brief.js +64 -54
  155. package/dist/src/ui/tui/tui-editor-budget.js +105 -93
  156. package/dist/src/ui/tui/tui-editor-config.js +2 -4
  157. package/dist/src/ui/tui/tui-editor-entry.js +171 -153
  158. package/dist/src/ui/tui/tui-editor-instances.js +2 -1
  159. package/dist/src/ui/tui/tui-editor-pause.js +209 -183
  160. package/dist/src/ui/tui/tui-editor-prompt.js +44 -34
  161. package/dist/src/ui/tui/tui-editor-queued.js +74 -64
  162. package/dist/src/ui/tui/tui-editor-quiet.js +121 -108
  163. package/dist/src/ui/tui/tui-editor-release.js +50 -42
  164. package/dist/src/ui/tui/tui-editor-retire.js +57 -46
  165. package/dist/src/ui/tui/tui-editor-role-enabled.js +90 -80
  166. package/dist/src/ui/tui/tui-editor-role-file.js +58 -46
  167. package/dist/src/ui/tui/tui-editor-role-key.js +49 -42
  168. package/dist/src/ui/tui/tui-editor-search.js +70 -58
  169. package/dist/src/ui/tui/tui-frame.js +1 -1
  170. package/dist/src/ui/tui/tui-keys.js +1 -1
  171. package/dist/src/ui/tui/tui-pane-activity.js +62 -50
  172. package/dist/src/ui/tui/tui-pane-backlog.js +4 -4
  173. package/dist/src/ui/tui/tui-pane-health.js +3 -24
  174. package/dist/src/ui/tui/tui-pane-history.js +20 -24
  175. package/dist/src/ui/tui/tui-pane-report.js +74 -57
  176. package/dist/src/ui/tui/tui-pane-session.js +3 -2
  177. package/dist/src/ui/tui/tui-pane-transcript.js +151 -128
  178. package/dist/src/ui/tui/tui-pane.js +201 -174
  179. package/dist/src/ui/tui/tui-panes.js +2 -3
  180. package/dist/src/ui/tui/tui.js +3 -3
  181. package/dist/src/verdict/fix-claim.js +18 -6
  182. package/dist/src/verdict/refusal.js +30 -6
  183. package/package.json +1 -1
  184. package/dist/src/doctor/image-probe.js +0 -257
  185. package/dist/src/ui/team-alert-backlog-feed.js +0 -181
  186. package/dist/src/ui/team-alert-merge.js +0 -183
@@ -24,12 +24,10 @@ import { ONCE_FAILURE_RESULTS, inheritedWindowStart, onceFailures, onceReport, o
24
24
  * renames the other. */
25
25
  const GUI_TOKEN_ENV = "TUMWATER_GUI_TOKEN";
26
26
  export { ONCE_FAILURE_RESULTS, inheritedWindowStart, onceFailures, onceReport, onceSummary, parseRunWindow, renderOnceSummary, windowReport, windowSummary, };
27
- /** Parse and validate the invocation before any team boots: the --tui/--gui/--json/--port/
28
- * --all-interfaces/--token/--role/--for/--branch guards, the --token argv scrub, runStartupCheck,
29
- * and the already-running-orchestrator refusal. Returns the resolved invocation. */
30
- async function parseStartInvocation(root, args) {
31
- const once = args.includes("--once");
32
- const json = args.includes("--json");
27
+ /** Refuse the --once run-mode rivals: a TUI and a dashboard each cannot be hosted by a run that
28
+ * is about to stop, so both are refused together before any boot. --for stays allowed — both
29
+ * serve for the window. Owns the run-mode rival refusals. */
30
+ function assertOnceRivalFlags(args, once) {
33
31
  // The TUI cannot be hosted by a run that is about to stop, like the dashboard: a --once round
34
32
  // drains and exits within the same invocation, so the two shapes are refused together before
35
33
  // any boot. --for stays allowed — the TUI runs for the window, like the dashboard.
@@ -40,6 +38,10 @@ async function parseStartInvocation(root, args) {
40
38
  // stays allowed — the dashboard serves for the window.
41
39
  if (once && args.includes("--gui"))
42
40
  failRivalShapes("--gui", "--once", "a one-round run cannot serve a dashboard it is about to kill");
41
+ }
42
+ /** Refuse the dashboard-only flags that name nothing without --gui. Owns the dashboard-only
43
+ * refusals. */
44
+ function assertDashboardOnlyFlags(args) {
43
45
  // `--port` chooses the `--gui` dashboard's port; without `--gui` it names no port for this
44
46
  // command, so refuse it (a valid value already passed the spec's shape gate) before any boot.
45
47
  if (args.includes("--port") && !args.includes("--gui"))
@@ -52,6 +54,10 @@ async function parseStartInvocation(root, args) {
52
54
  fail("--all-interfaces is only valid with --gui (e.g. `tumwater start --gui --all-interfaces`); the standalone dashboard is `tumwater gui --all-interfaces`");
53
55
  if (args.includes("--token") && !args.includes("--gui"))
54
56
  fail("--token is only valid with --gui (e.g. `tumwater start --gui --token s3cret`); the standalone dashboard is `tumwater gui --token <secret>`");
57
+ }
58
+ /** Check the --token value and scrub `--token <value>` off this process's argv. Owns the --token
59
+ * value check and the argv scrub. */
60
+ function handleTokenFlag(args) {
55
61
  // A malformed --token (valueless, empty, or flag-looking) must fail here before any boot, so
56
62
  // a bad secret never leaves the team running behind a dashboard that exited. The same
57
63
  // tokenValueProblem `tumwater gui` runs, named for the one-command form the operator typed.
@@ -69,12 +75,10 @@ async function parseStartInvocation(root, args) {
69
75
  process.argv.splice(argvToken, 2);
70
76
  say(`removed --token from this process's command line; prefer the ${GUI_TOKEN_ENV} env var`);
71
77
  }
72
- const forMs = parseRunWindow(args, once);
73
- const branchArg = parseBranchFlag(args);
74
- const startup = await runStartupCheck(root, branchArg);
75
- if ("problem" in startup)
76
- fail(startup.problem);
77
- const { config, mainBranch } = startup;
78
+ }
79
+ /** Parse the --role filter against the live config and guard it to --once rounds. Owns the
80
+ * --role parse and its --once guard; the disabled/unknown guards stay separate (see below). */
81
+ function resolveRoleFilter(args, config, once) {
78
82
  // A scoped once round: `--role <id>[,<id>...]` names the runners that run. Parsed here, where the
79
83
  // live config is readable. The parser accepts every known id (custom roles included, enabled
80
84
  // or not) so a typo still fails with the did-you-mean hint; an id that is known but has no
@@ -84,6 +88,11 @@ async function parseStartInvocation(root, args) {
84
88
  const roleFilter = parseRoleListFlag(args, knownRoleIds(config));
85
89
  if (roleFilter !== null && !once)
86
90
  fail("--role is only valid with --once");
91
+ return roleFilter;
92
+ }
93
+ /** Refuse --json without --once or --for, and the --gui/--tui rivals of a --json round/window.
94
+ * Owns the --json mode refusals. */
95
+ function assertJsonMode(args, json, once, forMs) {
87
96
  if (json && !once && forMs === null)
88
97
  fail("--json is only valid with --once or --for");
89
98
  // Both interactive modes write their own banner to the stdout a JSON document must own, so a
@@ -92,6 +101,10 @@ async function parseStartInvocation(root, args) {
92
101
  failRivalShapes("--json", "--gui", "the dashboard writes its banner to the stdout a JSON document must own");
93
102
  if (json && args.includes("--tui"))
94
103
  failRivalShapes("--json", "--tui", "a TUI owns the terminal");
104
+ }
105
+ /** Guard a non-null --role filter against a disabled or unknown id. Owns the disabled/unknown
106
+ * --role guards, firing after the --json mode refusals so the fire order upstream is unchanged. */
107
+ function assertRoleFilterRunnable(roleFilter, config) {
95
108
  if (roleFilter !== null) {
96
109
  const runners = runnerIds(config);
97
110
  const missing = roleFilter.find((id) => !runners.includes(id));
@@ -102,6 +115,10 @@ async function parseStartInvocation(root, args) {
102
115
  fail(unknownRoleMessage(missing, runners));
103
116
  }
104
117
  }
118
+ }
119
+ /** Refuse a second team in one repo by naming the running pid and the two ways to stop it. Owns
120
+ * the already-running-orchestrator refusal. */
121
+ function assertNoRunningOrchestrator(root) {
105
122
  // The refusal an operator hits by trying to start a second team in one repo: name the
106
123
  // running pid and the two ways to stop it, so the fix is in the message instead of a
107
124
  // separate `tumwater status`/help lookup. The info file is read once and reused for the
@@ -109,6 +126,29 @@ async function parseStartInvocation(root, args) {
109
126
  const running = readOrchestratorInfo(root);
110
127
  if (running !== null && orchestratorAlive(root, running))
111
128
  fail(`an orchestrator is already running for this repo (pid ${running.pid}) — stop it with \`tumwater stop\` from another terminal, or press Ctrl+C in the terminal that started it`);
129
+ }
130
+ /** Parse and validate the invocation before any team boots: the --tui/--gui/--json/--port/
131
+ * --all-interfaces/--token/--role/--for/--branch guards, the --token argv scrub, runStartupCheck,
132
+ * and the already-running-orchestrator refusal. Returns the resolved invocation. The per-job
133
+ * guard groups each live in a named helper — assertOnceRivalFlags, assertDashboardOnlyFlags,
134
+ * handleTokenFlag, resolveRoleFilter, assertJsonMode, assertRoleFilterRunnable and
135
+ * assertNoRunningOrchestrator — called here in fire order. */
136
+ async function parseStartInvocation(root, args) {
137
+ const once = args.includes("--once");
138
+ const json = args.includes("--json");
139
+ assertOnceRivalFlags(args, once);
140
+ assertDashboardOnlyFlags(args);
141
+ handleTokenFlag(args);
142
+ const forMs = parseRunWindow(args, once);
143
+ const branchArg = parseBranchFlag(args);
144
+ const startup = await runStartupCheck(root, branchArg);
145
+ if ("problem" in startup)
146
+ fail(startup.problem);
147
+ const { config, mainBranch } = startup;
148
+ const roleFilter = resolveRoleFilter(args, config, once);
149
+ assertJsonMode(args, json, once, forMs);
150
+ assertRoleFilterRunnable(roleFilter, config);
151
+ assertNoRunningOrchestrator(root);
112
152
  return { once, json, forMs, branchArg, roleFilter, config, mainBranch };
113
153
  }
114
154
  /** Boot the supervised generation: the stop closure and SIGINT/SIGTERM handlers, the --for
@@ -248,6 +288,16 @@ async function runSupervisedGeneration(input) {
248
288
  // which respawns this same script — now the new code — as the next generation.
249
289
  if (exit.restart)
250
290
  process.exit(RESTART_EXIT_CODE);
291
+ // A windowed (--for) run that did not self-redeploy is done the moment its summary is out:
292
+ // exit deterministically instead of trusting the event loop to drain. This supervised
293
+ // generation runs a whole team, and any ref'd handle a shutdown misses (a watcher, marker,
294
+ // or notifier handle a join missed) would otherwise pin this process's loop open, so the
295
+ // supervisor — which waits on this child's exit — never exits and the run reads as a hang:
296
+ // summary printed, exit code null (BUGS.md 2026-10-26). The summary above was the last
297
+ // output and nothing after depends on this loop, so an explicit exit is equivalent to a
298
+ // natural one with code 0, just guaranteed.
299
+ if (forMs !== null)
300
+ process.exit(0);
251
301
  }
252
302
  /** `tumwater start`: boot the team and stream its event feed to this terminal until it stops.
253
303
  * Three layers cooperate here: without SUPERVISED_ENV this process becomes the supervisor
@@ -3,7 +3,7 @@
3
3
  * Ctrl+C or the process that started the command exits. Lifted out of
4
4
  * cli-query-commands.ts when `report -f` landed so the follow views have one leaf
5
5
  * home instead of a per-command copy. */
6
- import { startParentDeathWatch } from "../process/supervisor.js";
6
+ import { expectedSupervisorPid, startParentDeathWatch } from "../process/supervisor.js";
7
7
  import { stripTerminalControls } from "../text/text.js";
8
8
  /** The default repaint interval for a follow view — a fixed cadence, no knob. */
9
9
  const FOLLOW_VIEW_INTERVAL_MS = 2000;
@@ -47,6 +47,7 @@ export async function followView(frameText, seams) {
47
47
  // would also leave that read's rejections unhandled. Sync callers never set `painting`, so
48
48
  // the check is a no-op for them: each of their ticks still paints exactly one frame.
49
49
  let painting = false;
50
+ const expectedSupervisor = expectedSupervisorPid();
50
51
  await new Promise((resolve) => {
51
52
  const timer = setInterval(() => {
52
53
  if (painting)
@@ -68,6 +69,7 @@ export async function followView(frameText, seams) {
68
69
  clearInterval(timer);
69
70
  resolve();
70
71
  }, {
72
+ ...(expectedSupervisor !== undefined ? { expectedPpid: expectedSupervisor } : {}),
71
73
  ...(seams.ppid ? { ppid: seams.ppid } : {}),
72
74
  ...(seams.intervalMs !== undefined ? { intervalMs: seams.intervalMs } : {}),
73
75
  });
@@ -85,7 +85,7 @@ Usage:
85
85
  (merge runs and backlog tallies omitted); --until <duration>
86
86
  ends that window the given duration ago (requires --since);
87
87
  not combinable with --days
88
- tumwater doctor [<check>...] [--json] [--reprobe] [--problems] [--kill-orphans] [--commit-backlog] [--resync-install] [--drop-broken-pins] [--retire-leftovers]
88
+ tumwater doctor [<check>...] [--json] [--problems] [--kill-orphans] [--commit-backlog] [--resync-install] [--drop-broken-pins] [--retire-leftovers]
89
89
  Pre-flight check: node, git, repo, config, fallback
90
90
  model, pi, locks, update, orphans, macOS port leak
91
91
  (read-only unless --kill-orphans, --commit-backlog
@@ -102,8 +102,7 @@ Usage:
102
102
  worktree, branch and merge ref, like tumwater retire --role <id> per role,
103
103
  never --force; exit 0/1; --json prints the report object —
104
104
  header, the checks array with level, name, and detail,
105
- and verdict; probes image-input models — --reprobe
106
- re-probes every one, bypassing the 7-day cache; --problems prints only the warn
105
+ and verdict; --problems prints only the warn
107
106
  and fail rows (and how many ok rows it hid), the same
108
107
  verdict and exit code; with --json the checks array holds
109
108
  only those rows; naming checks (as the report prints them, any case; quote names
@@ -314,8 +313,8 @@ Usage:
314
313
  non-blank line is the symptom, the rest is the body kept
315
314
  line for line; wakes the bugfix role
316
315
  tumwater bug --release <n> [--json]
317
- Lift the Refused, Waiting for the next failure, or a
318
- Needs-review/Needs-replan note held past its threshold
316
+ Lift the Refused or a
317
+ Needs-review note held past its threshold
319
318
  (one per run) from the Nth entry in BUGS.md ## Open (as
320
319
  \`tumwater bug --list\` lists it), commit it on main, and wake
321
320
  the bugfix role; --json prints {file, title, lifted}
@@ -371,8 +370,8 @@ Usage:
371
370
  the first non-blank line is the title, the rest is the body
372
371
  kept line for line; wakes the feature role
373
372
  tumwater plan --release <n> [--json]
374
- Lift the Refused, Waiting for the next failure, or a
375
- Needs-review/Needs-replan note held past its threshold
373
+ Lift the Refused or a
374
+ Needs-review note held past its threshold
376
375
  (one per run) from the Nth entry in PLANS.md ## Planned
377
376
  (as \`tumwater plan --list\` lists it), commit it on main,
378
377
  and wake the feature role; --json prints {file, title, lifted}
@@ -10,7 +10,7 @@ import { canonicalEventType } from "../events/event-legacy.js";
10
10
  import { EVENT_TYPE_LABELS, eventTypeLabel } from "../events/event-labels.js";
11
11
  import { followFile } from "../files/tail.js";
12
12
  import { roleInScope } from "../roles/runner-ids.js";
13
- import { startParentDeathWatch } from "../process/supervisor.js";
13
+ import { expectedSupervisorPid, startParentDeathWatch } from "../process/supervisor.js";
14
14
  import { typoSuffix } from "../text/suggest.js";
15
15
  import { splitCommaList } from "../text/text.js";
16
16
  import { createTranscriptFilter, createTranscriptRenderer } from "../ui/transcript.js";
@@ -90,12 +90,14 @@ function typeEmpty(type, pieces) {
90
90
  /** Follow `file` until Ctrl+C or until the process that started this one is gone (the shape of
91
91
  * a `logs -f` leaked to PPID 1 that polled for days). Resolves once the parent is gone. */
92
92
  export function followUntilParentGone(file, offset, onLines, seams) {
93
+ const expected = expectedSupervisorPid();
93
94
  const stop = followFile(file, offset, onLines);
94
95
  return new Promise((resolve) => {
95
96
  startParentDeathWatch(() => {
96
97
  stop();
97
98
  resolve();
98
99
  }, {
100
+ ...(expected !== undefined ? { expectedPpid: expected } : {}),
99
101
  ...(seams.ppid ? { ppid: seams.ppid } : {}),
100
102
  ...(seams.intervalMs !== undefined ? { intervalMs: seams.intervalMs } : {}),
101
103
  });
package/dist/src/cli.js CHANGED
@@ -13,7 +13,7 @@
13
13
  * ready-repo gate. An error escaping main() funnels through its catch to fail(errorMessage(err)),
14
14
  * the CLI's one error path. */
15
15
  import { parseCountFlag, parseGrepFlag, parseModelFlag, parseResultFlag } from "./cli/cli-args.js";
16
- import { grepFlagSpec, GUI_FLAG_SPECS, JSON_FLAG, LAST_FLAG, N_FLAG, rejectUnknownArgs, resultFlagSpec, modelFlagSpec, byFlagSpec, LOGS_TRANSCRIPT_FLAG, ROLE_FLAG, START_FLAG_SPECS, sinceFlagSpec, untilFlagSpec, STAT_FLAG, PATCH_FLAG, PROMPT_FLAG, TRANSCRIPT_FLAG, SUMMARY_FLAG, COUNT_FLAG, NOTABLE_FLAG, typeFlagSpec, DRY_RUN_FLAG, FORCE_FLAG, FOLLOW_FLAG, STOP_CANCEL_FLAG, STOP_IN_FLAG, REPROBE_FLAG, PROBLEMS_FLAG, KILL_ORPHANS_FLAG, COMMIT_BACKLOG_FLAG, RESYNC_INSTALL_FLAG, DROP_BROKEN_PINS_FLAG, RETIRE_LEFTOVERS_FLAG, } from "./cli/cli-flag-specs.js";
16
+ import { grepFlagSpec, GUI_FLAG_SPECS, JSON_FLAG, LAST_FLAG, N_FLAG, rejectUnknownArgs, resultFlagSpec, modelFlagSpec, byFlagSpec, LOGS_TRANSCRIPT_FLAG, ROLE_FLAG, START_FLAG_SPECS, sinceFlagSpec, untilFlagSpec, STAT_FLAG, PATCH_FLAG, PROMPT_FLAG, TRANSCRIPT_FLAG, SUMMARY_FLAG, COUNT_FLAG, NOTABLE_FLAG, typeFlagSpec, DRY_RUN_FLAG, FORCE_FLAG, FOLLOW_FLAG, STOP_CANCEL_FLAG, STOP_IN_FLAG, PROBLEMS_FLAG, KILL_ORPHANS_FLAG, COMMIT_BACKLOG_FLAG, RESYNC_INSTALL_FLAG, DROP_BROKEN_PINS_FLAG, RETIRE_LEFTOVERS_FLAG, } from "./cli/cli-flag-specs.js";
17
17
  import { fail, say, sayJsonOrRender } from "./cli/cli-output.js";
18
18
  import { historyTrailForm, parseDoctorChecks, parsePromptArgs, peelPositionals } from "./cli/cli-command-args.js";
19
19
  import { refuseTeamWorkspace, requireReadyRepo } from "./cli/cli-repo-gate.js";
@@ -129,7 +129,7 @@ async function cmdDoctorCase(root, args) {
129
129
  // No requireReadyRepo gate: doctor's job is to report WHY the environment isn't ready,
130
130
  // so it must run outside a git repo and print fail lines rather than throwing.
131
131
  const { positionals: checkNames, rest: doctorFlags } = peelPositionals(args);
132
- rejectUnknownArgs("doctor", doctorFlags, [JSON_FLAG, REPROBE_FLAG, PROBLEMS_FLAG, KILL_ORPHANS_FLAG, COMMIT_BACKLOG_FLAG, RESYNC_INSTALL_FLAG, DROP_BROKEN_PINS_FLAG, RETIRE_LEFTOVERS_FLAG]);
132
+ rejectUnknownArgs("doctor", doctorFlags, [JSON_FLAG, PROBLEMS_FLAG, KILL_ORPHANS_FLAG, COMMIT_BACKLOG_FLAG, RESYNC_INSTALL_FLAG, DROP_BROKEN_PINS_FLAG, RETIRE_LEFTOVERS_FLAG]);
133
133
  const only = parseDoctorChecks(checkNames);
134
134
  const { runDoctor } = await import("./doctor/doctor.js");
135
135
  let orphanKill;
@@ -197,11 +197,7 @@ async function cmdDoctorCase(root, args) {
197
197
  }
198
198
  }
199
199
  const { renderDoctor, renderDoctorProblems, problemsOnly } = await import("./doctor/doctor-render.js");
200
- // The terminal probes unclaimed-verified models by default (7-day cache); --reprobe
201
- // forces every claimed model. The TUI/GUI call runDoctor with the default "never", so a
202
- // refresh never spends a model call.
203
- const probeImages = args.includes("--reprobe") ? "all" : "missing";
204
- const report = await runDoctor(root, undefined, undefined, probeImages, only);
200
+ const report = await runDoctor(root, undefined, undefined, only);
205
201
  // --json prints the collector's own payload (the DoctorReport object), not a re-parse of
206
202
  // the render — the `report --json` precedent. The exit-code contract below holds in both
207
203
  // forms: 1 when any check fails, 0 otherwise; warnings never fail the exit.
@@ -65,7 +65,7 @@ export function increment(map, key) {
65
65
  * step (the seed matters because `noUncheckedIndexedAccess` reads every entry as possibly
66
66
  * undefined), shared by the failure digest's outcome tally per role (failure-data.ts), the
67
67
  * usage report's window role totals (report-render.ts), and its per-day fold's run and cost
68
- * tallies (report-fold.ts), so those sites cannot drift on how a missing key is seeded. The
68
+ * tallies (report-usage-fold.ts), so those sites cannot drift on how a missing key is seeded. The
69
69
  * test duration reporter (test/test-durations-reporter.ts) keeps its own copy: it imports no
70
70
  * tumwater module by design, since node --test loads it into its own parent process.
71
71
  *
@@ -160,18 +160,18 @@ export function lowerMedian(values) {
160
160
  return sorted[Math.floor((sorted.length - 1) / 2)];
161
161
  }
162
162
  /** Most-days-waited-first comparator, ties in ascending index (file order) — `b.days - a.days ||
163
- * a.index - b.index`, the single home of that one-line ordering. Shared by the stale-bug
164
- * alert (src/ui/alert-feeds.ts's staleOpenBugs) and the stale-waiting-bug doctor row
165
- * (src/doctor/doctor-backlog-bugs.ts's staleWaitingBugRows), which both build `{index, days}`
166
- * rows off the same backlog scan, so the two cannot drift on how ties order. The generic holds
163
+ * a.index - b.index`, the single home of that one-line ordering. Shared by the stale-questions
164
+ * feed (src/ui/alert-feeds.ts's staleOpenQuestions), which builds `{index, days}`
165
+ * rows off the same backlog scan, so its tie order cannot drift. The generic holds
167
166
  * any row type carrying both fields; a row without a natural index passes its first-seen order. */
168
167
  export function byDaysThenIndex(a, b) {
169
168
  return b.days - a.days || a.index - b.index;
170
169
  }
171
170
  /** Ascending string comparator by UTF-16 code unit — the locale-independent order a bare `.sort()`
172
171
  * uses, unlike `localeCompare` (which `rankByCount` uses for its tiebreak). Used directly by
173
- * src/cli/cli-start-summary.ts, src/cli/log-commands.ts and src/history/history-data.ts, and by
174
- * `sortByValueDesc` for its tiebreak. */
172
+ * src/cli/cli-start-summary.ts, src/cli/completion.ts, src/cli/log-commands.ts,
173
+ * src/history/history-data.ts, src/review/post-merge-review.ts, src/review/quarantine-render.ts,
174
+ * src/budget/budget.ts and src/change/change-data.ts, and by `sortByValueDesc` for its tiebreak. */
175
175
  export function compareCodeUnits(a, b) {
176
176
  return a < b ? -1 : a > b ? 1 : 0;
177
177
  }
@@ -185,6 +185,20 @@ export function compareCodeUnits(a, b) {
185
185
  export function sortByValueDesc(entries) {
186
186
  return entries.sort((a, b) => b[1] - a[1] || compareCodeUnits(a[0], b[0]));
187
187
  }
188
+ /** Sort `[key, …]` entry pairs by their string key ascending — the single home of the
189
+ * `entries.sort(([a], [b]) => a.localeCompare(b))` step, shared by the budget check's
190
+ * capped-role rows (doctor-holds.ts's checkBudget), the permit pool's provider fragment
191
+ * (ui/badges.ts's permitsBadge), and the doctor's rate-limit standing-holds rows
192
+ * (doctor-holds.ts's checkRateLimitHolds), so those sites cannot drift on how a possibly
193
+ * `undefined` key (a rate-limit hold recorded with no provider) orders. A missing key sorts
194
+ * first, matching the `(a ?? "")` guard the hold site alone needed; on a defined string the
195
+ * guard is a no-op, so the comparator is identical for the other two. Returns a fresh sorted
196
+ * array; the input is never mutated. (Deliberately unlike the value-descending `sortByValueDesc`
197
+ * and the count-then-key `rankCountEntries` above, which sort by a different axis. Also used to
198
+ * stabilize a Map's insertion order before an assertion in test/once-round.test.ts.) */
199
+ export function sortEntriesByKey(entries) {
200
+ return [...entries].sort(([a], [b]) => (a ?? "").localeCompare(b ?? ""));
201
+ }
188
202
  /** rankByCount for `[key, count]` entry pairs (count first): src/report/report-render.ts's
189
203
  * rankedRoleMap, src/team/failure-spread.ts's strongest-kind pick, and
190
204
  * src/doctor/doctor-contention-checks.ts's check-wait and provider-wait rankings. */
@@ -80,10 +80,6 @@ const BORROW_ORDER = {
80
80
  default: ["default", "strong", "small"],
81
81
  strong: ["strong", "default"],
82
82
  };
83
- /** Exported for imageRerouteTarget (src/agent/image-input.ts), which walks a rerouting role's
84
- * tier through the same borrow order the budget fallback uses (skipping the tier itself), and
85
- * for the doctor's `image input` check naming the tier a text-only role reroutes to. */
86
- export { BORROW_ORDER };
87
83
  /** A tier's OWN fallback chain, first step first — what the `fallback` key declares at that
88
84
  * tier's map entry (a selector or a list of them), or (default only) the string/list form of
89
85
  * `fallback` or the legacy `fallbackModel` object (a one-element chain). Empty when the tier