@defrex/autobuild 1.0.0-beta.3 → 1.0.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/SPEC.md +317 -20
  2. package/bin/ab-dispatch-generation.ts +93 -0
  3. package/docs/answering-blocked-builds.md +21 -3
  4. package/docs/architecture.md +166 -7
  5. package/docs/configuration.md +173 -5
  6. package/docs/integration-tree.md +87 -2
  7. package/docs/integration.md +54 -0
  8. package/docs/operator-api.md +58 -5
  9. package/docs/remote-store-protocol.md +4 -1
  10. package/docs/restacking.md +4 -1
  11. package/docs/setup.md +20 -0
  12. package/docs/spec-standard.md +23 -5
  13. package/package.json +3 -3
  14. package/packages/core/src/cli/artifact.ts +5 -4
  15. package/packages/core/src/cli/attention.ts +2 -0
  16. package/packages/core/src/cli/binary-direct.ts +190 -0
  17. package/packages/core/src/cli/binary-lifecycle.ts +46 -0
  18. package/packages/core/src/cli/binary.ts +24 -210
  19. package/packages/core/src/cli/build-control.ts +105 -2
  20. package/packages/core/src/cli/context.ts +41 -1
  21. package/packages/core/src/cli/dashboard/hand-pushed.ts +24 -0
  22. package/packages/core/src/cli/dashboard/handoff.ts +64 -0
  23. package/packages/core/src/cli/dashboard/integration-detail.ts +3 -0
  24. package/packages/core/src/cli/dashboard/model.ts +34 -10
  25. package/packages/core/src/cli/dashboard/render.ts +24 -2
  26. package/packages/core/src/cli/dashboard/rollback.ts +30 -0
  27. package/packages/core/src/cli/dispatch-args.ts +53 -0
  28. package/packages/core/src/cli/dispatch-crash-budget.ts +15 -0
  29. package/packages/core/src/cli/dispatch-frontend.ts +52 -5
  30. package/packages/core/src/cli/dispatch-handoff.ts +276 -0
  31. package/packages/core/src/cli/dispatch-launch-contract.ts +170 -0
  32. package/packages/core/src/cli/dispatch-launcher.ts +580 -0
  33. package/packages/core/src/cli/dispatch-parent-watch.ts +44 -0
  34. package/packages/core/src/cli/dispatch-preflight.ts +272 -0
  35. package/packages/core/src/cli/dispatch-presentation-job.ts +46 -0
  36. package/packages/core/src/cli/dispatch-presentation-ownership.ts +9 -0
  37. package/packages/core/src/cli/dispatch-process.ts +22 -90
  38. package/packages/core/src/cli/dispatch-readiness.ts +47 -0
  39. package/packages/core/src/cli/dispatch-repository-feed.ts +5 -1
  40. package/packages/core/src/cli/dispatch-runtime-cache.ts +522 -0
  41. package/packages/core/src/cli/dispatch-runtime-dependencies.ts +291 -0
  42. package/packages/core/src/cli/dispatch-runtime-use.ts +336 -0
  43. package/packages/core/src/cli/dispatch-upgrade-controller.ts +221 -0
  44. package/packages/core/src/cli/dispatch-upgrade-install.ts +258 -0
  45. package/packages/core/src/cli/dispatch-upgrade-source.ts +309 -0
  46. package/packages/core/src/cli/dispatch-upgrade-target.ts +190 -0
  47. package/packages/core/src/cli/dispatch.ts +604 -60
  48. package/packages/core/src/cli/dispatcher-liveness.ts +1 -1
  49. package/packages/core/src/cli/harvest.ts +28 -11
  50. package/packages/core/src/cli/help.ts +6 -3
  51. package/packages/core/src/cli/installation.ts +5 -3
  52. package/packages/core/src/cli/main-checkout.ts +59 -0
  53. package/packages/core/src/cli/main.ts +15 -45
  54. package/packages/core/src/cli/node-verification-provenance.ts +97 -0
  55. package/packages/core/src/cli/repo-state.ts +3 -58
  56. package/packages/core/src/cli/repository-status.ts +67 -3
  57. package/packages/core/src/cli/runtime-spawn.ts +16 -0
  58. package/packages/core/src/cli/status.ts +57 -3
  59. package/packages/core/src/cli/upgrade-followup.ts +25 -0
  60. package/packages/core/src/cli/wait.ts +3 -0
  61. package/packages/core/src/cli/watch.ts +7 -0
  62. package/packages/core/src/config/live.ts +1 -0
  63. package/packages/core/src/config/schema.ts +8 -4
  64. package/packages/core/src/distribution-packaging.ts +116 -0
  65. package/packages/core/src/events/catalog.ts +6 -0
  66. package/packages/core/src/events/payloads.ts +53 -9
  67. package/packages/core/src/events/policy.ts +25 -0
  68. package/packages/core/src/events/repository.ts +184 -4
  69. package/packages/core/src/events/runtime.ts +16 -0
  70. package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +2515 -78
  71. package/packages/core/src/kernel/dispatch-drain-recovery.ts +121 -0
  72. package/packages/core/src/kernel/dispatch-status.ts +4 -2
  73. package/packages/core/src/kernel/dispatch-upgrade.ts +171 -0
  74. package/packages/core/src/kernel/dispatcher-liveness.ts +7 -0
  75. package/packages/core/src/kernel/generators/repository-journals.ts +82 -0
  76. package/packages/core/src/kernel/guarded-forge.ts +1 -1
  77. package/packages/core/src/kernel/harvest.ts +98 -4
  78. package/packages/core/src/kernel/integration-attention.ts +20 -0
  79. package/packages/core/src/kernel/integration-state.ts +80 -11
  80. package/packages/core/src/kernel/landing-readiness.ts +6 -1
  81. package/packages/core/src/kernel/mixed-version.ts +34 -0
  82. package/packages/core/src/kernel/node-polling.ts +160 -0
  83. package/packages/core/src/kernel/read-facts.ts +40 -5
  84. package/packages/core/src/kernel/reducer-registry.ts +3 -0
  85. package/packages/core/src/kernel/reducer.ts +75 -14
  86. package/packages/core/src/kernel/service-facts.ts +11 -4
  87. package/packages/core/src/operator/presentation.ts +7 -0
  88. package/packages/core/src/operator/query.ts +6 -2
  89. package/packages/core/src/operator/registry.ts +1 -1
  90. package/packages/core/src/plugins/load.ts +4 -1
  91. package/packages/core/src/plugins/runtime-snapshot.ts +128 -0
  92. package/packages/core/src/ports/forge/contract.ts +29 -0
  93. package/packages/core/src/ports/forge/github.ts +189 -61
  94. package/packages/core/src/ports/forge-failure.ts +1 -0
  95. package/packages/core/src/ports/forge-telemetry.ts +3 -0
  96. package/packages/core/src/ports/runner/session-env.ts +1 -0
  97. package/packages/core/src/ports/types.ts +10 -0
  98. package/packages/core/src/ports/workspace/distribution-archive.ts +22 -149
  99. package/packages/core/src/ports/workspace/distribution-release.ts +56 -0
  100. package/packages/core/src/ports/workspace/git-worktree.ts +2 -1
  101. package/packages/core/src/ports/workspace/local-build-execution.ts +37 -17
  102. package/packages/core/src/processes/build-child-exit.ts +5 -26
  103. package/packages/core/src/processes/build-runner.ts +81 -11
  104. package/packages/core/src/processes/dispatcher.ts +254 -23
  105. package/packages/core/src/processes/execution-no-progress.ts +6 -0
  106. package/packages/core/src/processes/execution-relaunch.ts +30 -0
  107. package/packages/core/src/processes/execution-settlement.ts +16 -7
  108. package/packages/core/src/processes/harvest-runner.ts +328 -292
  109. package/packages/core/src/processes/process-group-reaper.ts +17 -10
  110. package/packages/core/src/runtime-identity.ts +22 -3
  111. package/packages/core/src/store/contract.ts +153 -0
  112. package/packages/core/src/store/local/store.ts +197 -72
  113. package/packages/core/src/store/reduced-reads.ts +8 -0
  114. package/packages/core/src/store/reducer-value-shapes.json +5783 -3305
  115. package/packages/core/src/store/remote/client.ts +43 -0
  116. package/packages/core/src/store/repo-state-events.ts +20 -3
  117. package/packages/core/src/store/types.ts +7 -0
  118. package/skills/guide/SKILL.md +231 -23
  119. package/skills/guide/references/integration-tree.md +87 -2
  120. package/skills/guide/references/operator-api.md +53 -4
  121. package/skills/guide/references/plugin-authoring.md +45 -4
  122. package/skills/guide/references/remote-store-protocol.md +4 -1
  123. package/skills/guide/references/restacking.md +4 -1
  124. package/skills/guide/references/setup.md +20 -0
  125. package/skills/guide/references/spec-standard.md +23 -5
  126. package/skills/harvest/SKILL.md +4 -0
  127. package/skills/harvest-review/SKILL.md +4 -0
  128. package/skills/operate/SKILL.md +78 -8
  129. package/skills/spec/SKILL.md +19 -1
  130. package/skills/tickets/SKILL.md +19 -0
package/SPEC.md CHANGED
@@ -217,6 +217,157 @@ surface remains the remote HTTP protocol rather than in-process registration.
217
217
 
218
218
  Small, independently runnable, crash-safe:
219
219
 
220
+ Resident checkout-backed `ab dispatch` starts a launcher and one dispatcher
221
+ **generation**. The launcher eagerly loads its own filesystem/process code,
222
+ opens no Store, holds no repository/execution lease and makes no kernel
223
+ decisions. Before starting the generation it freezes the invoking distribution
224
+ and its already installed production dependency graph into the canonical
225
+ checkout's `.autobuild/runtime/` cache, offline. Source edits (including
226
+ uncommitted edits) and dependency bytes participate in content identity; version
227
+ alone never selects a snapshot. Completed distribution roots are immutable.
228
+ The generation, kernel, later local runners and agent PATH `ab` all execute
229
+ from that same root. Run/attach runtime identities name the cached directory.
230
+ Source generations capture their guest archive from that exact snapshot.
231
+ Registry generations preserve the normalized host archive and resolve their
232
+ manifest version's published GitHub release asset on first guest use. Host launch
233
+ is offline; version and SHA256 validation precede atomic guest-asset completion.
234
+ Missing, corrupt or wrong-version assets fail guest delivery and remain retryable.
235
+ Metadata retains explicit provenance and the host digest, adding the guest digest
236
+ after resolution; older entries without provenance are not silently reused.
237
+
238
+ The versioned v1 launch contract consists of argv, a consumed one-shot
239
+ `AB_DISPATCH_GENERATION` marker, graceful signals and exit reasons `stopped`,
240
+ `handoff`, `failed`. Public invocations discard inherited markers. No private
241
+ operational channel exists; work outcomes still come only from durable state.
242
+ The launcher observes presentation stop/continue liveness so Ctrl-Z returns the
243
+ shell prompt and `fg` resumes only the presentation; the kernel keeps running.
244
+ Terminal restoration by the launcher is a fallback for abnormal termination,
245
+ never a second alternate-screen exit after a clean generation stop.
246
+ Automatic upgrades default on (`[upgrade] automatic = true`). The resident
247
+ kernel checks immediately and every 60 seconds independently of dispatch ticks.
248
+ It resolves the root manifest and Bun lock from a single authoritative base
249
+ branch commit through the forge, never from a feature branch, checkout pin or
250
+ stale tracking ref. A declared dependency selects pinned mode; unsupported or
251
+ inconsistent metadata is an attention failure. With no declaration (including
252
+ no root manifest), installed mode rereads the original public installation
253
+ pathname retained across handoffs. A launch from a source root in the dispatched
254
+ repository's Git common-directory topology selects source mode instead. That
255
+ eligibility and its initial packaged snapshot are frozen across successors. The
256
+ target is the forge-authoritative base commit, exported into private cache staging
257
+ without changing any operator or build worktree. A frozen-lockfile, script-free
258
+ Bun install supplies dependencies; the completed immutable runtime records the
259
+ exact commit and follows ordinary cache retention and pruning. Source adoption
260
+ compares packaged contents and production-reachable dependency resolution rather
261
+ than version or commit: excluded-file advances do not hand off. Included shipped
262
+ documentation counts as packaged content.
263
+
264
+ A changed exact version (including a downgrade) is installed in isolation and
265
+ validated in the immutable cache before cutover. The operator's installation
266
+ and consuming dependency graph are untouched. Registry/lock/install/contract
267
+ failures retain the running generation and record repository attention. Failed
268
+ inputs are suppressed until their target metadata changes or an operator starts
269
+ a fresh launcher; unrelated base commits do not reset suppression.
270
+
271
+ The kernel records `dispatcher.upgrade-target-resolved` once per changed successful
272
+ target observation per run, including equal-content source advances. Repository
273
+ status exposes its mode, base and target SHA independently of the running commit
274
+ and earlier failure or handoff evidence. Identical polls append nothing.
275
+ A successor first validates configuration and the actual selected store without
276
+ starting repository work or terminal input/output. Provider compatibility evidence
277
+ chooses drain when sharing is safe and cutover otherwise. SQLite compares its
278
+ untouched catalog semantically (columns, indexes, keys and constraints) with target
279
+ requirements, accepting equivalent schemas built by guarded ALTER migrations; HTTP uses the live service's client
280
+ and protocol admission. Missing evidence chooses cutover. A target outside the hosted client overlap
281
+ window also requires cutover; target admission and successful protocol writes
282
+ are still mandatory. Cutover never makes a rejected target runnable. Successful durable
283
+ protocol writes are also required: a service that admits the client but rejects
284
+ a new yield fact fails preflight, leaving the predecessor active with target and
285
+ reason in repository attention. Failed targets are not retried every tick; a change in selected-store compatibility
286
+ evidence allows the normal target-check cadence to retry.
287
+
288
+ Local harvest suspends durably before repository lease release on handoff or
289
+ clean stop. The next generation resumes eligible native sessions with fresh
290
+ logical credentials, or records a reasoned `harvest.session.resume-fallback`
291
+ and starts fresh. Orderly suspension spends no recovery attempt; real crashes
292
+ retain recovery accounting.
293
+
294
+ The predecessor serializes acceptance with ticks and launch admission, joins
295
+ repository-owned harvest and provisioning work, and records the exact local
296
+ executions, start time and deadline. Its terminal frontend removes and joins
297
+ input/render work before acknowledging terminal release. Only after that durable
298
+ acknowledgement and a successful repository lease claim may the successor draw
299
+ or consume input. Only the successor ticks, claims, runs janitor/harvest and
300
+ launches runners. Execution leases remain with existing local runners; remote
301
+ executions detach immediately. Their exact instances and recorded guest runtimes
302
+ are captured separately on `dispatcher.handoff-started.remoteBuilds`. This
303
+ authorization work survives local retirement completion and late attachment;
304
+ it never adds to local drain counts or delays predecessor exit. Recovery reads
305
+ only builds whose repository digest records an open execution, at most once per
306
+ build per tick; historical captures of ended executions add no build reads. Guests retain
307
+ their leases and heartbeats and request neutral relaunch after their current
308
+ phase completes. The successor re-attaches with refreshed guest bytes.
309
+
310
+ A draining predecessor supervises its captured local executions until they settle
311
+ or `policy.upgradeDrainSeconds` (900 seconds by default) elapses. The deadline
312
+ tracks accepted live policy changes relative to the original start. Remaining
313
+ local sessions suspend through the normal durable native-resume path before
314
+ process-group cleanup. Cutover uses this suspension path immediately and waits
315
+ for predecessor stop before takeover. Retirement completion records drained and
316
+ suspended counts separately from takeover. A successor reconstructs unfinished
317
+ retirement from execution leases and durable build facts after predecessor death.
318
+ An unrelated dispatcher taking the lease still causes ordinary supersession and
319
+ teardown.
320
+
321
+ At each completed phase boundary, a local or remote build runner compares its immutable
322
+ attach runtime with the accepted handoff target mirrored in its instance-scoped
323
+ build-log drain authorization. The comparison uses existing boundary facts and
324
+ adds no Store read. A mismatch records `execution.relaunch-requested` and exits
325
+ after normal phase completion, publication settlement and session cleanup.
326
+ Confirmed teardown records the neutral `relaunch` execution outcome; it consumes
327
+ no failure or no-progress allowance. The current repository lease holder
328
+ relaunches from durable state on its own immutable runtime, including after an
329
+ ownership gap. Equal or absent targets preserve normal execution. Remote guests
330
+ re-attach through the provider, which reinstalls the accepted generation’s archive
331
+ before launching the next execution. Deadline suspension applies only to local phases.
332
+
333
+ With rollback-capable launcher and generation peers, three failed successor exits
334
+ within ten minutes of the original durable takeover restore the immediately previous
335
+ cached runtime. The first two failures restart the same runtime without repeating
336
+ preflight. Preflight failures never count; outside that window ordinary failure
337
+ exit behavior applies. Rollback goes back one runtime only. The launcher opens no
338
+ store: it passes a validated, versioned recovery context to the restored generation,
339
+ which records `dispatcher.runtime-rolled-back` under repository authority and holds
340
+ the failed target for that launcher lineage. Store compatibility changes, resolution
341
+ errors and disabling/re-enabling upgrades do not clear this hold. A successfully
342
+ resolved different target records `dispatcher.rollback-hold-cleared`; a fresh operator
343
+ launch starts a new lineage. Both previous and held runtimes remain protected from
344
+ cache pruning. Existing phase executions keep their leases and continue on the
345
+ restored runtime at the next boundary; unreadable decisive facts defer a build with
346
+ attention before any action. Peers without negotiated rollback capability retain
347
+ existing failure behavior and report that capable runtimes are required.
348
+
349
+ The journal records `dispatcher.target-prepared`, `dispatcher.yield-requested`,
350
+ `dispatcher.handoff-started`, `dispatcher.terminal-released`, `dispatcher.takeover`,
351
+ per-execution `dispatcher.drain-settled`, deadline changes and
352
+ `dispatcher.handoff-completed`, plus rollback and hold-clear facts, correlated by predecessor run, successor run,
353
+ launcher lineage, both runtimes and cached target. Legacy handoffs without a
354
+ mode mean cutover. The launcher first binds the runtime-owned journal transport to its persisted
355
+ repository record, so rejected configuration edits cannot redirect readers away
356
+ from the held run. It reads runtime-owned durable projections while generations overlap; it owns no store or operational authority and keeps each
357
+ live runtime reserved. Overlap requires explicit launcher and target capabilities; unsupported
358
+ targets fail safely with manual-restart attention. Operator stop wins and joins
359
+ all live children. Only the presentation owner installs terminal cleanup.
360
+ `[upgrade] automatic = false` disables target preparation; `--once`, origin
361
+ `--repository`, hosted cron and development hot rendering remain direct.
362
+
363
+ Cache publication is atomic after validation. Current, distinct previous,
364
+ explicitly held and live process-use entries survive pruning independently of
365
+ Store leases. Process-start identities distinguish PID reuse; uncertain
366
+ liveness retains code. Each cached Bun entry disables automatic installation
367
+ and pins a cache-owned neutral compiler config before evaluating JavaScript.
368
+ Autobuild compiler chains must remain inside the runtime. Third-party package
369
+ files, including development configs, remain exactly as installed.
370
+
220
371
  - **build-runner** — one operating-system process per build; owns one pipeline
221
372
  execution end to end. The local implementation starts the process beside its
222
373
  Git worktree in its own POSIX session/process group and owns teardown of that
@@ -445,13 +596,31 @@ output, error, or timeout. Naming failure never prevents build creation. The
445
596
  slug and its `ab/<slug>` branch are recorded once and never renamed.
446
597
 
447
598
  **Immutability:** the spec cannot change during a build except through the
448
- explicit escalation revision protocol. Every downstream reviewer approves
599
+ explicit operator revision protocol (leaf escalation or the node exception below). Every downstream reviewer approves
449
600
  conformance *to it*; a drifting spec silently converts approvals into
450
601
  approvals-of-something-else. A phase discovering the spec itself is wrong
451
602
  raises an `escalation`; a human uses `ab answer --revise-spec` (or
452
- `--revise-spec-from-ticket`), the spec gets rev N+1, and the build restarts
603
+ `--revise-spec-from-ticket`), the spec gets rev N+1, and the leaf restarts
453
604
  from `plan` (cheap — downstream was invalidated anyway).
454
605
 
606
+ Operators may explicitly revise an opened idle collecting node or a node blocked on failed
607
+ integration verification without an escalation. Use
608
+ `ab answer <node> --revise-spec replacement.md` or, after amending its ticket,
609
+ `ab answer <node> --revise-spec-from-ticket`. Ticket edits alone do not revise
610
+ the build. Both forms enforce the same spec standard as leaf revisions.
611
+ Each kernel `spec.revised` records the exact artifact and operator identity
612
+ (with optional transport provenance); earlier revisions remain readable.
613
+ Ticket-origin revisions re-pin assets; supplied bodies preserve asset pins.
614
+ The node recollects and verifies the new revision, including on the same head
615
+ and parent after a failed cycle. Earlier cycles remain historical evidence
616
+ and cannot block or authorize landing under the replacement. Children keep
617
+ their specs, claims and targets; contributions are not restarted.
618
+ Active verification/reconcile or writer work, restack/reparent work, pause,
619
+ pending controls, landing intent and ended PRs refuse the no-escalation path.
620
+ A concurrent state change refuses publication with a retry explanation;
621
+ uncited artifacts are inert. Leaves still require an open escalation and
622
+ restart from `plan`.
623
+
455
624
  **Ticket assets are frozen with the spec.** Claiming a ticket pins the
456
625
  ticket's current assets (§7.1.3) into the build the same way the spec becomes
457
626
  revision 0: `build.created.assets` lists exactly which `(kind, name, revision)`
@@ -813,9 +982,12 @@ per-build scan paid only when a gate actually trips and a scan packet is built.
813
982
 
814
983
  Stateless repository-level readers also have a bounded journal read,
815
984
  `getRepoStateEvents(repo)` (AUT-489): every durable, slow-growing event type
816
- (all harvest facts, operator-sandbox facts, and the three dispatcher setting
985
+ (all harvest facts, operator-sandbox facts, cross-generation handoff correlation
986
+ facts including preparation, request, failure, start, release, takeover, deadline,
987
+ settlement and completion, and the three dispatcher setting
817
988
  types) plus, when the journal has one, the tail from the latest
818
- `dispatcher.run-started`. Reducing this subset with the state readers yields
989
+ `dispatcher.run-started`. The run-scoped `dispatcher.runtime-recorded` companion
990
+ is retained in this same bounded tail. Reducing this subset with the state readers yields
819
991
  exactly what a full replay yields, so the cost of reading repository state no
820
992
  longer grows with the number of past dispatcher invocations. The journal
821
993
  itself stays append-only: full replay remains the normative truth, and
@@ -1149,7 +1321,7 @@ Delegated grants have no fixed wall-clock expiry. The service checks signed
1149
1321
  bindings against authoritative durable lifecycle facts on every request and
1150
1322
  fails closed if those reads fail. Active, paused and escalated builds may outlive
1151
1323
  a dispatcher restart or a week-long parent credential. Build termination,
1152
- harvest execution/run termination, or the phase's own session end retires the
1324
+ harvest execution/run termination, or the phase's own session end or suspension retires the
1153
1325
  corresponding grant after a 60-second evidence grace window. A durable ending
1154
1326
  permanently closes that grant; recovered harvest executions use fresh durable
1155
1327
  authorizations and fresh grants. Project removal denies all its grants immediately.
@@ -1217,6 +1389,8 @@ A phase-scoped hydration into the gitignored scratch dir:
1217
1389
  context.json # manifest: build, phase, round, artifact revs,
1218
1390
  # required deposits, allowed terminal commands
1219
1391
  spec.md
1392
+ node-verification.json # node verify: exhaustive commit provenance index
1393
+ contributions/ # node verify: <build>/spec.md
1220
1394
  plan.md # per phase needs (see table)
1221
1395
  findings.json # current feedback, when round > 1
1222
1396
  history/ # prior-round artifacts where the phase needs them
@@ -1241,10 +1415,36 @@ terminals:
1241
1415
  | `plan-review` | spec, plan@latest, all prior rounds' findings (for `persists` marking) | `verdict` (requires notes artifact) |
1242
1416
  | `implement` | spec, approved plan, feedback (findings **or** verify report), own prior notes | `done` (requires clean worktree + notes) |
1243
1417
  | `code-review` | spec, plan, commit range `{base, head}`, prior findings, implement-notes | `verdict` |
1244
- | `verify:<step>` (agent) | spec (acceptance criteria), step config, commit range | `verdict pass` \| `verdict fail --report` \| `verdict skip --reason` |
1418
+ | `verify:<step>` (agent) | spec (acceptance criteria), step config, commit range; node contribution specs and provenance | `verdict pass` \| `verdict fail --report` \| `verdict skip --reason` |
1245
1419
  | `finalize` | spec, plan, verify reports, PR template config | `done` (requires `pr-description` artifact) |
1246
1420
  | `reconcile` | spec, plan, implement-notes, conflict `{baseSha}` and kernel-prepared replay transaction | `done` (requires one replayed commit on the frozen base) |
1247
1421
 
1422
+ In node `verify:*` context, `nodeVerification` in the manifest identifies the frozen
1423
+ `range`, `indexPath`, `contributions`, `handPushedCommits` and `unattributedCommits`. Each contribution
1424
+ has `build`, its current stored `ticket` identity, `spec: {kind: 'spec', rev}`,
1425
+ `specPath` and `commits`. The JSON index repeats this metadata and adds the
1426
+ exhaustive ordered `commits: [{sha, build?}]` mapping. Paths are workspace-relative
1427
+ and reflect scratch allocation, including legacy tracked-file collisions.
1428
+ Contribution specs normally live at `.ab/contributions/<build>/spec.md`; the index
1429
+ normally lives at `.ab/node-verification.json`. These files are marked `derived`
1430
+ in `materialized`, with their source build and revision recorded in the metadata.
1431
+
1432
+ Membership comes from build identity trailers on every commit reachable in the
1433
+ frozen parent-to-head range, including earlier cycles and merge side history.
1434
+ Specs use the current event-authorized revision, never an unsanctioned latest
1435
+ deposit or mutable ticket body. Unknown identities, ambiguous or invalid trailers,
1436
+ and missing source data fail hydration. Commits without a build trailer are
1437
+ listed as unattributed, a mechanical absence of a trailer rather than an authorization verdict.
1438
+ `handPushedCommits: [{sha, originalSha, message}]` identifies node-owned hand-pushed
1439
+ commits in the frozen range. Ownership uses the durable first-parent contribution
1440
+ boundary; inherited and merge-side history are not automatically owned. Confirmed
1441
+ rewrite aliases preserve original identity, and `message` is the full commit message.
1442
+ These messages express maintainer-authorized intent: judge quality and consistency;
1443
+ never fail these commits solely for lacking a covering spec.
1444
+ Other node changes are authorized when the node spec or the spec of the contribution
1445
+ that introduced it covers it; use the commit mapping to find that spec.
1446
+ Leaf verification context is unchanged.
1447
+
1248
1448
  Scoping is deliberate: the planner never sees code-review rounds; the
1249
1449
  reviewer sees prior findings but not the producer's session. What a phase
1250
1450
  *can't* see is part of its design.
@@ -1534,8 +1734,10 @@ SIGINT/SIGTERM. A conditional artifact deposit records `session.suspended`
1534
1734
  with cause `shutdown`, the native handle, active milliseconds, partial transcript
1535
1735
  and any known incremental usage. A terminal fact that lands first prevents
1536
1736
  suspension; suspension fences the old session's terminal credentials permanently.
1537
- The process supervisor retains its existing bounded force-stop path if provider
1538
- cleanup or persistence cannot complete.
1737
+ Graceful shutdown waits for provider cleanup and durable suspension without a
1738
+ wall-clock force-exit deadline. Only after the runner leader exits does bounded
1739
+ process-group cleanup reap remaining descendants. Abnormal parent loss retains
1740
+ the detached reaper recovery path.
1539
1741
 
1540
1742
  On attachment the runner retains an eligible current phase/round session and
1541
1743
  records takeover. Matching host, workspace and runtime permit native resume;
@@ -2282,7 +2484,7 @@ displays is a reduction of the logs, and anything it does is an event — so
2282
2484
  every frontend (terminal today, web later) is the same adapter pattern
2283
2485
  against the same store, and a dead runner still receives commands on resume.
2284
2486
 
2285
- Interactive `ab dispatch` owns the terminal in a frontend process and supervises
2487
+ Within the immutable generation, interactive `ab dispatch` owns the terminal in a frontend process and supervises
2286
2488
  one private child containing the dispatcher, build runners, Harvest, config and
2287
2489
  plugin loading, and every ticket/forge/workspace/runtime adapter. The frontend
2288
2490
  has no handle on those adapters: it reads build and repository streams plus
@@ -2312,9 +2514,10 @@ child is terminated unless such a tick is open, in which case that tick first
2312
2514
  reaches a recoverable durable boundary. The run-stopped fact and frontend result
2313
2515
  distinguish a graceful drain, an actual forced termination requested by the
2314
2516
  operator, and an unsolicited abnormal exit, retaining available exit-code,
2315
- signal, and error evidence. `--plain`, non-TTY,
2316
- and `--once` kernel semantics remain the line-oriented/direct compatibility
2317
- path; `--once` still performs one tick and drains its in-flight work.
2517
+ signal, and error evidence. Resident `--plain` and non-TTY generations run
2518
+ the line-oriented kernel directly. `--once` bypasses the launcher, performs
2519
+ one tick and drains its in-flight work. The launcher forwards stop signals and
2520
+ waits for the generation to drain before returning.
2318
2521
 
2319
2522
  Interactive watch presentation enables xterm focus reporting (mode 1004) only
2320
2523
  while it owns terminal input. Local-store reads keep the same cadence regardless
@@ -2394,12 +2597,19 @@ stands in for tick completion. Telemetry survives lease release. Safe shutdown
2394
2597
  uses the matching run's open observation, historical journal boundaries when
2395
2598
  absent, and refuses forced termination when the observation cannot be read.
2396
2599
 
2600
+ Both dashboards show each accepted unfinished generation handoff, naming its source
2601
+ and target runtimes (version and abbreviated commit), mode and drain deadline
2602
+ (`unknown` for missing historical facts). A drain-mode outstanding execution
2603
+ adds `(draining)` to its build without replacing lifecycle status. Matching
2604
+ settlement clears the marker; accepted completion clears the banner. Takeover,
2605
+ an expired deadline and an empty outstanding set do not clear the banner.
2606
+
2397
2607
  The operator's job across many concurrent builds: see status at a glance,
2398
2608
  act on a selected build, find blocked builds, answer escalations, and inspect
2399
2609
  any build's trail. Each dashboard build row spends its header on identity and
2400
2610
  lifecycle status, with the pipeline and its per-step elapsed values below it;
2401
2611
  controls and diagnostic lines expose actions, pending dispatch, abort cleanup,
2402
- setup failures, and blockers. Dashboard rows derive from build events and
2612
+ setup failures, and blockers. Dashboard rows derive from build and repository events and
2403
2613
  effective configuration only, so heartbeat or lease renewal without an event
2404
2614
  does not alter them. Every nonterminal build, including `queued`, has a
2405
2615
  dashboard row; a pre-run row names its pending dispatch boundary or latest
@@ -2516,13 +2726,14 @@ with illustrative members:
2516
2726
 
2517
2727
  | Family | Examples |
2518
2728
  |---|---|
2519
- | Build lifecycle | `build.created` (carrying `assets`, the claim-time pin, §6.3), `workspace.provisioned`, `workspace.released`, `execution.started`, `execution.ended`, `infrastructure.failed`, `infrastructure.cleanup-attempted`, `dispatch.comment-posted`, `dispatch.failed`, `runner.attached`, `runner.setup-failed`, `abort.remote-branch-deleted`, `abort.local-branch-deleted`, `abort.ticket-returned`, `build.completed` |
2729
+ | Build lifecycle | `build.created` (carrying `assets`, the claim-time pin, §6.3), `workspace.provisioned`, `workspace.released`, `execution.started`, `execution.ended`, `infrastructure.failed`, `infrastructure.cleanup-attempted`, `dispatch.comment-posted`, `dispatch.failed`, `runner.attached`, `runner.runtime-recorded`, `runner.setup-failed`, `abort.remote-branch-deleted`, `abort.local-branch-deleted`, `abort.ticket-returned`, `build.completed` |
2520
2730
  | Operator commands [D2] | `build.pause-requested` → `build.paused`; `build.discard-requested`; `build.hold-requested`; `build.land-requested` → `landing.command-acknowledged`; `escalation.answered` (optionally carrying a validated `reviewRoundCeiling`, or the `assets` sampled with a revise-from-ticket authorization) |
2521
2731
  | Landing policy | `landing.decided` (candidate, matched rule/default, labels, target, mode); `landing.native-enable-started`; `landing.native-applied` |
2522
- | Spec | `spec.imported`, `spec.authored`, `spec.revised` (optionally carrying `assets`, a re-pin of the ticket's assets, §6.3) |
2732
+ | Spec | `spec.imported`, `spec.authored`, `spec.revised` (either positive `escalation` sequence or exclusive `operator: {user, via?}` provenance for an idle node; optionally carrying `assets`, a re-pin of the ticket's assets, §6.3) |
2523
2733
  | Sessions | `session.started` (including optional write-ahead continuation intent and budget ceiling); `session.suspended` with partial transcript and active duration; `session.resumed` acceptance (stale reports are inert); reasoned `session.resume-fallback`; kernel-only `session.native-handle-recorded` with bracket and native execution identity; `session.ended` with transcript ref and usage (ordinary completion — the analysis corpus), or `session.ended {outcome: reclaimed, reclaimedBy: {instance, resumedFromSeq}}` (explicit transcriptless takeover) |
2524
2734
  | Plan/code loops | `plan.started` … `plan-review.verdict`; `implement.started` … `code-review.verdict` |
2525
2735
  | Verify/finalize | `verify.started {step, attempt, feedback?, baseSha?, headSha?, restackId?}`, `verify.completed {step, outcome, skipCause?, baseSha?, headSha?, restackId?}`, `verify.reconcile-policy-captured {reconcileSeq, steps}`, `finalize.completed {pr}`, `finalize.step-started {step}`, `finalize.step-completed {step, ok, headSha?}` |
2736
+ | Integration attention | Kernel/dispatcher `integration.verification-failed {id, head, parent, steps, guidance}`: one durable failed-cycle notification, recovered from exact verification receipts |
2526
2737
  | PR summary | Kernel-authored `pr-summary.requested {occurrence, boundary}`, `pr-summary.attempted {occurrence, boundary, pr}`, `pr-summary.result {attempt, outcome, eligibleAfter?}`, `pr-summary.settled {request, disposition}`; sequence identities correlate durable starts, completed boundaries, attempts, and handoffs (§7.5) |
2527
2738
  | PR attachments | `pr-attachment.designated`, `pr-attachment.hosted`, `pr-attachment.reclaimed`, `pr-attachment.reclaim-failed` |
2528
2739
  | Leaf restacking | `target.moved {branch, sha}`, `restack.prepared`, `restack.replayed`, `restack.publish-intended`, `restack.rewritten`, `restack.contended`, `restack.completed` |
@@ -2589,7 +2800,12 @@ routing, integration and landing/publication decisions for that build only;
2589
2800
  read-only status/context/dashboard reads retain the lifecycle status. The
2590
2801
  kernel or dispatcher records advisory `build.compatibility-deferred` with the
2591
2802
  decisive boundary, types, versions and diagnostic, deduplicated per boundary.
2592
- Default `ab watch` attention includes it. Diagnostics request a build that
2803
+ Default `ab watch` attention includes it. An unsettled dispatcher-written
2804
+ `execution.drain-authorized` in the build's own log suppresses that attention
2805
+ only for the matching execution instance and predecessor runtime during an
2806
+ accepted draining handoff. The decisive-fact fence and exit-for-relaunch remain.
2807
+ `execution.ended` or matching `execution.drain-settled` settles authorization;
2808
+ a later unrelated execution never inherits it. Diagnostics request a build that
2593
2809
  understands the unsupported types and name the writer releases, even when
2594
2810
  writer and reader share a release string. Upgrading clears deferral through
2595
2811
  local replay without answering an escalation. Repository unknown counts do
@@ -2763,6 +2979,42 @@ answer appended after delivery is a new eligible winner. Destinations remain
2763
2979
  independent, and the kernel derives both the winner and its delivery from the
2764
2980
  event history so replay and restart preserve the result.
2765
2981
 
2982
+ Automatic upgrade repository facts are run- and launcher-lineage-correlated.
2983
+ `dispatcher.upgrade-detected` is advisory; preparation, yield, acceptance,
2984
+ terminal release, takeover, drain settlement/deadline, completion and upgrade
2985
+ failure, `dispatcher.runtime-rolled-back` and `dispatcher.rollback-hold-cleared`
2986
+ are decisive. Rollback is immediate repository attention naming failed and restored
2987
+ runtimes. A run-start fact may carry its launcher lineage for effective-hold
2988
+ projection; historical rollback remains visible after a hold clears or lineage changes.
2989
+ Start and completion retain runtime/target provenance;
2990
+ retirement completion is distinct from takeover. Failure is immediate repository
2991
+ attention. A launcher consumes only its exact lineage/run's pending target and
2992
+ never an operator-stopped run. See §3.3 for the draining protocol.
2993
+
2994
+ Every dispatcher run start is immediately followed by an advisory
2995
+ `dispatcher.runtime-recorded {run, startedSeq, runtime}` fact. Every successful
2996
+ runner attach is immediately followed by advisory
2997
+ `runner.runtime-recorded {instance, attachedSeq, runtime}` before dispatch work
2998
+ or phases begin. Persistence failure prevents that work. Existing lifecycle
2999
+ facts remain decisive; older readers skip the advisory companions without
3000
+ compatibility deferral. Interrupted pairs and historical logs remain readable
3001
+ with runtime null in JSON and `runtime unrecorded` in human detail.
3002
+
3003
+ The runtime is captured once per executing process from its own distribution,
3004
+ never the consuming repository or dispatcher on behalf of a runner. It includes
3005
+ `version`, `commit` (a Git object id or explicit `unknown`), and
3006
+ `source: {kind: source | package, location}` with an absolute distribution root
3007
+ (realpath when available). A source distribution owns its Git top level,
3008
+ including worktrees; nested package installs cannot inherit a consumer's HEAD.
3009
+ Packages use valid manifest `gitHead` when available. Missing diagnostic metadata
3010
+ never prevents startup. Capture survives later checkout movement.
3011
+
3012
+ Repository status reports the authoritative lease holder's runtime independently
3013
+ of the newest invocation. Build detail reports chronological runner attaches;
3014
+ each phase is attributable to the preceding attach boundary. Companions correlate
3015
+ by exact start/attach sequence and run/instance, never by proximity or instance
3016
+ alone. Writer-version stamping and runtime selection are unchanged.
3017
+
2766
3018
  **C — setup failure:** the first attach retains the normal `runner.attached`
2767
3019
  fact, then a failed setup appends `runner.setup-failed
2768
3020
  {command,attempt,exitStatus,output}` and starts no phase or session. A retry runs
@@ -2843,8 +3095,10 @@ build-owned Store state. The kernel claims each execution's durable lease before
2843
3095
  launch and releases that exact holder only after completion; the child renews it.
2844
3096
  The lease remains the cross-process recovery and workspace-teardown gate (the
2845
3097
  in-memory guard is deliberately not durable: a dead process's memory disappears
2846
- with it). Ordinary dispatcher shutdown gracefully signals each local process
2847
- group, escalates the whole group after the bounded stop delay, and reaps it.
3098
+ with it). Ordinary dispatcher shutdown gracefully signals each local runner leader and
3099
+ waits for it to finish suspension and exit. It then reaps remaining descendants
3100
+ with bounded TERM-then-KILL process-group cleanup. The frontend waits for kernel
3101
+ teardown without a wall-clock force-kill deadline.
2848
3102
  Before every build-child terminal path exits — natural success or failure,
2849
3103
  SIGINT/SIGTERM, or immutable-parent watchdog death — it launches one detached
2850
3104
  group reaper while the leader still pins the group's identity. That owner
@@ -3210,6 +3464,9 @@ ticketScanIntervalSeconds = 60 # positive integer; ready scans, with tick spaci
3210
3464
  forge = "github" # builtin: github | local-git; or a plugin name
3211
3465
  plugins = ["./plugins/local.ts", "@acme/autobuild-plugin"]
3212
3466
 
3467
+ [upgrade]
3468
+ automatic = true # immediate/60-second target checks; false requires manual restart
3469
+
3213
3470
  #[workspace] # optional; default provider = "git-worktree"
3214
3471
  #provider = "vercel-sandbox" # shipped remote provider, or plugin name
3215
3472
  #[workspace.config]
@@ -3261,6 +3518,7 @@ model = "moonshotai/kimi-k3"
3261
3518
  sessionBudgetSeconds = 7200 # optional role override
3262
3519
 
3263
3520
  [policy]
3521
+ upgradeDrainSeconds = 900 # local generation drain deadline, hot-reloaded
3264
3522
  sessionBudgetSeconds = 3600 # non-infinite default for build agent sessions
3265
3523
  stallRounds = 3
3266
3524
  maxVerifyAttempts = 3
@@ -3315,7 +3573,7 @@ decide where a build's effective configuration is composed from:
3315
3573
  |---|---|---|
3316
3574
  | Build-owned (pinned) | `[verify]` and `[verify.<step>]`, `[finalize]` and `[finalize.<step>]`, `[commands]`, `[workspace]` (provider and config, including `provisioning` and `runtimeProvisioning`) | The build's own branch: its branch head once it has published commits, otherwise the recorded base commit its workspace was cut from. The exact commit is recorded once per deposit in the effective-config artifact metadata — except in checkout mode when the worktree read cannot be attributed to the branch-head commit: because the worktree file has uncommitted edits, because the clean/dirty comparison could not be performed (non-git workspace or a transient git error), or because the branch head never carried the file. The deposit then records the source `worktree-dirty` and no commit, because no commit claims the worktree bytes (the build still runs them). |
3317
3575
  | Deployment-owned (live) | `[roles]` (runtime, model, args, alternates, per-role `sessionBudgetSeconds`) and `[policy]` (budgets, retry bounds, stall and harvest knobs) | The dispatcher's live snapshot; an accepted reload delivers these to active builds. |
3318
- | Dispatcher-owned | `baseBranch`, `capacity`, `ticketScanIntervalSeconds`, `forge`, `plugins`, `pr`, `tickets`, `orchestrator`, `landing` | The dispatcher's live snapshot; the build runner never interprets them. |
3576
+ | Dispatcher-owned | `baseBranch`, `capacity`, `ticketScanIntervalSeconds`, `forge`, `plugins`, `pr`, `tickets`, `orchestrator`, `landing`, `upgrade` | The dispatcher's live snapshot; the build runner never interprets them. |
3319
3577
 
3320
3578
  A build's pipeline definition is therefore composed from the build's own
3321
3579
  branch: in origin mode the dispatcher reads `autobuild.toml` at the build's
@@ -3674,7 +3932,7 @@ current decision is required; auto-authorized and consented candidates are absen
3674
3932
  Source `ab ticket tree` / `tickets.tree` enumerate all ticket states with listing
3675
3933
  diagnostics; effective build targets remain frozen independently of source metadata.
3676
3934
 
3677
- Default watch attention includes `integration.landed`, `node.item-conflicted`,
3935
+ Default watch attention includes `integration.verification-failed`, `integration.landed`, `node.item-conflicted`,
3678
3936
  and conflicted `restack.replayed`. Derived `build.consent-ready` observations
3679
3937
  carry target, branch, candidate and the durable readiness entry position in the
3680
3938
  existing cursor envelope. Cursor identities retain readiness episodes across
@@ -3714,3 +3972,42 @@ unavailable for uninstrumented adapters. Attribution retains at most ten builds
3714
3972
  ordered by descending count then build name; repository requests are unattributed.
3715
3973
  Repository status names a hotspot only when one build makes at least two requests
3716
3974
  and more than half of attributed requests. Telemetry never controls workflow.
3975
+
3976
+ GitHub shares in-flight and completed PR, branch/ref and comparison observations
3977
+ across builds within one dispatcher tick. Opened nodes prime their tips and
3978
+ commit distance with at most two reads: PR plus comparison, or parent branch
3979
+ plus reversed comparison without a PR. Priming is best-effort: failures add a
3980
+ diagnostic and ordinary parent/target observations continue, so a deleted parent
3981
+ can still be replaced. Forge cooldowns and rate limits retain their gates.
3982
+ Each admitted poll revalidates mutable resources
3983
+ using exact-resource ETags; authenticated 304s spare the REST primary quota.
3984
+ Adapter caches are bounded and restart/eviction falls back to fresh reads.
3985
+ Writes, including Git publication and rewrites, invalidate observations before
3986
+ attempting the mutation so acknowledgement reads remain fresh. Leaf PR polling
3987
+ keeps its existing cadence. Readiness and landing inspections remain fresh.
3988
+
3989
+ Opened integration nodes poll every tick until their durable activity has been
3990
+ quiet for `policy.nodeIdleAfterSeconds` (default 600 seconds), then poll every
3991
+ `policy.nodeIdlePollSeconds` (default 120 seconds). Holds and waiting for consent
3992
+ qualify normally. Child claims, PR and landing activity, operator commands
3993
+ (including repeated holds), restack requests and answers wake the next tick.
3994
+ GitHub-only changes are discovered on the next due check, within the idle
3995
+ interval plus normal tick scheduling while the dispatcher is running; failure,
3996
+ cooldown and transport-budget gates still apply. Pending operations retain
3997
+ active polling and action-time readiness checks remain fresh. Successful
3998
+ `node.poll-checked` facts preserve quiet history across restarts; missing facts
3999
+ force a fresh check. `ab build status` reports active or idle cadence and the
4000
+ last successful check (or unrecorded evidence).
4001
+
4002
+
4003
+ The total includes all attempted requests. Optional `restPrimary`,
4004
+ `restNotModified` and `graphql` counts distinguish REST responses charged to the
4005
+ primary quota, REST 304s and GraphQL calls. Transport failures and historical or
4006
+ legacy observations can remain unclassified; absent fields never imply zero.
4007
+ Shared requests are attributed to their first requester; cache hits count zero.
4008
+
4009
+ ## Integration verification attention
4010
+
4011
+ A failed node verification cycle records `integration.verification-failed` with its prepared cycle id, failed steps, exact head and parent, and guidance to file a repair child targeting the node. The kernel reports durable failed receipts; dispatcher housekeeping recovers missing reports for the current cycle using a per-cycle CAS guard. Superseded cycles are never backfilled with repair instructions: recovery requires the latest prepared cycle to match the node’s observed head and parent. This fact is decisive evidence and bookkeeping, and does not change verification or leaf routing.
4012
+
4013
+ Default watch and new hosted wake settings include this event. Watch cursors deliver each failed cycle once and baseline failures when first armed; reconcile build status after arming. `ab wait --for attention` also detects a current failed node cycle before the report is written. Historical facts remain queryable after repair without retaining current attention. Explicit event globs and existing stored wake choices are preserved.
@@ -0,0 +1,93 @@
1
+ #!/usr/bin/env bun
2
+ import { ownsDispatchPresentation } from '../packages/core/src/cli/dispatch-presentation-ownership'
3
+ import { cachedRuntime } from '../packages/core/src/cli/dispatch-runtime-cache'
4
+ import { distributionRoot } from '../packages/core/src/distribution'
5
+ import {
6
+ consumeGenerationMarker,
7
+ GENERATION_EXITS,
8
+ DISPATCH_LAUNCH_CONTEXT_ENV,
9
+ } from '../packages/core/src/cli/dispatch-launch-contract'
10
+ import { watchDispatchParent } from '../packages/core/src/cli/dispatch-parent-watch'
11
+ let code: number = GENERATION_EXITS.failed
12
+ let presentationOwner = process.argv[2] !== '--preflight'
13
+ try {
14
+ const launch = consumeGenerationMarker(process.env, distributionRoot())
15
+ if (!(await cachedRuntime(launch.runtimeRoot)))
16
+ throw new Error('dispatcher generation requires a completed cached runtime')
17
+ const { loadDotEnv } = await import('../packages/core/src/cli/dotenv')
18
+ const { join } = await import('node:path')
19
+ loadDotEnv(join(launch.checkout, '.env'), process.env)
20
+ const { readHandoff } = await import('../packages/core/src/cli/dispatch-handoff')
21
+ if (process.argv[2] === '--read-journal') {
22
+ const { readGenerationJournal } = await import('../packages/core/src/cli/dispatch-handoff')
23
+ console.log(
24
+ JSON.stringify(await readGenerationJournal(launch, process.argv.slice(3), process.env)),
25
+ )
26
+ process.exit(0)
27
+ }
28
+ if (process.argv[2] === '--recover-terminal-release') {
29
+ const { recoverTerminalRelease } = await import('../packages/core/src/cli/dispatch-handoff')
30
+ await recoverTerminalRelease(launch, process.argv.slice(3), process.env)
31
+ process.exit(0)
32
+ }
33
+ if (process.argv[2] === '--read-upgrade') {
34
+ const { readUpgradeProjection } = await import('../packages/core/src/cli/dispatch-handoff')
35
+ console.log(
36
+ JSON.stringify(await readUpgradeProjection(launch, process.argv.slice(3), process.env)),
37
+ )
38
+ process.exit(0)
39
+ }
40
+ if (process.argv[2] === '--record-preflight-failure') {
41
+ const { recordPreflightFailure } = await import('../packages/core/src/cli/dispatch-handoff')
42
+ await recordPreflightFailure(
43
+ launch,
44
+ process.argv.slice(5),
45
+ process.env,
46
+ process.argv[3]!,
47
+ process.argv[4]!,
48
+ )
49
+ process.exit(0)
50
+ }
51
+ if (process.argv[2] === '--read-handoff') {
52
+ const handoff = await readHandoff(launch, process.argv.slice(3), process.env)
53
+ console.log(JSON.stringify({ version: 1, handoff: handoff ?? null }))
54
+ process.exit(0)
55
+ }
56
+ if (process.argv[2] === '--preflight') {
57
+ if (launch.overlapVersion !== 1) throw new Error('launcher has no overlap capability')
58
+ const { preflightGeneration } = await import('../packages/core/src/cli/dispatch-preflight')
59
+ const abort = new AbortController()
60
+ const stop = () => abort.abort()
61
+ for (const signal of ['SIGINT', 'SIGTERM', 'SIGHUP', 'SIGQUIT'] as const)
62
+ process.on(signal, stop)
63
+ try {
64
+ if (!(await preflightGeneration(launch, process.argv.slice(3), process.env, abort.signal)))
65
+ process.exit(GENERATION_EXITS.failed)
66
+ presentationOwner = true
67
+ process.argv.splice(2, 1)
68
+ } finally {
69
+ for (const signal of ['SIGINT', 'SIGTERM', 'SIGHUP', 'SIGQUIT'] as const)
70
+ process.removeListener(signal, stop)
71
+ }
72
+ }
73
+ process.env[DISPATCH_LAUNCH_CONTEXT_ENV] = JSON.stringify(launch)
74
+ const watch = watchDispatchParent(launch.launcherPid ?? process.ppid, () =>
75
+ process.kill(process.pid, 'SIGINT'),
76
+ )
77
+ try {
78
+ const { runDirectBinary } = await import('../packages/core/src/cli/binary-direct')
79
+ const result = await runDirectBinary(process.argv.slice(2))
80
+ code =
81
+ result === 0
82
+ ? (await readHandoff(launch, process.argv.slice(2), process.env))
83
+ ? GENERATION_EXITS.handoff
84
+ : GENERATION_EXITS.stopped
85
+ : result
86
+ } finally {
87
+ watch.close()
88
+ }
89
+ } catch (error) {
90
+ if (presentationOwner && ownsDispatchPresentation())
91
+ console.error(error instanceof Error ? error.message : String(error))
92
+ }
93
+ process.exit(code)
@@ -11,7 +11,7 @@ Every action below is sessionless, records a human-authored fact, and accepts
11
11
  | Try again without guidance | `ab answer <slug>` | Records a bare `retry`; no prose is delivered to an agent. |
12
12
  | Widen an exhausted review loop | `ab answer <slug> [<text>] --review-round-ceiling <n>` | Answers the open `review-round-limit` escalation and replaces the configured cap with absolute ceiling `n` for that loop and spec revision only. |
13
13
  | Retire a review disagreement | `ab answer <slug> --dismiss` | Records `dismiss-finding` for each escalation that cites a real finding id. The next reviewer is told not to re-raise that chain. |
14
- | Replace the build contract from a file | `ab answer <slug> --revise-spec <file>` | Records the replacement as the next spec revision and restarts at `plan`. |
14
+ | Replace the build contract from a file | `ab answer <slug> --revise-spec <file>` | Records the replacement as the next spec revision and restarts leaves at `plan`; nodes recollect and verify. |
15
15
  | Re-import an amended ticket | `ab answer <slug> --revise-spec-from-ticket` | Reads the build's recorded ticket and performs the same revision. |
16
16
  | Abandon the build | `ab abort <slug>` | Irrevocably requests abort; cleanup returns the ticket to Triage. |
17
17
 
@@ -66,14 +66,14 @@ problem in the same file under a new finding id.
66
66
 
67
67
  ## Revising the spec
68
68
 
69
- Revision requires an open escalation because the spec is the contract against
69
+ Leaf revision requires an open escalation because the spec is the contract against
70
70
  which every downstream approval is measured. The replacement must satisfy the
71
71
  same spec-standard quality gate used at dispatch; a non-conforming body is
72
72
  rejected before an artifact or event is recorded, leaving the build blocked on
73
73
  its current revision.
74
74
 
75
75
  A successful answer records a human `escalation.answered` fact naming the exact
76
- replacement artifact, followed by kernel `spec.revised`. The build re-plans and
76
+ replacement artifact, followed by kernel `spec.revised`. The leaf re-plans and
77
77
  pre-revision reviews, verification, and finalize completion do not satisfy the
78
78
  new run. Historical phase runs remain pinned to the revision they saw. An
79
79
  already-open pull request is retained and updated rather than duplicated.
@@ -87,3 +87,21 @@ A build that has already become terminal cannot restart. This includes the
87
87
  short windows where its PR has merged or closed and completion is underway, or
88
88
  where an abort request is pending. Abort is irrevocable; after cleanup, dispatch
89
89
  the returned ticket as a fresh build if work should continue.
90
+
91
+ Operators may explicitly revise an opened idle collecting node or a node blocked on failed
92
+ integration verification without an escalation. Use
93
+ `ab answer <node> --revise-spec replacement.md` or, after amending its ticket,
94
+ `ab answer <node> --revise-spec-from-ticket`. Ticket edits alone do not revise
95
+ the build. Both forms enforce the same spec standard as leaf revisions.
96
+ Each kernel `spec.revised` records the exact artifact and operator identity
97
+ (with optional transport provenance); earlier revisions remain readable.
98
+ Ticket-origin revisions re-pin assets; supplied bodies preserve asset pins.
99
+ The node recollects and verifies the new revision, including on the same head
100
+ and parent after a failed cycle. Earlier cycles remain historical evidence
101
+ and cannot block or authorize landing under the replacement. Children keep
102
+ their specs, claims and targets; contributions are not restarted.
103
+ Active verification/reconcile or writer work, restack/reparent work, pause,
104
+ pending controls, landing intent and ended PRs refuse the no-escalation path.
105
+ A concurrent state change refuses publication with a retry explanation;
106
+ uncited artifacts are inert. Leaves still require an open escalation and
107
+ restart from `plan`.