@defrex/autobuild 0.13.0 → 1.0.0-beta.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 +5 -3
- package/SPEC.md +673 -99
- package/bin/ab-dispatch-kernel.ts +4 -6
- package/docs/architecture.md +322 -75
- package/docs/assets/headline-wide.png +0 -0
- package/docs/configuration.md +112 -12
- package/docs/hosted-service.md +20 -2
- package/docs/integration-tree.md +117 -0
- package/docs/landing-policy.md +150 -0
- package/docs/mcp.md +24 -0
- package/docs/migration-1.0.md +68 -0
- package/docs/operator-api.md +20 -9
- package/docs/remote-store-protocol.md +114 -9
- package/docs/remote-ticket-protocol.md +26 -5
- package/docs/restacking.md +79 -0
- package/docs/setup.md +49 -6
- package/docs/ticket-dependencies.md +69 -0
- package/docs/ticket-migration.md +8 -0
- package/package.json +4 -3
- package/packages/core/src/cli/attention.ts +40 -163
- package/packages/core/src/cli/build-control.ts +75 -55
- package/packages/core/src/cli/bulk-control.ts +3 -2
- package/packages/core/src/cli/context.ts +68 -78
- package/packages/core/src/cli/dashboard/actions.ts +6 -3
- package/packages/core/src/cli/dashboard/landing-display.ts +6 -0
- package/packages/core/src/cli/dashboard/live.ts +5 -0
- package/packages/core/src/cli/dashboard/model.ts +178 -40
- package/packages/core/src/cli/dashboard/poll.ts +15 -9
- package/packages/core/src/cli/dashboard/refresh.ts +176 -0
- package/packages/core/src/cli/dashboard/render.ts +78 -28
- package/packages/core/src/cli/dashboard/repository-poll.ts +57 -0
- package/packages/core/src/cli/dashboard/selection.ts +7 -1
- package/packages/core/src/cli/dashboard/tree.ts +107 -0
- package/packages/core/src/cli/dispatch-frontend.ts +173 -169
- package/packages/core/src/cli/dispatch-process.ts +14 -7
- package/packages/core/src/cli/dispatch-repository-feed.ts +196 -0
- package/packages/core/src/cli/dispatch.ts +397 -214
- package/packages/core/src/cli/dispatcher-liveness.ts +41 -21
- package/packages/core/src/cli/harvest.ts +71 -39
- package/packages/core/src/cli/help.ts +49 -32
- package/packages/core/src/cli/historical-build-state.ts +27 -0
- package/packages/core/src/cli/init-validation.ts +43 -2
- package/packages/core/src/cli/keyboard.ts +6 -0
- package/packages/core/src/cli/landings.ts +18 -0
- package/packages/core/src/cli/main.ts +52 -18
- package/packages/core/src/cli/mcp.ts +9 -0
- package/packages/core/src/cli/pr-attachments.ts +10 -13
- package/packages/core/src/cli/pr-summary-publication.ts +27 -60
- package/packages/core/src/cli/pr-summary.ts +43 -13
- package/packages/core/src/cli/publication-settlement.ts +177 -21
- package/packages/core/src/cli/repository-status.ts +49 -2
- package/packages/core/src/cli/status.ts +133 -36
- package/packages/core/src/cli/terminal-restore.ts +54 -0
- package/packages/core/src/cli/terminal.ts +16 -2
- package/packages/core/src/cli/terminals.ts +121 -219
- package/packages/core/src/cli/ticket-editor.ts +10 -3
- package/packages/core/src/cli/ticket.ts +115 -20
- package/packages/core/src/cli/upgrade-commit.ts +4 -0
- package/packages/core/src/cli/upgrade-compatibility.ts +2 -2
- package/packages/core/src/cli/upgrade-landing.ts +69 -0
- package/packages/core/src/cli/upgrade.ts +16 -0
- package/packages/core/src/cli/wait.ts +194 -91
- package/packages/core/src/cli/watch.ts +111 -109
- package/packages/core/src/config/landing.ts +22 -0
- package/packages/core/src/config/live.ts +1 -0
- package/packages/core/src/config/pipeline-source.ts +4 -3
- package/packages/core/src/config/schema.ts +3 -0
- package/packages/core/src/events/catalog.ts +48 -3
- package/packages/core/src/events/payloads.ts +295 -6
- package/packages/core/src/events/repository.ts +38 -3
- package/packages/core/src/integration/harness.ts +11 -2
- package/packages/core/src/kernel/__snapshots__/reducer-registry.test.ts.snap +3330 -119
- package/packages/core/src/kernel/auto-merge-default.ts +1 -0
- package/packages/core/src/kernel/auto-merge.ts +29 -4
- package/packages/core/src/kernel/build-identity.ts +94 -0
- package/packages/core/src/kernel/change-presence.ts +179 -0
- package/packages/core/src/kernel/dispatch-status.ts +17 -1
- package/packages/core/src/kernel/dispatcher-liveness.ts +10 -4
- package/packages/core/src/kernel/engine.ts +89 -2
- package/packages/core/src/kernel/generators/build-log.ts +23 -0
- package/packages/core/src/kernel/generators/leaf-restack-log.ts +110 -0
- package/packages/core/src/kernel/generators/node-restack-log.ts +94 -0
- package/packages/core/src/kernel/generators/repository-journals.ts +25 -3
- package/packages/core/src/kernel/harvest.ts +25 -23
- package/packages/core/src/kernel/integration-completeness.ts +81 -0
- package/packages/core/src/kernel/integration-landing.ts +263 -0
- package/packages/core/src/kernel/integration-stack.ts +36 -0
- package/packages/core/src/kernel/integration-state.ts +135 -0
- package/packages/core/src/kernel/landing-policy.ts +47 -0
- package/packages/core/src/kernel/landing-publication.ts +41 -0
- package/packages/core/src/kernel/landing-readiness.ts +67 -0
- package/packages/core/src/kernel/landing-state.ts +96 -0
- package/packages/core/src/kernel/leaf-restack-completion.ts +24 -0
- package/packages/core/src/kernel/leaf-restack-state.ts +73 -0
- package/packages/core/src/kernel/log-index-value.ts +38 -0
- package/packages/core/src/kernel/log-index.ts +35 -5
- package/packages/core/src/kernel/node-landing.ts +439 -0
- package/packages/core/src/kernel/node-parent.ts +184 -0
- package/packages/core/src/kernel/node-restack-state.ts +191 -0
- package/packages/core/src/kernel/node-restack-transaction.ts +210 -0
- package/packages/core/src/kernel/node-restack.ts +274 -0
- package/packages/core/src/kernel/read-facts.ts +704 -0
- package/packages/core/src/kernel/reconcile-head.ts +51 -0
- package/packages/core/src/kernel/reconcile-restack.ts +560 -0
- package/packages/core/src/kernel/reducer-registry.ts +153 -3
- package/packages/core/src/kernel/reducer.ts +121 -6
- package/packages/core/src/kernel/repository-attention.ts +179 -0
- package/packages/core/src/kernel/service-facts.ts +135 -0
- package/packages/core/src/kernel/snapshot-parent.ts +33 -0
- package/packages/core/src/kernel/terminal-guard.ts +133 -0
- package/packages/core/src/ontology.ts +9 -1
- package/packages/core/src/operator/annotations.ts +12 -0
- package/packages/core/src/operator/control.ts +11 -6
- package/packages/core/src/operator/index.ts +6 -0
- package/packages/core/src/operator/landings.ts +35 -0
- package/packages/core/src/operator/presentation.ts +1 -0
- package/packages/core/src/operator/protocol.ts +12 -3
- package/packages/core/src/operator/query.ts +40 -21
- package/packages/core/src/operator/read-view.ts +4 -13
- package/packages/core/src/operator/registry.ts +48 -19
- package/packages/core/src/operator/requests.ts +3 -22
- package/packages/core/src/operator/sandbox.ts +10 -9
- package/packages/core/src/operator/tickets.ts +57 -11
- package/packages/core/src/plugin-sdk/index.ts +13 -0
- package/packages/core/src/ports/forge/contract.ts +91 -3
- package/packages/core/src/ports/forge/fake.ts +142 -4
- package/packages/core/src/ports/forge/git-rewrite.ts +232 -0
- package/packages/core/src/ports/forge/github-readiness.ts +421 -0
- package/packages/core/src/ports/forge/github.ts +631 -35
- package/packages/core/src/ports/forge/local-git.ts +119 -5
- package/packages/core/src/ports/forge/readiness.ts +99 -0
- package/packages/core/src/ports/tickets/contract.ts +41 -0
- package/packages/core/src/ports/tickets/create.ts +8 -1
- package/packages/core/src/ports/tickets/fake.ts +32 -1
- package/packages/core/src/ports/tickets/file-codec.ts +7 -0
- package/packages/core/src/ports/tickets/file.ts +18 -1
- package/packages/core/src/ports/tickets/hosted-index.ts +2 -0
- package/packages/core/src/ports/tickets/linear.ts +124 -4
- package/packages/core/src/ports/tickets/migration.ts +25 -1
- package/packages/core/src/ports/tickets/operations.ts +7 -2
- package/packages/core/src/ports/tickets/remote-protocol.ts +19 -0
- package/packages/core/src/ports/tickets/remote.ts +10 -1
- package/packages/core/src/ports/tickets/revision.ts +3 -1
- package/packages/core/src/ports/tickets/tree.ts +148 -0
- package/packages/core/src/ports/tickets/update.ts +15 -2
- package/packages/core/src/ports/types.ts +135 -5
- package/packages/core/src/ports/workspace/git-worktree.ts +2 -1
- package/packages/core/src/ports/workspace/provider-capabilities.ts +1 -1
- package/packages/core/src/ports/workspace/vercel-sandbox.ts +60 -3
- package/packages/core/src/processes/build-child.ts +6 -6
- package/packages/core/src/processes/build-runner.ts +586 -87
- package/packages/core/src/processes/dispatch-failure-budget.ts +5 -4
- package/packages/core/src/processes/dispatcher-selectors.ts +15 -9
- package/packages/core/src/processes/dispatcher.ts +2239 -357
- package/packages/core/src/processes/execution-no-progress.ts +46 -1
- package/packages/core/src/processes/harvest-execution-state.ts +15 -9
- package/packages/core/src/processes/harvest-runner.ts +34 -70
- package/packages/core/src/processes/harvest.ts +38 -15
- package/packages/core/src/processes/infrastructure-failure-budget.ts +13 -15
- package/packages/core/src/processes/orchestrator-tick.ts +2 -2
- package/packages/core/src/processes/publication-loss.ts +35 -21
- package/packages/core/src/processes/publication-state.ts +30 -5
- package/packages/core/src/processes/repo-view.ts +244 -1130
- package/packages/core/src/processes/tick-publication.ts +110 -0
- package/packages/core/src/store/adapter.ts +23 -0
- package/packages/core/src/store/build-scope.ts +35 -0
- package/packages/core/src/store/contract.ts +909 -0
- package/packages/core/src/store/digest.ts +52 -4
- package/packages/core/src/store/local/schema.ts +26 -13
- package/packages/core/src/store/local/store.ts +296 -55
- package/packages/core/src/store/memory.ts +181 -30
- package/packages/core/src/store/phase-session.ts +34 -0
- package/packages/core/src/store/reduced-reads.ts +240 -0
- package/packages/core/src/store/reducer-value-shapes.json +18323 -0
- package/packages/core/src/store/reducer-value-validation.ts +96 -0
- package/packages/core/src/store/reducer-values.ts +145 -0
- package/packages/core/src/store/remote/client.ts +85 -0
- package/packages/core/src/store/remote/compatibility.ts +21 -9
- package/packages/core/src/store/remote/index.ts +19 -0
- package/packages/core/src/store/remote/protocol.ts +27 -0
- package/packages/core/src/store/remote/version.ts +3 -1
- package/packages/core/src/store/repo-state-events.ts +3 -1
- package/packages/core/src/store/repo-tick.ts +72 -0
- package/packages/core/src/store/session-handle.ts +34 -0
- package/packages/core/src/store/snapshots.ts +10 -0
- package/packages/core/src/store/subscribe.ts +1 -1
- package/packages/core/src/store/ticket-assets.ts +4 -4
- package/packages/core/src/store/types.ts +71 -6
- package/packages/core/src/testing/dispatch-read-budget.ts +215 -0
- package/packages/core/src/testing/index.ts +10 -0
- package/packages/core/src/testing/reduced-read-budget.ts +502 -0
- package/packages/core/src/testing/refresh-scheduler.ts +32 -0
- package/skills/guide/SKILL.md +116 -62
- package/skills/guide/references/integration-tree.md +117 -0
- package/skills/guide/references/landing-policy.md +150 -0
- package/skills/guide/references/migration-1.0.md +68 -0
- package/skills/guide/references/operator-api.md +13 -6
- package/skills/guide/references/plugin-authoring.md +34 -0
- package/skills/guide/references/remote-store-protocol.md +114 -9
- package/skills/guide/references/remote-ticket-protocol.md +26 -5
- package/skills/guide/references/restacking.md +79 -0
- package/skills/guide/references/setup.md +49 -6
- package/skills/guide/references/ticket-dependencies.md +69 -0
- package/skills/guide/references/ticket-migration.md +8 -0
- package/skills/operate/SKILL.md +55 -5
- package/skills/reconcile/SKILL.md +55 -48
- package/skills/spec/SKILL.md +67 -1
- package/skills/tickets/SKILL.md +55 -2
- package/templates/autobuild.toml +3 -0
- package/templates/hosted-service/package.json +2 -2
|
@@ -1,10 +1,20 @@
|
|
|
1
|
+
import { forgeReadinessWarnings } from '../kernel/dispatch-status'
|
|
2
|
+
import { RepositoryPollCache } from './dashboard/repository-poll'
|
|
3
|
+
import {
|
|
4
|
+
DashboardRefresh,
|
|
5
|
+
interactionRead,
|
|
6
|
+
presentationReader,
|
|
7
|
+
type RefreshScheduler,
|
|
8
|
+
} from './dashboard/refresh'
|
|
9
|
+
import { FOCUS_REPORTING_MODE, installPresentationSuspension } from './terminal-restore'
|
|
10
|
+
import { DispatchRepositoryFeed } from './dispatch-repository-feed'
|
|
1
11
|
import { StandbyIdentityResolver } from './dispatcher-liveness'
|
|
2
12
|
import { configSchema, type Config } from '../config/schema'
|
|
3
13
|
import { humanActor } from '../events/envelope'
|
|
4
14
|
import type { RepositoryEvent } from '../events/repository'
|
|
5
15
|
import { reduceDispatchStatus, type DispatchStatus } from '../kernel/dispatch-status'
|
|
6
16
|
import type { BuildState } from '../kernel/reducer'
|
|
7
|
-
import {
|
|
17
|
+
import { unclaimedObservationCount } from '../processes/harvest'
|
|
8
18
|
import {
|
|
9
19
|
controlHarvestRun,
|
|
10
20
|
OperatorControlError,
|
|
@@ -24,7 +34,7 @@ import {
|
|
|
24
34
|
type DashboardSelection,
|
|
25
35
|
type DashboardView,
|
|
26
36
|
} from './dashboard/model'
|
|
27
|
-
import { DashboardBuildPollCache } from './dashboard/poll'
|
|
37
|
+
import { DashboardBuildPollCache, type DashboardPollSnapshot } from './dashboard/poll'
|
|
28
38
|
import {
|
|
29
39
|
dashboardContentWidth,
|
|
30
40
|
detailScrollLimit,
|
|
@@ -47,9 +57,10 @@ import {
|
|
|
47
57
|
type DispatchChildOptions,
|
|
48
58
|
} from './dispatch-process'
|
|
49
59
|
|
|
50
|
-
|
|
60
|
+
import type { TicketSource } from '../ports/types'
|
|
61
|
+
|
|
51
62
|
const PAINT_MS = 250
|
|
52
|
-
const ABORTABLE_STATUSES = new Set(['queued', 'running', 'paused', 'blocked'])
|
|
63
|
+
const ABORTABLE_STATUSES = new Set(['queued', 'running', 'collecting', 'paused', 'blocked'])
|
|
53
64
|
|
|
54
65
|
function validAbortConfirmation(state: BuildState | undefined): boolean {
|
|
55
66
|
return (
|
|
@@ -68,15 +79,6 @@ function isStaleAbortControlError(error: unknown): error is BuildControlError {
|
|
|
68
79
|
)
|
|
69
80
|
}
|
|
70
81
|
|
|
71
|
-
function isDashboardRepositoryEvent(event: RepositoryEvent): boolean {
|
|
72
|
-
return (
|
|
73
|
-
event.type.startsWith('harvest.') ||
|
|
74
|
-
event.type === 'dispatcher.intake-set' ||
|
|
75
|
-
event.type === 'dispatcher.pause-set' ||
|
|
76
|
-
event.type === 'dispatcher.auto-merge-default-set'
|
|
77
|
-
)
|
|
78
|
-
}
|
|
79
|
-
|
|
80
82
|
interface ResumePrompt {
|
|
81
83
|
slug: string
|
|
82
84
|
escalationIds: string[]
|
|
@@ -92,6 +94,7 @@ export interface DispatchFrontendOptions {
|
|
|
92
94
|
checkout?: string
|
|
93
95
|
storeRef: string
|
|
94
96
|
store: BuildStore
|
|
97
|
+
ticketSource?: () => Promise<TicketSource>
|
|
95
98
|
env: Record<string, string | undefined>
|
|
96
99
|
terminal: TerminalOut
|
|
97
100
|
input: TerminalInput
|
|
@@ -100,6 +103,7 @@ export interface DispatchFrontendOptions {
|
|
|
100
103
|
intervalMs?: number
|
|
101
104
|
intake?: boolean
|
|
102
105
|
defaultAutoMerge?: boolean
|
|
106
|
+
refreshScheduler?: RefreshScheduler
|
|
103
107
|
clock?: Clock
|
|
104
108
|
resolveDashboardRenderer?: DashboardRendererResolver
|
|
105
109
|
launchChild?: (input: {
|
|
@@ -121,11 +125,7 @@ export class DispatchFrontend {
|
|
|
121
125
|
private readonly region: LiveRegion
|
|
122
126
|
private readonly keyboard
|
|
123
127
|
private child: DispatchChildHandle | undefined
|
|
124
|
-
private
|
|
125
|
-
/** Set only after a successful initial fold; every later `events()` call
|
|
126
|
-
* takes the delta path. */
|
|
127
|
-
private seeded = false
|
|
128
|
-
private repositoryEvents: RepositoryEvent[] = []
|
|
128
|
+
private readonly repositoryFeed: DispatchRepositoryFeed
|
|
129
129
|
private dispatchStatus: DispatchStatus = reduceDispatchStatus([], this.runId)
|
|
130
130
|
private eventRefreshTail: Promise<void> = Promise.resolve()
|
|
131
131
|
private cache: DashboardBuildPollCache | undefined
|
|
@@ -146,17 +146,22 @@ export class DispatchFrontend {
|
|
|
146
146
|
private abortConfirmation: { slug: string } | undefined
|
|
147
147
|
private accepting = false
|
|
148
148
|
private cleanupInput: (() => void) | undefined
|
|
149
|
-
private
|
|
149
|
+
private refresh: DashboardRefresh | undefined
|
|
150
|
+
private suspension: ReturnType<typeof installPresentationSuspension> | undefined
|
|
151
|
+
private readonly reader: BuildStore
|
|
150
152
|
private paintTimer: ReturnType<typeof setInterval> | undefined
|
|
151
|
-
private polling = false
|
|
152
|
-
private pollInFlight: Promise<void> | undefined
|
|
153
153
|
private actionTail: Promise<void> = Promise.resolve()
|
|
154
154
|
private presentationRestored = false
|
|
155
155
|
private operatorStopRequested = false
|
|
156
156
|
|
|
157
157
|
constructor(private readonly opts: DispatchFrontendOptions) {
|
|
158
|
-
this.
|
|
158
|
+
this.reader = presentationReader(opts.store, () => this.refresh?.admitted ?? true)
|
|
159
159
|
this.clock = opts.clock ?? systemClock
|
|
160
|
+
this.repositoryFeed = new DispatchRepositoryFeed(this.reader, opts.repo, this.clock)
|
|
161
|
+
this.standbyResolver = new StandbyIdentityResolver(this.reader, opts.repo, {
|
|
162
|
+
allowLookup: () => this.repositoryFeed.incompleteIdentities,
|
|
163
|
+
remember: (events, complete) => this.repositoryFeed.remember(events, complete),
|
|
164
|
+
})
|
|
160
165
|
this.keyboard = createKeyboardProtocol(
|
|
161
166
|
(chunk) => opts.terminal.write(chunk),
|
|
162
167
|
opts.terminal.modes,
|
|
@@ -170,47 +175,14 @@ export class DispatchFrontend {
|
|
|
170
175
|
* are retained for their existing replay reducers. */
|
|
171
176
|
private async events(): Promise<RepositoryEvent[]> {
|
|
172
177
|
const refresh = this.eventRefreshTail.then(async () => {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
// to pay is replaced by AUT-489's bounded read where that is provably
|
|
176
|
-
// equivalent. The bounded attempt is confined to the pre-launch
|
|
177
|
-
// window (`this.child === undefined`): before `launchChild` no
|
|
178
|
-
// run-scoped journal fact can carry `this.runId` (only the supervised
|
|
179
|
-
// child appends run-scoped facts with it), so every run-scoped event
|
|
180
|
-
// in the bounded subset is skipped by `reduceDispatchStatus` exactly
|
|
181
|
-
// as it would be in a full replay, and the dashboard filter keeps
|
|
182
|
-
// only durable types, which the subset carries in full. After launch
|
|
183
|
-
// a bounded subset cannot guarantee the child's `run-started` under a
|
|
184
|
-
// competing dispatcher's later anchor — dropping it would leave
|
|
185
|
-
// `effectiveConfig` unset and the first frame would never render —
|
|
186
|
-
// so a post-launch seed always takes the full read (the pre-AUT-534
|
|
187
|
-
// behavior). `once` mode's teardown fold runs after the child exits,
|
|
188
|
-
// so the same guard routes it to the full read.
|
|
189
|
-
const seed =
|
|
190
|
-
this.child === undefined
|
|
191
|
-
? await this.opts.store.getRepoStateEvents(this.opts.repo).catch(() =>
|
|
192
|
-
// Bounded-read failure falls back to the exact pre-AUT-534
|
|
193
|
-
// full read within this same seed attempt.
|
|
194
|
-
this.opts.store.getRepoEvents(this.opts.repo, 0),
|
|
195
|
-
)
|
|
196
|
-
: await this.opts.store.getRepoEvents(this.opts.repo, 0)
|
|
197
|
-
this.standbyResolver.ingest(seed)
|
|
198
|
-
this.repositorySeq = seed.at(-1)?.seq ?? 0
|
|
199
|
-
this.dispatchStatus = reduceDispatchStatus(seed, this.runId)
|
|
200
|
-
this.repositoryEvents.push(...seed.filter(isDashboardRepositoryEvent))
|
|
201
|
-
this.seeded = true
|
|
202
|
-
return
|
|
203
|
-
}
|
|
204
|
-
const delta = await this.opts.store.getRepoEvents(this.opts.repo, this.repositorySeq)
|
|
205
|
-
if (delta.length === 0) return
|
|
178
|
+
const delta = await this.repositoryFeed.refresh(false)
|
|
179
|
+
this.standbyResolver.ingest(this.repositoryFeed.identities)
|
|
206
180
|
this.standbyResolver.ingest(delta)
|
|
207
|
-
this.repositorySeq = delta.at(-1)!.seq
|
|
208
181
|
this.dispatchStatus = reduceDispatchStatus(delta, this.runId, this.dispatchStatus)
|
|
209
|
-
this.repositoryEvents.push(...delta.filter(isDashboardRepositoryEvent))
|
|
210
182
|
})
|
|
211
183
|
this.eventRefreshTail = refresh.catch(() => {})
|
|
212
184
|
await refresh
|
|
213
|
-
return this.
|
|
185
|
+
return this.repositoryFeed.events
|
|
214
186
|
}
|
|
215
187
|
|
|
216
188
|
private async report(message: string, level: 'info' | 'warning' = 'info'): Promise<void> {
|
|
@@ -221,8 +193,10 @@ export class DispatchFrontend {
|
|
|
221
193
|
})
|
|
222
194
|
}
|
|
223
195
|
|
|
224
|
-
private queue(operation: () => Promise<void
|
|
225
|
-
const result = this.actionTail.then(
|
|
196
|
+
private queue(operation: () => Promise<void>, interaction = true): void {
|
|
197
|
+
const result = this.actionTail.then(() =>
|
|
198
|
+
interaction ? interactionRead(operation) : operation(),
|
|
199
|
+
)
|
|
226
200
|
this.actionTail = result.then(
|
|
227
201
|
() => undefined,
|
|
228
202
|
async (error) => {
|
|
@@ -231,7 +205,7 @@ export class DispatchFrontend {
|
|
|
231
205
|
`dashboard action failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
232
206
|
'warning',
|
|
233
207
|
)
|
|
234
|
-
await this.renderOnce()
|
|
208
|
+
await this.renderOnce(interaction)
|
|
235
209
|
} catch {
|
|
236
210
|
// The next poll remains the recovery boundary.
|
|
237
211
|
}
|
|
@@ -295,6 +269,7 @@ export class DispatchFrontend {
|
|
|
295
269
|
}
|
|
296
270
|
|
|
297
271
|
private paint(): void {
|
|
272
|
+
if (this.refresh !== undefined && !this.refresh.painting) return
|
|
298
273
|
if (this.model === undefined) return
|
|
299
274
|
const renderer = this.opts.resolveDashboardRenderer?.() ?? renderDashboard
|
|
300
275
|
this.region.update(
|
|
@@ -310,7 +285,7 @@ export class DispatchFrontend {
|
|
|
310
285
|
private async loadConfig(kind: string, rev: number): Promise<Config> {
|
|
311
286
|
const key = `${kind}@${rev}`
|
|
312
287
|
if (this.config !== undefined && this.configRef === key) return this.config
|
|
313
|
-
const artifact = await this.
|
|
288
|
+
const artifact = await this.reader.getRepoArtifact(this.opts.repo, kind, rev)
|
|
314
289
|
if (artifact === null) throw new Error(`effective config ${key} is not retrievable`)
|
|
315
290
|
const parsed = configSchema.parse(JSON.parse(new TextDecoder().decode(artifact.content)))
|
|
316
291
|
this.config = parsed
|
|
@@ -319,37 +294,69 @@ export class DispatchFrontend {
|
|
|
319
294
|
return parsed
|
|
320
295
|
}
|
|
321
296
|
|
|
322
|
-
private async renderOnce(): Promise<void> {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
this.
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
297
|
+
private async renderOnce(interaction = true): Promise<void> {
|
|
298
|
+
if (this.refresh !== undefined) return this.refresh.request(interaction)
|
|
299
|
+
return this.readFrame()
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
private readonly repositoryPoll = new RepositoryPollCache<{
|
|
303
|
+
repositoryEvents: RepositoryEvent[]
|
|
304
|
+
status: DispatchStatus
|
|
305
|
+
config: Config
|
|
306
|
+
observationCount: number
|
|
307
|
+
snapshot: DashboardPollSnapshot
|
|
308
|
+
}>()
|
|
309
|
+
|
|
310
|
+
private async readFrame(): Promise<void> {
|
|
311
|
+
if (this.refresh !== undefined && !this.refresh.admitted) return
|
|
312
|
+
const frame = await this.repositoryPoll.refresh({
|
|
313
|
+
position: () => this.reader.getRepoChangePosition(this.opts.repo),
|
|
314
|
+
now: () => this.clock().getTime(),
|
|
315
|
+
revision: 0,
|
|
316
|
+
enabled: !this.opts.once,
|
|
317
|
+
valid: (frame) => this.cache?.isCurrent(frame.snapshot) ?? false,
|
|
318
|
+
admitted: () => this.refresh === undefined || this.refresh.admitted,
|
|
319
|
+
nextPollMs: this.refresh?.intervalMs ?? 0,
|
|
320
|
+
read: async ({ fullEnrichment }) => {
|
|
321
|
+
const repositoryEvents = await this.events()
|
|
322
|
+
const status = this.dispatchStatus
|
|
323
|
+
const ref = status.effectiveConfig
|
|
324
|
+
if (ref === undefined) {
|
|
325
|
+
if (status.health === 'failed' && status.warningNotice !== undefined)
|
|
326
|
+
this.region.update([status.warningNotice])
|
|
327
|
+
// Startup is incomplete: retry at the same position.
|
|
328
|
+
return undefined
|
|
329
|
+
}
|
|
330
|
+
const config = await this.loadConfig(ref.kind, ref.rev)
|
|
331
|
+
let observationCount: number
|
|
332
|
+
try {
|
|
333
|
+
observationCount = unclaimedObservationCount({
|
|
334
|
+
digests: await this.reader.getRepoBuildDigests(this.opts.repo),
|
|
335
|
+
harvestEvents: repositoryEvents,
|
|
336
|
+
})
|
|
337
|
+
} catch {
|
|
338
|
+
// Incomplete snapshots never acknowledge the sampled position.
|
|
339
|
+
this.syncControls()
|
|
340
|
+
this.paint()
|
|
341
|
+
return undefined
|
|
342
|
+
}
|
|
343
|
+
this.cache ??= new DashboardBuildPollCache(this.reader, this.opts.repo, config)
|
|
344
|
+
const snapshot = await this.cache.refresh(config, this.configRevision, fullEnrichment)
|
|
345
|
+
if (!this.opts.once)
|
|
346
|
+
await this.standbyResolver.refresh(this.runId, status.yieldedHolder, this.clock())
|
|
347
|
+
await this.repositoryFeed.save()
|
|
348
|
+
if (!this.cache.isCurrent(snapshot)) return undefined
|
|
349
|
+
return { repositoryEvents, status, config, observationCount, snapshot }
|
|
350
|
+
},
|
|
351
|
+
})
|
|
352
|
+
if (frame === undefined) return
|
|
353
|
+
let { repositoryEvents, status } = frame
|
|
354
|
+
const { config, snapshot } = frame
|
|
355
|
+
const standby = this.opts.once
|
|
356
|
+
? undefined
|
|
357
|
+
: this.standbyResolver.current(this.runId, status.yieldedHolder, this.clock())
|
|
358
|
+
this.observationCount = frame.observationCount
|
|
359
|
+
this.refresh?.activity(snapshot.states.size > 0)
|
|
353
360
|
|
|
354
361
|
if (this.resumePrompt !== undefined) {
|
|
355
362
|
const state = snapshot.states.get(this.resumePrompt.slug)
|
|
@@ -370,11 +377,9 @@ export class DispatchFrontend {
|
|
|
370
377
|
const previous = this.model === undefined ? [] : dashboardSelections(this.model)
|
|
371
378
|
const warningLines = [
|
|
372
379
|
...status.roleWarnings,
|
|
380
|
+
...forgeReadinessWarnings(status),
|
|
373
381
|
...(status.warningNotice !== undefined ? [status.warningNotice] : []),
|
|
374
382
|
]
|
|
375
|
-
const standby = this.opts.once
|
|
376
|
-
? undefined
|
|
377
|
-
: await this.standbyResolver.refresh(this.runId, status.yieldedHolder, this.clock())
|
|
378
383
|
const projected = buildDashboardFromProjected(
|
|
379
384
|
snapshot.builds,
|
|
380
385
|
{
|
|
@@ -382,7 +387,7 @@ export class DispatchFrontend {
|
|
|
382
387
|
...(standby !== undefined ? { standby } : {}),
|
|
383
388
|
queued: status.queued ?? 0,
|
|
384
389
|
activeCount: [...snapshot.states.values()].filter(
|
|
385
|
-
(state) => state.status !== 'done' && state.status !== 'aborted',
|
|
390
|
+
(state) => state.kind !== 'node' && state.status !== 'done' && state.status !== 'aborted',
|
|
386
391
|
).length,
|
|
387
392
|
capacity: config.capacity,
|
|
388
393
|
observationCount: this.observationCount,
|
|
@@ -527,7 +532,7 @@ export class DispatchFrontend {
|
|
|
527
532
|
follow: true,
|
|
528
533
|
scroll: 0,
|
|
529
534
|
}
|
|
530
|
-
this.sessionFeed = new SessionStreamFeed(this.
|
|
535
|
+
this.sessionFeed = new SessionStreamFeed(this.reader, captured.slug)
|
|
531
536
|
this.syncControls()
|
|
532
537
|
this.paint()
|
|
533
538
|
// Kick the first read immediately rather than waiting one interval.
|
|
@@ -584,6 +589,7 @@ export class DispatchFrontend {
|
|
|
584
589
|
* feed's identity+cursor fence — the same pattern the DispatchLoop path
|
|
585
590
|
* uses, from the same shared feed module. */
|
|
586
591
|
private pollSessionFeed(): void {
|
|
592
|
+
if (this.refresh !== undefined && !this.refresh.admitted) return
|
|
587
593
|
const view = this.view
|
|
588
594
|
if (view?.kind !== 'session') return
|
|
589
595
|
if (view.status !== 'open' && view.error === undefined) {
|
|
@@ -618,7 +624,7 @@ export class DispatchFrontend {
|
|
|
618
624
|
}
|
|
619
625
|
this.syncControls()
|
|
620
626
|
this.paint()
|
|
621
|
-
})
|
|
627
|
+
}, false)
|
|
622
628
|
})
|
|
623
629
|
.catch(() => {
|
|
624
630
|
// The feed contains its own failures; the next poll retries.
|
|
@@ -660,7 +666,7 @@ export class DispatchFrontend {
|
|
|
660
666
|
const ref = this.dispatchStatus.effectiveConfig
|
|
661
667
|
if (ref === undefined) throw new Error('effective config is not available')
|
|
662
668
|
const config = await this.loadConfig(ref.kind, ref.rev)
|
|
663
|
-
this.cache ??= new DashboardBuildPollCache(this.
|
|
669
|
+
this.cache ??= new DashboardBuildPollCache(this.reader, this.opts.repo, config)
|
|
664
670
|
let snapshot = await this.cache.refresh(config, this.configRevision)
|
|
665
671
|
while (!this.cache.isCurrent(snapshot)) {
|
|
666
672
|
snapshot = await this.cache.refresh(config, this.configRevision)
|
|
@@ -682,11 +688,12 @@ export class DispatchFrontend {
|
|
|
682
688
|
}
|
|
683
689
|
|
|
684
690
|
private async buildAction(
|
|
685
|
-
kind: 'pause' | 'resume' | 'discard' | '
|
|
691
|
+
kind: 'pause' | 'resume' | 'discard' | 'hold' | 'land' | 'abort',
|
|
686
692
|
slug: string,
|
|
687
693
|
): Promise<void> {
|
|
688
694
|
const result = await controlBuild({
|
|
689
695
|
store: this.opts.store,
|
|
696
|
+
ticketSource: this.opts.ticketSource,
|
|
690
697
|
repo: this.opts.repo,
|
|
691
698
|
slug,
|
|
692
699
|
env: this.opts.env,
|
|
@@ -716,9 +723,9 @@ export class DispatchFrontend {
|
|
|
716
723
|
? `build ${slug}: discard requested`
|
|
717
724
|
: result.command === 'abort'
|
|
718
725
|
? `build ${slug}: abort requested`
|
|
719
|
-
: result.command === '
|
|
720
|
-
? `build ${slug}:
|
|
721
|
-
: `build ${slug}:
|
|
726
|
+
: result.command === 'land'
|
|
727
|
+
? `build ${slug}: landing consent requested`
|
|
728
|
+
: `build ${slug}: landing hold requested`
|
|
722
729
|
await this.report(message)
|
|
723
730
|
await this.renderOnce()
|
|
724
731
|
}
|
|
@@ -735,18 +742,6 @@ export class DispatchFrontend {
|
|
|
735
742
|
await this.renderOnce()
|
|
736
743
|
}
|
|
737
744
|
|
|
738
|
-
private async toggleDefaultAutoMerge(): Promise<void> {
|
|
739
|
-
const event = await toggleRepositorySetting({
|
|
740
|
-
store: this.opts.store,
|
|
741
|
-
repo: this.opts.repo,
|
|
742
|
-
user: buildControlUser(this.opts.env),
|
|
743
|
-
setting: 'auto-merge-default',
|
|
744
|
-
run: this.runId,
|
|
745
|
-
})
|
|
746
|
-
await this.report(`dispatcher auto-merge default ${event.enabled ? 'ON' : 'OFF'}`)
|
|
747
|
-
await this.renderOnce()
|
|
748
|
-
}
|
|
749
|
-
|
|
750
745
|
private async bulk(direction: 'pause' | 'resume'): Promise<void> {
|
|
751
746
|
const summary = await bulkControlRepository({
|
|
752
747
|
store: this.opts.store,
|
|
@@ -838,6 +833,7 @@ export class DispatchFrontend {
|
|
|
838
833
|
}
|
|
839
834
|
|
|
840
835
|
private onInput(input: TerminalInputEvent): void {
|
|
836
|
+
this.refresh?.interaction()
|
|
841
837
|
if (!this.accepting) return
|
|
842
838
|
if (input.type === 'interrupt') {
|
|
843
839
|
this.requestOperatorStop()
|
|
@@ -884,7 +880,7 @@ export class DispatchFrontend {
|
|
|
884
880
|
if (enter) {
|
|
885
881
|
// List/detail identity is captured synchronously before any Store read;
|
|
886
882
|
// a later selection move cannot retarget this navigation.
|
|
887
|
-
void this.openSelected().catch((error) =>
|
|
883
|
+
void interactionRead(() => this.openSelected()).catch((error) =>
|
|
888
884
|
this.report(
|
|
889
885
|
`dashboard open action failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
890
886
|
'warning',
|
|
@@ -902,13 +898,13 @@ export class DispatchFrontend {
|
|
|
902
898
|
if (this.selection?.kind === 'global' && this.view === undefined)
|
|
903
899
|
this.queue(() => this.toggleIntake())
|
|
904
900
|
break
|
|
905
|
-
case '
|
|
901
|
+
case 'o':
|
|
902
|
+
case 'l': {
|
|
906
903
|
const slug = this.selectedSlug()
|
|
907
|
-
if (
|
|
908
|
-
this.queue(() =>
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
}
|
|
904
|
+
if (slug !== undefined)
|
|
905
|
+
this.queue(() =>
|
|
906
|
+
this.buildAction(input.text.toLowerCase() === 'o' ? 'hold' : 'land', slug),
|
|
907
|
+
)
|
|
912
908
|
break
|
|
913
909
|
}
|
|
914
910
|
case 'p': {
|
|
@@ -953,38 +949,49 @@ export class DispatchFrontend {
|
|
|
953
949
|
}
|
|
954
950
|
}
|
|
955
951
|
|
|
956
|
-
private
|
|
957
|
-
this.accepting = true
|
|
952
|
+
private listen(): void {
|
|
958
953
|
this.cleanupInput = this.opts.input.start((input) => this.onInput(input), {
|
|
959
954
|
onListening: () => this.keyboard.query(),
|
|
960
955
|
onKeyboardFlags: (flags) => this.keyboard.reported(flags),
|
|
961
956
|
onDeviceAttributes: () => this.keyboard.deviceAttributes(),
|
|
957
|
+
onFocus: (focused) => this.refresh?.focus(focused),
|
|
958
|
+
onInteraction: () => this.refresh?.interaction(),
|
|
959
|
+
onSuspend: () => this.suspension?.suspend(),
|
|
962
960
|
})
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
private startPresentation(): void {
|
|
964
|
+
this.accepting = true
|
|
965
|
+
this.refresh = new DashboardRefresh(async () => {
|
|
966
|
+
try {
|
|
967
|
+
await this.readFrame()
|
|
968
|
+
} catch (error) {
|
|
969
|
+
if (this.refresh?.admitted)
|
|
970
|
+
await this.report(
|
|
971
|
+
`dashboard render failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
972
|
+
'warning',
|
|
973
|
+
)
|
|
974
|
+
throw error
|
|
975
|
+
}
|
|
976
|
+
}, this.opts.refreshScheduler)
|
|
977
|
+
this.listen()
|
|
978
|
+
this.opts.terminal.modes.enter(FOCUS_REPORTING_MODE)
|
|
979
|
+
this.suspension = installPresentationSuspension(
|
|
980
|
+
this.opts.terminal.modes,
|
|
981
|
+
() => {
|
|
982
|
+
this.refresh?.suspend()
|
|
983
|
+
this.cleanupInput?.()
|
|
984
|
+
this.cleanupInput = undefined
|
|
985
|
+
},
|
|
986
|
+
() => {
|
|
987
|
+
this.listen()
|
|
988
|
+
this.region.invalidate()
|
|
989
|
+
this.refresh?.resume()
|
|
990
|
+
},
|
|
991
|
+
)
|
|
984
992
|
this.paintTimer = setInterval(() => this.paint(), PAINT_MS)
|
|
985
|
-
this.pollTimer.unref?.()
|
|
986
993
|
this.paintTimer.unref?.()
|
|
987
|
-
|
|
994
|
+
void this.refresh.request()
|
|
988
995
|
}
|
|
989
996
|
|
|
990
997
|
private requestOperatorStop(): void {
|
|
@@ -1003,13 +1010,14 @@ export class DispatchFrontend {
|
|
|
1003
1010
|
if (this.presentationRestored) return
|
|
1004
1011
|
this.presentationRestored = true
|
|
1005
1012
|
this.accepting = false
|
|
1013
|
+
this.refresh?.stop()
|
|
1014
|
+
this.suspension?.close()
|
|
1015
|
+
this.opts.terminal.modes.leave(FOCUS_REPORTING_MODE)
|
|
1006
1016
|
try {
|
|
1007
1017
|
this.cleanupInput?.()
|
|
1008
1018
|
} finally {
|
|
1009
1019
|
this.cleanupInput = undefined
|
|
1010
|
-
if (this.pollTimer !== undefined) clearInterval(this.pollTimer)
|
|
1011
1020
|
if (this.paintTimer !== undefined) clearInterval(this.paintTimer)
|
|
1012
|
-
this.pollTimer = undefined
|
|
1013
1021
|
this.paintTimer = undefined
|
|
1014
1022
|
this.region.finish()
|
|
1015
1023
|
}
|
|
@@ -1018,22 +1026,24 @@ export class DispatchFrontend {
|
|
|
1018
1026
|
private async finishPresentation(): Promise<void> {
|
|
1019
1027
|
if (!this.presentationRestored) {
|
|
1020
1028
|
this.accepting = false
|
|
1029
|
+
this.refresh?.stop()
|
|
1030
|
+
this.suspension?.close()
|
|
1031
|
+
this.opts.terminal.modes.leave(FOCUS_REPORTING_MODE)
|
|
1021
1032
|
try {
|
|
1022
1033
|
this.cleanupInput?.()
|
|
1023
1034
|
} finally {
|
|
1024
1035
|
this.cleanupInput = undefined
|
|
1025
1036
|
}
|
|
1026
|
-
if (this.pollTimer !== undefined) clearInterval(this.pollTimer)
|
|
1027
1037
|
if (this.paintTimer !== undefined) clearInterval(this.paintTimer)
|
|
1028
|
-
this.pollTimer = undefined
|
|
1029
1038
|
this.paintTimer = undefined
|
|
1030
1039
|
}
|
|
1031
1040
|
try {
|
|
1032
|
-
await this.
|
|
1041
|
+
await this.refresh?.join()
|
|
1033
1042
|
await this.actionTail
|
|
1034
|
-
await this.
|
|
1043
|
+
if (this.opts.once) await this.readFrame()
|
|
1044
|
+
else if (!this.presentationRestored) await this.refresh?.finalRefresh()
|
|
1035
1045
|
} catch {
|
|
1036
|
-
//
|
|
1046
|
+
// Final presentation remains best-effort.
|
|
1037
1047
|
} finally {
|
|
1038
1048
|
this.region.finish()
|
|
1039
1049
|
}
|
|
@@ -1049,21 +1059,14 @@ export class DispatchFrontend {
|
|
|
1049
1059
|
payload: { enabled: this.opts.intake, run: this.runId },
|
|
1050
1060
|
})
|
|
1051
1061
|
}
|
|
1052
|
-
if (this.opts.defaultAutoMerge !== undefined) {
|
|
1053
|
-
await this.opts.store.appendRepo(this.opts.repo, {
|
|
1054
|
-
actor,
|
|
1055
|
-
type: 'dispatcher.auto-merge-default-set',
|
|
1056
|
-
payload: { enabled: this.opts.defaultAutoMerge, run: this.runId },
|
|
1057
|
-
})
|
|
1058
|
-
}
|
|
1059
1062
|
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1063
|
+
try {
|
|
1064
|
+
const delta = await this.repositoryFeed.warm()
|
|
1065
|
+
this.standbyResolver.ingest(this.repositoryFeed.identities)
|
|
1066
|
+
this.dispatchStatus = reduceDispatchStatus(delta, this.runId, this.dispatchStatus)
|
|
1067
|
+
} catch {
|
|
1068
|
+
/* Display initialization must not gate the kernel. */
|
|
1069
|
+
}
|
|
1067
1070
|
|
|
1068
1071
|
const options: DispatchChildOptions = {
|
|
1069
1072
|
targetRepo: this.opts.checkout ?? this.opts.repo,
|
|
@@ -1104,6 +1107,7 @@ export class DispatchFrontend {
|
|
|
1104
1107
|
this.opts.signal?.removeEventListener('abort', stop)
|
|
1105
1108
|
await this.child.stop()
|
|
1106
1109
|
await this.finishPresentation()
|
|
1110
|
+
await this.repositoryFeed.save(true)
|
|
1107
1111
|
}
|
|
1108
1112
|
}
|
|
1109
1113
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { readDispatcherRunFacts, readOpenTick } from '../store/reduced-reads'
|
|
1
2
|
import { distributionPath } from '../distribution'
|
|
2
3
|
import { DISPATCHER } from '../events/envelope'
|
|
3
|
-
import { hasOpenTick } from '../processes/tick-state'
|
|
4
4
|
import type { BuildStore } from '../store/types'
|
|
5
5
|
|
|
6
6
|
export const DISPATCH_CHILD_OPTIONS_ENV = 'AB_DISPATCH_CHILD_OPTIONS'
|
|
@@ -168,10 +168,8 @@ export function superviseDispatchChild(deps: DispatchChildSupervisorDeps): Dispa
|
|
|
168
168
|
// chooses/awaits process termination, avoiding check-then-append races.
|
|
169
169
|
const completed = child.exited.then(async (exitCode): Promise<DispatchChildResult> => {
|
|
170
170
|
const processSignal = child.signalCode === null ? requestedSignal : String(child.signalCode)
|
|
171
|
-
const
|
|
172
|
-
|
|
173
|
-
(event) => event.type === 'dispatcher.run-stopped' && event.payload.run === deps.run,
|
|
174
|
-
)
|
|
171
|
+
const recorded = (await readDispatcherRunFacts(deps.store, deps.repo, deps.run, false)).value
|
|
172
|
+
.stop
|
|
175
173
|
if (recorded?.type === 'dispatcher.run-stopped') {
|
|
176
174
|
const signal = processSignal ?? recorded.payload.signal
|
|
177
175
|
return {
|
|
@@ -245,12 +243,21 @@ export function superviseDispatchChild(deps: DispatchChildSupervisorDeps): Dispa
|
|
|
245
243
|
// Ready with no durable build to recover. Let an open tick reach its
|
|
246
244
|
// normal boundary; all non-tick work is lease-backed/recoverable and a
|
|
247
245
|
// child stuck there is safe to terminate.
|
|
248
|
-
|
|
246
|
+
let open = true
|
|
247
|
+
try {
|
|
248
|
+
const record = await deps.store.getRepo(deps.repo)
|
|
249
|
+
open =
|
|
250
|
+
record?.tick?.run === deps.run
|
|
251
|
+
? record.tick.open !== undefined
|
|
252
|
+
: await readOpenTick(deps.store, deps.repo, deps.run, false)
|
|
253
|
+
} catch {
|
|
254
|
+
// Unreadable telemetry cannot authorize an unsafe kill.
|
|
255
|
+
}
|
|
249
256
|
// The child may have exited while the asynchronous journal read was in
|
|
250
257
|
// flight. Re-check at the force boundary so evidence never claims a
|
|
251
258
|
// SIGKILL that was not actually sent.
|
|
252
259
|
if (child.exitCode !== null) return
|
|
253
|
-
if (
|
|
260
|
+
if (open) {
|
|
254
261
|
await child.exited
|
|
255
262
|
return
|
|
256
263
|
}
|