@defrex/autobuild 0.14.0 → 1.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (172) hide show
  1. package/README.md +4 -2
  2. package/SPEC.md +654 -98
  3. package/docs/architecture.md +226 -5
  4. package/docs/assets/headline-wide.png +0 -0
  5. package/docs/configuration.md +112 -12
  6. package/docs/hosted-service.md +18 -0
  7. package/docs/integration-tree.md +117 -0
  8. package/docs/landing-policy.md +150 -0
  9. package/docs/mcp.md +24 -0
  10. package/docs/migration-1.0.md +68 -0
  11. package/docs/operator-api.md +19 -8
  12. package/docs/remote-store-protocol.md +30 -7
  13. package/docs/remote-ticket-protocol.md +26 -5
  14. package/docs/restacking.md +79 -0
  15. package/docs/setup.md +49 -6
  16. package/docs/ticket-dependencies.md +69 -0
  17. package/docs/ticket-migration.md +8 -0
  18. package/package.json +3 -3
  19. package/packages/core/src/cli/attention.ts +25 -2
  20. package/packages/core/src/cli/build-control.ts +65 -41
  21. package/packages/core/src/cli/context.ts +54 -2
  22. package/packages/core/src/cli/dashboard/actions.ts +6 -3
  23. package/packages/core/src/cli/dashboard/landing-display.ts +6 -0
  24. package/packages/core/src/cli/dashboard/live.ts +5 -0
  25. package/packages/core/src/cli/dashboard/model.ts +142 -18
  26. package/packages/core/src/cli/dashboard/poll.ts +15 -9
  27. package/packages/core/src/cli/dashboard/refresh.ts +176 -0
  28. package/packages/core/src/cli/dashboard/render.ts +78 -28
  29. package/packages/core/src/cli/dashboard/repository-poll.ts +57 -0
  30. package/packages/core/src/cli/dashboard/selection.ts +7 -1
  31. package/packages/core/src/cli/dashboard/tree.ts +107 -0
  32. package/packages/core/src/cli/dispatch-frontend.ts +156 -109
  33. package/packages/core/src/cli/dispatch.ts +250 -136
  34. package/packages/core/src/cli/dispatcher-liveness.ts +15 -2
  35. package/packages/core/src/cli/help.ts +49 -32
  36. package/packages/core/src/cli/init-validation.ts +43 -2
  37. package/packages/core/src/cli/keyboard.ts +6 -0
  38. package/packages/core/src/cli/landings.ts +18 -0
  39. package/packages/core/src/cli/main.ts +49 -15
  40. package/packages/core/src/cli/mcp.ts +9 -0
  41. package/packages/core/src/cli/publication-settlement.ts +168 -2
  42. package/packages/core/src/cli/repository-status.ts +11 -0
  43. package/packages/core/src/cli/status.ts +72 -5
  44. package/packages/core/src/cli/terminal-restore.ts +54 -0
  45. package/packages/core/src/cli/terminal.ts +16 -2
  46. package/packages/core/src/cli/terminals.ts +98 -79
  47. package/packages/core/src/cli/ticket-editor.ts +10 -3
  48. package/packages/core/src/cli/ticket.ts +113 -18
  49. package/packages/core/src/cli/upgrade-commit.ts +4 -0
  50. package/packages/core/src/cli/upgrade-compatibility.ts +2 -2
  51. package/packages/core/src/cli/upgrade-landing.ts +69 -0
  52. package/packages/core/src/cli/upgrade.ts +16 -0
  53. package/packages/core/src/cli/wait.ts +115 -19
  54. package/packages/core/src/cli/watch.ts +51 -12
  55. package/packages/core/src/config/landing.ts +22 -0
  56. package/packages/core/src/config/live.ts +1 -0
  57. package/packages/core/src/config/schema.ts +3 -0
  58. package/packages/core/src/events/catalog.ts +48 -3
  59. package/packages/core/src/events/payloads.ts +295 -6
  60. package/packages/core/src/events/repository.ts +31 -0
  61. package/packages/core/src/integration/harness.ts +10 -0
  62. package/packages/core/src/kernel/__snapshots__/reducer-registry.test.ts.snap +1030 -239
  63. package/packages/core/src/kernel/auto-merge-default.ts +1 -0
  64. package/packages/core/src/kernel/auto-merge.ts +12 -3
  65. package/packages/core/src/kernel/build-identity.ts +94 -0
  66. package/packages/core/src/kernel/change-presence.ts +179 -0
  67. package/packages/core/src/kernel/dispatch-status.ts +17 -1
  68. package/packages/core/src/kernel/engine.ts +89 -2
  69. package/packages/core/src/kernel/generators/build-log.ts +23 -0
  70. package/packages/core/src/kernel/generators/leaf-restack-log.ts +110 -0
  71. package/packages/core/src/kernel/generators/node-restack-log.ts +94 -0
  72. package/packages/core/src/kernel/generators/repository-journals.ts +11 -0
  73. package/packages/core/src/kernel/integration-completeness.ts +81 -0
  74. package/packages/core/src/kernel/integration-landing.ts +263 -0
  75. package/packages/core/src/kernel/integration-stack.ts +36 -0
  76. package/packages/core/src/kernel/integration-state.ts +135 -0
  77. package/packages/core/src/kernel/landing-policy.ts +47 -0
  78. package/packages/core/src/kernel/landing-publication.ts +41 -0
  79. package/packages/core/src/kernel/landing-readiness.ts +67 -0
  80. package/packages/core/src/kernel/landing-state.ts +96 -0
  81. package/packages/core/src/kernel/leaf-restack-completion.ts +24 -0
  82. package/packages/core/src/kernel/leaf-restack-state.ts +73 -0
  83. package/packages/core/src/kernel/log-index.ts +35 -5
  84. package/packages/core/src/kernel/node-landing.ts +439 -0
  85. package/packages/core/src/kernel/node-parent.ts +184 -0
  86. package/packages/core/src/kernel/node-restack-state.ts +191 -0
  87. package/packages/core/src/kernel/node-restack-transaction.ts +210 -0
  88. package/packages/core/src/kernel/node-restack.ts +274 -0
  89. package/packages/core/src/kernel/read-facts.ts +70 -3
  90. package/packages/core/src/kernel/reconcile-head.ts +51 -0
  91. package/packages/core/src/kernel/reconcile-restack.ts +560 -0
  92. package/packages/core/src/kernel/reducer-registry.ts +16 -0
  93. package/packages/core/src/kernel/reducer.ts +121 -6
  94. package/packages/core/src/kernel/snapshot-parent.ts +33 -0
  95. package/packages/core/src/ontology.ts +9 -1
  96. package/packages/core/src/operator/annotations.ts +12 -0
  97. package/packages/core/src/operator/control.ts +6 -0
  98. package/packages/core/src/operator/index.ts +4 -0
  99. package/packages/core/src/operator/landings.ts +35 -0
  100. package/packages/core/src/operator/presentation.ts +1 -0
  101. package/packages/core/src/operator/protocol.ts +12 -3
  102. package/packages/core/src/operator/query.ts +3 -1
  103. package/packages/core/src/operator/registry.ts +48 -19
  104. package/packages/core/src/operator/requests.ts +1 -8
  105. package/packages/core/src/operator/tickets.ts +55 -9
  106. package/packages/core/src/ports/forge/contract.ts +91 -3
  107. package/packages/core/src/ports/forge/fake.ts +142 -4
  108. package/packages/core/src/ports/forge/git-rewrite.ts +232 -0
  109. package/packages/core/src/ports/forge/github-readiness.ts +421 -0
  110. package/packages/core/src/ports/forge/github.ts +631 -35
  111. package/packages/core/src/ports/forge/local-git.ts +119 -5
  112. package/packages/core/src/ports/forge/readiness.ts +99 -0
  113. package/packages/core/src/ports/tickets/contract.ts +41 -0
  114. package/packages/core/src/ports/tickets/create.ts +8 -1
  115. package/packages/core/src/ports/tickets/fake.ts +32 -1
  116. package/packages/core/src/ports/tickets/file-codec.ts +7 -0
  117. package/packages/core/src/ports/tickets/file.ts +18 -1
  118. package/packages/core/src/ports/tickets/hosted-index.ts +2 -0
  119. package/packages/core/src/ports/tickets/linear.ts +124 -4
  120. package/packages/core/src/ports/tickets/migration.ts +25 -1
  121. package/packages/core/src/ports/tickets/operations.ts +7 -2
  122. package/packages/core/src/ports/tickets/remote-protocol.ts +19 -0
  123. package/packages/core/src/ports/tickets/remote.ts +10 -1
  124. package/packages/core/src/ports/tickets/revision.ts +3 -1
  125. package/packages/core/src/ports/tickets/tree.ts +148 -0
  126. package/packages/core/src/ports/tickets/update.ts +15 -2
  127. package/packages/core/src/ports/types.ts +135 -5
  128. package/packages/core/src/ports/workspace/git-worktree.ts +2 -1
  129. package/packages/core/src/ports/workspace/provider-capabilities.ts +1 -1
  130. package/packages/core/src/ports/workspace/vercel-sandbox.ts +60 -3
  131. package/packages/core/src/processes/build-runner.ts +530 -23
  132. package/packages/core/src/processes/dispatcher-selectors.ts +15 -9
  133. package/packages/core/src/processes/dispatcher.ts +2145 -203
  134. package/packages/core/src/processes/execution-no-progress.ts +46 -1
  135. package/packages/core/src/processes/publication-state.ts +30 -5
  136. package/packages/core/src/processes/repo-view.ts +21 -2
  137. package/packages/core/src/store/build-scope.ts +18 -0
  138. package/packages/core/src/store/contract.ts +658 -0
  139. package/packages/core/src/store/digest.ts +52 -4
  140. package/packages/core/src/store/local/schema.ts +25 -13
  141. package/packages/core/src/store/local/store.ts +117 -1
  142. package/packages/core/src/store/memory.ts +62 -1
  143. package/packages/core/src/store/phase-session.ts +17 -0
  144. package/packages/core/src/store/reduced-reads.ts +2 -1
  145. package/packages/core/src/store/reducer-value-shapes.json +10707 -6440
  146. package/packages/core/src/store/remote/client.ts +44 -0
  147. package/packages/core/src/store/remote/compatibility.ts +19 -9
  148. package/packages/core/src/store/remote/protocol.ts +11 -0
  149. package/packages/core/src/store/repo-state-events.ts +2 -0
  150. package/packages/core/src/store/session-handle.ts +15 -0
  151. package/packages/core/src/store/subscribe.ts +1 -1
  152. package/packages/core/src/store/types.ts +32 -4
  153. package/packages/core/src/testing/index.ts +2 -0
  154. package/packages/core/src/testing/reduced-read-budget.ts +48 -8
  155. package/packages/core/src/testing/refresh-scheduler.ts +32 -0
  156. package/skills/guide/SKILL.md +110 -61
  157. package/skills/guide/references/integration-tree.md +117 -0
  158. package/skills/guide/references/landing-policy.md +150 -0
  159. package/skills/guide/references/migration-1.0.md +68 -0
  160. package/skills/guide/references/operator-api.md +12 -5
  161. package/skills/guide/references/plugin-authoring.md +34 -0
  162. package/skills/guide/references/remote-store-protocol.md +30 -7
  163. package/skills/guide/references/remote-ticket-protocol.md +26 -5
  164. package/skills/guide/references/restacking.md +79 -0
  165. package/skills/guide/references/setup.md +49 -6
  166. package/skills/guide/references/ticket-dependencies.md +69 -0
  167. package/skills/guide/references/ticket-migration.md +8 -0
  168. package/skills/operate/SKILL.md +55 -5
  169. package/skills/reconcile/SKILL.md +55 -48
  170. package/skills/spec/SKILL.md +67 -1
  171. package/skills/tickets/SKILL.md +55 -2
  172. package/templates/autobuild.toml +3 -0
package/SPEC.md CHANGED
@@ -1,10 +1,11 @@
1
- # Autobuild v2 — Specification
1
+ # Autobuild — Specification
2
2
 
3
3
  An agent-driven software development lifecycle system: it takes work from
4
4
  *"something should be done"* to a merged PR, with a human in the loop only
5
- where judgment matters. This is a ground-up rebuild of v1 (preserved in git
6
- history at `6d4dce3`), keeping v1's validated ideas and replacing what it
7
- hard-coded with real interfaces.
5
+ where judgment matters. This is a ground-up rebuild of the pilot (preserved in
6
+ git history at `6d4dce3`), keeping the pilot's validated ideas and replacing
7
+ what it hard-coded with real interfaces. Versions are the npm release versions
8
+ of `@defrex/autobuild`; the pilot was never versioned.
8
9
 
9
10
  **What this document is.** SPEC.md holds the durable design: principles,
10
11
  boundaries between components, invariants, and decisions with their rationale
@@ -28,7 +29,8 @@ Status legend: sections describe **decided** design unless marked **[OPEN]**.
28
29
 
29
30
  ## 1. Why a rebuild
30
31
 
31
- v1 proved the core loop works. Its structural limits, which motivate v2:
32
+ The pilot proved the core loop works. Its structural limits, which motivate
33
+ this design:
32
34
 
33
35
  - **Repo as database.** Build state and artifacts lived in `build/<feature>/`
34
36
  dirs committed to the repo — accumulating noise, bloating the repo, with no
@@ -45,7 +47,7 @@ v1 proved the core loop works. Its structural limits, which motivate v2:
45
47
 
46
48
  ## 2. Constitution
47
49
 
48
- Principles — the first four carried from v1 — that are non-negotiable and that
50
+ Principles — the first four carried from the pilot — that are non-negotiable and that
49
51
  every design decision below answers to:
50
52
 
51
53
  1. **Judgment in skills, determinism in code.** Agents never decide phase
@@ -177,6 +179,18 @@ and janitor completion; the same registration backs every source-agnostic
177
179
  lifecycle fields unchanged and own any further validation; credentials remain
178
180
  environment-only.
179
181
 
182
+ Forge readiness is an optional read-only port capability, inspected on the host
183
+ by init validation and once at dispatch startup after repository lease acquisition.
184
+ It reports squash/rebase merge methods and kernel build/node/archive publication
185
+ permissions as hard requirements, and protected-target linear history and root
186
+ freshness as recommendations. Results are pass, fail, or unknown; incomplete
187
+ inspection never proves permission. Local Git passes trivially; legacy plugins
188
+ report unknown. Known hard failures fail init validation and produce one durable
189
+ `dispatcher.forge-readiness-failed` repository fact per run/check. They do not
190
+ add a dispatch admission gate. Repository attention watches (`ab watch`), dashboard
191
+ warnings, and operator queries expose all failures and remediation for the run;
192
+ `ab wait` remains build-only. No setting is changed and no probe ref is pushed.
193
+
180
194
  Forge selection is open through the root `forge` scalar (`github` by default).
181
195
  Two adapters ship: `github` publishes through GitHub/`gh`; `local-git` uses only
182
196
  the repository's shared local Git database and requires no remote, network, or
@@ -221,9 +235,8 @@ Small, independently runnable, crash-safe:
221
235
  `build.created` from the immutable record (only records an older dispatcher
222
236
  left with an empty stream: new claims write it atomically with the record), executes only missing workspace,
223
237
  spec, and ticket-notification boundaries, and records each failed attempt as
224
- `dispatch.failed`. `build.created` retains any claim-time auto-merge
225
- attribution and the sampled default fact's seq until the human-authored
226
- command fact is materialized, while
238
+ `dispatch.failed`. New claims do not seed landing consent or materialize
239
+ historical auto-merge defaults; policy is sampled at readiness. Meanwhile,
227
240
  `dispatch.comment-posted` prevents retries from duplicating the ticket notice.
228
241
  It also owns observation back-pressure: settling
229
242
  outstanding recoverable harvest runs takes priority over starting new scans
@@ -281,8 +294,10 @@ One name, used everywhere. Every noun lives in exactly one layer.
281
294
  |---|---|
282
295
  | **Signal** | Raw input from the world — a Sentry issue, an observation |
283
296
  | **Proposal** | A synthesized candidate ticket sitting in Triage, awaiting grooming |
284
- | **Ticket** | A groomed, dispatchable unit of work in the TicketSource |
285
- | **Build** | One pipeline execution for one ticket; has a slug; the unit the operator sees |
297
+ | **Ticket** | A source record of kind `work` (default) or `node`, optionally targeting a same-source node; ordinary groomed work is dispatchable |
298
+ | **Node ticket** | A named integration point represented by a ticket of kind `node`; its integration build owns a branch collecting child work |
299
+ | **Build** | One ticket execution with a slug; either a work pipeline or an integration branch lifecycle; the unit the operator sees |
300
+ | **Integration build** | A node build that opens its branch without a runner or capacity charge, collects child work, verifies its complete head and lands under ordered policy (node consent by default) |
286
301
  | **Harvest run** | One repository-scoped claimed observation snapshot and staged proposal workflow; never a build |
287
302
  | **Phase** | A named stage of the build pipeline grammar (§5) |
288
303
  | **Round** | One iteration inside a review loop |
@@ -309,7 +324,7 @@ mechanically:
309
324
  | `code-review` | `/code-review <build>` | `code-review.verdict` | `code-review` (rev N) |
310
325
  | `verify:e2e` | `/verify-app-e2e <build>` (repository-authored) | `verify.completed {step, outcome}` | `verify-report:e2e` on pass/fail when present |
311
326
  | `finalize` | `/finalize <build>` | `finalize.completed` | PR ref, summary |
312
- | `reconcile` | `/reconcile <build>` | `reconcile.started`, `reconcile.completed` | `reconcile-notes` + merge commit |
327
+ | `reconcile` | `/reconcile <build>` | `reconcile.started`, `reconcile.prepared`, `reconcile.replayed`, `reconcile.publish-intended`, `reconcile.rewritten`, `reconcile.contended`, `reconcile.completed` | `reconcile-notes` + one replayed change |
313
328
 
314
329
  Every phase skill takes **only the build slug**; everything else it needs
315
330
  comes from the store via the `ab` CLI (§8).
@@ -321,6 +336,14 @@ the bare phase names throughout.
321
336
 
322
337
  ## 5. Pipeline grammar
323
338
 
339
+ Work builds retain the fixed grammar below. Integration builds instead follow
340
+ `spec → branch opening → collecting → complete → verify:* → authorization → land → close`.
341
+ Authorization follows ordered landing policy: nodes default to explicit consent,
342
+ while an auto rule authorizes a complete, verified candidate without a command.
343
+ They never enter plan, implement, code-review or finalize. A node conflict uses
344
+ source-aware reconcile. Idle collecting nodes own no execution resources;
345
+ verification temporarily uses ordinary execution capacity. Empty nodes have no PR.
346
+
324
347
  ```
325
348
  spec → plan ⇄ plan-review → implement ⇄ code-review → verify:* → finalize (+ finalize:*)
326
349
  ```
@@ -357,9 +380,24 @@ is kernel-hard-coded. That is what keeps the system inspectable.
357
380
  `spec` is *not* a phase; it is satisfied at or before dispatch (§6). After
358
381
  `finalize`, the build enters a post-PR epilogue owned by the dispatcher's
359
382
  janitor duty (§15.7): a conflicted PR triggers the `reconcile` phase —
360
- agent-resolved merge of base into branch, full `verify:*` re-run — repeating
383
+ kernel-prepared single-change replay onto a frozen refreshed base, with agent
384
+ conflict resolution and the captured post-reconcile `verify:*` policy — repeating
361
385
  until merge or close.
362
386
 
387
+ Leaf branches are collapsed into one build change and restacked onto the frozen
388
+ target branch's current head at verify entry, before any verifier or exclusion.
389
+ This is kernel work within the fixed grammar, not another phase. A verify failure
390
+ returns to implementation; its new commits append to the canonical change, and
391
+ the next approved cycle collapses and restacks again. While waiting to land after
392
+ finalize and its post-steps, an observed target move also schedules a restack.
393
+ For a node-targeted leaf, published finalize-step commits also schedule one
394
+ waiting restack, even when the target SHA is unchanged, so guarded landing
395
+ preserves one canonical build identity.
396
+ Clean waiting restacks retain existing verification; conflicts use reconcile and
397
+ its captured post-reconcile policy. A conflict before initial verification cannot
398
+ skip initial checks through that policy.
399
+
400
+
363
401
  ## 6. The spec
364
402
 
365
403
  Two things wear the name:
@@ -441,8 +479,9 @@ continue reading their existing ticket rows.
441
479
 
442
480
  ## 7. The build store
443
481
 
444
- The v1 repo-bloat and no-observability problems share one root cause: the
445
- repo did double duty as workspace and database. v2 splits the roles:
482
+ The pilot's repo-bloat and no-observability problems share one root cause:
483
+ the repo did double duty as workspace and database. This design splits the
484
+ roles:
446
485
 
447
486
  - **Workspace** — the sandbox/worktree. Scratch by construction: the working
448
487
  tree plus the gitignored `.ab/` dir agents use as working memory during a
@@ -454,7 +493,8 @@ repo did double duty as workspace and database. v2 splits the roles:
454
493
 
455
494
  ```
456
495
  builds id/slug, ticket ref, repo, branch, status (derived), created/updated,
457
- lease + heartbeat (mutable liveness columns — §15.2.6, never events)
496
+ runner lease + heartbeat; independent node writer lease
497
+ (mutable liveness columns — §15.2.6, never events)
458
498
  events build_id, seq, timestamp, actor, type, payload (JSON) — append-only
459
499
  artifacts build_id, kind, revision, blobRef, metadata
460
500
  repo_streams repo, created/updated, lease + heartbeat, bounded tick observation
@@ -675,6 +715,14 @@ concurrent processors; the event stream remains authoritative, with no
675
715
  snapshot or side ledger. Sequence 0 names an empty stream, candidates receive
676
716
  ordinary event validation, unknown builds reject, and a comparison miss leaves
677
717
  the log and build timestamps untouched.
718
+ Node branch writers use separate `claimNodeWriter`, `renewNodeWriter`, and
719
+ `releaseNodeWriter` operations. Claim permits an absent, expired, or same-holder
720
+ lease; renewal requires the same unexpired holder, and release is holder-checked.
721
+ The memory, SQLite, Postgres, and HTTP stores enforce the same contract. These
722
+ leases neither grant nor renew runner authority. Delegated execution credentials
723
+ cannot acquire node writer authority. The active operation remains a durable
724
+ build-stream reservation across expiry, not mutable lease data.
725
+
678
726
  The same contract has repository-scoped `ensureRepo`, event/artifact deposit
679
727
  and read methods, plus a repository lease. Ticket assets (§7.1) add
680
728
  `putTicketAsset`, `getTicketAsset` (latest live revision, or an explicit
@@ -725,25 +773,28 @@ conformance suite):
725
773
  client, is the conformance bar. Autobuild does not load in-process BuildStore
726
774
  plugins. Git worktrees and default file tickets necessarily remain local.
727
775
 
728
- A service accepts stable clients from its own `major.minor` release line and
729
- the two preceding minor lines in the same major. A major starts a new family:
776
+ A service accepts stable and prerelease clients from its own `major.minor`
777
+ release line and the two preceding minor lines in the same major. A major starts a new family:
730
778
  X.0 accepts only X.0, X.1 accepts X.0/X.1, and X.2 onward accepts three lines.
731
779
  Patch versions are interchangeable in both directions and must never change
732
780
  the protocol. Upgrade the service first, then projects independently within
733
781
  its window. Supported release lines retain their wire handlers and known
734
782
  protocol identities; an unknown protocol is refused independently of version.
735
- Malformed, missing, and prerelease identities are refused with HTTP 409.
783
+ Stable and prerelease service and client identities share their numeric major/minor
784
+ line. Malformed or missing identities, build metadata (`+…`), prefixes and
785
+ whitespace are refused with HTTP 409.
736
786
  A newer client is told to upgrade the service; a client below the window is
737
787
  told to upgrade the project's Autobuild. Diagnostics name the service version
738
788
  and supported range.
739
789
 
740
790
  Unauthenticated `GET /health` publishes `ok`, `autobuildVersion`,
741
791
  `protocolVersion`, and `supportedClientRange: { minVersion, maxVersionExclusive }`.
742
- The range is inclusive at the minimum and exclusive at the maximum; a 0.11.x
792
+ Range endpoints remain stable versions. The range is inclusive at the minimum
793
+ and exclusive at the maximum; a 0.11.x
743
794
  service publishes `>=0.9.0 <0.12.0`. Health needs no credentials, version
744
795
  headers, or available backend.
745
796
 
746
- `subscribe` is specced in the interface; the v2.0 implementation is polling
797
+ `subscribe` is specced in the interface; the current implementation is polling
747
798
  `getEvents(since)`. True push comes later.
748
799
 
749
800
  Operator UIs additionally have a repository-scoped batch read,
@@ -818,36 +869,43 @@ mid-turn leaves its transcript behind instead of nothing.
818
869
 
819
870
  Because state is the event log and artifacts live in the store, a *new*
820
871
  sandbox can resume a build a dead sandbox started: pull events, rehydrate
821
- scratch from latest artifact revisions, continue. v1 structurally could not
872
+ scratch from latest artifact revisions, continue. The pilot structurally could not
822
873
  do this.
823
874
 
824
- Four base-selection invariants make this safe with Git:
875
+ The base-selection invariants make this safe with Git:
825
876
 
826
877
  - **The base is chosen once, at first branch creation**, from the freshly
827
878
  fetched origin tip of the configured base branch (fetched into a
828
879
  build-scoped internal ref so concurrent dispatches cannot clobber each
829
880
  other or the operator's refs). If the remote is unavailable, creation falls
830
881
  back to the local base and records the diagnostic.
831
- - **Re-provisioning never re-cuts.** An existing build branch is resumed at
832
- its current tip — never rewound, rebased, or re-created from a newer base.
833
- The first `workspace.provisioned` base remains immutable branch-cut
834
- provenance; later `existing` facts are resume evidence, not new cuts.
835
- - **Each implementation completion records the branch's effective target
836
- divergence.** `ab done` asks the selected Forge to snapshot its authoritative
837
- base when that capability exists; otherwise it fetches the frozen target
838
- branch's current remote tip into a build-scoped private ref. It requires
839
- exactly one merge-base with
840
- the implementation `HEAD`. That merge-base and head become the durable
841
- `implement.completed {commits}` range, so target history already absorbed by
842
- the build is excluded while every branch-unique commit remains reviewable.
843
- Resolution is refreshed across review rounds and sandbox resumption. Fetch,
844
- ref, missing-ancestor, malformed-output, or ambiguous-base failure rejects
845
- the terminal before push, artifact deposit, or completion event; there is no
846
- stale fallback. This interrogation never moves the build branch, rewrites
847
- history, writes `FETCH_HEAD`, or updates operator/remote-tracking refs.
848
- - **Conditional verify keeps its own durable diff base.** Path applicability
849
- still uses the initial branch-cut SHA until a completed reconcile promotes
850
- that attempt's refreshed target. It does not consume the focused review base.
882
+ - **Re-provisioning resumes; eligible restacks rewrite.** Provisioning alone
883
+ resumes the published branch. The kernel collapses and restacks at verify
884
+ entry and after target moves while awaiting landing. The first
885
+ `workspace.provisioned` base stays immutable branch-cut provenance; later
886
+ `existing` facts are resume evidence, not new cuts.
887
+ - **Review loops keep their starting effective base.** The initial loop uses
888
+ the original cut; after a successful verify-entry restack, later failure
889
+ loops use that restacked contribution base. Plan, implementation and
890
+ code-review never rewrite the branch. Previously recorded review ranges
891
+ remain immutable, including between rounds.
892
+ - **Each implementation completion records effective target divergence.**
893
+ `ab done` snapshots the authoritative frozen target branch in a build-private
894
+ ref and requires exactly one merge-base with implementation HEAD. The focused
895
+ `implement.completed {commits}` range excludes target history already absorbed
896
+ by the branch. This interrogation never moves the build branch. The original
897
+ cut remains provenance, and successful restacks establish the contribution
898
+ baseline for later loops and collapses. Recorded review ranges stay immutable.
899
+ - **Verification names its actual base.** Successful restack or reconcile
900
+ publication promotes the contribution/path base. Every new verify start and
901
+ result, including skips, cites the cycle's base and head. Those citations stay
902
+ frozen throughout the cycle and survive clean waiting restacks; historical
903
+ facts without citations remain readable. Upstream-only paths are excluded.
904
+ - **Observation never mutates a running workspace.** `target.moved` records an
905
+ exact observed head, even during a session. Transactions freeze their target;
906
+ later observations coalesce into one follow-on transaction for the newest
907
+ snapshot at the next eligible point. Session and execution settlement fence
908
+ rewrites, and trusted publication waits for remote guest teardown.
851
909
 
852
910
  ### 7.5 What the PR gets
853
911
 
@@ -996,7 +1054,7 @@ It buys three properties at once:
996
1054
  1. **Storage-agnostic skills** — local or remote store, same commands.
997
1055
  2. **An enforced ontology** — the CLI validates schemas at deposit; verdicts
998
1056
  travel a typed channel, never parsed from stdout (the root-cause fix for
999
- v1 sentinel parsing).
1057
+ the pilot's sentinel parsing).
1000
1058
  3. **Structured observations at the point of capture**, not prose mined from
1001
1059
  `observations.md` after the fact.
1002
1060
 
@@ -1045,7 +1103,14 @@ access rather than falling back to operator authority. `AB_STORE` and
1045
1103
  Dispatcher machine authority is an opaque, revocable credential for exactly one
1046
1104
  registered project. The service keeps only a digest of its random secret and
1047
1105
  credential metadata (creator, creation, last use, expiry and revocation), and
1048
- checks both credential status and project registration on each request. It
1106
+ checks both credential status and project registration in one fresh database
1107
+ read on each request. Last-use metadata is written at most once per 60 seconds,
1108
+ with a database cutoff fencing concurrent writers; it trails actual use by at
1109
+ most 60 seconds. Requests starting after revocation, expiry, or deregistration
1110
+ are refused; an authentication already in flight may complete. Authentication
1111
+ is shared only within a handled request. Repository record/existence reads may
1112
+ also be reused within that request, including compound operator reads, but
1113
+ events, reducer tails, and mutation locks remain fresh. It
1049
1114
  checks actual build/session/stream ownership and filters collections server-side.
1050
1115
  Explicit project mismatch is 403; missing and foreign indirect IDs share 404.
1051
1116
  Remote project build creation allocates a fresh slug and branch; the returned
@@ -1166,7 +1231,7 @@ terminals:
1166
1231
  | `code-review` | spec, plan, commit range `{base, head}`, prior findings, implement-notes | `verdict` |
1167
1232
  | `verify:<step>` (agent) | spec (acceptance criteria), step config, commit range | `verdict pass` \| `verdict fail --report` \| `verdict skip --reason` |
1168
1233
  | `finalize` | spec, plan, verify reports, PR template config | `done` (requires `pr-description` artifact) |
1169
- | `reconcile` | spec, plan, implement-notes, conflict `{baseSha}` from this attempt's `reconcile.started` | `done` (requires merge commit present) |
1234
+ | `reconcile` | spec, plan, implement-notes, conflict `{baseSha}` and kernel-prepared replay transaction | `done` (requires one replayed commit on the frozen base) |
1170
1235
 
1171
1236
  Scoping is deliberate: the planner never sees code-review rounds; the
1172
1237
  reviewer sees prior findings but not the producer's session. What a phase
@@ -1235,7 +1300,8 @@ requires a clean worktree and a descendant local `HEAD`, then regular-pushes
1235
1300
  the configured build branch and records that head before completing the step.
1236
1301
  A no-op step has no push. Agents only ever commit locally. Consequences: forge
1237
1302
  credentials **never enter the sandbox** (load-bearing once builds run on
1238
- remote sandboxes), history is extended rather than force-pushed, and the
1303
+ remote sandboxes), ordinary implementation history is extended and reconcile
1304
+ uses exact expected-head guarded rewrites with archived evidence, and the
1239
1305
  push-at-boundary rule from [D3] is enforced by construction rather than
1240
1306
  convention. The same rule bounds the orchestrator's small fixes: an operator
1241
1307
  sandbox publishes work only through the `sandbox.publish` tool, whose push and
@@ -1336,10 +1402,10 @@ sessionless read-only status projection.
1336
1402
 
1337
1403
  `ab repository status [--json] [--store <ref>]` is the sessionless read-only
1338
1404
  projection of the repository journal's dispatcher controls: ticket intake, the
1339
- repository-wide pause, and the auto-merge default. It uses the same
1405
+ repository-wide pause, and the harvest gate. It uses the same
1340
1406
  dispatch-settings reducer as dispatcher decisions and the dashboard. An absent
1341
1407
  repository stream reduces as an empty journal and reports intake on, repository
1342
- pause off, and auto-merge default off; the query does not create that stream,
1408
+ pause off; the query does not create that stream,
1343
1409
  append an event, claim a ticket, attach a runner, or start dispatcher work.
1344
1410
 
1345
1411
  Agents never receive TicketSource credentials. Only the deterministic file
@@ -1845,6 +1911,26 @@ dependency-blocked ticket stays
1845
1911
  queued source work rather than becoming a blocked build: the runtime `blocked`
1846
1912
  status is for builds awaiting a human.
1847
1913
 
1914
+ In repositories with integration nodes, a blocker that has a build resolves only
1915
+ when its change identity is present in the dependent's sampled target head
1916
+ (the configured root branch when no target is set). Source completion or an
1917
+ aggregate source blocker flag cannot substitute for presence. Confirmed landing
1918
+ SHAs prove identity through Git reachability even without a build trailer;
1919
+ confirmed node landings transport their frozen whole contribution, including
1920
+ node-owned foreign changes and nested contributions. Inherited parent history
1921
+ is excluded. An empty completed node contributes nothing; missing or ambiguous
1922
+ completion evidence does not mean empty. The newest build generation is used,
1923
+ with ties diagnosed rather than falling back to older successful work.
1924
+
1925
+ The existing cascade supplies ancestor changes to descendants. Sibling changes
1926
+ wait for their node to land in the common ancestor and cascade into the target;
1927
+ descendant changes wait for their node to land into the target ancestor. Same-node
1928
+ landings satisfy presence directly. Unknown evidence leaves source work queued,
1929
+ with diagnostics naming the blocker and destination. Blockers with no build,
1930
+ and repositories without nodes, retain source done-state resolution. Presence
1931
+ is checked only at claim, with the sampled destination revalidated before claim;
1932
+ later movement never interrupts an existing build.
1933
+
1848
1934
  **Crash-safe filing.** Creation supports a state override (harvest targets
1849
1935
  Triage explicitly) and an idempotency key that must adopt the same ticket on
1850
1936
  retry across process restarts. Ticket projections may carry this stable
@@ -1855,6 +1941,197 @@ ordering, not provider behavior, is what makes filing crash-safe. Dispatch
1855
1941
  uses the key only to withhold unfinished Autobuild creates; its absence fails
1856
1942
  open for legacy/plugin tickets and introduces no new readiness gate.
1857
1943
 
1944
+ ### 13.1 Node tickets and targets
1945
+
1946
+ Tickets have `kind = "work"` by default, or `kind = "node"` for a named
1947
+ integration point. The optional `target` is a node ticket id in the same source;
1948
+ omission means the configured `baseBranch` root. Nodes may target other nodes.
1949
+ A ready node ticket opens an integration build on `ab-node/<slug>`, cut
1950
+ from its parent's sampled head. Opening intent and acknowledgement are durable;
1951
+ the branch is open to targeting tickets immediately, without a PR. Idle integration
1952
+ builds use no provisioned workspace, runner, execution lease, or dispatch capacity.
1953
+ An empty node has no PR and reports `integration`, `target`, and `empty`.
1954
+ Once it holds commits its current parent lacks, the dispatcher opens or adopts
1955
+ its PR. No placeholder commit is created; parent-only advancement is still empty.
1956
+
1957
+ Claims targeting an open node freeze its build identity and branch as their base.
1958
+ Their PR, landing and reconcile all use that frozen base, even after source
1959
+ metadata changes. Missing, unopened, landed, closed or aborted targets remain
1960
+ queued with a diagnostic. The newest generation wins; a closed generation never
1961
+ falls back to an older open one. Blockers remain a separate graph.
1962
+
1963
+ A node is complete when exhaustive native ticket enumeration finds no unresolved
1964
+ ticket targeting it, no unsettled frozen child claim remains, and a landed
1965
+ contribution is durably known. Triage, backlog and ready children keep it open;
1966
+ done and cancelled children do not. Listing diagnostics fail closed. Completeness
1967
+ is sampled again before verification and publication. Source edits cannot be
1968
+ transactional with a forge write.
1969
+
1970
+ The kernel verifies the exact node head and sampled parent with all configured
1971
+ verify steps and normal path applicability. A moved head or parent invalidates
1972
+ eligibility, including a clean restack. Failure blocks the node; file a repair
1973
+ child targeting it. Repair children remain admissible, and their landed head
1974
+ supersedes the failed cycle. Reports retain their actual head/base citations.
1975
+
1976
+ Landing follows ordered `[[landing]]` rules (§15.7), defaulting to node consent.
1977
+ Auto mode authorizes complete, verified nodes; consent mode waits for `ab land`.
1978
+ Land refuses incomplete nodes and names open children; `ab hold` remains available.
1979
+ Node parents and local-git roots receive guarded fast-forwards, preserving one
1980
+ commit and identity trailer per contributing build. GitHub shared roots use the
1981
+ PR rebase endpoint guarded on verified head, after a final parent freshness read.
1982
+ Authoritative enforced up-to-date protection records fenced landing; uncertainty
1983
+ records unfenced landing and triggers immutable landed-tree comparison. A mismatch
1984
+ raises operator attention and never rewrites the shared parent.
1985
+ The repository build digest carries an additive optional pending-audit signal from
1986
+ `integration.landed` with an operation until `integration.audited` settles it.
1987
+ Settled nodes without that signal require no full build reads; completion does
1988
+ not suppress retries for an outstanding audit. Pending audits
1989
+ survive completion. Merge gates are never bypassed; unsupported transports defer.
1990
+
1991
+ Human forge merges are an explicit escape hatch, even while incomplete, paused
1992
+ or unverified. The janitor records human provenance and whether the actual merged
1993
+ head had a successful cycle, then completes the node ticket.
1994
+ Closing without merge or aborting closes admission and returns the ticket to
1995
+ triage; children already claimed retain their frozen base. Nested nodes work.
1996
+ A forge plugin needs node branch creation, comparison and
1997
+ head-read capabilities to admit node tickets.
1998
+
1999
+ **Changing a node's parent.** Updating an open node ticket's target moves it to
2000
+ another open node generation, or to the configured root when cleared. The node
2001
+ branch replays only its contribution above the last completed boundary onto the
2002
+ new parent. Former-parent-only history is excluded; owned foreign changes and
2003
+ source build identities survive. Existing review identity is retained and its PR
2004
+ base changes after branch publication. Empty and same-head moves need no new
2005
+ commit or PR. Descendants keep targeting the moved node and follow its head
2006
+ through the ordinary cascade, including source-aware conflict reconciliation.
2007
+
2008
+ A supported ticket mutation records `node.parent-requested` before the provider
2009
+ write under node writer authority. The dispatcher reads back the source and
2010
+ records `node.parent-accepted` with old/new target, branch, destination build
2011
+ generation and observed ticket revision. Only acceptance changes the effective
2012
+ node ancestry; `build.created` and `node.opening` remain historical provenance.
2013
+ Replay completion, `node.parent-pr-retargeted`, and `node.parent-completed`
2014
+ acknowledge independent effects. Pending requests and accepted moves fence
2015
+ verification and landing, and keep both old and new parents incomplete. Leases
2016
+ alone do not represent outstanding work. Recovery rereads ambiguous writes,
2017
+ cancels unconfirmed requests, resumes frozen replay, and retries PR retargeting
2018
+ without replaying unrelated ticket edits. Later edits wait for the reserved
2019
+ operation to settle. Native auto-merge is cancelled before changing the base.
2020
+ Accepted node re-parenting revokes prior land consent through the recorded
2021
+ `node.parent-accepted` fact. Holds survive. Readiness evaluates landing policy
2022
+ against the new effective parent before another landing can proceed.
2023
+
2024
+ Parent identity changes invalidate eligibility even at identical SHAs; historical
2025
+ verification evidence remains immutable.
2026
+
2027
+ Self/ancestor cycles (including pending effective ancestry), unopened or terminal
2028
+ destination generations, landing/closing sources and unsupported forge retargeting
2029
+ are refused with a reason. Busy writer reservations defer external changes and
2030
+ refuse synchronous mutations. Direct provider edits receive durable, revision-
2031
+ deduplicated `node.parent-rejected` diagnostics when invalid, preserving effective
2032
+ ancestry. Restoring the effective target records `node.parent-rejection-cleared`,
2033
+ removing the current refusal while retaining its historical fact. Rejection deduplication
2034
+ compares revision, target and reason independently of persistence key order.
2035
+ Missing source reads withhold parent acceptance; ordinary cascade and PR handling
2036
+ continue against durable effective ancestry. Accepted moves finish their reserved
2037
+ Git and PR effects independently of tracker availability. A PR merged or closed
2038
+ by a human follows ordinary terminal handling. Changing a claimed work ticket's target is
2039
+ refused before any combined patch is written: abort and re-dispatch is the
2040
+ supported path. Unclaimed tickets retain ordinary target editing.
2041
+
2042
+ **Descendant cascade and node writers.** Every open node observes its effective
2043
+ parent branch and its own authoritative head. Parent movement schedules a
2044
+ multi-change restack, including for an empty node with no PR. Publications flow
2045
+ down the tree on subsequent dispatcher polls, to arbitrary depth; clean replay
2046
+ starts no agent and consumes no runner capacity. Observations coalesce after the
2047
+ active frozen transaction completes. Leaf children retain their verify-entry and
2048
+ awaiting-landing restack rules. Existing integration PR numbers and bases survive
2049
+ rewrites; an empty node never creates a placeholder PR.
2050
+
2051
+ Node branches have one writer at a time. A distinct mutable node writer lease
2052
+ (serialized independently of runner execution leases) guards both restacks and
2053
+ controlled child landings. A revision-checked `node.writer-reserved` fact freezes
2054
+ the operation, original expected head, parent snapshot, previous contribution
2055
+ boundary, immutable archives, ordered changes, and merge proofs. Expiry permits
2056
+ recovery of that reservation, never an incompatible operation. Each change has
2057
+ prepared, conflicted, or replayed receipts. Resolved objects are retained in the
2058
+ BuildStore before their receipts. `node.publish-intended`, `node.rewritten`, and
2059
+ `node.writer-settled` distinguish intent, proven effect, and completion. Exact
2060
+ expected-head replacement and immutable archive refs preserve displaced history;
2061
+ contention retains the previous contribution boundary and retries the complete
2062
+ observed contribution. An untagged commit, including an empty commit, is foreign.
2063
+ `node.inventory` reports reachable build identities separately from node-owned
2064
+ foreign commits above the durable boundary; inherited foreign history is excluded
2065
+ from the owned count.
2066
+
2067
+ Only a conflicted replay item attaches the integration build's reconcile runner.
2068
+ Its context names the integration owner separately from the original source
2069
+ build and supplies that source's pinned spec, approved plan and implement-notes.
2070
+ Missing source artifacts or invalid identities escalate. Foreign conflicts supply
2071
+ commit metadata and a diff, with escalation when intent is unclear. Completion
2072
+ validates exactly one commit on that item's replay base, retaining its original
2073
+ identity or foreign status. The agent never publishes the stack; the dispatcher
2074
+ resumes only after session and execution settlement. Automatic landing policy
2075
+ remains outside this grammar.
2076
+
2077
+ **Foreign merge safety for node replay.** A node contribution is enumerated
2078
+ oldest first along first-parent history above its durable previous contribution
2079
+ base (initially the opening SHA). Parent movement never makes inherited foreign
2080
+ commits into node-owned contributions. The boundary advances only on confirmed
2081
+ restack completion.
2082
+
2083
+ Before replaying any contribution or publishing a replacement, preflight every
2084
+ merge against the frozen new parent's full reachable build identity set. For
2085
+ each merge, inspect the union reachable from every non-first parent but not the
2086
+ first parent, including nested side history. Flattening is allowed only when
2087
+ the merge itself has no terminal `Autobuild-Build` trailer and every side-history
2088
+ identity is already reachable through the sampled parent, regardless of commit
2089
+ SHA. The safe merge becomes one linear foreign change carrying its first-parent
2090
+ delta, including merge-resolution content and an empty result when necessary;
2091
+ its side identities remain inherited from the parent.
2092
+
2093
+ A merge carrying its own identity is anomalous: the kernel never creates merges,
2094
+ and legacy reconcile merges were squashed at landing. It is refused regardless
2095
+ of side-history safety. Never strip, move or reinterpret its identity trailer.
2096
+ An absent upstream side identity, ambiguous or malformed identity, or an
2097
+ identity-bearing merge refuses the entire restack before replay or publication.
2098
+ Leave the public node branch untouched and escalate on the integration build,
2099
+ naming each offending merge and its missing or own build identities. The kernel
2100
+ never preserves merge topology or automatically decomposes a foreign merge.
2101
+ Refusal never promotes the contribution boundary; an authorized later retry
2102
+ samples the parent anew and repeats the proof.
2103
+
2104
+ Use `ab ticket create "Integration" --body spec.md --kind node`, then
2105
+ `ab ticket update <id> --target <node-id>`. Clear a target with `--no-target`;
2106
+ reset kind with `--kind work`. Omitted fields preserve existing values.
2107
+ `ab ticket show <id> [--json]` exposes both fields; `ab ticket tree [--json]`
2108
+ shows the configured root and every ticket, including completed work and empty
2109
+ nodes, nested by target with state. Siblings are sorted by id. Invalid external
2110
+ graphs and listing diagnostics are reported explicitly.
2111
+
2112
+ Targets must exist and be nodes in the configured source. Self-targeting,
2113
+ ancestor cycles and demoting a node with targeting tickets are refused before
2114
+ any part of the requested update is written, regardless of ticket state.
2115
+ Clear or reparent its children before demotion. File frontmatter persists the
2116
+ fields; `ab ticket edit` displays them read-only. Change them through update.
2117
+ Kind and target participate in content revisions and revision-checked writes.
2118
+ File writes retain their existing best-effort, unlocked concurrency semantics.
2119
+
2120
+ Linear uses the exact `node` issue label for kind and the parent relation for
2121
+ target, only when the parent carries that label. Ordinary grouping parents do
2122
+ not impose targets and survive unrelated updates. Explicit target clear clears
2123
+ the parent relation. Label replacements can demote nodes and receive the same
2124
+ guards; explicit kind and label instructions must agree about `node`. Label
2125
+ and parent connections are fully paginated. Linear still refuses guarded writes.
2126
+
2127
+ Hosted sources support kind and target with project-scoped transactional validation.
2128
+ Existing tickets default to work with no target. Metadata changes increment the
2129
+ revision once; equivalent aliases and unchanged values do not. Node demotion
2130
+ checks all targeting tickets, including completed work. Legacy plugins without
2131
+ integrationTree support read as work with no target and refuse metadata writes.
2132
+
2133
+
2134
+
1858
2135
  ## 14. Operator UI
1859
2136
 
1860
2137
  The UI layer is defined by the seam, not any implementation: **subscribe to
@@ -1899,15 +2176,47 @@ signal, and error evidence. `--plain`, non-TTY,
1899
2176
  and `--once` kernel semantics remain the line-oriented/direct compatibility
1900
2177
  path; `--once` still performs one tick and drains its in-flight work.
1901
2178
 
1902
- Durable operator settings (intake, the repository-wide pause, the auto-merge
1903
- default, the harvest gate) are repository-journal facts: they survive restarts,
1904
- propagate between dispatchers by ordinary polling, and are never optimistically
1905
- rendered — the UI shows acknowledged state. The repository-wide pause holds
1906
- every queued build: while it is set, no dispatcher tick may attach a runner to
1907
- a build that does not have one yet. The auto-merge default both seeds new
1908
- claims and, on each change, fans out onto every current non-terminal build of
1909
- the repository as a bulk request or withdrawal attributed to the toggling
1910
- operator (§15.7).
2179
+ Interactive watch presentation enables xterm focus reporting (mode 1004) only
2180
+ while it owns terminal input. A focus-out report pauses all automatic dashboard
2181
+ reads, including session feeds; focus-in refreshes immediately. Terminals that
2182
+ send no reports remain focused. Every operator key requests an immediate refresh
2183
+ unless one is already running and holds the 500 ms cadence for at least 30
2184
+ seconds. Otherwise retained nonterminal builds (including abort cleanup) use
2185
+ 500 ms polling and an empty dashboard uses 5 seconds. Cached elapsed counters
2186
+ may repaint without reads. Focus never pauses the dispatcher kernel. Job-control
2187
+ suspension restores owned terminal modes and raw input before stopping; resume
2188
+ reenables them, assumes focus, and refreshes immediately. Teardown disables focus
2189
+ reporting even when no frame painted, with synchronous process restoration for
2190
+ catchable faults. Plain, non-TTY, and once runs never enable focus reporting.
2191
+
2192
+ Interactive frames first read `BuildStore.getRepoChangePosition(repo)`, a canonical
2193
+ unsigned decimal string used only for invalidation. Unknown repositories return
2194
+ `"0"` without creating state. Each repository's durable position advances in the
2195
+ same transaction as build creation, build/repository event insertion (including
2196
+ artifact-backed and tick writes), or a stored dispatcher lease holder transition.
2197
+ Other repositories, failed writes, denied claims, same-holder renewals, heartbeats,
2198
+ and passive expiry do not advance it. It is separate from journal sequence cursors.
2199
+ Unchanged positions reuse the complete presentation snapshot; a focused ordinary
2200
+ refresh then makes exactly one store request. Discovery uses required exact-repo
2201
+ `listBuildsForRepo(repo)`, never a global listing. Initial hydration, position or
2202
+ configuration changes, and at most ten seconds between full reads refresh the
2203
+ snapshot, including mutable lease/stream/artifact/ticket enrichment. Failed or
2204
+ cancelled reads do not acknowledge the sampled position. Open session feeds poll
2205
+ independently; kernel ticks and watch/wait retain their existing reads.
2206
+
2207
+ SQLite installs an additive counter table and transactional triggers on open.
2208
+ PostgreSQL installs the corresponding additive table/functions/triggers through
2209
+ explicit migration before deploying the new service; the core schema version
2210
+ and checksum stay unchanged. Existing data starts at zero, with no replay or
2211
+ backfill, and migration reruns preserve counters. Hosted reads use one GET
2212
+ `/repos/:repo/change-position` returning only `{ position: string }`, and
2213
+ `/repos/:repo/builds` returns scoped build records. Both routes authorize the
2214
+ repository before reading and support repositories with builds but no journal.
2215
+
2216
+ Durable operator settings (intake, repository pause, harvest gate) survive
2217
+ restarts through the repository journal. Per-landing hold and land commands
2218
+ live in the build log. Landing policy is declarative dispatcher configuration
2219
+ (§15.7); there is no writable repository auto-merge default.
1911
2220
 
1912
2221
  The **operator sandbox** is the third execution kind beside build and harvest
1913
2222
  executions: a persistent, credential-free, per-operator-per-repository
@@ -2030,7 +2339,15 @@ rejection is `EventValidationError`.
2030
2339
  4. **[D3] Code travels through the Forge, never the store.**
2031
2340
  `implement.completed` pushes the branch; events carry commit SHAs only.
2032
2341
  This is what makes cross-sandbox resume work (§15.6-C) and keeps the
2033
- store lean.
2342
+ store lean. SHAs are momentary evidence, not change identity: a forge
2343
+ or future history rewrite can mint a new object id for the same change.
2344
+ The immutable build slug in the landed commit's terminal Git trailer
2345
+ `Autobuild-Build: <slug>` identifies the build's change across such rewrites
2346
+ (RFC 0001 §5). Branch presence is determined by exact parsed trailer values
2347
+ in reachable history, not recorded SHA ancestry. Kernel-owned single-change
2348
+ replay, durable rewrite facts and immutable forge archive refs preserve
2349
+ historical SHAs (§15.7); the original no-rebase rationale does not prohibit
2350
+ this archived replay standard.
2034
2351
  5. **Append-only; corrections are new events.**
2035
2352
  6. **Liveness is not history.** Heartbeats and runner leases are mutable
2036
2353
  columns on the `builds` table, never events — they would drown the log.
@@ -2057,14 +2374,16 @@ with illustrative members:
2057
2374
  | Family | Examples |
2058
2375
  |---|---|
2059
2376
  | 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` |
2060
- | Operator commands [D2] | `build.pause-requested` → `build.paused`; `build.discard-requested`; `build.auto-merge-requested`; `escalation.answered` (optionally carrying a validated `reviewRoundCeiling`, or the `assets` sampled with a revise-from-ticket authorization) |
2377
+ | 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) |
2378
+ | Landing policy | `landing.decided` (candidate, matched rule/default, labels, target, mode); `landing.native-enable-started`; `landing.native-applied` |
2061
2379
  | Spec | `spec.imported`, `spec.authored`, `spec.revised` (optionally carrying `assets`, a re-pin of the ticket's assets, §6.3) |
2062
2380
  | Sessions | `session.started`; `session.ended` with transcript ref and usage (ordinary completion — the analysis corpus), or `session.ended {outcome: reclaimed, reclaimedBy: {instance, resumedFromSeq}}` (explicit transcriptless takeover) |
2063
2381
  | Plan/code loops | `plan.started` … `plan-review.verdict`; `implement.started` … `code-review.verdict` |
2064
- | Verify/finalize | `verify.started {step, attempt, feedback?}`, `verify.completed {step, outcome, skipCause?}`, `verify.reconcile-policy-captured {reconcileSeq, steps}`, `finalize.completed {pr}`, `finalize.step-started {step}`, `finalize.step-completed {step, ok, headSha?}` |
2382
+ | 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?}` |
2065
2383
  | 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) |
2066
2384
  | PR attachments | `pr-attachment.designated`, `pr-attachment.hosted`, `pr-attachment.reclaimed`, `pr-attachment.reclaim-failed` |
2067
- | Post-PR [D1] | `pr.merged`, `pr.conflicted`, `reconcile.progress-checked`, `reconcile.started`, `reconcile.completed` |
2385
+ | Leaf restacking | `target.moved {branch, sha}`, `restack.prepared`, `restack.replayed`, `restack.publish-intended`, `restack.rewritten`, `restack.contended`, `restack.completed` |
2386
+ | Post-PR [D1] | `pr.merged`, `pr.conflicted`, `reconcile.progress-checked`, `reconcile.started`, `reconcile.prepared`, `reconcile.replayed`, `reconcile.publish-intended`, `reconcile.rewritten`, `reconcile.contended`, `reconcile.completed` |
2068
2387
  | Cross-cutting | `observation.recorded`, `escalation.raised`, `phase.failed` |
2069
2388
  | Repository journal | dispatcher setting facts; run lifecycle, effective config, tick/queue diagnostics, reload and runner outcomes; the `harvest.*` workflow, recovery, and ledger facts |
2070
2389
 
@@ -2081,7 +2400,7 @@ missing Forge capabilities or outages leave the remainder due on the next tick.
2081
2400
  One deliberate subtlety worth recording: `pr.conflicted.baseSha` is
2082
2401
  detection-time evidence, while `reconcile.progress-checked.baseSha` is the
2083
2402
  kernel's authoritative observation for deciding whether a completed attempt
2084
- made progress and `reconcile.started.baseSha` is the separately refreshed merge
2403
+ made progress and `reconcile.started.baseSha` is the separately refreshed replay
2085
2404
  target for the next attempt. Agent context uses only the started fact, so a
2086
2405
  reconcile never runs against a persisted or known-stale observation.
2087
2406
 
@@ -2108,7 +2427,30 @@ chain survives `policy.stallRounds` rounds.
2108
2427
 
2109
2428
  ### 15.5 Derived state (the reducer)
2110
2429
 
2111
- `status ∈ queued | running | paused | blocked | done | aborted`, plus
2430
+ A nonterminal integration with `node.opened` derives `collecting` (below paused
2431
+ and blocked in precedence); it requires no attached runner. Empty/holding changes
2432
+ comes from `node.compared`, independently of admission openness. Integration
2433
+ identity and target are immutable claim-time facts in `build.created`;
2434
+ historical absence means work/root. The resolved `baseBranch` stays frozen.
2435
+
2436
+ `node.opening {branch, parent, sha}` is the dispatcher's durable mutation intent.
2437
+ `node.opened {sha}` acknowledges creation or adoption without resetting advanced
2438
+ history. `node.compared {parentSha, headSha, ahead}` retains a changed observation;
2439
+ only positive ahead counts permit creating a PR. `pr.opened {pr}` records its
2440
+ identity without a fabricated finalize completion. All four facts are
2441
+ dispatcher-authored. Existing merged/closed PR, abort and completion facts close admission.
2442
+
2443
+ Node transaction state reduces `node.writer-reserved`, `node.item-prepared`,
2444
+ `node.item-conflicted`, `node.item-replayed`, `node.publish-intended`,
2445
+ `node.rewritten`, `node.writer-settled`, and `node.inventory` (§13.1 integration
2446
+ cascade). It retains the previous contribution boundary, latest parent
2447
+ observation, complete replay prefix, active source item and merge proofs.
2448
+ A rewrite receipt alone never promotes the boundary; only completed settlement
2449
+ does. CLI status exposes pending/active work, reachable build identities and
2450
+ node-owned foreign changes. A node stays `collecting` while its narrow reconcile
2451
+ runner is attached; it does not acquire a leaf pipeline.
2452
+
2453
+ `status ∈ queued | running | collecting | paused | blocked | done | aborted`, plus
2112
2454
  `{phase, round, openEscalations[], reviewRoundCeilings?, pr?, autoMerge,
2113
2455
  lastEvent}`. `blocked` ≡ an `escalation.raised` without a matching
2114
2456
  `escalation.answered`, matched by id. `reviewRoundCeilings` projects valid
@@ -2163,9 +2505,9 @@ finalize.started → pr-attachment.hosted{designationSeq,asset} → finalize.com
2163
2505
 
2164
2506
  **Interrupted dispatch:** if the log stops after `build.created`, a later
2165
2507
  ordinary dispatcher tick provisions the workspace, atomically imports the spec,
2166
- posts the ticket notice once, and launches the runner. Claim-time auto-merge
2167
- attribution retained by `build.created` is materialized as the ordinary
2168
- human-authored request before launch. A failed boundary appends `dispatch.failed
2508
+ posts the ticket notice once, and launches the runner. New claims do not
2509
+ materialize auto-merge-default attribution as a human request. Landing policy
2510
+ is recorded at readiness; consent is an explicit land command. A failed boundary appends `dispatch.failed
2169
2511
  {stage,attempt,error}` and stays queued for another tick until its budget is
2170
2512
  exhausted. Dispatch failures share a `[policy].maxDispatchAttempts` budget
2171
2513
  (default 3) across
@@ -2311,7 +2653,7 @@ wins harmlessly.
2311
2653
 
2312
2654
  Walking the happy path exposed a gap in the grammar: `finalize` creates the
2313
2655
  PR, but *something* must watch it to merge/close, release the workspace, and
2314
- emit `build.completed`. v2 makes it a deterministic **janitor duty of the
2656
+ emit `build.completed`. Autobuild makes it a deterministic **janitor duty of the
2315
2657
  dispatcher** (which already polls on cron): it checks open PRs for its
2316
2658
  builds, emits `pr.merged`/`pr.closed`/`pr.conflicted`, releases workspaces,
2317
2659
  and completes builds. Destructive discard, abort, and terminal-PR cleanup defer
@@ -2322,24 +2664,181 @@ correlated facts; a failed delete remains pending and retries on later ticks,
2322
2664
  including after the build is already done. A merged-PR fixup request is a *new
2323
2665
  ticket*, never a reopened build.
2324
2666
 
2325
- **Merge standard: one rule per direction, never rebase.**
2326
-
2327
- - **PR → main: squash merge.** Main stays linear, one commit per build —
2328
- which keeps reverts (one commit → one new ticket), release notes, and
2329
- history archaeology clean.
2330
- - **main → feature branch: merge commit.** A stale branch is refreshed by
2331
- merging base *into* it, resolving conflicts once against current main.
2332
- - **Rebase is banned**, for two reasons. Operationally: at this system's
2333
- merge velocity, a rebase re-resolves conflicts commit-by-commit against a
2334
- target that keeps moving — agents can be stuck in
2335
- rebase-conflict-after-rebase-conflict nearly indefinitely (observed in
2336
- practice). Structurally: rebase rewrites the branch and severs the SHAs
2337
- recorded in `implement.completed` events [D3]. Squash-at-merge is safe on
2338
- both counts.
2339
-
2340
- **Merge gates are never bypassed.** The operator's auto-merge command is
2341
- durable consent to merge, not a bypass. Whenever the base branch has any real
2342
- merge-blocking gate, consent is applied as GitHub-native auto-merge, so the
2667
+ **Merge standard: one change per build, replay at reconcile.**
2668
+
2669
+ - **Root-target leaf PR → configured root: squash merge.** One commit per
2670
+ leaf build keeps the root linear. Node-target children and nodes landing into
2671
+ local-git roots use guarded fast-forwards; GitHub root nodes use guarded PR
2672
+ rebase merge with fencing/audit provenance (§13.1), preserving contributions.
2673
+ - **Conflicted build → refreshed base: restack.** The kernel collapses the
2674
+ contribution relative to its effective diff base into one commit with the
2675
+ original head's exact tree, then replays that change onto the freshly captured
2676
+ `reconcile.started.baseSha`. The result has exactly one parent equal to that
2677
+ frozen SHA and one `Autobuild-Build: <slug>` identity trailer, including when
2678
+ the resolved change is empty. No reconcile creates a merge commit.
2679
+
2680
+ This reverses the original rebase ban [D1, D3]. Replaying many WIP commits caused
2681
+ repeated conflict loops; replaying one net change resolves the conflict once.
2682
+ Rewrites used to sever event-recorded SHAs; immutable archives and durable
2683
+ rewrite facts retain them. Ordinary per-WIP-commit rebase remains inappropriate.
2684
+ Existing historical merge reconciliations retain their original replay/display
2685
+ semantics and supply the promoted contribution base for a later restack. Resumed
2686
+ builds use current engine routing at newly reached replay and landing boundaries;
2687
+ there is no claim-version guarantee that in-flight builds finish under the old
2688
+ merge standard. Execution configuration remains pinned, while landing policy
2689
+ is live dispatcher configuration. Operators requiring old execution behavior
2690
+ should drain work before upgrading rather than run mixed-version writers.
2691
+
2692
+ Before branch replacement the kernel publishes Git tips named by retained
2693
+ history and rewrite facts, plus both heads and the temporary change, under immutable non-branch refs
2694
+ `refs/autobuild/archive/<slug>/<sha>`. Archives must be fetchable by exact ref;
2695
+ namespace or permission failures stop publication without a branch/tag fallback.
2696
+ Publication requests and loss records alone are not retained Git history: their
2697
+ unpublished objects may have died with a released sandbox. A separately published
2698
+ or reviewed tip remains an archive requirement even when an earlier request named
2699
+ that same SHA.
2700
+ The branch replacement uses an explicit expected-old-head guard. A lost lease
2701
+ fetches the observed contribution and prepares another correlated transaction on
2702
+ the same occurrence's frozen base, preserving external work; deleted, divergent,
2703
+ or ambiguous history requires operator resolution. It never changes the target
2704
+ because upstream advances during contention. Only a later conflict occurrence
2705
+ captures a new base. Replay occurs detached, leaving the named branch untouched
2706
+ until publication. Confirmed publication reattaches the matching workspace HEAD
2707
+ to the build branch so a later verify → implement cycle can publish normally.
2708
+ Missing third-party forge capabilities refuse actionably.
2709
+
2710
+ Automatic leaf transactions use `restack.*`, independently of reconcile attempt
2711
+ numbers. Preparation freezes the trigger, verify-cycle boundary, absorbed target
2712
+ observation, old base/head, target base, single-change commit, workspace/local
2713
+ branch tips and canonical message. Publication intent precedes guarded replacement;
2714
+ `restack.rewritten` retains archives and proven writes even if readback observes a
2715
+ later writer. Completion requires confirmed publication. Clean transactions start
2716
+ no agent and do not fabricate `reconcile.completed`. A conflicted replay is adopted
2717
+ by `reconcile.started {restackId}` without another collapse or target selection.
2718
+ Resolver completion links back to the automatic transaction. Retained commit bytes
2719
+ and replay object packs recover disposable-workspace objects before publication.
2720
+
2721
+ `reconcile.prepared` records transaction identity, attempt, branch, old head,
2722
+ effective old base, target base and temporary single-change SHA before checkout.
2723
+ Before that fact is appended, the exact temporary commit bytes are deposited as a
2724
+ SHA-keyed BuildStore artifact. A replacement sandbox restores and verifies the
2725
+ same object from those bytes, retaining the original transaction and frozen base
2726
+ without requiring prepare-time remote write credentials. Retained trees and
2727
+ parents supply the rest of its object graph; trusted publication still archives
2728
+ the temporary commit before replacing the branch.
2729
+ `reconcile.replayed` records whether replay conflicted. Notes and the resolved
2730
+ head are deposited with `reconcile.publish-intended` before publication.
2731
+ `ab done` records a publication request; local kernels wait for the resolver
2732
+ session to end and remote kernels wait for guest teardown before replacement;
2733
+ `reconcile.rewritten` records old/new heads, old/new change SHAs, frozen base,
2734
+ conflict outcome and archive refs after confirmed publication. A successful CAS
2735
+ that is overtaken before readback still records its receipt, with `observedHead`
2736
+ naming the later head (or null for deletion). That observed head informs recovery;
2737
+ it does not complete reconcile or promote the verification base. Intent recovery
2738
+ can recognize an overtaken candidate newly introduced into the observed branch
2739
+ history, while a candidate already present in the expected old history is not
2740
+ evidence of a new write. New completion is
2741
+ `{headSha, rewriteId, artifact}`; historical `{mergeCommit, artifact}` remains
2742
+ valid. Remote requests carry identical transaction inputs and use the provider's
2743
+ trusted rewrite/archive capability only after execution teardown. Contention is
2744
+ recorded durably and uses the existing runner-failure bound, without spending
2745
+ unchanged-base no-progress budget before completion.
2746
+
2747
+ **Stable landed identity.** A root-target leaf kernel landing remains one squash commit and
2748
+ preserves the forge's existing message except for normalizing terminal build
2749
+ identity trailers to exactly one final `Autobuild-Build: <immutable slug>`.
2750
+ Implementation commits and deposited PR descriptions are unchanged. The janitor
2751
+ records `pr.merged { sha, buildTrailerPresent? }` from the actual landed message,
2752
+ including human landings. True and false are successful observations; historical
2753
+ logs, unsupported inspection, and transient read failures leave evidence absent.
2754
+ A failed inspection records an actionable observation and never blocks merge
2755
+ completion. This evidence does not change reduction or display semantics.
2756
+
2757
+ A node-target child landing instead fast-forwards its already canonical
2758
+ single-change commit, preserving exactly one terminal source-build identity.
2759
+ The guarded destination write is authoritative: its pushed SHA and identity
2760
+ produce the durable landing receipt independently of forge PR state. PR
2761
+ acknowledgement is best-effort: observe a provider-reported merge, or comment
2762
+ with the landed SHA and close a still-open review. Acknowledgement failure never
2763
+ retries or fails the landing.
2764
+
2765
+ GitHub uses its authoritative viewer squash headline and body with an expected
2766
+ head guard. Native auto-merge messages are checked against fresh server defaults
2767
+ on eligible polls even after consent acknowledgement, and repaired through
2768
+ consent-guarded disable/enable. Repeated polling covers later head or metadata
2769
+ changes; it cannot make a future push atomic with an already armed native merge.
2770
+ Merge queues ignore message overrides, so identity-aware kernel landing defers
2771
+ with `unproven-gate-state` rather than bypassing the queue. Human merges remain
2772
+ observable regardless of trailer evidence.
2773
+
2774
+ Ordered `[[landing]]` rules in `autobuild.toml` decide authorization. Each rule
2775
+ requires `mode = "auto" | "consent"` and may match `into = "root" | "node" |
2776
+ <node-ticket-id>`, `from = "leaf" | "node"`, and an exact, case-sensitive
2777
+ `label`. Predicates are ANDed; the first matching rule wins. Omitted predicates
2778
+ match anything. With no match, leaves use auto and nodes require consent.
2779
+ The target is the immutable destination frozen at claim, not a ticket's current
2780
+ parent. Labels are sampled from a successful source-ticket read at readiness;
2781
+ unavailable ticket data defers the decision instead of supplying empty labels.
2782
+
2783
+ A leaf becomes ready after verification and finalize on a current base; a node
2784
+ must be complete and verified at its exact head and parent. `landing.decided`
2785
+ records that candidate, the sampled labels, resulting mode, and the full matched
2786
+ rule and index (or explicit default). Editing configuration cannot change this
2787
+ recorded decision. A replacement candidate gets a new decision once ready.
2788
+ Policy is live dispatcher configuration, outside the pinned execution pipeline.
2789
+
2790
+ `ab hold <slug>` durably suppresses landing and revokes previous consent, even
2791
+ before readiness. `ab land <slug>` requires readiness, clears hold, and consents
2792
+ to this build/node landing into its frozen destination. Consent survives head
2793
+ replacement, restacking, verification and re-finalization until another hold or
2794
+ completion. It is consent to the landing, not approval of an immutable diff.
2795
+ Commands and acknowledgements are sequence-correlated; hold acknowledgement
2796
+ requires confirmed native cancellation, while land acknowledgement accepts
2797
+ consent without claiming that merge gates passed. The same actions are available
2798
+ through the MCP/operator build-control tools. The terminal uses `l` for land and
2799
+ `o` for hold on the selected landing. The web has no consent controls.
2800
+
2801
+ The repository auto-merge default and its fan-out are retired. Historical events
2802
+ still replay; explicit old per-build commands map to consent/hold until a new
2803
+ landing command supersedes them, while old default seeds confer no consent.
2804
+ `ab upgrade` samples the target repository's configured journal and writes leaf
2805
+ auto for old ON, leaf consent for old OFF (including no fact), and node consent
2806
+ in either case. Explicit landing arrays remain byte-for-byte unchanged. Missing
2807
+ configuration or unavailable journals fail with recovery guidance. Fresh init
2808
+ uses the no-rules fallback.
2809
+
2810
+ A native-enable failure after the provider's mutation guard requires confirmed
2811
+ cancellation. Its disabled receipt records the candidate, authorization, retry
2812
+ attempt and next eligible time. Retries back off from 30 seconds exponentially
2813
+ to a five-minute maximum interval, surviving dispatcher restarts. A new
2814
+ candidate or land command resets this delay; hold and cancellation never wait
2815
+ for it. Quiet polls append no attempt facts. Native application receipts are
2816
+ bookkeeping, not pipeline execution progress.
2817
+
2818
+ Native auto-merge is reconciled on every janitor poll against durable desired
2819
+ landing state using the native state in the existing PR read, without additional
2820
+ forge reads. A native write is issued only when observed and desired state disagree. It is disabled while held, unauthorized, unready, or replacement
2821
+ publication is pending or just completed; enabling binds to the current head
2822
+ through the forge's expected-head guard. Every replacement publication confirms
2823
+ cancellation first, and its first following poll re-reads and reconciles native
2824
+ state before other build actions. Native receipts bind to exact candidates;
2825
+ consent does not. A stale enable completing after cancellation is repaired by
2826
+ poll reconciliation. This is an explicitly bounded failure model: native merge
2827
+ is used only behind a merge-blocking gate, and checks on a replacement head must
2828
+ take far longer than one poll interval, allowing cancellation before they pass.
2829
+ There is no durable native-effect reservation protocol. An undesired forge
2830
+ landing is classified from the kernel's last durable native application state, without changing provider contracts. A confirmed disabled
2831
+ state with no enable in flight or indeterminate means a deliberate human forge
2832
+ landing, which supplies consent. Record whether it overrode a hold: an unheld
2833
+ human landing needs no operator attention; overriding a hold is informational.
2834
+ If native auto-merge was armed, or an enable was in flight or indeterminate,
2835
+ record a possible stale-enable landing as contrary to policy and raise operator
2836
+ attention. Autobuild never rewrites the target to undo either outcome. Merge
2837
+ gates and the serialized node-writer publication rules remain authoritative.
2838
+
2839
+ **Merge gates are never bypassed.** Landing authorization comes from recorded
2840
+ policy or explicit consent. For root-target leaves, whenever the base branch has
2841
+ any real merge-blocking gate, authorization is applied as GitHub-native auto-merge, so the
2343
2842
  forge's own checks decide when the PR lands. Only when the forge
2344
2843
  authoritatively reports no gate may the janitor perform a normal,
2345
2844
  head-guarded squash itself — never admin, force, or rebase — and only after
@@ -2354,6 +2853,16 @@ when the classic protection response is incomplete, while an incomplete classic
2354
2853
  response with no proven ruleset gate still fails closed with a reason naming
2355
2854
  the missing subsection.
2356
2855
 
2856
+ Serialized node-target landing has a stricter path: native auto-merge is
2857
+ cancelled and cancellation confirmed, never enabled. Under the destination
2858
+ writer reservation, refresh the PR's actual base and head and inspect gates on
2859
+ that exact frozen destination immediately before mutation. Only proved-ungated
2860
+ branches permit the guarded fast-forward, regardless of token bypass privileges.
2861
+ Gated branches defer with `gated-node-destination`; unknown or unreadable policy
2862
+ defers with `unproven-gate-state`. Both leave the PR open with actionable human
2863
+ guidance, and every later attempt obtains fresh proof. No native fallback can
2864
+ participate in node serialization. Human node landing remains observable.
2865
+
2357
2866
  Inability to prove or apply auto-merge is nonfatal pipeline plumbing, not a PR
2358
2867
  creation failure: finalize still records the open PR and completes, and consent
2359
2868
  stays pending for later janitor polls, which re-examine it. Deferrals divide by
@@ -2367,8 +2876,9 @@ one follow-up while the PR is open, and a later `reconcile.completed` or
2367
2876
  `finalize.completed` supersedes it — the projection shows nothing until the
2368
2877
  gate re-examines consent and records a fresh one. A repository
2369
2878
  with native auto-merge disabled is left open for a human; Autobuild never
2370
- changes the setting. The local-git forge has no external gate or native
2371
- setting: consent produces the same inspected-head guarded squash candidate,
2879
+ changes the setting. For root-target leaves, the local-git forge has no external
2880
+ gate or native setting: authorization produces the same inspected-head guarded
2881
+ squash candidate,
2372
2882
  mergeability is recomputed against the current local base, and the exact
2373
2883
  `pr-description` becomes the single-parent squash commit message. Its author and
2374
2884
  committer are Git's ordinary resolved repository identity, exactly as for a plain
@@ -2386,7 +2896,7 @@ base ref. A poll after a crash retries that same old-to-landed transition withou
2386
2896
  rolling back the ref or overwriting operator work; the PR remains open and
2387
2897
  retryable until checkout repair succeeds. No merge is ever assumed: a build
2388
2898
  reaches `merged` only when a later poll observes the landing and any required
2389
- checkout synchronization. Without consent, the local branch and PR record
2899
+ checkout synchronization. Without authorization, the local branch and PR record
2390
2900
  remain open for inspection with ordinary Git.
2391
2901
 
2392
2902
  **Conflicts re-enter the pipeline via `reconcile`.** When the janitor's
@@ -2395,9 +2905,9 @@ build-runner (the dispatcher itself never runs agents). Immediately before
2395
2905
  each attempt, the runner asks the Forge for its current authoritative base
2396
2906
  snapshot when supported, otherwise fetching the build's frozen base branch
2397
2907
  fresh from `origin`, and records the resolved SHA on `reconcile.started` — known-stale input is never
2398
- used (§15.3). The agent merges that base into the branch guided by the spec,
2399
- plan, and implement-notes, with the explicit charge to regress against
2400
- neither; the resolution lands as a merge commit, and because reconciliation
2908
+ used (§15.3). The kernel prepares one replay on that frozen base. The agent
2909
+ resolves it guided by the spec, plan, and implement-notes, with the explicit
2910
+ charge to regress against neither side; the result is one commit, and because reconciliation
2401
2911
  changed code, **`verify:*` starts a fresh cycle**, subject to the captured
2402
2912
  post-reconcile policy (default: re-run all applicable steps). A resolution the agent judges
2403
2913
  risky — semantic conflicts, spec-relevant choices — escalates rather than
@@ -2470,6 +2980,18 @@ The dispatcher emits an actionable operator notice without repeating it for the
2470
2980
  same failure. Restoring a valid `autobuild.toml` clears the rejection and
2471
2981
  ordinary boundary reload resumes.
2472
2982
 
2983
+ Landing policy is an ordered `[[landing]]` array. Each rule requires
2984
+ `mode = "auto" | "consent"` and may match `into = "root" | "node" | <node-ticket-id>`,
2985
+ `from = "leaf" | "node"`, and an exact, case-sensitive `label`. Predicates
2986
+ within a rule are ANDed; omitted predicates are wildcards; first match wins.
2987
+ The destination is the frozen target identity, and labels are sampled when
2988
+ readiness is recorded. No matching rule, including no rules, means leaf auto /
2989
+ node consent. Policy is hot dispatcher-owned configuration, not pinned build
2990
+ execution settings; each ready candidate retains its immutable `landing.decided`
2991
+ rule snapshot and mode after config edits. Historical `build.auto-merge-requested`
2992
+ and default-attribution fields remain replay-compatible but are not new controls.
2993
+
2994
+
2473
2995
  ```toml
2474
2996
  baseBranch = "main"
2475
2997
  capacity = 3 # concurrent builds for this repo
@@ -2582,7 +3104,7 @@ decide where a build's effective configuration is composed from:
2582
3104
  |---|---|---|
2583
3105
  | 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). |
2584
3106
  | 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. |
2585
- | Dispatcher-owned | `baseBranch`, `capacity`, `ticketScanIntervalSeconds`, `forge`, `plugins`, `pr`, `tickets`, `orchestrator` | The dispatcher's live snapshot; the build runner never interprets them. |
3107
+ | Dispatcher-owned | `baseBranch`, `capacity`, `ticketScanIntervalSeconds`, `forge`, `plugins`, `pr`, `tickets`, `orchestrator`, `landing` | The dispatcher's live snapshot; the build runner never interprets them. |
2586
3108
 
2587
3109
  A build's pipeline definition is therefore composed from the build's own
2588
3110
  branch: in origin mode the dispatcher reads `autobuild.toml` at the build's
@@ -2808,7 +3330,7 @@ discovery conflicts retain their nonzero contract. Local customization survives
2808
3330
  upgrades; divergence is visible instead of silent. No other command checks for
2809
3331
  or installs releases in the foreground or background.
2810
3332
 
2811
- ## 17. Out of scope for v2.0 (explicitly)
3333
+ ## 17. Out of scope (explicitly)
2812
3334
 
2813
3335
  - True push `subscribe` (interface reserved; polling implementation).
2814
3336
  - Live transcript streaming for writers and readers (the stream primitive —
@@ -2823,9 +3345,11 @@ or installs releases in the foreground or background.
2823
3345
  1. **[OPEN] Other-ingester detail** — observation harvest is decided (§8.8,
2824
3346
  §12); per-source filter design for scheduled `ingest:*` sources remains
2825
3347
  open.
2826
- 2. **[OPEN] Retention/archival policy** — the v1 archival gap, now a store
3348
+ 2. **[OPEN] Retention/archival policy** — the pilot's archival gap, now a store
2827
3349
  config concern rather than a repo problem. Needs a default (e.g. prune
2828
- blobs for merged builds after N months, keep events).
3350
+ blobs for merged builds after N months, keep events). Immutable reconcile
3351
+ archive refs are retained indefinitely for now; their retention policy is
3352
+ part of this open thread.
2829
3353
  3. **[OPEN] Global capacity** — per-repo capacity is the top-level `capacity`
2830
3354
  scalar (§16.1); whether a cross-repo global cap is needed, and where it
2831
3355
  lives, is unresolved.
@@ -2848,13 +3372,13 @@ revisions rather than ignoring them.
2848
3372
 
2849
3373
  `ab ticket edit <id>` opens `$VISUAL`, falling back to `$EDITOR`, using TOML
2850
3374
  frontmatter and a Markdown body. Only title, body and labels are editable;
2851
- id, blockers, creation key and reference comments are read-only. It saves only
3375
+ kind, target, id, blockers, creation key and reference comments are read-only. It saves only
2852
3376
  changed fields with the opening revision. Unchanged or formatting-only edits
2853
3377
  write nothing. On conflict, invalid input or editor failure, the error names an
2854
3378
  absolute file path containing the edited text. Read the current ticket and
2855
3379
  reapply the intended changes before retrying; conflicts are never merged.
2856
3380
 
2857
- File and Linear revisions fingerprint title, body, canonical label/blocker sets
3381
+ File and Linear revisions fingerprint kind, target, title, body, canonical label/blocker sets
2858
3382
  and state; reverting identical content restores its fingerprint. File checks
2859
3383
  re-read immediately before writing, with the existing no-lock race window.
2860
3384
  Direct file edits and state-directory moves change revisions. File revisions also
@@ -2903,3 +3427,35 @@ State normalization and the complete operator procedure are documented in
2903
3427
  [Ticket migration](docs/ticket-migration.md). The same reference is delivered in
2904
3428
  the installed guide. Export keeps lifecycle membership without inferring roles;
2905
3429
  import reuses unique case-insensitive states and creates normalized missing ones.
3430
+
3431
+
3432
+ ### Tree and consent operator reads
3433
+
3434
+ The shared dashboard projection supplies root, node, target, integration build,
3435
+ landing, restack and consent vocabulary. The terminal groups ready decisions in
3436
+ one consent queue, retaining build-slug selection for land/hold controls. Nodes
3437
+ show stored open children/completeness diagnostics, restack state, current-cycle
3438
+ verification and landing readiness. Ordinary repositories omit empty tree sections.
3439
+ The web dashboard consumes shared terminology without introducing a tree surface.
3440
+
3441
+ `ab landings [--json] [--store <ref>]` and registry `landings.list` expose the
3442
+ same deterministic, repository-scoped ready consent/held candidates. A recorded
3443
+ current decision is required; auto-authorized and consented candidates are absent.
3444
+ Source `ab ticket tree` / `tickets.tree` enumerate all ticket states with listing
3445
+ diagnostics; effective build targets remain frozen independently of source metadata.
3446
+
3447
+ Default watch attention includes `integration.landed`, `node.item-conflicted`,
3448
+ and conflicted `restack.replayed`. Derived `build.consent-ready` observations
3449
+ carry target, branch, candidate and the durable readiness entry position in the
3450
+ existing cursor envelope. Cursor identities retain readiness episodes across
3451
+ restart; a new candidate or exit/re-entry can wake again. Explicit event globs
3452
+ remain event-only. Wait adds `consent`, `node-landed`, `restack-conflicted`, and
3453
+ includes these in attention; current-state waits return immediately, backlog
3454
+ replay retains event ordering, including landing before terminal completion.
3455
+
3456
+ Consent/hold readiness is signalled exclusively by `build.consent-ready`,
3457
+ including first discovery in a repository-wide watch. `build.merge-decision`
3458
+ reports current gate deferrals or unsafe forge outcomes, never a second consent
3459
+ or hold wake. Readiness observations and queue entries share the effective
3460
+ target shape `{kind, branch, ticket?, build?}`. Tree display labels are owned
3461
+ by the shared projection vocabulary and reused by terminal and CLI text.