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

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 (172) hide show
  1. package/SPEC.md +310 -56
  2. package/bin/ab-build-runner.ts +10 -8
  3. package/docs/architecture.md +177 -23
  4. package/docs/configuration.md +35 -4
  5. package/docs/hosted-service.md +35 -0
  6. package/docs/integration-tree.md +83 -4
  7. package/docs/landing-policy.md +11 -0
  8. package/docs/migration-1.0.md +9 -0
  9. package/docs/operator-api.md +18 -0
  10. package/docs/remote-store-protocol.md +16 -0
  11. package/docs/remote-ticket-protocol.md +5 -0
  12. package/docs/restacking.md +42 -7
  13. package/docs/setup.md +25 -0
  14. package/docs/spec-standard.md +71 -0
  15. package/docs/ticket-dependencies.md +6 -45
  16. package/docs/ticket-migration.md +50 -4
  17. package/package.json +3 -3
  18. package/packages/core/src/cli/attention.ts +4 -1
  19. package/packages/core/src/cli/binary.ts +17 -1
  20. package/packages/core/src/cli/build-control.ts +3 -3
  21. package/packages/core/src/cli/context.ts +53 -1
  22. package/packages/core/src/cli/dashboard/actions.ts +4 -0
  23. package/packages/core/src/cli/dashboard/detail.ts +45 -1
  24. package/packages/core/src/cli/dashboard/facts.ts +7 -2
  25. package/packages/core/src/cli/dashboard/integration-detail.ts +144 -0
  26. package/packages/core/src/cli/dashboard/integration-row.ts +255 -0
  27. package/packages/core/src/cli/dashboard/landing-display.ts +64 -0
  28. package/packages/core/src/cli/dashboard/model.ts +147 -16
  29. package/packages/core/src/cli/dashboard/poll.ts +40 -4
  30. package/packages/core/src/cli/dashboard/render.ts +106 -5
  31. package/packages/core/src/cli/dashboard/transcript.ts +2 -1
  32. package/packages/core/src/cli/dispatch-frontend.ts +11 -0
  33. package/packages/core/src/cli/dispatch-repository-feed.ts +2 -1
  34. package/packages/core/src/cli/dispatch.ts +49 -14
  35. package/packages/core/src/cli/help.ts +17 -1
  36. package/packages/core/src/cli/main.ts +48 -8
  37. package/packages/core/src/cli/publication-settlement.ts +49 -5
  38. package/packages/core/src/cli/repository-status.ts +103 -2
  39. package/packages/core/src/cli/status.ts +24 -1
  40. package/packages/core/src/cli/terminals.ts +94 -93
  41. package/packages/core/src/cli/ticket.ts +35 -11
  42. package/packages/core/src/cli/wait.ts +11 -2
  43. package/packages/core/src/cli/watch.ts +12 -0
  44. package/packages/core/src/config/schema.ts +3 -0
  45. package/packages/core/src/events/catalog.ts +38 -0
  46. package/packages/core/src/events/compatibility.ts +183 -0
  47. package/packages/core/src/events/native-session.ts +13 -0
  48. package/packages/core/src/events/payloads.ts +150 -2
  49. package/packages/core/src/events/policy.ts +210 -0
  50. package/packages/core/src/events/repository.ts +69 -0
  51. package/packages/core/src/integration/harness.ts +4 -4
  52. package/packages/core/src/kernel/__snapshots__/{reducer-registry.test.ts.snap → reducer-accumulator-shapes.json} +4286 -4006
  53. package/packages/core/src/kernel/change-presence.ts +11 -3
  54. package/packages/core/src/kernel/dispatch-capacity.ts +127 -0
  55. package/packages/core/src/kernel/dispatcher-liveness.ts +5 -1
  56. package/packages/core/src/kernel/engine.ts +25 -5
  57. package/packages/core/src/kernel/forge-health.ts +19 -0
  58. package/packages/core/src/kernel/generators/build-log.ts +18 -0
  59. package/packages/core/src/kernel/generators/node-restack-log.ts +1 -1
  60. package/packages/core/src/kernel/generators/repository-journals.ts +10 -0
  61. package/packages/core/src/kernel/guarded-forge.ts +159 -0
  62. package/packages/core/src/kernel/incremental.ts +4 -2
  63. package/packages/core/src/kernel/integration-completeness.ts +108 -9
  64. package/packages/core/src/kernel/integration-landing.ts +5 -4
  65. package/packages/core/src/kernel/janitor-failure.ts +36 -0
  66. package/packages/core/src/kernel/landing-publication.ts +35 -15
  67. package/packages/core/src/kernel/landing-state.ts +7 -0
  68. package/packages/core/src/kernel/leaf-restack-state.ts +1 -1
  69. package/packages/core/src/kernel/log-index.ts +12 -1
  70. package/packages/core/src/kernel/mixed-version.ts +52 -0
  71. package/packages/core/src/kernel/node-landing.ts +14 -11
  72. package/packages/core/src/kernel/node-parent.ts +35 -10
  73. package/packages/core/src/kernel/node-restack-demand.ts +29 -0
  74. package/packages/core/src/kernel/node-restack-state.ts +46 -16
  75. package/packages/core/src/kernel/node-restack-transaction.ts +151 -8
  76. package/packages/core/src/kernel/node-restack.ts +34 -10
  77. package/packages/core/src/kernel/publication.ts +22 -0
  78. package/packages/core/src/kernel/read-deferrals.ts +111 -0
  79. package/packages/core/src/kernel/read-facts.ts +34 -6
  80. package/packages/core/src/kernel/reconcile-restack.ts +23 -2
  81. package/packages/core/src/kernel/reducer-registry.ts +18 -2
  82. package/packages/core/src/kernel/reducer.ts +196 -10
  83. package/packages/core/src/kernel/repository-attention.ts +38 -1
  84. package/packages/core/src/kernel/terminal-guard.ts +11 -4
  85. package/packages/core/src/kernel/ticket-migrations.ts +139 -0
  86. package/packages/core/src/operator/annotations.ts +6 -0
  87. package/packages/core/src/operator/index.ts +2 -0
  88. package/packages/core/src/operator/presentation.ts +5 -0
  89. package/packages/core/src/operator/query.ts +51 -11
  90. package/packages/core/src/operator/registry.ts +17 -1
  91. package/packages/core/src/operator/restack.ts +51 -0
  92. package/packages/core/src/operator/tickets.ts +30 -26
  93. package/packages/core/src/plugin-sdk/index.ts +10 -0
  94. package/packages/core/src/plugins/manifest.ts +1 -1
  95. package/packages/core/src/ports/forge/contract.ts +23 -0
  96. package/packages/core/src/ports/forge/fake.ts +6 -2
  97. package/packages/core/src/ports/forge/git-rewrite.ts +92 -64
  98. package/packages/core/src/ports/forge/github-transport.ts +45 -2
  99. package/packages/core/src/ports/forge/github.ts +56 -17
  100. package/packages/core/src/ports/forge/local-git.ts +7 -2
  101. package/packages/core/src/ports/forge-failure.ts +40 -0
  102. package/packages/core/src/ports/forge-request-context.ts +35 -0
  103. package/packages/core/src/ports/forge-telemetry.ts +16 -0
  104. package/packages/core/src/ports/runner/claude.ts +136 -9
  105. package/packages/core/src/ports/runner/codex.ts +112 -7
  106. package/packages/core/src/ports/runner/contract.ts +78 -0
  107. package/packages/core/src/ports/runner/fake.ts +59 -1
  108. package/packages/core/src/ports/runner/native-cli-fixture.ts +86 -0
  109. package/packages/core/src/ports/runner/native-process-fixture.ts +38 -0
  110. package/packages/core/src/ports/runner/native-session.ts +110 -0
  111. package/packages/core/src/ports/runner/pi-rpc.ts +7 -1
  112. package/packages/core/src/ports/runner/pi.ts +162 -2
  113. package/packages/core/src/ports/tickets/linear.ts +180 -12
  114. package/packages/core/src/ports/tickets/migration.ts +92 -9
  115. package/packages/core/src/ports/types.ts +60 -5
  116. package/packages/core/src/ports/workspace/git-worktree.ts +45 -51
  117. package/packages/core/src/ports/workspace/vercel-sandbox.ts +28 -12
  118. package/packages/core/src/processes/build-child-exit.ts +50 -2
  119. package/packages/core/src/processes/build-child.ts +15 -7
  120. package/packages/core/src/processes/build-runner.ts +909 -213
  121. package/packages/core/src/processes/dispatcher.ts +815 -369
  122. package/packages/core/src/processes/execution-no-progress.ts +15 -0
  123. package/packages/core/src/processes/pause-execution-fixture.ts +37 -0
  124. package/packages/core/src/processes/phase-failure-budget.ts +2 -1
  125. package/packages/core/src/processes/publication-loss.ts +7 -3
  126. package/packages/core/src/processes/repo-view.ts +53 -6
  127. package/packages/core/src/processes/tick-publication.ts +6 -2
  128. package/packages/core/src/runtime-identity.ts +37 -0
  129. package/packages/core/src/store/adapter.ts +4 -2
  130. package/packages/core/src/store/build-scope.ts +9 -0
  131. package/packages/core/src/store/contract.ts +233 -16
  132. package/packages/core/src/store/digest.ts +20 -2
  133. package/packages/core/src/store/local/schema.ts +6 -0
  134. package/packages/core/src/store/local/store.ts +57 -4
  135. package/packages/core/src/store/memory.ts +83 -2
  136. package/packages/core/src/store/new-build.ts +2 -2
  137. package/packages/core/src/store/phase-session.ts +13 -0
  138. package/packages/core/src/store/reduced-reads.ts +43 -4
  139. package/packages/core/src/store/reducer-value-shapes.json +8911 -6344
  140. package/packages/core/src/store/reducer-value-validation.ts +103 -3
  141. package/packages/core/src/store/reducer-values.ts +21 -6
  142. package/packages/core/src/store/remote/client.ts +145 -20
  143. package/packages/core/src/store/remote/index.ts +2 -0
  144. package/packages/core/src/store/remote/protocol.ts +19 -0
  145. package/packages/core/src/store/remote/version.ts +2 -0
  146. package/packages/core/src/store/repo-state-events.ts +5 -2
  147. package/packages/core/src/store/repo-tick.ts +6 -1
  148. package/packages/core/src/store/session-handle.ts +8 -0
  149. package/packages/core/src/store/snapshots.ts +21 -5
  150. package/packages/core/src/store/types.ts +17 -1
  151. package/packages/core/src/testing/dispatch-read-budget.ts +18 -2
  152. package/packages/core/src/testing/index.ts +7 -0
  153. package/packages/core/src/testing/newer-writer.ts +37 -0
  154. package/packages/core/src/testing/reduced-read-budget.ts +3 -0
  155. package/skills/guide/SKILL.md +140 -25
  156. package/skills/guide/references/integration-tree.md +83 -4
  157. package/skills/guide/references/landing-policy.md +11 -0
  158. package/skills/guide/references/migration-1.0.md +9 -0
  159. package/skills/guide/references/operator-api.md +18 -0
  160. package/skills/guide/references/plugin-authoring.md +47 -4
  161. package/skills/guide/references/remote-store-protocol.md +16 -0
  162. package/skills/guide/references/remote-ticket-protocol.md +5 -0
  163. package/skills/guide/references/restacking.md +42 -7
  164. package/skills/guide/references/setup.md +25 -0
  165. package/skills/guide/references/spec-standard.md +71 -0
  166. package/skills/guide/references/ticket-dependencies.md +6 -45
  167. package/skills/guide/references/ticket-migration.md +50 -4
  168. package/skills/implement/SKILL.md +4 -2
  169. package/skills/operate/SKILL.md +63 -6
  170. package/skills/reconcile/SKILL.md +3 -1
  171. package/skills/spec/SKILL.md +62 -40
  172. package/skills/tickets/SKILL.md +15 -43
@@ -85,7 +85,7 @@ remote-store protocol requires matching client and server versions.
85
85
  | `packages/vercel-sandbox/` | Published `@defrex/autobuild-vercel-sandbox` provider plugin: transitional manifest over the shared capability object with a guarded factory (implementation stays builtin-hosted until AUT-505) | §3.2.1 |
86
86
  | `packages/hosted-store-service/server.ts`, `packages/hosted-store-service/vercel.json` | One host-neutral Bun listener used locally and by Vercel's Bun preset | §7.2 |
87
87
  | `packages/core/src/kernel/` | Phase table, build reducer, engine; pure harvest, dispatcher-settings, dispatcher-status, and PR-attachment selectors; converge, stall detection, verify gating | §5, §7.5, §10, §12, §14, §15.4–15.5 |
88
- | `packages/core/src/ports/` | TicketSource / Workspace / Forge / AgentRunner / Telemetry interfaces, adapters, and fakes; registry-aware builtin/plugin construction; eager primary/alternate runtime routing and provider-failure classification under `ports/runner/` | §3.2, §9, §13 |
88
+ | `packages/core/src/ports/` | TicketSource / Workspace / Forge / AgentRunner / Telemetry interfaces, adapters, and fakes; registry-aware builtin/plugin construction; eager primary/alternate runtime routing and provider-failure classification, awaited native identity observation and optional fresh-process native resume under `ports/runner/` | §3.2, §9, §13 |
89
89
  | `packages/core/src/plugins/` | Strict versioned plugin manifests, dual-root repository/package Bun loading, owner-aware adapter registration, contract/credential metadata, and runtime-factory materialization | §3.2.1, §9 |
90
90
  | `packages/core/src/plugin-sdk/` | The sole supported `@defrex/autobuild/plugin-sdk` barrel: port/manifest types, contract suites, and reference fakes | §3.2.1 |
91
91
  | `packages/core/src/processes/` | build-runner and standalone child composition, durable execution config/diagnostics, dispatcher (+ janitor duty, harvest trigger, and the last-step orchestrator resume/reap/wake pass, origin-mode-gated), orchestrator tick step, harvest deterministic core + runner | §3.3, §7.1.2, §12, §15.7 |
@@ -156,8 +156,8 @@ of a cursor: `getReducerSnapshot(scope, reducer, version)` and
156
156
  (`packages/core/src/store/snapshots.ts`). The log stays the only authority. The
157
157
  store enforces the invariants: the stored cursor never decreases (a write whose
158
158
  cursor does not advance is a no-op, so concurrent writers cannot undo each
159
- other), a row of another reducer version reads as absent and is replaced once a
160
- writer advances past it, and a cursor beyond the log's tail is refused and never
159
+ other), a row of another reducer version reads as absent, and a lower-version
160
+ writer never replaces a higher-version row even after advancing its cursor, and a cursor beyond the log's tail is refused and never
161
161
  returned. Every consumer treats a missing, mismatched, ahead-of-log, malformed
162
162
  or unreadable snapshot as a miss and replays the log, with identical results;
163
163
  deleting all snapshots changes no observable output (the integration harness
@@ -173,6 +173,24 @@ reads every snapshot as missing and replays (SQLSTATE `42P01` is never an
173
173
  error), and an older client never asks. Run `bun run postgres:migrate` once to
174
174
  gain the table; until then the dispatcher and every other reader replay in full.
175
175
 
176
+ **Mixed-version event decoding.** `events/compatibility.ts` separates opaque
177
+ stored facts from the known event unions. Strict producer schemas stay in
178
+ `events/payloads.ts` and `events/repository.ts`; `events/policy.ts` exhaustively
179
+ classifies every type and stamps writer release metadata. Named read boundaries
180
+ project known payloads before adapting selector rows, while build and repository
181
+ facts retain compatibility counts across incremental resumes. Unknown facts
182
+ still advance sequence cursors. `kernel/mixed-version.ts` guards affected build
183
+ decisions and deduplicates the default-watch attention fact. Other builds and
184
+ read-only queries continue. The [hosted upgrade guarantee](hosted-service.md#reading-across-upgrades)
185
+ describes recovery and the supported-window boundary.
186
+
187
+ All event-derived checkpoints include the combined read-catalog fingerprint in
188
+ their keys, independently of numeric reducer versions. Snapshot envelopes validate
189
+ that fingerprint; another catalog's rows remain untouched. Remote named values
190
+ use `x-autobuild-catalog-identity` for cache acceptance, keeping their strict
191
+ three-field JSON body unchanged. Missing or mismatching identity, version or
192
+ finished shape causes bounded local replay without a remote cache write.
193
+
176
194
  **Named reducer values.** `BuildStore.getReducerValue(scope, {reducer, args?})`
177
195
  returns `{version, cursor, value}` for each eligible entry in the executable
178
196
  reducer registry. Eligible reducers consume build or repository events and finish
@@ -230,6 +248,11 @@ the requested historical run. A never-started fresh invocation does not request
230
248
  historical correlation. Stopped dispatcher history is not copied into every
231
249
  current read.
232
250
 
251
+ Consumer validation failures report the reducer name, scope, returned store
252
+ cursor, structural field path and expected shape without persisted values.
253
+ Dispatcher tick warnings and stored failures add the running distribution's
254
+ version and source commit, captured at startup (or `unknown` without metadata).
255
+
233
256
  Hosted project build listings use the optional backing-store
234
257
  `listBuildsForRepo` capability with the authenticated repository. Postgres filters
235
258
  build rows in SQL before hosted ticket readable-id projection. Admin listings
@@ -345,8 +368,8 @@ requirement from the phase table.
345
368
  **Finalize publication.** Content-producing `finalize:*` checks or agents
346
369
  select and commit files locally and leave a clean worktree. `build-runner.ts`
347
370
  derives the last published head from event facts, rejects a non-descendant
348
- `HEAD`, and uses the `Forge.pushBranch` port for a regular kernel-side push
349
- before checkpointing the new head on `finalize.step-completed`. An unchanged
371
+ `HEAD`, freezes that SHA, and uses the Forge port for a regular kernel-side push
372
+ and exact authoritative readback before checkpointing the new head on `finalize.step-completed`. An unchanged
350
373
  head is a no-op; Git/Forge failures stay failure-tolerant observations.
351
374
 
352
375
  **Verify gating.** `packages/core/src/ontology.ts` owns the canonical
@@ -416,15 +439,25 @@ the repository record even with an unchanged event cursor, merging matching-run
416
439
  completion samples with journal ticks. Heartbeat renewal cannot invent progress.
417
440
  The memory, SQLite, Postgres and remote adapters share this contract, including
418
441
  no mutation after lease expiry and no partial publication on validation failure.
442
+ Repository read failures fail a watch tick and retry on the next iteration;
443
+ continuous failures use the existing five-minute persistent-tick attention.
444
+ Failure settlement writes through the fenced backing store without reading the
445
+ failed projection. Repository view writes distinguish a committed result from a
446
+ subsequent refresh failure, retaining the last complete snapshot while propagating
447
+ the read error to the operational caller. Exact metadata confirmation acknowledges
448
+ lost finish responses without requiring another projection read or duplicating
449
+ boundaries. Every operational tick refreshes facts before routing work. Startup
450
+ configuration errors, fatal forge publication errors, lease fencing and once-mode
451
+ failure behavior retain their existing semantics.
419
452
 
420
453
  Timeout escalation is held while the matching repository tick observation is open
421
454
  (with historical `tick-started` journal fallback when no observation exists),
422
455
  because force-killing the ticket claim before build creation would not be
423
456
  recoverable. After a build child claims a takeover lease, it reduces one
424
- captured event prefix and appends transcriptless reclaimed `session.ended`
425
- facts for every session open there before `runner.attached` cites that same
426
- boundary. Partial closure is retry-safe and an observed attachment therefore
427
- proves all pre-boundary sessions closed; historical orphan-only logs keep their
457
+ captured event prefix, retains an eligible local native recovery candidate, and
458
+ appends transcriptless reclaimed `session.ended` facts for unrelated open
459
+ sessions before `runner.attached` cites that same boundary. Partial closure is
460
+ retry-safe; historical orphan-only logs keep their
428
461
  old projection until an actual takeover records those facts. The supervisor
429
462
  rechecks kernel-child liveness at the force boundary
430
463
  and projects the same normal, forced, or abnormal result (with available
@@ -503,16 +536,19 @@ optional `localPath` explicitly identifies dispatcher reachability. Local Forge
503
536
  operations fall back to the main checkout when `localPath` is absent.
504
537
  `packages/core/src/ports/workspace/git-worktree.ts` selects the branch-cut base once
505
538
  at first creation, fetching into a build-scoped private ref; re-provisioning
506
- resumes at the branch tip and never re-cuts, so the first provisioning fact
507
- remains immutable provenance. Separately, each successful implementation terminal in
508
- `packages/core/src/cli/terminals.ts` asks the Forge to snapshot its authoritative base when
509
- that optional capability exists; otherwise it privately refreshes the frozen
510
- target branch from `origin` and records
511
- the unique merge-base of that snapshot and `HEAD` in `implement.completed`.
512
- It fails before publication/deposit on fetch, ref, ancestry, or ambiguity
513
- errors and writes neither `FETCH_HEAD` nor operator refs. Reconcile's
514
- execution-time target refresh in `packages/core/src/processes/build-runner.ts` remains a
515
- third, deliberately separate boundary and also fails closed.
539
+ resumes at the branch tip, so the first provisioning fact remains immutable
540
+ original provenance. A remote workspace lost before its branch is published
541
+ can be freshly cut again; the latest `remote` or `local` provisioning base is
542
+ the fallback review boundary, while `existing` facts only describe resumes.
543
+ Each implementation terminal in `packages/core/src/cli/terminals.ts` records
544
+ its proven contribution boundary verbatim: the projected implementation/replay
545
+ base, falling back to the latest fresh cut. Branch-cut target sampling remains
546
+ separate from review provenance. The immutable boundary must belong to HEAD's
547
+ history; missing or invalid provenance fails before publication or notes deposit.
548
+ There is no review-time target fetch or destination merge-base. Successful leaf
549
+ rewrite facts project `targetBase..headSha` for context, review and agent verify
550
+ steps without changing historical ranges. Node cycles retain separate semantics.
551
+ Reconcile's execution-time target refresh remains a separate boundary.
516
552
 
517
553
  The builtin `vercel-sandbox` adapter provisions an exact GitHub revision into a
518
554
  fixed guest path. Fresh-environment bootstrap scrubs clone authority, installs
@@ -1028,7 +1064,12 @@ validates issuance, durable lifecycle bindings and the 60-second terminal grace;
1028
1064
  `machine-auth.ts` authenticates these signed version-2 grants as delegated
1029
1065
  principals. `remote-store-server.ts` enforces resource mutations before deposits,
1030
1066
  including body-selected and addressed-stream resources. Operator routes reject
1031
- these principals. Ticket routes deny build grants and allow harvest grants only the reads and
1067
+ these principals. Build-runner and build-phase grants may append only the
1068
+ kernel's `dispatcher.forge-degraded` repository fact, in their own project,
1069
+ so runner/CLI guards can record a newly observed rate limit and wait for
1070
+ durable dispatcher recovery. This exception grants no repository administration,
1071
+ recovery, lease, or other journal writes. The agent-visible build-scoped Store
1072
+ still denies repository writes. Ticket routes deny build grants and allow harvest grants only the reads and
1032
1073
  runner filing operations they require. Ticket sources and assets are partitioned
1033
1074
  by the authenticated project.
1034
1075
 
@@ -1129,7 +1170,9 @@ Historical merge completions retain their original shape and semantics.
1129
1170
  The optional grouped Forge rewrite capability owns authoritative head snapshots,
1130
1171
  immutable `refs/autobuild/archive/<slug>/<sha>` publication and expected-head CAS.
1131
1172
  GitHub uses explicit Git transport leases; local-git uses shared-database
1132
- `update-ref` CAS without network calls. Trusted remote publication archives before
1173
+ `update-ref` CAS without network calls. Exact authoritative readback acknowledges
1174
+ publication. Remote-backed local refs are caches refreshed without expected-old
1175
+ CAS after confirmation, even if absent or recreated; checkout files are untouched. Trusted remote publication archives before
1133
1176
  replacement after guest teardown; it never uses ordinary append-only publication
1134
1177
  for restacks. Prepared, replayed, intended and rewritten facts support recovery.
1135
1178
  A contended rewrite preserves the observed work and retries on the same base.
@@ -1228,12 +1271,23 @@ exhaustive source listings, frozen claims and retained contribution identities.
1228
1271
  `integration.*` events retain observations, immutable cycle inputs, landing
1229
1272
  intents, provenance and tree audits. The build reducer projects these facts and
1230
1273
  `engine.ts` routes nodes directly through verification, without producer phases.
1274
+ The shared `cli/dashboard/integration-detail.ts` projection supplies both
1275
+ dashboards with all child titles/states, current verification outcomes, landing
1276
+ rule explanations and restack files. Optional `integration.observed.children`
1277
+ metadata stores source/id, title and contribution identity without changing the
1278
+ authoritative membership arrays. Completed build records supply legacy title
1279
+ fallbacks; missing historical titles remain explicit. Optional `files` on
1280
+ `node.item-conflicted` and conflicted `restack.replayed` are captured as
1281
+ NUL-delimited unmerged Git paths; historical missing filenames remain explicit.
1282
+ Repository enrichment refreshes live child phases even without a parent delta.
1231
1283
  Failed cycles park for repair children. The dispatcher temporarily provisions
1232
1284
  verification resources and rechecks head, parent, controls and completeness
1233
1285
  before publication. `integration-landing.ts` owns source-reserved root landing
1234
1286
  and immutable result audits; nested nodes use the destination writer transaction
1235
- in `node-landing.ts`. GitHub uses guarded PR rebase; local-git uses an ancestry
1236
- proof and exact-parent fast-forward. Shared status vocabulary exposes provenance
1287
+ in `node-landing.ts`. GitHub uses guarded PR rebase; local-git validates
1288
+ fast-forward shape against the frozen parent. Exact authoritative head readback
1289
+ or a durable confirmed receipt establishes publication; ancestry alone cannot
1290
+ acknowledge an unconfirmed candidate. Shared status vocabulary exposes provenance
1237
1291
  and mismatch attention in both frontends. Human forge merges remain observable
1238
1292
  escape hatches independent of completeness and verification.
1239
1293
 
@@ -1245,3 +1299,103 @@ decisions and persistent hold/land commands. The dispatcher owns readiness,
1245
1299
  ticket label sampling and native-state convergence. `kernel/landing-publication.ts`
1246
1300
  confirms native cancellation at local and trusted remote head-publication seams.
1247
1301
  Node landings retain the existing writer serialization and gate proof.
1302
+
1303
+ Build native session handles are kernel-authored `session.native-handle-recorded`
1304
+ facts. The build reducer retains them by bracket session id after session end;
1305
+ absence means no harness identity was reported. Adapters guard host/workspace
1306
+ and resume only native persisted state with fresh execution options.
1307
+
1308
+ Operator pause immediately cancels live turns, records suspension with cause
1309
+ `pause` (with or without a native handle, including remote workspaces), then
1310
+ acknowledges the still-current request. A newer resume supersedes pause; abort
1311
+ wins. Check-only steps and builds without a live agent retain boundary behavior.
1312
+
1313
+ Local git-worktree runners suspend an interrupted agent turn on dispatcher
1314
+ SIGINT/SIGTERM. A conditional artifact deposit records `session.suspended`
1315
+ with cause `shutdown`, the native handle, active milliseconds, partial transcript
1316
+ and any known incremental usage. A terminal fact that lands first prevents
1317
+ suspension; suspension fences the old session's terminal credentials permanently.
1318
+ The process supervisor retains its existing bounded force-stop path if provider
1319
+ cleanup or persistence cannot complete.
1320
+
1321
+ On attachment the runner retains an eligible current phase/round session and
1322
+ records takeover. Matching host, workspace and runtime permit native resume;
1323
+ remote workspaces, missing handles, unsupported runtimes and unavailable native
1324
+ state produce a reasoned `session.resume-fallback` and fresh execution. Provider
1325
+ failures retain ordinary retry/alternate policy. Native state is an optimization;
1326
+ the Store remains authoritative for durable resumption.
1327
+
1328
+ A continuation is a new Autobuild bracket with fresh credentials and a new
1329
+ stream. `session.started.continuation` durably records its predecessor, logical
1330
+ root, inherited handle, interruption cause and accumulated budget before launch.
1331
+ This is write-ahead resume intent, not a handshake: the prompt may execute and
1332
+ its terminal may land before the adapter reports native acceptance through
1333
+ `session.resumed`. Recovery retries an unaccepted attempt using the inherited
1334
+ handle; a superseded attempt's late acceptance is marked stale and changes no
1335
+ lifecycle state. The interruption prompt names pause, shutdown or runner loss and asks
1336
+ the agent to re-check the worktree and re-run anything in flight. Phase and round
1337
+ are retained, including uncommitted local work.
1338
+
1339
+ The original budget ceiling persists across interruptions. Monotonic elapsed
1340
+ milliseconds charge each live segment; suspended intervals are excluded. An
1341
+ abruptly lost segment is conservatively charged from its recorded start to
1342
+ recovery. Interrupted and continuation transcripts remain separate artifacts;
1343
+ logical totals sum known segment usage once and preserve every transcript ref.
1344
+ Unknown crash usage is not fabricated. Pause interrupts live turns and retains
1345
+ the suspension cause through continuation.
1346
+
1347
+ ### Failure budgets and own-build read deferrals
1348
+
1349
+ `policy.maxVerifyAttempts` counts distinct failed logical verify cycles after
1350
+ the latest spec revision. Passing and skipped cycles, including target movement
1351
+ through restack or reconcile, consume zero. Cycle identifiers remain monotonic;
1352
+ pass, pass, pass, fail at cycle 4 spends one failure. Duplicate completion
1353
+ evidence for a failed cycle does not charge it twice.
1354
+
1355
+ Classified session deferrals consume no phase failures. Unsupported decisive
1356
+ facts retain the mixed-version wait gate and durable compatibility diagnostic.
1357
+ When the scoped `ab context` initial own-build read fails, the CLI best-effort
1358
+ writes `session.build-read-failed` with exact session, phase, round, operation
1359
+ `context`, reason `own-build-read`, and diagnostic. A valid terminal from that
1360
+ session wins if the agent recovers. Otherwise settlement records `phase.deferred`
1361
+ and `phase.deferral-escalated`, immediately projecting ordinary blocked attention.
1362
+ The raise cites `own-build-read:<evidenceSeq>`; replay repairs either settlement
1363
+ crash gap before launching another agent. An `escalation.answered` retry or
1364
+ guidance authorizes one fresh session without resetting genuine phase failures;
1365
+ a new classified failure parks again. There are zero automatic paid retries
1366
+ after this deferral. If evidence cannot be written, ordinary recovery applies;
1367
+ agent output and `no-terminal` alone never classify a read failure.
1368
+
1369
+ Ordinary silence, provider failures and session timeouts retain the runner's
1370
+ phase failure limit (`BuildRunnerOpts.maxPhaseAttempts`, default 2). This is
1371
+ an internal runner option, not an accepted `[policy]` TOML key. Reconcile
1372
+ execution and unchanged-base progress budgets retain their existing accounting.
1373
+
1374
+ ## Forge failure recovery
1375
+
1376
+ Janitor failures are durable per-build episodes. Eligible failures retry after
1377
+ 30, 60, 120, 240 seconds, then at the configured cap (300 seconds by default).
1378
+ Skipped polls preserve the episode across restart. After
1379
+ `policy.janitorFailureAttentionSeconds` (600 by default), `build.janitor-failing`
1380
+ notifies default watchers and appears on the build row. A successful attempt
1381
+ clears it. `policy.janitorBackoffMaxSeconds` sets the positive integer cap.
1382
+
1383
+ A classified forge rate limit records repository degradation with `resetAt`.
1384
+ Forge work waits during cooldown; passing the deadline permits a recovery
1385
+ request, and only success clears degradation. A further limit extends cooldown.
1386
+ Native landing application failures keep candidate-specific retry eligibility,
1387
+ including automatic decisions without a human command. Retries recheck consent,
1388
+ holds, verification and the exact candidate. Uncertain enables remain pending
1389
+ until cancellation can be confirmed after cooldown. Publication retries reuse
1390
+ cancellation receipts only when the forge confirms the same disabled state for
1391
+ the same candidate and publication operation.
1392
+
1393
+ Tick telemetry counts provider wire requests, including failures. Counts are
1394
+ unavailable for uninstrumented adapters. Attribution retains at most ten builds
1395
+ ordered by descending count then build name; repository requests are unattributed.
1396
+ Repository status names a hotspot only when one build makes at least two requests
1397
+ and more than half of attributed requests. Telemetry never controls workflow.
1398
+
1399
+ Ticket-source continuity is reduced by `kernel/ticket-migrations.ts` from durable
1400
+ repository `tickets.migration-recorded` facts. Import publishes only complete
1401
+ mappings; current-operation resolvers leave build records and old events intact.
@@ -253,7 +253,7 @@ any table header.
253
253
  |---|---:|---|---|
254
254
  | `baseBranch` | `"main"` | nonempty string | Branch used to cut builds, target PRs, and merge during reconciliation. |
255
255
  | `ticketScanIntervalSeconds` | `60` | positive integer seconds | Ticket-source ready scan cadence; tick spacing is the effective minimum. |
256
- | `capacity` | `1` | positive integer | Maximum concurrent nonterminal builds for this repository. Paused and blocked builds still occupy capacity. |
256
+ | `capacity` | `1` | positive integer | Concurrent occupied slots for this repository. Paused and blocked work retains slots. Node reconcile and verification exclude their own blocked/paused descendants at admission; new claims use total occupancy. See [integration capacity](integration-tree.md). |
257
257
  | `forge` | `"github"` | nonblank string | Forge adapter name. Shipped values are `github` and `local-git`; configured plugins may register other names. |
258
258
  | `plugins` | `[]` | array of unique nonblank module specifiers | Trusted Bun plugin modules loaded by dispatch, `ab ticket`, and scoped phase CLI processes. |
259
259
 
@@ -1061,7 +1061,7 @@ session starts, with a copyable table and all registered runtime names.
1061
1061
  | `model` | inherited; otherwise selected runtime's own default | optional nonempty model id compatible with the resolved runtime | Select the exact model. Codex uses unqualified `gpt-*`; Pi ids are provider-qualified. |
1062
1062
  | `args` | inherited; otherwise `[]` | optional array of nonempty strings; `[]` allowed | Ordered extra CLI argv tokens applied to every phase and tool-free one-shot invocation. A supplied list replaces, rather than unions with, the inherited list. |
1063
1063
  | `extensions` | no effect | deprecated optional array of nonempty strings | Compatibility-only field. Dispatch warns for each declaring role; migrate explicit runtime options to `args`. |
1064
- | `sessionBudgetSeconds` | inherited; otherwise `[policy].sessionBudgetSeconds` | optional positive integer | Wall-clock budget for each build phase session routed through this logical role. One budget covers the primary and every alternate target. |
1064
+ | `sessionBudgetSeconds` | inherited; otherwise `[policy].sessionBudgetSeconds` | optional positive integer | Active-time budget for each build phase session routed through this logical role. Suspended intervals are excluded; native continuation retains the original ceiling and accumulated active time. One budget covers the primary and every alternate target. |
1065
1065
  | `alternates` | inherited; otherwise `[]` | optional ordered array of strict `{ runtime?, model?, args?, extensions? }` entries; `[]` allowed | Failure-triggered execution targets (provider failures and a runtime whose CLI is not installed). A role's list replaces the inherited list wholesale; each entry overlays that role's effective primary axes. `extensions` is accepted there only as the same deprecated no-op. |
1066
1066
 
1067
1067
  <!-- config-fragment:roles -->
@@ -1200,7 +1200,7 @@ Optional. Every field receives its own default. All are positive integers except
1200
1200
 
1201
1201
  | Field | Default | Constraints | Purpose |
1202
1202
  |---|---:|---|---|
1203
- | `sessionBudgetSeconds` | `3600` | positive integer | Wall-clock bound for each build agent session unless its logical role overrides it. |
1203
+ | `sessionBudgetSeconds` | `3600` | positive integer | Active-time bound for each build agent session unless its logical role overrides it. Native continuation retains the original ceiling; suspension does not consume it. |
1204
1204
  | `stallRounds` | `3` | positive integer | Escalate when the same review finding survives this many rounds. |
1205
1205
  | `maxVerifyAttempts` | `3` | positive integer | Bound failure-driven verify → implement retry cycles. |
1206
1206
  | `maxDispatchAttempts` | `3` | positive integer | Bound consecutive dispatch failures before human escalation. |
@@ -1209,6 +1209,8 @@ Optional. Every field receives its own default. All are positive integers except
1209
1209
  | `maxReconcileAttempts` | `3` | positive integer | Bound completed reconciles that leave the PR conflicted against an unchanged authoritative base. Moving-base races do not consume the bound. |
1210
1210
  | `maxReviewRounds` | `6` | positive integer | Default bound for each plan/review and implement/review convergence loop. An operator may replace it for one parked build loop and current spec revision with `ab answer --review-round-ceiling`; other builds are unaffected. |
1211
1211
  | `harvestThreshold` | `5` | positive integer | New unclaimed observation occurrences needed to start one harvest run. |
1212
+ | `janitorFailureAttentionSeconds` | `600` | positive integer | Consecutive janitor failure duration before build attention. |
1213
+ | `janitorBackoffMaxSeconds` | `300` | positive integer | Cap on exponential janitor retry delay, starting at 30 seconds. |
1212
1214
  | `harvestMaxDrift` | `3` | nonnegative integer | Other builds merged after the oldest unclaimed observation needed to start a run; `0` disables drift. |
1213
1215
 
1214
1216
  Dispatch failures share a `[policy].maxDispatchAttempts` budget (default 3) across
@@ -2019,4 +2021,33 @@ human landing needs no operator attention; overriding a hold is informational.
2019
2021
  If native auto-merge was armed, or an enable was in flight or indeterminate,
2020
2022
  record a possible stale-enable landing as contrary to policy and raise operator
2021
2023
  attention. Autobuild never rewrites the target to undo either outcome. Merge
2022
- gates and the serialized node-writer publication rules remain authoritative.
2024
+ gates and the serialized node-writer publication rules remain authoritative.
2025
+ ### Failure budgets and own-build read deferrals
2026
+
2027
+ `policy.maxVerifyAttempts` counts distinct failed logical verify cycles after
2028
+ the latest spec revision. Passing and skipped cycles, including target movement
2029
+ through restack or reconcile, consume zero. Cycle identifiers remain monotonic;
2030
+ pass, pass, pass, fail at cycle 4 spends one failure. Duplicate completion
2031
+ evidence for a failed cycle does not charge it twice.
2032
+
2033
+ Classified session deferrals consume no phase failures. Unsupported decisive
2034
+ facts retain the mixed-version wait gate and durable compatibility diagnostic.
2035
+ When the scoped `ab context` initial own-build read fails, the CLI best-effort
2036
+ writes `session.build-read-failed` with exact session, phase, round, operation
2037
+ `context`, reason `own-build-read`, and diagnostic. A valid terminal from that
2038
+ session wins if the agent recovers. Otherwise settlement records `phase.deferred`
2039
+ and `phase.deferral-escalated`, immediately projecting ordinary blocked attention.
2040
+ The raise cites `own-build-read:<evidenceSeq>`; replay repairs either settlement
2041
+ crash gap before launching another agent. An `escalation.answered` retry or
2042
+ guidance authorizes one fresh session without resetting genuine phase failures;
2043
+ a new classified failure parks again. There are zero automatic paid retries
2044
+ after this deferral. If evidence cannot be written, ordinary recovery applies;
2045
+ agent output and `no-terminal` alone never classify a read failure.
2046
+
2047
+ Ordinary silence, provider failures and session timeouts retain the runner's
2048
+ phase failure limit (`BuildRunnerOpts.maxPhaseAttempts`, default 2). This is
2049
+ an internal runner option, not an accepted `[policy]` TOML key. Reconcile
2050
+ execution and unchanged-base progress budgets retain their existing accounting.
2051
+
2052
+ Default `ab watch` and `ab wait --for attention` include
2053
+ `phase.deferral-escalated`; explicit event filters replace the default set.
@@ -256,3 +256,38 @@ client version. Without it, both fields are projected away, preserving historica
256
256
  strict decoders. Current hosted clients send all three capability headers and
257
257
  default absent kind to `work`. Unfiltered listing includes all ticket states and
258
258
  empty nodes for `ab ticket tree`; dispatch and landing behavior are unchanged.
259
+
260
+ ## Reading across upgrades
261
+
262
+ Within the advertised client compatibility window, readers with mixed-version
263
+ read support tolerate newer build and repository facts. Raw event endpoints
264
+ retain unknown types, payload fields and the producer's `compatibility`
265
+ metadata (`writerVersion` and `classification`). Known payload fields remain
266
+ validated. Adding an advisory field to an existing type is safe; a semantic
267
+ change that older kernels must respect requires a new decisive event type.
268
+
269
+ Named reduction responses retain exactly `{version, cursor, value}`. The
270
+ `x-autobuild-catalog-identity` response header identifies the backend's read
271
+ catalog independently of its package release and reducer version. Clients
272
+ accept an answer only when that identity, reducer version and finished shape
273
+ match their own; otherwise they replay raw events locally through the response
274
+ cursor. A missing header from an earlier service also triggers replay. A
275
+ service never invents an identity for a backend that supplies none. This keeps
276
+ released strict JSON decoders working without a new request capability.
277
+
278
+ Unknown advisory facts are counted and skipped. Unknown decisive facts defer
279
+ claiming, routing, landing and publication only for their build; status,
280
+ context and dashboards remain readable. One `build.compatibility-deferred`
281
+ attention fact per decisive boundary appears in the default `ab watch` stream.
282
+ Its diagnostic names unsupported types and producer releases: restart with a
283
+ build that understands those types. The type names matter even when both
284
+ processes report the same package version, as source builds may differ.
285
+ Legacy unknown facts lacking metadata are decisive and report that the writer
286
+ version is unavailable. Restarting with a reader that understands the facts
287
+ clears the guard through replay, without an escalation answer.
288
+
289
+ Caches are scoped to the reader's catalog. Replaying a reduction from an
290
+ unrecognized reducer version never overwrites its bytes; lower-version snapshot
291
+ writes cannot replace higher-version rows even at a later cursor. This
292
+ protects both upgrade directions. Readers predating this support still fail
293
+ closed; this guarantee does not widen the advertised client window.
@@ -15,7 +15,46 @@ build generation supplies evidence; ambiguous or unavailable evidence leaves the
15
15
  dependent queued. Confirmed landing SHA reachability can prove presence without
16
16
  a trailer, and a landed node transports its whole owned contribution. Empty
17
17
  completed nodes contribute nothing. Sibling work waits for landing into the common
18
- ancestor and cascade; same-node landings satisfy presence directly.
18
+ ancestor and demand the minimal restack path; same-node landings satisfy presence directly.
19
+
20
+ ## Choosing a destination
21
+
22
+ First decide whether the feature should be more than one ticket at all; the
23
+ [spec standard](spec-standard.md#sizing-and-splitting) prefers fewer, larger
24
+ tickets cut at seams. Whenever grooming produces more than one ticket for a
25
+ feature, explicitly choose root or a node before filing. Use a node when the set should reach the base branch
26
+ as one integrated change, or intermediate states should not ship independently.
27
+ Use root when every ticket is independently valuable and safe to land alone.
28
+ Nested nodes can collect a subfeature before contributing it to a larger feature.
29
+ A node provides one integrated delivery to its parent under the configured forge
30
+ method; it does not promise one physical Git commit.
31
+
32
+ Blockers and targets are independent: blockers order work; targets decide where
33
+ it lands. A blocker inside the same node resolves when its change lands into that
34
+ node, so a dependency chain can advance without waiting for root consent, subject
35
+ to the normal claim gates and presence rules. Dependencies across destinations
36
+ still need the presence evidence described above and in
37
+ [blocker resolution](ticket-dependencies.md#when-a-blocker-resolves).
38
+
39
+ Read the consuming repository's `autobuild.toml` and evaluate its effective
40
+ [landing policy](landing-policy.md) for the actual ticket kinds, destinations and
41
+ labels. Ordered `[[landing]]` rules use the first match; `from`, `into` and `label`
42
+ predicates are ANDed, with omitted predicates acting as wildcards. Without a
43
+ match, leaves default to auto and nodes to consent. Explain the resulting landing
44
+ and consent flow to the human in plain terms. Ask when grooming does not make the
45
+ destination choice clear. This decision is separate from workflow-state placement
46
+ and never authorizes promoting tickets to ready.
47
+
48
+ For example, **if** the matched rules require consent into root and allow automatic
49
+ landing into nodes (the staged-release example in the policy reference), a
50
+ root-targeted chain waits for consent separately for each ticket and ships each
51
+ intermediate change to the base branch. Under those same rules, children collect
52
+ automatically in a node and the verified, complete node waits for consent once
53
+ into root. Other matching rules can produce different flows; auto authorization
54
+ still obeys every readiness and merge gate. If the live dispatcher rejected a
55
+ configuration reload, the edited file is not evidence of its effective policy.
56
+ Resolve or report that uncertainty using existing operator repository status
57
+ and configuration-reload evidence before claiming which policy is active.
19
58
 
20
59
  ## Tickets and admission
21
60
 
@@ -25,8 +64,13 @@ cycles are refused. A node with targeting tickets cannot be demoted, even when
25
64
  those children are completed. Clear or reparent its children first.
26
65
 
27
66
  File tickets persist kind and target in frontmatter. Hosted tickets validate
28
- changes transactionally within the project. Linear uses the exact `node` label
29
- for kind and the parent relation for target only when that parent has the node
67
+ changes transactionally within the project. Existing tickets default to work with
68
+ no target; metadata changes increment the revision once, while equivalent aliases
69
+ and unchanged values do not. Legacy plugins without `integrationTree` support
70
+ read as work with no target and refuse explicit metadata writes, including clears
71
+ and mixed patches, with guidance to use a capable source.
72
+
73
+ Linear uses the exact `node` label for kind and the parent relation for target only when that parent has the node
30
74
  label. Ordinary grouping parents remain grouping and survive unrelated edits;
31
75
  explicit target clear clears the parent relation. Label replacement can demote a
32
76
  node and receives the same guards; explicit kind and labels must agree. Linear
@@ -40,6 +84,17 @@ no placeholder commit or PR. Idle nodes need no provisioned workspace, runner,
40
84
  execution lease or dispatch capacity. A PR opens or is adopted when the node
41
85
  has commits its current parent lacks; parent-only advancement remains empty.
42
86
 
87
+
88
+ A node requesting reconcile or verification is admitted before new ticket
89
+ claims. Its candidate occupancy excludes itself and capacity-bearing blocked or
90
+ paused descendants, following accepted source-qualified build target ancestry.
91
+ Running descendants and unrelated builds still count; ordinary blocked and
92
+ paused work retains its slot for every other admission. Provisioning reserves
93
+ node occupancy before the runner starts. This exception never raises the budget
94
+ for new claims. Status and both dashboards report actual occupancy, configured
95
+ capacity, effective display capacity and the nodes using descendant-held slots.
96
+ Idle collecting nodes remain free.
97
+
43
98
  Claims freeze the destination build generation and branch. Missing, unopened,
44
99
  landed, closed or aborted targets leave work queued with diagnostics. The newest
45
100
  generation wins; a closed generation never falls back to an older open one.
@@ -96,7 +151,7 @@ children retain their frozen destination.
96
151
  `--no-target` moves it to the root. Omitted fields preserve existing values;
97
152
  `--kind work` resets kind when valid. Only owned contributions replay onto the
98
153
  new parent, then the same PR is retargeted. Empty and same-head moves need no
99
- new commit or PR. Descendants follow through the normal cascade.
154
+ new commit or PR. Descendants restack only on their own demand.
100
155
 
101
156
  The request is durable before the provider write. Source readback accepts the
102
157
  new effective ancestry; branch publication, PR retargeting and completion have
@@ -115,3 +170,27 @@ written: abort and re-dispatch instead.
115
170
 
116
171
  See [forge requirements](landing-policy.md#forge-requirements),
117
172
  [restacking](restacking.md), and [migration from 0.x](migration-1.0.md).
173
+
174
+ ## Integration detail
175
+
176
+ Both dashboards show destination (with the configured-base annotation for root
177
+ targets), row progress and steps, branch/restack state, and all open and landed
178
+ children with titles and states. Open children come first; live children show
179
+ their current phase, unbuilt children read `queued`, contributions read `landed`.
180
+ Cancelled tickets without contributions are excluded. Verification names the
181
+ expected steps and only outcomes bound to the current node head and destination;
182
+ failures name the repair-child instruction. Landing explains the rule and mode;
183
+ ready consent names `l` and `ab land <slug>`. Conflicts name recorded files.
184
+ These are Store-only projections: additive `integration.observed.children`
185
+ metadata carries source/id, optional title and contribution build identity;
186
+ `node.item-conflicted.files` and conflicted `restack.replayed.files` retain paths.
187
+ Older events remain readable, with explicit unavailable titles/files. Display
188
+ metadata never changes completeness or landing eligibility.
189
+
190
+ ## Demand-driven parent freshness
191
+
192
+ Collecting nodes may intentionally trail their parent. They refresh before
193
+ verification and landing, for queued dependency presence, on operator request,
194
+ and after accepted re-parenting. Descendants need independent demand; presence
195
+ requests follow only the minimal proven ancestor path. See
196
+ [restacking](restacking.md#timing-and-evidence) for timing, requests and distance.
@@ -148,3 +148,14 @@ compatibility does not grant forge tree capabilities. Upgrade adapters before
148
148
  admitting nodes or requesting unsupported retargeting or landing operations.
149
149
  For the lifecycle see [integration trees](integration-tree.md); for old controls
150
150
  and upgrade conversion see [migration](migration-1.0.md).
151
+
152
+ Publication acknowledgement requires exact authoritative head readback, including
153
+ recovery. An unconfirmed candidate's descendants do not prove success. Durable
154
+ confirmed receipts preserve historical writes. Local refs cache confirmed heads;
155
+ remote expected-head leases and durable writer reservations still guard writes.
156
+ Local-git's shared database retains authoritative CAS.
157
+
158
+ Native cancellation receipts are candidate- and operation-specific. Publication
159
+ retries confirm forge state before reusing a receipt; external re-enables require
160
+ another confirmed cancellation. Classified transient landing failures retain
161
+ retry eligibility and recheck authorization after repository forge cooldown.
@@ -66,3 +66,12 @@ Check [forge requirements](landing-policy.md#forge-requirements) and
66
66
  [restacking](restacking.md) before enabling nodes on a plugin forge. Ensure
67
67
  archive publication/read permissions, tree capabilities and required merge
68
68
  methods are available; legacy read compatibility is insufficient.
69
+
70
+ ## Demand-driven node restacks
71
+
72
+ Parent movement is now observed without starting a node replay. Existing frozen
73
+ transactions finish after upgrade; subsequent replay needs completeness before
74
+ verification, freshness before landing, dependency presence, operator demand
75
+ (`ab restack <node>`), or accepted re-parenting. Nested nodes need independent
76
+ demand. Leaves keep their existing timing. There is no eager compatibility mode.
77
+ See [restacking](restacking.md) for durable requests and parent commit distance.
@@ -113,6 +113,7 @@ JSON bodies are strict: unknown fields are rejected.
113
113
  | Method and path | Body |
114
114
  |---|---|
115
115
  | `POST …/builds/{slug}/control` | `{"action":"pause"\|"cancel-pause"\|"resume"\|"abort"\|"discard"\|"land"\|"hold"}` |
116
+ | `POST …/builds/{slug}/restack` | Empty body; durable node restack demand. |
116
117
  | `POST …/builds/{slug}/answer` | One answer variant described below. |
117
118
  | `PUT …/settings/intake` | `{"enabled":boolean}` |
118
119
  | `POST …/settings/intake/toggle` | Empty body. |
@@ -237,6 +238,9 @@ record the first signal in the stop fact, and release its lease before exit.
237
238
 
238
239
  The default watch reports actionable conditions only:
239
240
 
241
+ - `build.janitor-failing`: a build has reached the configured consecutive-failure threshold; a successful janitor attempt clears it.
242
+ - `dispatcher.forge-persistent`: forge degradation remains after a completed post-reset retry opportunity; successful recovery clears it.
243
+
240
244
  - Build `escalation.raised`, `integration.landed`, `node.item-conflicted`, or
241
245
  conflicted `restack.replayed` events. `build.consent-ready` is the single
242
246
  signal for a ready consent or held landing, including first repository-wide
@@ -302,3 +306,17 @@ or clears before changing other fields. Dispatch routing is unchanged.
302
306
  Landing controls use `land` and `hold` with acknowledged durable state. Land
303
307
  requires readiness and survives restacks; hold persists until land. Repository
304
308
  auto-merge settings are retired; configure ordered `[[landing]]` rules.
309
+
310
+ Default attention includes `build.janitor-failing` and
311
+ `dispatcher.forge-persistent`. Raw `dispatcher.forge-degraded` and
312
+ `dispatcher.forge-recovered` facts are available through explicit event filters.
313
+ Active janitor attention clears on a successful attempt. Repository status
314
+ includes forge degradation/reset and available request counts; `dispatcher.forge-persistent` requires a completed retry opportunity past
315
+ the original reset, which later rate limits cannot postpone indefinitely.
316
+
317
+ ### Node restack request
318
+
319
+ `builds.restack` accepts `{repo, slug}`. `POST /operator/v1/repos/:repo/builds/:slug/restack`
320
+ uses the same service as `ab restack <node>`. The receipt contains `slug`,
321
+ `request`, `coalesced` and `waiting`; execution is asynchronous. It refuses
322
+ non-node, unopened and terminal builds and enforces repository ownership.
@@ -316,6 +316,7 @@ it to exist. An unknown build returns `404 not-found`.
316
316
  | `append` | `POST /builds/{slug}/events` | event write | `201` + build event envelope |
317
317
  | `appendIfCurrent` | `POST /builds/{slug}/events/conditional` | `{"expectedSeq": nonnegative integer, "event": event write}` | appended: `201` + build event envelope; stream advanced: `200 null` |
318
318
  | `getEvents` | `GET /builds/{slug}/events?since={n}&wait={s}` | optional `since` query value, parsed below; absence defaults to `0`. Optional `wait` in whole seconds, parsed per the event-wait rules below | `200` + envelopes whose `seq` is strictly greater than parsed `since`, in increasing sequence order |
319
+ | `appendWithArtifactsIfCurrent` | `POST /builds/{slug}/deposits/conditional` | atomic deposit request plus `expectedSeq` | `201` + `{event, artifacts}`, or `200` + `null` on stale head |
319
320
  | `appendWithArtifacts` | `POST /builds/{slug}/deposits` | atomic deposit request | `201` + `{event, artifacts}` |
320
321
  | `getReducerSnapshot` | `GET /builds/{slug}/snapshots/{reducer}?version={n}` | required `version` query value, a positive integer; `reducer` is a registry name (`^[A-Za-z][A-Za-z0-9._-]{0,63}$`) | `200` + `{"version", "cursor", "state"}` or `200 null` when absent, written by another reducer version, or ahead of the build log's tail; an unknown build is `404`, which the shipped client also maps to `null` |
321
322
  | `putReducerSnapshot` | `PUT /builds/{slug}/snapshots/{reducer}` | `{"version": int >= 1, "cursor": int >= 0, "state": JSON}`, at most 16 MiB (`413` above) | `200 {"written": boolean}`; the stored cursor never decreases, so a write at an equal or lower cursor (or an equal cursor at an equal or lower version) and one past the log's tail answer `written: false` |
@@ -1085,6 +1086,16 @@ and metadata is the visibility boundary. Revision assignment, substitution,
1085
1086
  event validation, and metadata/event commit must be serialized or
1086
1087
  transactional so concurrent deposits receive distinct revisions and events.
1087
1088
 
1089
+ Conditional build deposits use `POST /builds/{slug}/deposits/conditional` and
1090
+ require nonnegative integer `expectedSeq`. The distinct endpoint fails closed
1091
+ against an older server; the client never falls back to an unguarded deposit.
1092
+ The backing store compares the head under the same transaction
1093
+ or build lock as the deposit. A stale head returns `200 null` without artifact
1094
+ metadata, revision allocation, timestamp updates, retention pruning or event
1095
+ append. A matching head follows the normal validation/rollback contract and
1096
+ returns `201 {event, artifacts}`. Immutable orphan blobs remain harmless.
1097
+ Terminal and suspension writers re-read and revalidate after a comparison miss.
1098
+
1088
1099
  These rules apply identically to build, repository, and session deposits.
1089
1100
 
1090
1101
  ## 9. Errors and validation
@@ -1318,3 +1329,8 @@ The optional `integrationAuditPending` digest fact is introduced on the 0.14
1318
1329
  release line without changing protocol identity 4. It survives build completion
1319
1330
  and is cleared by audit settlement. Services omit it for historical 0.12/0.13
1320
1331
  clients, retaining their decoders and the supported three-line window.
1332
+
1333
+ `tickets.migration-recorded` is a durable, decisive human-authored repository
1334
+ fact: `{ identity, from, to, mapping }`, where mapping contains source ticket IDs
1335
+ and destination IDs. All migration facts survive dispatcher-run turnover.
1336
+ Conflicting identity reuse or source-qualified mappings fail replay closed.
@@ -333,3 +333,8 @@ client version. Without it, both fields are projected away, preserving historica
333
333
  strict decoders. Current hosted clients send all three capability headers and
334
334
  default absent kind to `work`. Unfiltered listing includes all ticket states and
335
335
  empty nodes for `ab ticket tree`; dispatch and landing behavior are unchanged.
336
+
337
+ Completed ticket imports record `tickets.migration-recorded` in the selected
338
+ BuildStore repository journal, with export identity, origin/destination adapter
339
+ names and the actual complete ID mapping. Requested-ID preservation alone does
340
+ not establish continuity for in-flight builds; see the migration procedure.