@defrex/autobuild 1.11.0 → 1.12.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 +1 -1
- package/SPEC.md +186 -57
- package/docs/answering-blocked-builds.md +10 -2
- package/docs/architecture.md +76 -10
- package/docs/assets/headline-wide.png +0 -0
- package/docs/cli.md +1 -1
- package/docs/configuration.md +13 -11
- package/docs/dispatcher.md +5 -4
- package/docs/integration-tree.md +28 -16
- package/docs/operator-api.md +4 -4
- package/docs/operator-surfaces.md +38 -3
- package/docs/optimization-nodes.md +3 -2
- package/docs/tickets.md +1 -1
- package/docs/troubleshooting.md +1 -1
- package/package.json +3 -3
- package/packages/core/src/cli/ambient-errors.ts +17 -0
- package/packages/core/src/cli/bounded-io.ts +174 -0
- package/packages/core/src/cli/dashboard/header.ts +10 -0
- package/packages/core/src/cli/dashboard/model.ts +81 -23
- package/packages/core/src/cli/dashboard/poll.ts +24 -34
- package/packages/core/src/cli/dashboard/render.ts +44 -37
- package/packages/core/src/cli/dashboard/row-text.ts +24 -7
- package/packages/core/src/cli/dashboard/tone-ansi.ts +39 -0
- package/packages/core/src/cli/dashboard/vocabulary.ts +161 -20
- package/packages/core/src/cli/dispatch-frontend.ts +12 -3
- package/packages/core/src/cli/dispatch-handoff.ts +41 -10
- package/packages/core/src/cli/dispatch-launch-contract.ts +5 -0
- package/packages/core/src/cli/dispatch-launcher-cadence.ts +80 -0
- package/packages/core/src/cli/dispatch-launcher.ts +9 -10
- package/packages/core/src/cli/dispatch-preflight.ts +12 -3
- package/packages/core/src/cli/dispatch-release-observer.ts +53 -0
- package/packages/core/src/cli/dispatch-runtime-cache.ts +204 -82
- package/packages/core/src/cli/dispatch-runtime-dependencies.ts +250 -43
- package/packages/core/src/cli/dispatch-upgrade-install.ts +36 -16
- package/packages/core/src/cli/dispatch-upgrade-source.ts +8 -2
- package/packages/core/src/cli/dispatch-yield-observer.ts +82 -0
- package/packages/core/src/cli/dispatch.ts +70 -9
- package/packages/core/src/cli/env.ts +2 -15
- package/packages/core/src/cli/help.ts +5 -4
- package/packages/core/src/cli/main.ts +4 -2
- package/packages/core/src/cli/production-store.ts +102 -0
- package/packages/core/src/cli/repo-state.ts +2 -3
- package/packages/core/src/cli/repository-status.ts +36 -28
- package/packages/core/src/cli/sessionless-store.ts +26 -0
- package/packages/core/src/cli/status.ts +169 -40
- package/packages/core/src/cli/store-opening.ts +15 -58
- package/packages/core/src/cli/store-ref.ts +6 -1
- package/packages/core/src/config/schema.ts +1 -1
- package/packages/core/src/distribution-packaging.ts +156 -18
- package/packages/core/src/events/catalog-identity.ts +28 -0
- package/packages/core/src/events/catalog.ts +3 -9
- package/packages/core/src/events/compatibility.ts +2 -30
- package/packages/core/src/events/payloads.ts +11 -0
- package/packages/core/src/events/policy.ts +3 -0
- package/packages/core/src/events/repository.ts +1 -1
- package/packages/core/src/events/sessions.ts +1 -1
- package/packages/core/src/events/validation-error.ts +12 -0
- package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +74 -30
- package/packages/core/src/kernel/__snapshots__/reducer-identity-records/3064e337cc75f8d6.json +310 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-records/46196d8f0076496a.json +97 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-records/a1e90a969d32a367.json +307 -0
- package/packages/core/src/kernel/__snapshots__/reducer-identity-records/da3bc91c49211eab.json +310 -0
- package/packages/core/src/kernel/auto-merge-default.ts +2 -1
- package/packages/core/src/kernel/capacity-build.ts +21 -0
- package/packages/core/src/kernel/discard-in-flight.ts +13 -0
- package/packages/core/src/kernel/dispatch-capacity.ts +354 -147
- package/packages/core/src/kernel/dispatch-status.ts +139 -0
- package/packages/core/src/kernel/engine.ts +2 -8
- package/packages/core/src/kernel/measurement.ts +24 -0
- package/packages/core/src/kernel/read-facts.ts +9 -369
- package/packages/core/src/kernel/reducer-registry.ts +40 -125
- package/packages/core/src/kernel/reducer-revisions.ts +5 -0
- package/packages/core/src/kernel/reducer-value-entry.ts +98 -0
- package/packages/core/src/kernel/reducer-value-index.ts +75 -0
- package/packages/core/src/kernel/reducer.ts +57 -9
- package/packages/core/src/kernel/reopen-state.ts +10 -0
- package/packages/core/src/kernel/repository-read-facts.ts +375 -0
- package/packages/core/src/kernel/verify-stage-state.ts +145 -3
- package/packages/core/src/operator/presentation.ts +13 -0
- package/packages/core/src/operator/query.ts +47 -41
- package/packages/core/src/operator/registry.ts +3 -3
- package/packages/core/src/ports/workspace/fake.ts +15 -3
- package/packages/core/src/processes/dispatcher.ts +232 -75
- package/packages/core/src/processes/execution-no-progress.ts +1 -0
- package/packages/core/src/store/local/capabilities.ts +115 -0
- package/packages/core/src/store/local/store.ts +86 -56
- package/packages/core/src/store/reduced-reads.ts +9 -1
- package/packages/core/src/store/reducer-value-read.ts +235 -0
- package/packages/core/src/store/reducer-value-shapes.json +3796 -3670
- package/packages/core/src/store/reducer-values.ts +36 -204
- package/packages/core/src/store/remote/released-clients.json +22 -0
- package/packages/core/src/store/remote/released-reducer-values/1.11.1.json +35718 -0
- package/packages/core/src/store/remote/released-reducer-values/1.12.0.json +35806 -0
- package/packages/core/src/store/remote/released-reducer-values/index.ts +20 -16
- package/packages/core/src/store/rollup-lease.ts +41 -0
- package/packages/core/src/store/rollups.ts +7 -38
- package/packages/core/src/store/snapshots.ts +1 -1
- package/packages/core/src/testing/dispatch-journals.ts +117 -0
- package/packages/core/src/testing/dispatch-read-budget.ts +265 -4
- package/packages/core/src/testing/import-graph.ts +78 -0
- package/packages/core/src/testing/reduced-read-budget.ts +221 -22
- package/packages/core/src/testing/slot-agreement.ts +52 -0
- package/packages/core/src/web/assets/app.js +5 -5
- package/packages/core/src/web/repository-source.ts +6 -2
- package/skills/guide/SKILL.md +126 -47
- package/skills/guide/references/integration-tree.md +28 -16
- package/skills/guide/references/operator-api.md +4 -4
- package/skills/guide/references/optimization-nodes.md +3 -2
- package/skills/operate/SKILL.md +38 -20
- package/templates/hosted-service/package.json +2 -2
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { normalizeEffectiveConfigArtifact } from '../config/effective-artifact'
|
|
2
|
-
import { migrationIdentity } from '../kernel/ticket-migrations'
|
|
3
2
|
import { enrichDrainingRow, projectHandoffs } from '../cli/dashboard/handoff'
|
|
3
|
+
import { repositoryQueueDepth } from '../cli/dashboard/header'
|
|
4
4
|
import { enrichIntegrationRows } from '../cli/dashboard/integration-row'
|
|
5
5
|
import {
|
|
6
6
|
dispatchCapacity,
|
|
7
|
-
slotRequest,
|
|
8
7
|
startClaimDemand,
|
|
9
8
|
urgentClaimDemand,
|
|
10
9
|
type CapacityBuild,
|
|
11
10
|
} from '../kernel/dispatch-capacity'
|
|
12
11
|
import { landingRestackDue } from '../kernel/engine'
|
|
12
|
+
import { capacityBuildFromFacts } from '../kernel/capacity-build'
|
|
13
13
|
import { forgeReadinessWarnings } from '../kernel/dispatch-status'
|
|
14
14
|
import { readBuildDigests } from '../store/reduced-reads'
|
|
15
15
|
import {
|
|
@@ -87,6 +87,19 @@ export async function listOperatorBuilds(opts: {
|
|
|
87
87
|
return withOperatorView(opts.store, opts.repo, 'builds', (view) => listFromView(view, opts))
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
+
/** A node's provisioning marker, for capacity; a leaf reads none. */
|
|
91
|
+
async function nodeProvisioning(
|
|
92
|
+
view: RepoViewStore,
|
|
93
|
+
slug: string,
|
|
94
|
+
state: BuildState,
|
|
95
|
+
): Promise<{ provisioning: boolean; provisioningSeq?: number }> {
|
|
96
|
+
if (state.kind !== 'node') return { provisioning: false }
|
|
97
|
+
const marker = (await readBuildFacts(view, slug)).value.provisionMarker
|
|
98
|
+
return marker === undefined
|
|
99
|
+
? { provisioning: false }
|
|
100
|
+
: { provisioning: true, provisioningSeq: marker.seq }
|
|
101
|
+
}
|
|
102
|
+
|
|
90
103
|
async function listFromView(
|
|
91
104
|
view: RepoViewStore,
|
|
92
105
|
opts: { repo: string; scope: BuildListScope; now: Date },
|
|
@@ -112,24 +125,14 @@ async function listFromView(
|
|
|
112
125
|
for (const record of records) {
|
|
113
126
|
if (record.repo !== opts.repo) continue
|
|
114
127
|
const facts = await view.buildFacts(record.slug)
|
|
115
|
-
const projected = summarizeFrom(
|
|
128
|
+
const projected = summarizeFrom(record, facts.state, opts.now, {
|
|
116
129
|
record,
|
|
117
|
-
facts.state,
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
workspace: facts.workspace !== null,
|
|
124
|
-
// Leaves rely on the continuation's lease; only nodes read the marker.
|
|
125
|
-
provisioning:
|
|
126
|
-
facts.state.kind === 'node' &&
|
|
127
|
-
(await readBuildFacts(view, record.slug)).value.provisionMarker !== undefined,
|
|
128
|
-
restackDue: landingRestackDue(facts.state, facts.log),
|
|
129
|
-
},
|
|
130
|
-
opts.now,
|
|
131
|
-
),
|
|
132
|
-
)
|
|
130
|
+
state: facts.state,
|
|
131
|
+
workspace: facts.workspace !== null,
|
|
132
|
+
// The marker anchors runners launched before durable node admission.
|
|
133
|
+
...(await nodeProvisioning(view, record.slug, facts.state)),
|
|
134
|
+
restackDue: landingRestackDue(facts.state, facts.log),
|
|
135
|
+
})
|
|
133
136
|
if (statuses.has(projected.status)) output.push(projected)
|
|
134
137
|
}
|
|
135
138
|
return output.sort((a, b) => b.updatedAt.localeCompare(a.updatedAt))
|
|
@@ -342,10 +345,17 @@ export async function getOperatorBuild(opts: {
|
|
|
342
345
|
}
|
|
343
346
|
}
|
|
344
347
|
}
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
348
|
+
const detail = detailFromFacts(
|
|
349
|
+
record,
|
|
350
|
+
facts,
|
|
351
|
+
opts.now,
|
|
352
|
+
undefined,
|
|
353
|
+
undefined,
|
|
354
|
+
undefined,
|
|
355
|
+
capacityBuildFromFacts(record, facts),
|
|
356
|
+
)
|
|
357
|
+
if (dashboardRow && detail.slot) dashboardRow.slot = detail.slot
|
|
358
|
+
return { detail, dashboardRow }
|
|
349
359
|
}
|
|
350
360
|
|
|
351
361
|
export async function getRepositoryStatus(
|
|
@@ -434,9 +444,7 @@ async function dashboardFromView(
|
|
|
434
444
|
record,
|
|
435
445
|
state: facts.state,
|
|
436
446
|
workspace: facts.workspace !== null,
|
|
437
|
-
|
|
438
|
-
facts.state.kind === 'node' &&
|
|
439
|
-
(await readBuildFacts(view, record.slug)).value.provisionMarker !== undefined,
|
|
447
|
+
...(await nodeProvisioning(view, record.slug, facts.state)),
|
|
440
448
|
restackDue: landingRestackDue(facts.state, facts.log),
|
|
441
449
|
})
|
|
442
450
|
if (projectsNoDashboardRow(facts.state)) continue
|
|
@@ -458,25 +466,19 @@ async function dashboardFromView(
|
|
|
458
466
|
...forgeReadinessWarnings(status),
|
|
459
467
|
...(status.warningNotice !== undefined ? [status.warningNotice] : []),
|
|
460
468
|
]
|
|
461
|
-
const capacityProjection = dispatchCapacity(
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
{
|
|
467
|
-
urgentClaims: urgentClaimDemand(repositoryEvents),
|
|
468
|
-
openPrs: {
|
|
469
|
-
policy: config.policy,
|
|
470
|
-
engaged: repositoryEvents.openPrBackpressure !== undefined,
|
|
471
|
-
},
|
|
472
|
-
startRequests: startClaimDemand(repositoryEvents),
|
|
469
|
+
const capacityProjection = dispatchCapacity(capacityBuilds, config.capacity, opts.clock(), {
|
|
470
|
+
urgentClaims: urgentClaimDemand(repositoryEvents),
|
|
471
|
+
openPrs: {
|
|
472
|
+
policy: config.policy,
|
|
473
|
+
engaged: repositoryEvents.openPrBackpressure !== undefined,
|
|
473
474
|
},
|
|
474
|
-
|
|
475
|
+
startRequests: startClaimDemand(repositoryEvents),
|
|
476
|
+
})
|
|
475
477
|
const model = buildDashboardFromProjected(
|
|
476
478
|
enrichIntegrationRows(projected, await integrationRecords(view, opts.repo, projected, records)),
|
|
477
479
|
{
|
|
478
480
|
repo: opts.repo,
|
|
479
|
-
queued:
|
|
481
|
+
queued: repositoryQueueDepth(repositoryEvents),
|
|
480
482
|
activeCount: capacityProjection.occupied,
|
|
481
483
|
capacityProjection,
|
|
482
484
|
capacity: config.capacity,
|
|
@@ -525,7 +527,11 @@ function noDispatcherRunSnapshot(
|
|
|
525
527
|
clock: Clock,
|
|
526
528
|
): OperatorDashboardSnapshot {
|
|
527
529
|
const model: DashboardModel = {
|
|
528
|
-
...buildDashboardFromProjected(
|
|
530
|
+
...buildDashboardFromProjected(
|
|
531
|
+
[],
|
|
532
|
+
{ repo, queued: repositoryQueueDepth(facts), activeCount: 0, capacity: 0 },
|
|
533
|
+
facts,
|
|
534
|
+
),
|
|
529
535
|
configuration: 'no-dispatcher-run',
|
|
530
536
|
}
|
|
531
537
|
return dashboardSnapshot(model, clock)
|
|
@@ -867,7 +867,7 @@ export const TOOLS: readonly ToolEntry[] = [
|
|
|
867
867
|
'builds.list',
|
|
868
868
|
'List one repository’s builds, newest first, with effective status derived from the build log.',
|
|
869
869
|
buildListInput,
|
|
870
|
-
'JSON array of build summaries: slug, ticket ref, effective status, phase/round/attempt, PR number/url/state, updatedAt, lease health, durable-event progress, any ticket wait (`wait` with its state and tickets; `waitOnly` when the wait is the only open escalation),
|
|
870
|
+
'JSON array of build summaries: slug, ticket ref, effective status, phase/round/attempt, PR number/url/state, updatedAt, lease health, durable-event progress, any ticket wait (`wait` with its state and tickets; `waitOnly` when the wait is the only open escalation), an optimization node’s objective progress (`objective`), and each nonterminal build’s slot state (`slot`: `{state: "held"}`, `{state: "requested", request, priority?: "urgent"}` or `{state: "none"}`; absent means unknown, never none).',
|
|
871
871
|
async (raw, ctx) => {
|
|
872
872
|
const input = raw as z.infer<typeof buildListInput>
|
|
873
873
|
return listOperatorBuilds({
|
|
@@ -882,7 +882,7 @@ export const TOOLS: readonly ToolEntry[] = [
|
|
|
882
882
|
'builds.get',
|
|
883
883
|
'Show detailed state for one build: open escalations, verify progress, PR lifecycle, lease health, and the dashboard row.',
|
|
884
884
|
buildDetailInput,
|
|
885
|
-
'{detail, dashboardRow}: the full build detail projection and the dashboard row a terminal dashboard would render (null when the build has no dashboard row). An optimization node carries its objective progress as `detail.objective` and `dashboardRow.objectiveRow`.',
|
|
885
|
+
'{detail, dashboardRow}: the full build detail projection and the dashboard row a terminal dashboard would render (null when the build has no dashboard row). An optimization node carries its objective progress as `detail.objective` and `dashboardRow.objectiveRow`. A nonterminal build reports its slot state as `detail.slot` and `dashboardRow.slot`, shaped as in builds.list.',
|
|
886
886
|
async (raw, ctx) => {
|
|
887
887
|
const input = raw as z.infer<typeof buildDetailInput>
|
|
888
888
|
return getOperatorBuild({
|
|
@@ -1152,7 +1152,7 @@ export const TOOLS: readonly ToolEntry[] = [
|
|
|
1152
1152
|
'repository.status',
|
|
1153
1153
|
'Report one repository’s durable dispatcher settings and journal state.',
|
|
1154
1154
|
repositoryStatusInput,
|
|
1155
|
-
'The repository status projection: dispatcherRunning is true for a holder, expired holder or unfinished draining handoff; ticket intake, repository-wide pause, claim-time auto-merge default, and the harvest/dispatch journal state the sessionless CLI and dashboard read. operator.presence is "unavailable" here because this tool does not load presence registrations; that is not evidence that no operator is present.',
|
|
1155
|
+
'The repository status projection: dispatcherRunning is true for a holder, expired holder or unfinished draining handoff; ticket intake, repository-wide pause, claim-time auto-merge default, and the harvest/dispatch journal state the sessionless CLI and dashboard read. capacity.slots maps each nonterminal build to its slot state, shaped as in builds.list; occupied counts its held entries. operator.presence is "unavailable" here because this tool does not load presence registrations; that is not evidence that no operator is present.',
|
|
1156
1156
|
async (raw, ctx) => {
|
|
1157
1157
|
const input = raw as z.infer<typeof repositoryStatusInput>
|
|
1158
1158
|
return getRepositoryStatus(ctx.store, input.repo)
|
|
@@ -406,7 +406,8 @@ export class FakeWorkspaceProvider implements WorkspaceProvider {
|
|
|
406
406
|
})
|
|
407
407
|
// Its own process group, so a cancel stops setup and its children
|
|
408
408
|
// together and releases the pipes awaited below (mirrors the real
|
|
409
|
-
// provider).
|
|
409
|
+
// provider). A cancel also waits for the group to be gone, so close
|
|
410
|
+
// returns only once no setup process remains.
|
|
410
411
|
const proc = Bun.spawn(['sh', '-c', this.sandboxSetupCommand], {
|
|
411
412
|
cwd: identity.workspacePath,
|
|
412
413
|
stdin: 'ignore',
|
|
@@ -415,7 +416,10 @@ export class FakeWorkspaceProvider implements WorkspaceProvider {
|
|
|
415
416
|
env: this.sandboxEnv(),
|
|
416
417
|
detached: true,
|
|
417
418
|
})
|
|
418
|
-
|
|
419
|
+
let terminating: Promise<boolean> | undefined
|
|
420
|
+
const onAbort = (): void => {
|
|
421
|
+
terminating ??= terminateProcessGroup(proc.pid)
|
|
422
|
+
}
|
|
419
423
|
if (signal?.aborted) onAbort()
|
|
420
424
|
else signal?.addEventListener('abort', onAbort, { once: true })
|
|
421
425
|
const [stdout, stderr, exitCode] = await Promise.all([
|
|
@@ -423,7 +427,15 @@ export class FakeWorkspaceProvider implements WorkspaceProvider {
|
|
|
423
427
|
new Response(proc.stderr).text(),
|
|
424
428
|
proc.exited,
|
|
425
429
|
]).finally(() => signal?.removeEventListener('abort', onAbort))
|
|
426
|
-
if (signal?.aborted)
|
|
430
|
+
if (signal?.aborted) {
|
|
431
|
+
// The pipes close when the last member exits, before it is reaped;
|
|
432
|
+
// a killed-but-unreaped member (a zombie re-parented to init) still
|
|
433
|
+
// answers kill(pid, 0). Wait for the whole group to be reaped so
|
|
434
|
+
// close returns only once no setup process remains. A `false`
|
|
435
|
+
// result (a member stuck past SIGKILL) still settles as cancelled.
|
|
436
|
+
await terminating
|
|
437
|
+
throw new SandboxCancelledError()
|
|
438
|
+
}
|
|
427
439
|
if (exitCode !== 0) {
|
|
428
440
|
throw new SandboxOperationError(
|
|
429
441
|
'provision',
|