tumwater 0.2.0 → 0.4.0
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/README.md +27 -13
- package/dist/build-info.json +2 -2
- package/dist/src/agent/agent-args.js +8 -9
- package/dist/src/agent/agent-backend.js +8 -6
- package/dist/src/agent/backend-traits.js +55 -25
- package/dist/src/agent/claude/claude-account.js +71 -204
- package/dist/src/agent/claude/claude-args.js +9 -6
- package/dist/src/agent/claude/claude-backend.js +10 -10
- package/dist/src/agent/claude/claude-env.js +1 -1
- package/dist/src/agent/claude/claude-stream.js +6 -4
- package/dist/src/agent/claude/claude-write-guard.js +49 -0
- package/dist/src/agent/claude/write-guard-hook.js +13 -0
- package/dist/src/agent/codex/codex-account.js +119 -0
- package/dist/src/agent/codex/codex-args.js +181 -0
- package/dist/src/agent/codex/codex-backend.js +279 -0
- package/dist/src/agent/codex/codex-catalog.js +97 -0
- package/dist/src/agent/codex/codex-env.js +18 -0
- package/dist/src/agent/codex/codex-hook-trust.js +246 -0
- package/dist/src/agent/codex/codex-patch-paths.js +36 -0
- package/dist/src/agent/codex/codex-rollout.js +179 -0
- package/dist/src/agent/codex/codex-stream.js +404 -0
- package/dist/src/agent/codex/codex-write-guard.js +86 -0
- package/dist/src/agent/codex/write-guard-hook.js +12 -0
- package/dist/src/agent/image-input.js +29 -24
- package/dist/src/agent/notes-shim.js +11 -12
- package/dist/src/agent/opencode/opencode-args.js +0 -1
- package/dist/src/agent/opencode/opencode-backend.js +12 -9
- package/dist/src/agent/opencode/opencode-catalog.js +55 -29
- package/dist/src/agent/opencode/opencode-config.js +19 -14
- package/dist/src/agent/opencode/opencode-env.js +0 -1
- package/dist/src/agent/opencode/opencode-session-id.js +1 -2
- package/dist/src/agent/opencode/opencode-stream.js +1 -1
- package/dist/src/agent/opencode/write-guard-plugin/index.js +48 -0
- package/dist/src/agent/role-notes-write.js +5 -6
- package/dist/src/agent/run-agent.js +465 -448
- package/dist/src/agent/run-settle.js +214 -0
- package/dist/src/agent/session-ledger.js +86 -16
- package/dist/src/agent/subscription-account.js +220 -0
- package/dist/src/agent/write-guard.js +148 -0
- package/dist/src/backlog/backlog-archive.js +281 -55
- package/dist/src/backlog/backlog-cli-view.js +255 -0
- package/dist/src/backlog/backlog-cli.js +91 -335
- package/dist/src/backlog/backlog-commit.js +20 -13
- package/dist/src/backlog/backlog-eligibility.js +193 -242
- package/dist/src/backlog/backlog-index.js +149 -0
- package/dist/src/backlog/backlog-md.js +54 -6
- package/dist/src/backlog/backlog-parts.js +264 -0
- package/dist/src/backlog/backlog-release.js +134 -0
- package/dist/src/backlog/backlog-render.js +27 -0
- package/dist/src/backlog/backlog-structure.js +99 -156
- package/dist/src/backlog/backlog-write.js +40 -127
- package/dist/src/backlog/backlog.js +21 -6
- package/dist/src/backlog/question-answer.js +21 -15
- package/dist/src/baseline/main-baseline.js +89 -20
- package/dist/src/baseline/main-guardrails.js +136 -0
- package/dist/src/baseline/main-red.js +153 -36
- package/dist/src/baseline/main-watch.js +232 -0
- package/dist/src/brief/brief-edit.js +12 -12
- package/dist/src/brief/brief.js +31 -51
- package/dist/src/budget/budget-fallback-view.js +288 -0
- package/dist/src/budget/budget-wiring.js +158 -0
- package/dist/src/budget/budget.js +31 -20
- package/dist/src/budget/fallback-breaker.js +26 -27
- package/dist/src/build/build-check-detect.js +23 -15
- package/dist/src/build/build-check-events.js +25 -6
- package/dist/src/build/build-check-report.js +49 -9
- package/dist/src/build/build-check-scoped.js +18 -11
- package/dist/src/build/build-check.js +2 -1
- package/dist/src/build/build-info.js +2 -3
- package/dist/src/build/build-stage.js +9 -14
- package/dist/src/build/dep-install.js +65 -3
- package/dist/src/change/change-data.js +123 -31
- package/dist/src/change/change-render.js +46 -5
- package/dist/src/cli/brief-command.js +3 -4
- package/dist/src/cli/cli-args.js +181 -33
- package/dist/src/cli/cli-command-args.js +46 -18
- package/dist/src/cli/cli-editor.js +2 -1
- package/dist/src/cli/cli-flag-specs.js +183 -45
- package/dist/src/cli/cli-init.js +51 -0
- package/dist/src/cli/cli-marker-commands.js +4 -4
- package/dist/src/cli/cli-query-commands.js +291 -598
- package/dist/src/cli/cli-repo-gate.js +11 -1
- package/dist/src/cli/cli-review-commands.js +113 -0
- package/dist/src/cli/cli-role-command.js +525 -0
- package/dist/src/cli/cli-start-summary.js +167 -0
- package/dist/src/cli/{cli-run.js → cli-start.js} +193 -237
- package/dist/src/cli/completion.js +169 -22
- package/dist/src/cli/config-commands.js +58 -26
- package/dist/src/cli/follow-view.js +75 -0
- package/dist/src/cli/help.js +258 -82
- package/dist/src/cli/log-commands.js +164 -85
- package/dist/src/cli/question-commands.js +211 -10
- package/dist/src/cli.js +173 -45
- package/dist/src/collections.js +56 -13
- package/dist/src/concurrency/check-permit.js +20 -3
- package/dist/src/concurrency/lock.js +17 -13
- package/dist/src/concurrency/provider-lease.js +44 -8
- package/dist/src/concurrency/semaphore.js +102 -26
- package/dist/src/config/config-aliases.js +0 -1
- package/dist/src/config/config-editable-keys.js +16 -1
- package/dist/src/config/config-fallbacks.js +94 -56
- package/dist/src/config/config-field-checks.js +40 -10
- package/dist/src/config/config-keys.js +30 -8
- package/dist/src/config/config-live.js +63 -24
- package/dist/src/config/config-request.js +137 -0
- package/dist/src/config/config-schema.js +31 -24
- package/dist/src/config/config-selector-checks.js +123 -0
- package/dist/src/config/config-validation-agents.js +80 -0
- package/dist/src/config/config-validation-model.js +116 -0
- package/dist/src/config/config-validation.js +169 -222
- package/dist/src/config/config-views.js +136 -54
- package/dist/src/config/config-write-core.js +135 -0
- package/dist/src/config/config-write.js +164 -265
- package/dist/src/config/config.js +53 -38
- package/dist/src/config/model-selector.js +34 -34
- package/dist/src/doctor/doctor-backlog-bugs.js +330 -0
- package/dist/src/doctor/doctor-backlog-plans.js +398 -0
- package/dist/src/doctor/doctor-backlog.js +249 -512
- package/dist/src/doctor/doctor-check-names.js +85 -0
- package/dist/src/doctor/doctor-checks.js +61 -593
- package/dist/src/doctor/doctor-claude-checks.js +142 -0
- package/dist/src/doctor/doctor-codex-checks.js +276 -0
- package/dist/src/doctor/doctor-contention-checks.js +506 -0
- package/dist/src/doctor/doctor-fallback-checks.js +130 -0
- package/dist/src/doctor/doctor-holds.js +80 -66
- package/dist/src/doctor/doctor-install.js +2 -1
- package/dist/src/doctor/doctor-model-checks.js +216 -537
- package/dist/src/doctor/doctor-notify.js +9 -5
- package/dist/src/doctor/doctor-opencode-checks.js +164 -0
- package/dist/src/doctor/doctor-orphans.js +182 -63
- package/dist/src/doctor/doctor-pi-checks.js +62 -0
- package/dist/src/doctor/doctor-project-checks.js +397 -0
- package/dist/src/doctor/doctor.js +126 -77
- package/dist/src/doctor/image-probe.js +21 -8
- package/dist/src/doctor/outcome.js +3 -2
- package/dist/src/doctor/probe.js +21 -12
- package/dist/src/events/event-format.js +185 -89
- package/dist/src/events/event-labels.js +11 -5
- package/dist/src/events/event-legacy.js +39 -15
- package/dist/src/events/event-read.js +52 -39
- package/dist/src/events/event-tally.js +16 -0
- package/dist/src/events/event-window.js +80 -26
- package/dist/src/events/events.js +30 -13
- package/dist/src/events/notify.js +7 -7
- package/dist/src/failure/failure-cluster.js +12 -12
- package/dist/src/failure/failure-data.js +65 -60
- package/dist/src/failure/failure-render.js +29 -21
- package/dist/src/failure/failure-state-change.js +17 -12
- package/dist/src/failure/time-spend.js +35 -35
- package/dist/src/files/file-queue.js +17 -0
- package/dist/src/files/files.js +111 -35
- package/dist/src/files/json-files.js +3 -3
- package/dist/src/files/json-object.js +28 -7
- package/dist/src/files/stat-cache.js +2 -2
- package/dist/src/files/tail.js +1 -1
- package/dist/src/gates/bootstrap-gates.js +4 -5
- package/dist/src/gates/budget-gates.js +88 -225
- package/dist/src/gates/disk-gate.js +1 -1
- package/dist/src/gates/gate-polls.js +101 -143
- package/dist/src/gates/maintenance-quota.js +37 -30
- package/dist/src/gates/pause-gates.js +28 -10
- package/dist/src/gates/readiness.js +7 -3
- package/dist/src/gates/role-cap-gates.js +8 -8
- package/dist/src/gates/startup-gate.js +94 -32
- package/dist/src/gates/streak-gate.js +54 -30
- package/dist/src/git/commit-message.js +89 -46
- package/dist/src/git/git-diff.js +16 -10
- package/dist/src/git/git-run.js +79 -38
- package/dist/src/git/git.js +54 -34
- package/dist/src/git/slot-salvage.js +253 -0
- package/dist/src/git/slots-state.js +6 -6
- package/dist/src/git/worktree-pool.js +132 -38
- package/dist/src/git/worktree-use.js +4 -11
- package/dist/src/git/worktree.js +94 -37
- package/dist/src/gui/gui-admin-endpoints.js +96 -0
- package/dist/src/gui/gui-args.js +79 -8
- package/dist/src/gui/gui-backlog-commands.js +43 -19
- package/dist/src/gui/gui-backlog-endpoints.js +156 -0
- package/dist/src/gui/gui-command.js +26 -13
- package/dist/src/gui/gui-config-commands.js +168 -80
- package/dist/src/gui/gui-endpoint-commands.js +5 -4
- package/dist/src/gui/gui-endpoint-common.js +4 -4
- package/dist/src/gui/gui-endpoints.js +11 -380
- package/dist/src/gui/gui-history-endpoints.js +301 -0
- package/dist/src/gui/gui-operator-commands.js +235 -13
- package/dist/src/gui/gui-prompt-commands.js +26 -20
- package/dist/src/gui/gui-report-endpoints.js +97 -0
- package/dist/src/gui/gui-server.js +26 -5
- package/dist/src/gui/gui-team-commands.js +7 -7
- package/dist/src/gui/http-body.js +1 -1
- package/dist/src/history/history-data.js +122 -234
- package/dist/src/history/history-queued.js +155 -0
- package/dist/src/history/history-render.js +42 -22
- package/dist/src/history/history.js +190 -49
- package/dist/src/inbox/inbox-attachments.js +29 -30
- package/dist/src/inbox/inbox-cancel.js +10 -11
- package/dist/src/inbox/inbox-edit.js +9 -9
- package/dist/src/inbox/inbox-submit.js +18 -18
- package/dist/src/inbox/inbox-top.js +28 -17
- package/dist/src/inbox/inbox.js +42 -43
- package/dist/src/inbox/pending-prompt.js +26 -26
- package/dist/src/inbox/prompt-commands.js +62 -49
- package/dist/src/inbox/prompt-not-before.js +2 -2
- package/dist/src/init/init-templates.js +1 -2
- package/dist/src/init/init.js +28 -23
- package/dist/src/merge/backlog-conflicts.js +215 -35
- package/dist/src/merge/merge-batch.js +14 -8
- package/dist/src/merge/merge-cancel.js +53 -0
- package/dist/src/merge/merge-check-failures.js +44 -22
- package/dist/src/merge/merge-core.js +58 -32
- package/dist/src/merge/merge-diff.js +5 -4
- package/dist/src/merge/merge-drain.js +45 -19
- package/dist/src/merge/merge-git.js +177 -38
- package/dist/src/merge/merge-pipeline.js +15 -3
- package/dist/src/merge/merge-post-review.js +214 -0
- package/dist/src/merge/merge-queue-render.js +48 -11
- package/dist/src/merge/merge-queue.js +52 -15
- package/dist/src/merge/merge-requeue.js +103 -0
- package/dist/src/merge/merge-slot.js +61 -16
- package/dist/src/merge/merge-stack.js +27 -11
- package/dist/src/merge/merge-to-main.js +77 -26
- package/dist/src/merge/merge-top.js +83 -0
- package/dist/src/merge/merge-verify.js +75 -18
- package/dist/src/notes-cli.js +35 -15
- package/dist/src/operator/operator-commands.js +192 -81
- package/dist/src/operator/operator-intent.js +69 -42
- package/dist/src/operator/operator-requests.js +35 -40
- package/dist/src/operator/retire.js +5 -6
- package/dist/src/operator/revert.js +142 -34
- package/dist/src/orchestrator/orchestrator-launch.js +60 -52
- package/dist/src/orchestrator/orchestrator-poll.js +352 -0
- package/dist/src/orchestrator/orchestrator-scheduling.js +71 -370
- package/dist/src/orchestrator/orchestrator.js +129 -369
- package/dist/src/orchestrator/retention.js +42 -8
- package/dist/src/orchestrator/scheduling-admit.js +116 -0
- package/dist/src/orchestrator/scheduling-scope.js +245 -0
- package/dist/src/orchestrator/scheduling-skip.js +195 -0
- package/dist/src/orchestrator/startup-migration-steps.js +8 -7
- package/dist/src/orchestrator/startup-migrations.js +11 -7
- package/dist/src/paths.js +126 -49
- package/dist/src/pi/command-shape.js +12 -1
- package/dist/src/pi/pi-args.js +6 -4
- package/dist/src/pi/pi-backend.js +6 -6
- package/dist/src/pi/pi-bin.js +54 -63
- package/dist/src/pi/pi-listed-models.js +53 -0
- package/dist/src/pi/pi-models.js +63 -30
- package/dist/src/pi/pi-run-result.js +1 -1
- package/dist/src/pi/pi-settings.js +1 -1
- package/dist/src/pi/pi-stream.js +6 -6
- package/dist/src/pi/pi-watchdogs.js +18 -19
- package/dist/src/pi-extension/bounded-output.js +5 -3
- package/dist/src/pi-extension/context-budget.js +2 -2
- package/dist/src/pi-extension/context-shake.js +1 -1
- package/dist/src/pi-extension/context-window.js +0 -1
- package/dist/src/pi-extension/full-output.js +3 -10
- package/dist/src/pi-extension/strip-thinking.js +0 -1
- package/dist/src/pi-extension/trim-system-prompt.js +3 -4
- package/dist/src/pi-extension/write-guard.js +37 -0
- package/dist/src/process/launch-services.js +1 -2
- package/dist/src/process/node-bin.js +16 -0
- package/dist/src/process/process-group.js +8 -18
- package/dist/src/process/process.js +41 -2
- package/dist/src/process/run-marker.js +26 -6
- package/dist/src/process/supervisor.js +22 -21
- package/dist/src/prompt/dialect.js +17 -2
- package/dist/src/prompt/gate-notes.js +203 -0
- package/dist/src/prompt/gate-prompts.js +150 -217
- package/dist/src/prompt/notes-backlog.js +184 -0
- package/dist/src/prompt/principles.js +1 -2
- package/dist/src/prompt/prompt-followup.js +19 -14
- package/dist/src/prompt/prompt.js +131 -204
- package/dist/src/redeploy/redeploy-policy.js +24 -19
- package/dist/src/redeploy/redeploy-probes.js +1 -1
- package/dist/src/redeploy/redeploy.js +2 -3
- package/dist/src/redeploy/redeployer.js +20 -20
- package/dist/src/redeploy/self-reload.js +2 -1
- package/dist/src/report/report-data.js +188 -124
- package/dist/src/report/report-fold.js +130 -54
- package/dist/src/report/report-main-red.js +55 -0
- package/dist/src/report/report-render.js +136 -65
- package/dist/src/report/report-types.js +1 -0
- package/dist/src/report/report.js +23 -9
- package/dist/src/request-timeouts.js +2 -2
- package/dist/src/review/diff-rules.js +53 -0
- package/dist/src/review/known-flakes.js +112 -1
- package/dist/src/review/post-merge-review-accept.js +51 -0
- package/dist/src/review/post-merge-review-render.js +112 -0
- package/dist/src/review/post-merge-review.js +239 -0
- package/dist/src/review/protected-edits.js +24 -10
- package/dist/src/review/quarantine-render.js +65 -0
- package/dist/src/review/review-followup.js +8 -8
- package/dist/src/review/review-precheck.js +66 -23
- package/dist/src/review/review-run.js +395 -0
- package/dist/src/review/review-verdict.js +2 -2
- package/dist/src/review/review.js +180 -401
- package/dist/src/review/secret-leaks.js +36 -16
- package/dist/src/review/suite-rerun.js +0 -1
- package/dist/src/roles/legacy-role-migration.js +80 -7
- package/dist/src/roles/role-catalog.js +127 -12
- package/dist/src/roles/role-guidance.js +65 -20
- package/dist/src/roles/role-labels.js +7 -5
- package/dist/src/roles/role-render.js +108 -56
- package/dist/src/roles/role-view.js +95 -56
- package/dist/src/roles/roles.js +33 -33
- package/dist/src/roles/runner-ids.js +97 -0
- package/dist/src/run/acceptance-greps.js +119 -0
- package/dist/src/run/ci-parity.js +121 -0
- package/dist/src/run/feedback-filings.js +51 -0
- package/dist/src/run/qa-coverage.js +125 -0
- package/dist/src/{tick/tick-apply.js → run/run-apply.js} +95 -94
- package/dist/src/run/run-detail-data.js +175 -0
- package/dist/src/run/run-detail-render.js +91 -0
- package/dist/src/run/run-detail.js +168 -0
- package/dist/src/{tick/tick-finalize.js → run/run-finalize.js} +73 -60
- package/dist/src/{tick/tick-outcome.js → run/run-outcome.js} +6 -7
- package/dist/src/{tick/tick-prompt.js → run/run-prompt.js} +122 -73
- package/dist/src/{tick/tick-resume.js → run/run-resume.js} +55 -26
- package/dist/src/{tick/tick-stage.js → run/run-stage.js} +170 -83
- package/dist/src/{tick/tick-timing.js → run/run-timing.js} +43 -41
- package/dist/src/{tick/tick-usage.js → run/run-usage.js} +45 -37
- package/dist/src/{tick/tick-verdict.js → run/run-verdict.js} +105 -57
- package/dist/src/run/selfcheck-digest.js +40 -0
- package/dist/src/run/stage-backlog-checks.js +249 -0
- package/dist/src/run/stage-check.js +178 -0
- package/dist/src/run/stage-checks-shared.js +65 -0
- package/dist/src/run/stage-name-checks.js +204 -0
- package/dist/src/run/stage-path-checks.js +231 -0
- package/dist/src/run/stage-prose-checks.js +261 -0
- package/dist/src/runner/leftover.js +216 -0
- package/dist/src/{loop → runner}/model-fallback.js +12 -12
- package/dist/src/runner/revision.js +191 -0
- package/dist/src/{loop/loop-fallback.js → runner/runner-fallback.js} +8 -8
- package/dist/src/runner/runner-outcome.js +109 -0
- package/dist/src/{loop/loop-pi.js → runner/runner-pi.js} +140 -131
- package/dist/src/{loop/loop-recovery.js → runner/runner-recovery.js} +39 -18
- package/dist/src/{loop/loop-tick.js → runner/runner-run.js} +236 -245
- package/dist/src/{loop/loop-state.js → runner/runner-state-load.js} +61 -114
- package/dist/src/runner/runner-state.js +103 -0
- package/dist/src/{loop/loop.js → runner/runner.js} +123 -120
- package/dist/src/scheduling/backoff.js +38 -38
- package/dist/src/scheduling/claim-entries.js +49 -0
- package/dist/src/scheduling/claims.js +35 -22
- package/dist/src/scheduling/once-round.js +22 -22
- package/dist/src/scheduling/quiet-hours.js +5 -6
- package/dist/src/scheduling/scheduling.js +74 -64
- package/dist/src/scheduling/work-merged-cache.js +2 -2
- package/dist/src/status/status-budget.js +55 -47
- package/dist/src/status/status-data.js +49 -17
- package/dist/src/status/status-inbox.js +2 -2
- package/dist/src/status/status-install.js +0 -1
- package/dist/src/status/status-polls.js +43 -28
- package/dist/src/status/status-roles.js +50 -13
- package/dist/src/team/error-storm.js +8 -8
- package/dist/src/team/failure-spread.js +2 -2
- package/dist/src/team/orchestrator-info.js +15 -9
- package/dist/src/team/reclaim.js +7 -8
- package/dist/src/team/team-hold.js +7 -7
- package/dist/src/team/team-polls.js +91 -50
- package/dist/src/team/team-state.js +8 -2
- package/dist/src/text/datetime.js +65 -18
- package/dist/src/text/format.js +48 -11
- package/dist/src/text/markdown.js +8 -5
- package/dist/src/text/phrases.js +60 -23
- package/dist/src/text/suggest.js +1 -1
- package/dist/src/text/text.js +78 -13
- package/dist/src/ui/badges.js +99 -38
- package/dist/src/ui/gui/gui-client-backlog.js +314 -0
- package/dist/src/ui/gui/gui-client-boot.js +89 -61
- package/dist/src/ui/gui/gui-client-composer.js +8 -9
- package/dist/src/ui/gui/gui-client-drawer-config.js +254 -0
- package/dist/src/ui/gui/gui-client-drawer.js +155 -289
- package/dist/src/ui/gui/gui-client-feed.js +271 -0
- package/dist/src/ui/gui/gui-client-history.js +437 -68
- package/dist/src/ui/gui/gui-client-labels.js +6 -3
- package/dist/src/ui/gui/gui-client-markdown.js +1 -2
- package/dist/src/ui/gui/gui-client-model.js +27 -36
- package/dist/src/ui/gui/gui-client-operator.js +60 -52
- package/dist/src/ui/gui/gui-client-pending.js +405 -24
- package/dist/src/ui/gui/gui-client-report-chart.js +492 -0
- package/dist/src/ui/gui/gui-client-report.js +105 -430
- package/dist/src/ui/gui/{gui-client-loops.js → gui-client-roles.js} +43 -44
- package/dist/src/ui/gui/gui-client-settings.js +163 -5
- package/dist/src/ui/gui/gui-client-team.js +36 -465
- package/dist/src/ui/gui/gui-client.js +38 -26
- package/dist/src/ui/gui/gui-icons.js +0 -2
- package/dist/src/ui/gui/gui-page.js +10 -7
- package/dist/src/ui/gui/gui-styles.js +38 -34
- package/dist/src/ui/progress-data.js +9 -11
- package/dist/src/ui/{tick-progress-model.js → run-progress-model.js} +33 -32
- package/dist/src/ui/status-model.js +133 -125
- package/dist/src/ui/status-payload.js +364 -49
- package/dist/src/ui/status-render.js +109 -82
- package/dist/src/ui/team-alerts.js +728 -62
- package/dist/src/ui/tone.js +12 -6
- package/dist/src/ui/transcript-run.js +58 -0
- package/dist/src/ui/transcript-tail.js +28 -20
- package/dist/src/ui/transcript.js +63 -23
- package/dist/src/ui/tui/tui-app.js +0 -1
- package/dist/src/ui/tui/tui-backlog.js +53 -14
- package/dist/src/ui/tui/tui-editor-answer.js +27 -31
- package/dist/src/ui/tui/tui-editor-attach.js +4 -12
- package/dist/src/ui/tui/tui-editor-backends.js +127 -0
- package/dist/src/ui/tui/tui-editor-brief.js +14 -36
- package/dist/src/ui/tui/tui-editor-budget.js +36 -39
- package/dist/src/ui/tui/tui-editor-check.js +29 -0
- package/dist/src/ui/tui/tui-editor-checks.js +28 -0
- package/dist/src/ui/tui/tui-editor-claude-reserve.js +24 -0
- package/dist/src/ui/tui/tui-editor-concurrency.js +25 -0
- package/dist/src/ui/tui/tui-editor-config.js +99 -0
- package/dist/src/ui/tui/tui-editor-entry.js +39 -64
- package/dist/src/ui/tui/tui-editor-fallback.js +31 -0
- package/dist/src/ui/tui/tui-editor-instances.js +46 -0
- package/dist/src/ui/tui/tui-editor-instructions.js +117 -0
- package/dist/src/ui/tui/tui-editor-interval.js +29 -16
- package/dist/src/ui/tui/tui-editor-model.js +29 -0
- package/dist/src/ui/tui/tui-editor-notes.js +9 -29
- package/dist/src/ui/tui/tui-editor-notify.js +25 -0
- package/dist/src/ui/tui/tui-editor-pause.js +48 -59
- package/dist/src/ui/tui/tui-editor-prompt.js +11 -16
- package/dist/src/ui/tui/tui-editor-provider-caps.js +27 -0
- package/dist/src/ui/tui/tui-editor-queued.js +5 -9
- package/dist/src/ui/tui/tui-editor-quiet.js +95 -41
- package/dist/src/ui/tui/tui-editor-retire.js +5 -13
- package/dist/src/ui/tui/tui-editor-role-enabled.js +126 -0
- package/dist/src/ui/tui/tui-editor-role-key.js +71 -0
- package/dist/src/ui/tui/tui-editor-role-model.js +28 -0
- package/dist/src/ui/tui/tui-editor-search.js +45 -33
- package/dist/src/ui/tui/tui-editor-session.js +101 -34
- package/dist/src/ui/tui/tui-editor-slots.js +24 -0
- package/dist/src/ui/tui/tui-editors.js +44 -2
- package/dist/src/ui/tui/tui-frame.js +68 -11
- package/dist/src/ui/tui/tui-history.js +8 -9
- package/dist/src/ui/tui/tui-input.js +13 -11
- package/dist/src/ui/tui/tui-keymap.js +0 -1
- package/dist/src/ui/tui/tui-keys.js +33 -9
- package/dist/src/ui/tui/tui-pane-activity.js +35 -19
- package/dist/src/ui/tui/tui-pane-backlog.js +198 -126
- package/dist/src/ui/tui/tui-pane-brief.js +0 -1
- package/dist/src/ui/tui/tui-pane-ctx.js +2 -2
- package/dist/src/ui/tui/tui-pane-health.js +168 -8
- package/dist/src/ui/tui/tui-pane-history.js +446 -82
- package/dist/src/ui/tui/tui-pane-pending.js +539 -15
- package/dist/src/ui/tui/tui-pane-queued.js +78 -57
- package/dist/src/ui/tui/tui-pane-report.js +54 -16
- package/dist/src/ui/tui/tui-pane-session.js +34 -6
- package/dist/src/ui/tui/tui-pane-transcript.js +111 -37
- package/dist/src/ui/tui/tui-pane.js +91 -28
- package/dist/src/ui/tui/tui-panes.js +153 -34
- package/dist/src/ui/tui/tui.js +18 -15
- package/dist/src/verdict/fix-claim.js +129 -33
- package/dist/src/verdict/no-change.js +4 -4
- package/dist/src/verdict/refusal.js +40 -16
- package/dist/src/verdict/reply-contract.js +77 -31
- package/dist/src/version.js +0 -1
- package/package.json +2 -1
- package/dist/src/loop/leftover.js +0 -130
- package/dist/src/loop/revision.js +0 -70
- package/dist/src/roles/loop-ids.js +0 -77
- package/dist/src/tick/qa-coverage.js +0 -108
- package/dist/src/tick/stage-check.js +0 -419
- package/dist/src/tick/telemetry-digest.js +0 -25
- package/dist/src/tick/tick-detail-data.js +0 -108
- package/dist/src/tick/tick-detail.js +0 -163
- package/dist/src/ui/gui/gui-client-sound.js +0 -53
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
// vocabulary: plain
|
|
2
1
|
import { deleteRef, headOf, patchId, setRef } from "../git/git.js";
|
|
3
2
|
import { mergeRefName, mergeWorktreePath, rejectedRefName, reviewRunSessionDir } from "../paths.js";
|
|
3
|
+
import { tryLeaseSlot } from "../git/worktree-pool.js";
|
|
4
|
+
import { slotCount } from "../config/config.js";
|
|
4
5
|
import { ensureDetachedWorktree } from "../git/worktree.js";
|
|
5
6
|
import { useWorktree } from "../git/worktree-use.js";
|
|
6
7
|
import { mergeToMain } from "./merge-to-main.js";
|
|
@@ -9,8 +10,8 @@ import { mergeCheckRed, mergeBlocked, noteMergeRetryPassed } from "./merge-check
|
|
|
9
10
|
import { reviewAheadOfMain } from "../review/review.js";
|
|
10
11
|
import { reviewRunConfig, modelSelectorField } from "../config/config-views.js";
|
|
11
12
|
import { warnEventBestEffort, logEventBestEffort } from "../events/events.js";
|
|
12
|
-
import {
|
|
13
|
-
import { REVISION_FINAL_ON_REPEAT, REVISION_BACKSTOP } from "../
|
|
13
|
+
import { saveRunnerStateBestEffort } from "../runner/runner-state.js";
|
|
14
|
+
import { REVISION_FINAL_ON_REPEAT, REVISION_BACKSTOP, holdEntryAfterExhaustion } from "../runner/revision.js";
|
|
14
15
|
import { priorObjectionNumber } from "../review/review-verdict.js";
|
|
15
16
|
import { DIRECTOR_ROLE } from "../roles/roles.js";
|
|
16
17
|
import { shortSha } from "../text/format.js";
|
|
@@ -38,25 +39,38 @@ export async function syncPinToMain(ctx, wt, req) {
|
|
|
38
39
|
await setRef(ctx.root, mergeRefName(req.role), syncedHead);
|
|
39
40
|
return { ...req, sha: syncedHead };
|
|
40
41
|
}
|
|
42
|
+
/** Set to "0" to run every gate check before its review, as before Fast merge part 12 (a test seam
|
|
43
|
+
* for the suites that pin the sequential merge stages). */
|
|
44
|
+
const REVIEW_OVERLAP_ENV = "TUMWATER_REVIEW_CHECK_OVERLAP";
|
|
41
45
|
/** The ReviewContext for judging merge request `req` in worktree `wt` — the single
|
|
42
46
|
* home of that argument object, shared by reviewPinnedChange's pinned verify and
|
|
43
47
|
* mergeApprovedChange's re-review of a resolved conflict (its recheckResolved callback), so the
|
|
44
48
|
* two gate invocations cannot drift on which fields the reviewer sees. Both callers' contexts
|
|
45
49
|
* (ReviewGateContext and MergerContext) carry the root/mainBranch/config/signal/runGatePi fields
|
|
46
50
|
* this reads. */
|
|
47
|
-
function reviewContextFor(ctx, req, wt) {
|
|
51
|
+
function reviewContextFor(ctx, req, wt, foldUsage) {
|
|
48
52
|
return {
|
|
49
53
|
root: ctx.root,
|
|
50
54
|
role: req.role,
|
|
51
55
|
wt,
|
|
52
56
|
mainBranch: ctx.mainBranch,
|
|
53
57
|
config: ctx.config,
|
|
54
|
-
|
|
55
|
-
// One directory per review of one change:
|
|
58
|
+
runNumber: req.runNumber,
|
|
59
|
+
// One directory per review of one change: run plus the pinned sha, so a re-verify of the
|
|
56
60
|
// same sha reuses it and the verify and the conflict-resolved re-review agree.
|
|
57
|
-
sessionDir: reviewRunSessionDir(ctx.root, req.role, `${req.
|
|
61
|
+
sessionDir: reviewRunSessionDir(ctx.root, req.role, `${req.runNumber}-${shortSha(req.sha)}`),
|
|
58
62
|
signal: ctx.signal(),
|
|
59
63
|
runGatePi: ctx.runGatePi,
|
|
64
|
+
foldUsage,
|
|
65
|
+
// The check overlaps the review unless a test that pins the sequential stages opts out.
|
|
66
|
+
...(process.env[REVIEW_OVERLAP_ENV] === "0"
|
|
67
|
+
? {}
|
|
68
|
+
: {
|
|
69
|
+
leaseCheckSlot: (ref) => tryLeaseSlot(ctx.root, { role: req.role, purpose: "verify-check", ref, slotBudget: slotCount(ctx.config) }),
|
|
70
|
+
}),
|
|
71
|
+
...(ctx.reviewRetries !== undefined ? { retries: ctx.reviewRetries } : {}),
|
|
72
|
+
...(ctx.reviewRetryDelayMs !== undefined ? { retryDelayMs: ctx.reviewRetryDelayMs } : {}),
|
|
73
|
+
...(ctx.reviewHeld ? { reviewHeld: () => ctx.reviewHeld() } : {}),
|
|
60
74
|
revisionRound: req.revisionRound,
|
|
61
75
|
priorReview: req.priorReview,
|
|
62
76
|
};
|
|
@@ -64,7 +78,7 @@ function reviewContextFor(ctx, req, wt) {
|
|
|
64
78
|
/** Run one pinned change through the review gate in its leased pool slot `wt` and handle the
|
|
65
79
|
* immediate bookkeeping — the heart of every verify (merge-batch.ts's verifyRequest). Persists the
|
|
66
80
|
* verdict at once, folds the reviewer's usage, and routes
|
|
67
|
-
* the three terminal outcomes: aborted (ref kept — fail closed, the next
|
|
81
|
+
* the three terminal outcomes: aborted (ref kept — fail closed, the next run re-merges it),
|
|
68
82
|
* rejected (ref deleted — final for this sha), and failed (a strike-cap discard — the gate
|
|
69
83
|
* reports it as `discarded` — deletes the ref; an under-cap failure, a red main's included,
|
|
70
84
|
* keeps it for the next re-merge). Returns
|
|
@@ -91,7 +105,7 @@ export async function reviewPinnedChange(ctx, req, wt, state, foldUsage) {
|
|
|
91
105
|
// (fail closed) exactly as for an abort mid-review below.
|
|
92
106
|
if (ctx.signal().aborted)
|
|
93
107
|
return { kind: "result", result: "aborted" };
|
|
94
|
-
const gate = await reviewAheadOfMain(reviewContextFor(ctx, req, wt), state, req.summary, req.body, req.highFriction);
|
|
108
|
+
const gate = await reviewAheadOfMain(reviewContextFor(ctx, req, wt, foldUsage), state, req.summary, req.body, req.highFriction);
|
|
95
109
|
// The gate is over, whatever it decided: move the merge cell off the gate's stages (a no-op
|
|
96
110
|
// outside a queued merge). What follows is the wait for the merge — the verify marks the change
|
|
97
111
|
// `approved` next, and the merge slot re-stages it `merging` when it takes it — and a finished
|
|
@@ -100,20 +114,22 @@ export async function reviewPinnedChange(ctx, req, wt, state, foldUsage) {
|
|
|
100
114
|
setMergeStage(root, role, "merging");
|
|
101
115
|
// A rejection keeps the rejected commit alive while a revision is due (plans/revise-rejected.md):
|
|
102
116
|
// point the rejected ref at the head the gate judged and record the round, so the author's next
|
|
103
|
-
//
|
|
117
|
+
// run re-applies it. A rejection is final — clear the state, delete the ref, and log
|
|
104
118
|
// `exhausted` — when the same objection has survived two revisions or the chain hit the
|
|
105
119
|
// backstop (BUGS.md 2026-10-14). Done before the save below so the round rides the
|
|
106
120
|
// persisted state.
|
|
107
121
|
if (gate.decision === "rejected") {
|
|
108
122
|
await recordRejectedChange(root, role, state, state.lastReview?.head ?? req.sha, req.revisionRound, req.priorReview?.counts);
|
|
109
123
|
}
|
|
110
|
-
// Persist the verdict immediately, not at the
|
|
111
|
-
// cross-
|
|
112
|
-
// note into the next prompt), and this
|
|
124
|
+
// Persist the verdict immediately, not at the run's end save: the gate's bookkeeping is
|
|
125
|
+
// cross-run memory (a persisted "reject" injects a "your previous change was rejected"
|
|
126
|
+
// note into the next prompt), and this run's tail — the merge plus the still-to-come
|
|
113
127
|
// authoring run — can outlive a sudden death by hours. A mid-run crash (power loss,
|
|
114
|
-
// kill -9) would otherwise roll the state file back to the last
|
|
115
|
-
// and re-inject a superseded rejection even though its replacement is already on main.
|
|
116
|
-
|
|
128
|
+
// kill -9) would otherwise roll the state file back to the last run-boundary snapshot
|
|
129
|
+
// and re-inject a superseded rejection even though its replacement is already on main. The
|
|
130
|
+
// save is best-effort (it warns "could not save the role's state"): a throw here would skip
|
|
131
|
+
// the reviewer's usage fold below, and the merge write-back saves the same state later.
|
|
132
|
+
saveRunnerStateBestEffort(root, state);
|
|
117
133
|
// The reviewer's usage is folded exactly once per attempt: runGatePi folds a RETRIED first
|
|
118
134
|
// attempt at retry time (stamping the team-wide rate-limit hold promptly, BUGS.md
|
|
119
135
|
// 2026-10-01), and the final run is folded HERE — not also inside the wiring, which would
|
|
@@ -128,7 +144,7 @@ export async function reviewPinnedChange(ctx, req, wt, state, foldUsage) {
|
|
|
128
144
|
// produced it — one more line here, because a GateResult carries a third run now.
|
|
129
145
|
if (gate.nudgeRun)
|
|
130
146
|
foldUsage(gate.nudgeRun);
|
|
131
|
-
// Shutdown/user abort mid-review: fail closed — the ref stays and the next
|
|
147
|
+
// Shutdown/user abort mid-review: fail closed — the ref stays and the next run re-merges it.
|
|
132
148
|
// The caller routes "aborted" through its own abort handling (which discards the pin too when
|
|
133
149
|
// the abort was a deliberate user stop).
|
|
134
150
|
if (gate.aborted)
|
|
@@ -140,7 +156,8 @@ export async function reviewPinnedChange(ctx, req, wt, state, foldUsage) {
|
|
|
140
156
|
}
|
|
141
157
|
if (gate.decision === "failed" && gate.mainRed) {
|
|
142
158
|
// Main is red at its tip: nothing judged this diff and nothing is wrong with the reviewer,
|
|
143
|
-
// so it is main_red, not review_error — the pin stays
|
|
159
|
+
// so it is main_red, not review_error — the pin stays; the poll's
|
|
160
|
+
// requeueMainRedPin re-queues it once main's head moves and the watch has not found it red.
|
|
144
161
|
state.lastError = `gate check failed: ${gate.detail}`;
|
|
145
162
|
return { kind: "result", result: "main_red" };
|
|
146
163
|
}
|
|
@@ -186,7 +203,7 @@ export async function reviewPinnedChange(ctx, req, wt, state, foldUsage) {
|
|
|
186
203
|
* failure, or a merge that could not be rebased/merged. They are exactly a merge's
|
|
187
204
|
* non-terminal failures (`rejected` is final and deletes the pin; `aborted` is a shutdown;
|
|
188
205
|
* `changed` merged), so a run of them on the leftover-recovery path is what feeds the error
|
|
189
|
-
* streak — a dead reviewer backend raises the alarm instead of resetting it every
|
|
206
|
+
* streak — a dead reviewer backend raises the alarm instead of resetting it every run
|
|
190
207
|
* (BUGS.md 2026-09-21). */
|
|
191
208
|
export const RETRIABLE_MERGE_RESULTS = new Set([
|
|
192
209
|
"review_error",
|
|
@@ -199,14 +216,15 @@ export const RETRIABLE_MERGE_RESULTS = new Set([
|
|
|
199
216
|
* count reaches REVISION_FINAL_ON_REPEAT, counted from `priorCounts` — or the chain has reached
|
|
200
217
|
* the REVISION_BACKSTOP cap, when it ends even if the objections never repeat. While it keeps
|
|
201
218
|
* revising, point `refs/tumwater/rejected/<role>` at the head the gate judged and set
|
|
202
|
-
*
|
|
219
|
+
* RunnerState.revision (with each reason's persistence count) so the author's next run re-applies
|
|
203
220
|
* it; when final, clear the revision, delete the ref and log `exhausted`. `priorCounts` is the
|
|
204
221
|
* previous round's per-reason persistence counts, carried from the queued merge's PriorReview;
|
|
205
222
|
* absent for a fresh change's first rejection and on a recovery merge, a `(prior N)` tag then
|
|
206
|
-
*
|
|
207
|
-
* in-lock re-review rejection of a resolved
|
|
208
|
-
* change back for revision the same way. A
|
|
209
|
-
* first round (1). The director never
|
|
223
|
+
* counts as having survived one revision (count 1): not final that round. Shared by a pinned
|
|
224
|
+
* change's rejection (reviewPinnedChange) and the in-lock re-review rejection of a resolved
|
|
225
|
+
* conflict (mergeApprovedChange), so both send the change back for revision the same way. A
|
|
226
|
+
* rejection with no `revisionRound` is a fresh change's first round (1). The director never
|
|
227
|
+
* revises. */
|
|
210
228
|
async function recordRejectedChange(root, role, state, rejectedHead, revisionRound, priorCounts) {
|
|
211
229
|
if (role === DIRECTOR_ROLE)
|
|
212
230
|
return;
|
|
@@ -215,7 +233,7 @@ async function recordRejectedChange(root, role, state, rejectedHead, revisionRou
|
|
|
215
233
|
// Each reason's persistence count: a new (untagged) objection starts at 0; a `(prior N)`
|
|
216
234
|
// restatement has survived one more revision than that objection's own count from the prior
|
|
217
235
|
// round, so an objection standing across two revisions reaches REVISION_FINAL_ON_REPEAT. An
|
|
218
|
-
// out-of-range or missing tag (a stale prior list, no prior round)
|
|
236
|
+
// out-of-range or missing tag (a stale prior list, no prior round) counts 1: not final yet.
|
|
219
237
|
const prior = priorCounts ?? [];
|
|
220
238
|
const counts = reasons.map((r) => {
|
|
221
239
|
const n = priorObjectionNumber(r);
|
|
@@ -225,10 +243,18 @@ async function recordRejectedChange(root, role, state, rejectedHead, revisionRou
|
|
|
225
243
|
if (nextRound >= REVISION_BACKSTOP || repeatedFinal) {
|
|
226
244
|
state.revision = undefined;
|
|
227
245
|
await deleteRef(root, rejectedRefName(role));
|
|
228
|
-
// The next
|
|
246
|
+
// The next run gets the plain rejected note, not a revision note; mark it final so that
|
|
229
247
|
// note says the rejected diff is gone rather than inviting another revision.
|
|
230
248
|
if (state.lastReview)
|
|
231
249
|
state.lastReview.exhausted = true;
|
|
250
|
+
// The convergence rule (PLANS.md "Reviewer as a regular role, part 3/4"): the reject→revise
|
|
251
|
+
// loop has stopped converging, so hold the PLANS.md plan for the plan role instead of
|
|
252
|
+
// leaving it for a fresh author pick that would restart the cycle. The surviving
|
|
253
|
+
// objections go verbatim into the hold text, which is then committed on main. Best-effort:
|
|
254
|
+
// it must never make the already-terminal exhaustion throw (a BUGS.md claim is never held
|
|
255
|
+
// — the convergence hold is PLANS.md-only by design: it parks the revised plan for the plan
|
|
256
|
+
// role to clear, which resolves a bug's hold by splitting it rather than parking it).
|
|
257
|
+
await holdEntryAfterExhaustion(root, role, state.claim, reasons);
|
|
232
258
|
logEventBestEffort(root, { source: role, type: "revision", action: "exhausted", round: nextRound, sha: rejectedHead });
|
|
233
259
|
return;
|
|
234
260
|
}
|
|
@@ -249,7 +275,7 @@ async function recordRejectedChange(root, role, state, rejectedHead, revisionRou
|
|
|
249
275
|
* a pin whose pre-gate rebase conflicted. `lastApprovedHead` is neither read nor widened: the
|
|
250
276
|
* caller vouches for `req.sha` (only changes the gate approved or exempted are merged). Owns
|
|
251
277
|
* the merge ref's lifecycle from here: deleted on merge, KEPT on every non-terminal outcome
|
|
252
|
-
* (aborted, merge_conflict, merge_blocked) for the next
|
|
278
|
+
* (aborted, merge_conflict, merge_blocked) for the next run's leftover recovery. An abort that has
|
|
253
279
|
* already fired returns "aborted" before anything starts, ref kept — the merge's step-boundary
|
|
254
280
|
* stop (BUGS.md 2026-09-23): with no gate here, nothing else on this path would notice it
|
|
255
281
|
* before the in-lock check and the merge. Never throws for a failed merge: git-level failures
|
|
@@ -272,7 +298,7 @@ async function mergeApprovedChangeIn(ctx, req) {
|
|
|
272
298
|
mainBranch: ctx.mainBranch,
|
|
273
299
|
exemptPaths: ctx.config.review.exemptPaths,
|
|
274
300
|
config: ctx.config,
|
|
275
|
-
|
|
301
|
+
runNumber: req.runNumber,
|
|
276
302
|
runPi: ctx.runPi,
|
|
277
303
|
onMergeCheckRed: (check, outcome) => {
|
|
278
304
|
red = { check, outcome };
|
|
@@ -288,7 +314,7 @@ async function mergeApprovedChangeIn(ctx, req) {
|
|
|
288
314
|
// deliberately reverted merged on the build check alone). Same gate, same worktree
|
|
289
315
|
// convention as reviewPinnedChange: the reject path records the verdict, resets the
|
|
290
316
|
// worktree to main and logs review_rejected itself; the ref and the lastError are ours.
|
|
291
|
-
const gate = await reviewAheadOfMain(reviewContextFor(ctx, req, resolvedWt), ctx.state, req.summary, req.body, req.highFriction);
|
|
317
|
+
const gate = await reviewAheadOfMain(reviewContextFor(ctx, req, resolvedWt, ctx.foldUsage), ctx.state, req.summary, req.body, req.highFriction);
|
|
292
318
|
if (gate.run)
|
|
293
319
|
ctx.foldUsage(gate.run);
|
|
294
320
|
if (gate.followUpRun)
|
|
@@ -296,7 +322,7 @@ async function mergeApprovedChangeIn(ctx, req) {
|
|
|
296
322
|
if (gate.nudgeRun)
|
|
297
323
|
ctx.foldUsage(gate.nudgeRun);
|
|
298
324
|
setMergeStage(ctx.root, req.role, "merging");
|
|
299
|
-
|
|
325
|
+
saveRunnerStateBestEffort(ctx.root, ctx.state);
|
|
300
326
|
if (gate.aborted)
|
|
301
327
|
return { verdict: "retry" };
|
|
302
328
|
if (gate.decision === "approved" || gate.decision === "exempt") {
|
|
@@ -308,7 +334,7 @@ async function mergeApprovedChangeIn(ctx, req) {
|
|
|
308
334
|
// rejection does, then drop this pin. Persist before returning — the state save above
|
|
309
335
|
// predates this bookkeeping.
|
|
310
336
|
await recordRejectedChange(ctx.root, req.role, ctx.state, ctx.state.lastReview?.head ?? req.sha, req.revisionRound, req.priorReview?.counts);
|
|
311
|
-
|
|
337
|
+
saveRunnerStateBestEffort(ctx.root, ctx.state);
|
|
312
338
|
await deleteRef(ctx.root, mergeRefName(req.role)); // the verdict is final for this pin
|
|
313
339
|
ctx.state.lastError = "merge failed: conflict resolution rejected on re-review";
|
|
314
340
|
return { verdict: "rejected" };
|
|
@@ -334,7 +360,7 @@ async function mergeApprovedChangeIn(ctx, req) {
|
|
|
334
360
|
if (result === "merge_blocked" && blocked !== undefined) {
|
|
335
361
|
return mergeBlocked(ctx, req.role, wt, blocked);
|
|
336
362
|
}
|
|
337
|
-
// merge_conflict / merge_blocked: keep the ref — the next
|
|
363
|
+
// merge_conflict / merge_blocked: keep the ref — the next run's recovery re-merges it.
|
|
338
364
|
// (Cross-check blocks no longer come through here: merge-check-failures.ts's mergeBlocked
|
|
339
365
|
// counts them.)
|
|
340
366
|
// A rejected recheck already wrote its own lastError and deleted its ref — leave it.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { increment } from "../collections.js";
|
|
2
|
-
import {
|
|
2
|
+
import { git } from "../git/git-run.js";
|
|
3
3
|
/** The merge-scope DIFF COMPARISON (see merge-to-main.ts for the merge flow that consults
|
|
4
4
|
* it): whether a conflict-resolved tree's diff ahead of main stays inside the diff the review
|
|
5
5
|
* gate approved. Pure multiset comparison over unified diffs, plus the git reads that produce
|
|
@@ -9,10 +9,11 @@ import { gitTry } from "../git/git-run.js";
|
|
|
9
9
|
* did not — three-dot against the branch tip as the gate judged it: the merge-base with
|
|
10
10
|
* current main is the base the reviewer's diff was cut against (syncPinToMain rebased before
|
|
11
11
|
* the gate when it could, and a conflicted pre-gate rebase leaves the pin on its original
|
|
12
|
-
* base).
|
|
12
|
+
* base). A failed diff throws, failing the merge: read as empty, a resolved diff git could not
|
|
13
|
+
* produce is a subset of anything, and the resolution merged without its re-review. */
|
|
13
14
|
export async function resolvedDiffDiverges(ctx, wt, preMergeHead) {
|
|
14
|
-
const approved =
|
|
15
|
-
const resolved =
|
|
15
|
+
const approved = await git(wt, "diff", `${ctx.mainBranch}...${preMergeHead}`);
|
|
16
|
+
const resolved = await git(wt, "diff", `${ctx.mainBranch}...HEAD`);
|
|
16
17
|
const a = diffLineMultiset(approved);
|
|
17
18
|
const r = diffLineMultiset(resolved);
|
|
18
19
|
return !(subsetOf(r.add, a.add) && subsetOf(r.del, a.del));
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// vocabulary: plain
|
|
2
1
|
import { mergeApproved } from "./merge-batch.js";
|
|
3
2
|
import { removeMergeChange, resolveWaitStage, setMergeChangeStatus } from "./merge-slot.js";
|
|
4
3
|
import { seamConcurrencyKey } from "../config/config-views.js";
|
|
@@ -6,23 +5,35 @@ import { withProviderLease } from "../concurrency/provider-lease.js";
|
|
|
6
5
|
import { dropMerge, entryRevisionFields, queuedMergeFiles } from "./merge-queue.js";
|
|
7
6
|
import { errorMessage } from "../text/text.js";
|
|
8
7
|
import { warnEventBestEffort, TUMWATER_SOURCE } from "../events/events.js";
|
|
9
|
-
import {
|
|
8
|
+
import { saveRunnerState } from "../runner/runner-state.js";
|
|
9
|
+
import { addPostReview } from "../review/post-merge-review.js";
|
|
10
|
+
import { drainPostReviews } from "./merge-post-review.js";
|
|
11
|
+
import { subscribeEvents } from "../events/events.js";
|
|
12
|
+
import { treeDiffFiles } from "../git/git-diff.js";
|
|
13
|
+
import { isExemptDiff } from "../review/exemptions.js";
|
|
10
14
|
import { abortOnShutdown, discardPinnedRefs, guardMergeTask, settleMergeOutcome, } from "./merge-pipeline.js";
|
|
11
|
-
import { drainVerify,
|
|
12
|
-
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
*
|
|
23
|
-
*
|
|
15
|
+
import { drainVerify, MERGE_TIER } from "./merge-verify.js";
|
|
16
|
+
/** Whether a merged change still needs a post-merge review: the pre-merge gate skips review when
|
|
17
|
+
* it is disabled or the diff is exempt, so those changes queue none either. A diff that cannot be
|
|
18
|
+
* read queues the review. */
|
|
19
|
+
async function postReviewDue(config, root, commit) {
|
|
20
|
+
if (!config.review.enabled)
|
|
21
|
+
return false;
|
|
22
|
+
const files = await treeDiffFiles(root, `${commit}^`, commit);
|
|
23
|
+
return files === null || !isExemptDiff(files, config.review.exemptPaths);
|
|
24
|
+
}
|
|
25
|
+
/** One poll of the merge queue (the scheduler's WHEN: after the gates, never while a restart
|
|
26
|
+
* or a disk hold is pending — a reviewer-provider hold does not stop the whole drain, it parks
|
|
27
|
+
* only the entries a pre-merge review gates, per the role-scoped startHeld): start a
|
|
28
|
+
* verification for every queued change the pipeline does not already hold (drainVerify, in
|
|
29
|
+
* merge-verify.ts), and start the merge when the slot is free and something is approved
|
|
30
|
+
* (drainMerge). A queued merge is COMMITTED work awaiting completion, not a new run, so the
|
|
31
|
+
* budget and user-pause gates deliberately do not hold it (pausing it would leave main behind
|
|
32
|
+
* while the interlock blocks that role's next run forever). Starts tasks and returns; never
|
|
33
|
+
* awaits them — authors keep running behind them, which is the entire point. */
|
|
24
34
|
export async function drainMergeQueue(ctx, p) {
|
|
25
35
|
await drainVerify(ctx, p);
|
|
36
|
+
drainPostReviews(ctx, p);
|
|
26
37
|
drainMerge(ctx, p);
|
|
27
38
|
}
|
|
28
39
|
/** Settle every approved change `tumwater abort --role` flagged (consumeAbortRequests over
|
|
@@ -59,7 +70,9 @@ export async function settleAbortedApproved(root, p) {
|
|
|
59
70
|
* (a slow review) does not hold them back. An approved change whose queue entry is gone is
|
|
60
71
|
* forgotten (nothing in-process drops one; defensive). */
|
|
61
72
|
export function drainMerge(ctx, p) {
|
|
62
|
-
if (p.merge !== null
|
|
73
|
+
if (p.merge !== null)
|
|
74
|
+
return;
|
|
75
|
+
if (p.approved.size === 0)
|
|
63
76
|
return;
|
|
64
77
|
const queued = queuedMergeFiles(ctx.root);
|
|
65
78
|
const files = new Set(queued.map((q) => q.file));
|
|
@@ -136,13 +149,24 @@ function startMerge(ctx, p, picks) {
|
|
|
136
149
|
const task = (async () => {
|
|
137
150
|
let results;
|
|
138
151
|
let threw = false;
|
|
152
|
+
// The commit each merged role produced, from its `merged` event: the post-merge review of
|
|
153
|
+
// every merged role is queued once the change settles as merged.
|
|
154
|
+
const mergedCommits = new Map();
|
|
155
|
+
const unsubscribe = subscribeEvents((e) => {
|
|
156
|
+
if (e.type === "merged" && typeof e.commit === "string")
|
|
157
|
+
mergedCommits.set(e.source, e.commit);
|
|
158
|
+
});
|
|
139
159
|
// A result reaches settleMergeOutcome the moment mergeApproved finalizes it, not after the
|
|
140
160
|
// whole batch; this set lets the end-of-batch loop skip what is already written back.
|
|
141
161
|
const settled = new Set();
|
|
142
162
|
const settleOne = async (s, result) => {
|
|
143
163
|
const v = picks[s];
|
|
144
164
|
settled.add(s);
|
|
145
|
-
|
|
165
|
+
const mergedCommit = mergedCommits.get(v.entry.role);
|
|
166
|
+
if (result === "changed" && mergedCommit !== undefined && (await postReviewDue(ctx.liveConfig, root, mergedCommit))) {
|
|
167
|
+
addPostReview(root, { commit: mergedCommit, role: v.entry.role, summary: v.entry.summary, ...(v.entry.body !== undefined ? { body: v.entry.body } : {}) });
|
|
168
|
+
}
|
|
169
|
+
await settleMergeOutcome(root, v.entry, v.author.state, result, Date.now() - v.startedAt, v.usage, v.file, mainBranch);
|
|
146
170
|
};
|
|
147
171
|
try {
|
|
148
172
|
results = await mergeApproved({
|
|
@@ -153,10 +177,11 @@ function startMerge(ctx, p, picks) {
|
|
|
153
177
|
onChangeStatus: (role, status) => setMergeChangeStatus(root, role, status),
|
|
154
178
|
onResult: settleOne,
|
|
155
179
|
runGatePi: (opts) => picks[0].author.runGatePi(opts),
|
|
180
|
+
reviewHeld: () => ctx.startHeld(),
|
|
156
181
|
}, picks.map((v) => ({
|
|
157
182
|
role: v.entry.role,
|
|
158
183
|
sha: v.sha,
|
|
159
|
-
|
|
184
|
+
runNumber: v.entry.run,
|
|
160
185
|
summary: v.entry.summary,
|
|
161
186
|
body: v.entry.body,
|
|
162
187
|
highFriction: v.entry.highFriction,
|
|
@@ -174,7 +199,7 @@ function startMerge(ctx, p, picks) {
|
|
|
174
199
|
// and the finally that frees the merge slot, or the pipeline wedges with p.merge set
|
|
175
200
|
// forever; the write is bookkeeping a later save retries, so warn and keep going.
|
|
176
201
|
try {
|
|
177
|
-
|
|
202
|
+
saveRunnerState(root, head.state);
|
|
178
203
|
}
|
|
179
204
|
catch (writeErr) {
|
|
180
205
|
warnEventBestEffort(root, TUMWATER_SOURCE, `the merge error for ${head.state.role} could not be saved: ${errorMessage(writeErr)}`);
|
|
@@ -201,6 +226,7 @@ function startMerge(ctx, p, picks) {
|
|
|
201
226
|
}
|
|
202
227
|
}
|
|
203
228
|
finally {
|
|
229
|
+
unsubscribe();
|
|
204
230
|
detachShutdown();
|
|
205
231
|
if (merge.userAborted)
|
|
206
232
|
await discardPinnedRefs(root, merge.roles);
|