@defrex/autobuild 1.4.1 → 1.5.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 (201) hide show
  1. package/README.md +1 -1
  2. package/SPEC.md +440 -95
  3. package/bin/ab-dispatch-kernel.ts +1 -0
  4. package/docs/accounts.md +9 -0
  5. package/docs/agent-runtimes.md +1 -0
  6. package/docs/answering-blocked-builds.md +2 -1
  7. package/docs/architecture.md +290 -130
  8. package/docs/assets/headline-wide.png +0 -0
  9. package/docs/build-store.md +33 -3
  10. package/docs/cli.md +2 -1
  11. package/docs/configuration-overview.md +9 -0
  12. package/docs/configuration.md +166 -101
  13. package/docs/dispatcher-hosting.md +19 -3
  14. package/docs/dispatcher.md +9 -4
  15. package/docs/integration-overview.md +2 -2
  16. package/docs/integration-tree.md +91 -28
  17. package/docs/merge-policy.md +28 -9
  18. package/docs/operator-api.md +43 -18
  19. package/docs/operator-surfaces.md +1 -1
  20. package/docs/plugin-authoring.md +85 -8
  21. package/docs/remote-store-protocol.md +25 -7
  22. package/docs/remote-ticket-protocol.md +126 -12
  23. package/docs/restacking.md +20 -6
  24. package/docs/seams.md +2 -2
  25. package/docs/setup.md +19 -13
  26. package/docs/spec-standard.md +2 -1
  27. package/docs/ticket-dependencies.md +26 -8
  28. package/docs/ticket-migration.md +70 -7
  29. package/docs/ticket-sources.md +82 -5
  30. package/docs/tickets.md +34 -2
  31. package/docs/troubleshooting.md +2 -2
  32. package/docs/verification.md +5 -5
  33. package/docs/website.md +8 -0
  34. package/docs/workspaces.md +1 -1
  35. package/package.json +5 -4
  36. package/packages/core/src/accounts/hosted-readiness.ts +21 -0
  37. package/packages/core/src/cli/attention.ts +1 -0
  38. package/packages/core/src/cli/build-control.ts +36 -12
  39. package/packages/core/src/cli/connect.ts +9 -18
  40. package/packages/core/src/cli/context.ts +44 -0
  41. package/packages/core/src/cli/dashboard/configuration.ts +11 -0
  42. package/packages/core/src/cli/dashboard/model.ts +40 -10
  43. package/packages/core/src/cli/dashboard/queue.ts +21 -0
  44. package/packages/core/src/cli/dashboard/render.ts +40 -22
  45. package/packages/core/src/cli/dispatch-frontend.ts +63 -30
  46. package/packages/core/src/cli/dispatch-mode.ts +35 -16
  47. package/packages/core/src/cli/dispatch-repository-feed.ts +40 -11
  48. package/packages/core/src/cli/dispatch.ts +154 -47
  49. package/packages/core/src/cli/help.ts +59 -22
  50. package/packages/core/src/cli/init-hosted-accounts.ts +54 -0
  51. package/packages/core/src/cli/init-readiness-remote.ts +16 -3
  52. package/packages/core/src/cli/init-validation.ts +144 -42
  53. package/packages/core/src/cli/issue-links.ts +67 -0
  54. package/packages/core/src/cli/main.ts +32 -15
  55. package/packages/core/src/cli/pr-summary-publication.ts +38 -7
  56. package/packages/core/src/cli/publication-settlement.ts +36 -24
  57. package/packages/core/src/cli/repository-status.ts +201 -49
  58. package/packages/core/src/cli/status.ts +41 -3
  59. package/packages/core/src/cli/terminals.ts +37 -2
  60. package/packages/core/src/cli/ticket-editor.ts +20 -6
  61. package/packages/core/src/cli/ticket.ts +264 -46
  62. package/packages/core/src/cli/triage-count-sampler.ts +59 -0
  63. package/packages/core/src/cli/watch.ts +4 -0
  64. package/packages/core/src/config/live.ts +45 -4
  65. package/packages/core/src/config/load.ts +9 -0
  66. package/packages/core/src/config/pipeline-source.ts +6 -2
  67. package/packages/core/src/config/ready-assignee.ts +86 -0
  68. package/packages/core/src/config/schema.ts +164 -36
  69. package/packages/core/src/distribution-packaging.ts +1 -1
  70. package/packages/core/src/events/catalog.ts +5 -0
  71. package/packages/core/src/events/compatibility.ts +2 -1
  72. package/packages/core/src/events/payloads.ts +70 -0
  73. package/packages/core/src/events/policy.ts +8 -0
  74. package/packages/core/src/events/repository.ts +91 -28
  75. package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +41 -0
  76. package/packages/core/src/kernel/build-identity.ts +12 -0
  77. package/packages/core/src/kernel/change-presence.ts +139 -6
  78. package/packages/core/src/kernel/dispatch-capacity.ts +80 -14
  79. package/packages/core/src/kernel/dispatch-status.ts +10 -1
  80. package/packages/core/src/kernel/dispatch-upgrade.ts +104 -5
  81. package/packages/core/src/kernel/engine.ts +4 -2
  82. package/packages/core/src/kernel/finalize-pr-rejection.ts +95 -0
  83. package/packages/core/src/kernel/generators/repository-journals.ts +15 -1
  84. package/packages/core/src/kernel/harvest.ts +4 -1
  85. package/packages/core/src/kernel/integration-completeness.ts +104 -17
  86. package/packages/core/src/kernel/integration-landing.ts +17 -0
  87. package/packages/core/src/kernel/integration-state.ts +17 -0
  88. package/packages/core/src/kernel/issue-keywords.ts +202 -0
  89. package/packages/core/src/kernel/janitor-failure.ts +11 -0
  90. package/packages/core/src/kernel/kernel-git.ts +87 -0
  91. package/packages/core/src/kernel/landing-readiness.ts +25 -17
  92. package/packages/core/src/kernel/log-index.ts +1 -1
  93. package/packages/core/src/kernel/node-issue-links.ts +142 -0
  94. package/packages/core/src/kernel/node-parent.ts +6 -0
  95. package/packages/core/src/kernel/node-restack-transaction.ts +2 -0
  96. package/packages/core/src/kernel/pr-summary.ts +24 -0
  97. package/packages/core/src/kernel/read-deferrals.ts +75 -12
  98. package/packages/core/src/kernel/read-facts.ts +32 -1
  99. package/packages/core/src/kernel/reconcile-restack.ts +1 -1
  100. package/packages/core/src/kernel/reducer-registry.ts +31 -1
  101. package/packages/core/src/kernel/reducer.ts +90 -2
  102. package/packages/core/src/kernel/ticket-preparation.ts +12 -0
  103. package/packages/core/src/kernel/verify-budget.ts +43 -0
  104. package/packages/core/src/operator/index.ts +3 -1
  105. package/packages/core/src/operator/presentation.ts +3 -0
  106. package/packages/core/src/operator/protocol.ts +38 -2
  107. package/packages/core/src/operator/query.ts +66 -29
  108. package/packages/core/src/operator/registry.ts +47 -26
  109. package/packages/core/src/operator/tickets.ts +77 -10
  110. package/packages/core/src/plugin-sdk/index.ts +13 -0
  111. package/packages/core/src/plugins/manifest.ts +1 -1
  112. package/packages/core/src/plugins/registry.ts +1 -0
  113. package/packages/core/src/ports/forge/contract.ts +69 -0
  114. package/packages/core/src/ports/forge/create.ts +5 -0
  115. package/packages/core/src/ports/forge/fake.ts +184 -3
  116. package/packages/core/src/ports/forge/git-rewrite.ts +4 -2
  117. package/packages/core/src/ports/forge/github.ts +175 -38
  118. package/packages/core/src/ports/forge/local-git.ts +14 -0
  119. package/packages/core/src/ports/forge/readiness.ts +10 -0
  120. package/packages/core/src/ports/forge-failure.ts +43 -0
  121. package/packages/core/src/ports/runner/claude.ts +7 -1
  122. package/packages/core/src/ports/runner/codex.ts +7 -2
  123. package/packages/core/src/ports/runner/native-cli-fixture.ts +2 -1
  124. package/packages/core/src/ports/runner/pi.ts +7 -1
  125. package/packages/core/src/ports/runner/runtime.ts +3 -0
  126. package/packages/core/src/ports/runner/start-prompt.ts +37 -0
  127. package/packages/core/src/ports/tickets/contract.ts +320 -7
  128. package/packages/core/src/ports/tickets/create.ts +72 -17
  129. package/packages/core/src/ports/tickets/fake.ts +18 -0
  130. package/packages/core/src/ports/tickets/file-codec.ts +20 -0
  131. package/packages/core/src/ports/tickets/file.ts +43 -1
  132. package/packages/core/src/ports/tickets/github-fake.ts +1123 -0
  133. package/packages/core/src/ports/tickets/github-issues.ts +431 -0
  134. package/packages/core/src/ports/tickets/github-validators.ts +194 -0
  135. package/packages/core/src/ports/tickets/github.ts +2029 -0
  136. package/packages/core/src/ports/tickets/hosted-index.ts +34 -3
  137. package/packages/core/src/ports/tickets/issue-links.ts +86 -0
  138. package/packages/core/src/ports/tickets/lifecycle.ts +60 -4
  139. package/packages/core/src/ports/tickets/linear.ts +66 -6
  140. package/packages/core/src/ports/tickets/migration.ts +290 -68
  141. package/packages/core/src/ports/tickets/operations.ts +98 -12
  142. package/packages/core/src/ports/tickets/priority.ts +55 -0
  143. package/packages/core/src/ports/tickets/remote-protocol.ts +195 -29
  144. package/packages/core/src/ports/tickets/remote.ts +188 -13
  145. package/packages/core/src/ports/tickets/revision.ts +22 -1
  146. package/packages/core/src/ports/tickets/states.ts +43 -0
  147. package/packages/core/src/ports/tickets/tree.ts +58 -12
  148. package/packages/core/src/ports/tickets/update.ts +12 -2
  149. package/packages/core/src/ports/types.ts +194 -11
  150. package/packages/core/src/ports/workspace/commit-preservation.ts +135 -13
  151. package/packages/core/src/ports/workspace/git-worktree.ts +3 -1
  152. package/packages/core/src/ports/workspace/vercel-sandbox.ts +132 -27
  153. package/packages/core/src/processes/build-runner.ts +99 -21
  154. package/packages/core/src/processes/dispatcher.ts +1080 -533
  155. package/packages/core/src/processes/execution-no-progress.ts +5 -0
  156. package/packages/core/src/processes/harvest-runner.ts +17 -8
  157. package/packages/core/src/processes/harvest.ts +5 -8
  158. package/packages/core/src/processes/tick-publication.ts +12 -2
  159. package/packages/core/src/processes/ticket-scan-schedule.ts +78 -0
  160. package/packages/core/src/processes/workspace-preservation.ts +37 -2
  161. package/packages/core/src/runtime-identity.ts +10 -2
  162. package/packages/core/src/scenarios/harness.ts +4 -0
  163. package/packages/core/src/store/adapter.ts +7 -1
  164. package/packages/core/src/store/contract.ts +83 -2
  165. package/packages/core/src/store/digest.ts +32 -1
  166. package/packages/core/src/store/reducer-value-shapes.json +4187 -3391
  167. package/packages/core/src/store/remote/protocol.ts +2 -0
  168. package/packages/core/src/store/remote/released-clients.json +22 -0
  169. package/packages/core/src/store/remote/released-reducer-values/1.5.0.json +26924 -0
  170. package/packages/core/src/store/remote/released-reducer-values/index.ts +2 -0
  171. package/packages/core/src/store/repo-state-events.ts +2 -0
  172. package/packages/core/src/store/types.ts +5 -0
  173. package/packages/core/src/testing/dispatch-read-budget.ts +729 -123
  174. package/packages/core/src/testing/index.ts +18 -1
  175. package/packages/core/src/testing/presence-history.ts +79 -0
  176. package/packages/core/src/testing/reduced-read-budget.ts +1197 -31
  177. package/packages/core/src/testing/upgrade-generations.ts +77 -0
  178. package/skills/code-review/SKILL.md +4 -3
  179. package/skills/finalize/SKILL.md +18 -2
  180. package/skills/guide/SKILL.md +382 -139
  181. package/skills/guide/references/accounts.md +9 -0
  182. package/skills/guide/references/integration-tree.md +91 -28
  183. package/skills/guide/references/merge-policy.md +28 -9
  184. package/skills/guide/references/operator-api.md +43 -18
  185. package/skills/guide/references/plugin-authoring.md +85 -8
  186. package/skills/guide/references/remote-store-protocol.md +25 -7
  187. package/skills/guide/references/remote-ticket-protocol.md +126 -12
  188. package/skills/guide/references/restacking.md +20 -6
  189. package/skills/guide/references/setup.md +19 -13
  190. package/skills/guide/references/spec-standard.md +2 -1
  191. package/skills/guide/references/ticket-dependencies.md +26 -8
  192. package/skills/guide/references/ticket-migration.md +70 -7
  193. package/skills/harvest-review/SKILL.md +4 -3
  194. package/skills/implement/SKILL.md +20 -1
  195. package/skills/operate/SKILL.md +103 -28
  196. package/skills/plan/SKILL.md +1 -1
  197. package/skills/reconcile/SKILL.md +5 -4
  198. package/skills/spec/SKILL.md +15 -2
  199. package/skills/tickets/SKILL.md +114 -37
  200. package/templates/autobuild.toml +5 -0
  201. package/templates/hosted-service/package.json +2 -2
package/SPEC.md CHANGED
@@ -82,20 +82,21 @@ event log handling, state reducer. No I/O opinions — no ticket tracker, no
82
82
  telemetry vendor, no terminal.
83
83
 
84
84
  ### 3.2 Ports
85
- Ticket sources may optionally provide native `listPage(criteria, page)` windows with a matching total. Paged operator reads use it when present, otherwise slice the exhaustive listing; unpaged and dispatcher reads remain exhaustive.
86
-
87
85
 
88
86
  Interfaces to the world, each with swappable adapters:
89
87
 
90
88
  | Port | Duty | Initial adapters |
91
89
  |---|---|---|
92
- | `TicketSource` | list/claim/comment/transition/create/update tickets; add, remove, and resolve declared dependencies | file-based (default directory); Linear; third-party in-process registrations; later GitHub Issues |
90
+ | `TicketSource` | list/claim/comment/transition/create/update tickets; add, remove, and resolve declared dependencies | file-based (default directory); Linear; hosted; GitHub Issues; third-party in-process registrations |
93
91
  | `AgentRunner` | run agent sessions (see §9) | Claude Code CLI (headless); Codex CLI (`exec --json`); local pi CLI (`--mode rpc`, minimum 0.84.3); third-party in-process registrations |
94
92
  | `Workspace` | provision isolated working copies | git worktree; third-party in-process registrations; later remote sandbox |
95
93
  | `Forge` | git + PR plumbing | GitHub; local Git; third-party in-process registrations |
96
94
  | `TelemetrySource` | production signals | Sentry; later log streams |
97
95
  | `BuildStore` | per-build streams plus repository journals: events, artifacts, transcripts, leases (see §7) | local; remote HTTP |
98
96
 
97
+ Ticket sources may optionally provide native `listPage(criteria, page)` windows with a matching total. Paged operator reads use it when present, otherwise slice the exhaustive listing; unpaged and dispatcher reads remain exhaustive.
98
+ Integration-tree sources may optionally provide `listTargeting(nodeId)`, every ticket targeting one node in every state, equal to the exhaustive listing filtered by target. Integration observation uses it when present, otherwise `listAll`.
99
+
99
100
  #### 3.2.1 In-process adapter plugins
100
101
 
101
102
  A repository may list trusted Bun modules in `autobuild.toml`. Each module
@@ -219,7 +220,7 @@ surface remains the remote HTTP protocol rather than in-process registration.
219
220
 
220
221
  Small, independently runnable, crash-safe:
221
222
 
222
- Explicit human `ab dispatch --viewer` is a Store-only dashboard lifecycle,
223
+ Explicit human `ab dispatch --viewer` is a Store-backed dashboard lifecycle,
223
224
  available from a local checkout in TTY and plain/non-TTY modes. It bypasses the
224
225
  resident launcher, execution configuration/plugins, account admission and kernel
225
226
  wiring. It never takes or renews a repository lease, starts a child, writes
@@ -228,7 +229,9 @@ Canonical repository facts supply the observed dispatcher's status and effective
228
229
  configuration, independent of the viewer's operator correlation identity. With no
229
230
  configuration the display waits, polling bounded canonical state. Fresh viewers
230
231
  reuse saved server reductions; missing presentation caches never trigger event
231
- history reconstruction. Idle polls read zero event rows.
232
+ history reconstruction. Idle polls read zero event rows. Its one ticket-source
233
+ read is the header's triage count, sampled at most once per 60 s, outside
234
+ dispatcher ticks.
232
235
 
233
236
  Every frame reserves a row for `viewer`, optionally `viewer · dispatched by
234
237
  <label>` from explicit `--dispatched-by` input. Plain output states the mode at
@@ -240,9 +243,11 @@ and session inspection. No current control requires a local dispatcher. Viewer
240
243
  rejects startup intake flags and explicit `--repository`.
241
244
 
242
245
  A plain `ab dispatch` reads dispatch placement once before starting local execution.
243
- For a hosted project it opens the Store-only viewer automatically, displaying
246
+ For a hosted project it opens the viewer automatically, displaying
244
247
  `viewer · dispatched by <host>` from the placement origin (including a nondefault
245
248
  port). `--once`, `--plain`, and `--interval` retain their viewer meanings.
249
+ The viewer reads its dashboard from the Store; its one ticket-source read is
250
+ the header's triage count, through the source's optional `countStates`.
246
251
  `--takeover` explicitly dispatches locally, with a warning that it can displace
247
252
  the hosted dispatcher; it cannot be combined with `--viewer`. Startup intake
248
253
  flags require `--takeover` when placement selects viewer.
@@ -251,8 +256,11 @@ An unreadable placement fails closed with a typed error naming the cause:
251
256
  use `--viewer` to watch or `--takeover` to dispatch locally. Both explicit modes
252
257
  skip placement discovery. Older services without the capability and projects
253
258
  with unknown or nonhosted placement retain local dispatch behavior. Local stores
254
- need no placement request. Origin mode (`--repository` or `AB_REPOSITORY`) and
255
- hosted cron dispatch bypass this check. Placement is a startup snapshot, not a
259
+ need no placement request. Failing to resolve the checkout's store selection
260
+ (for example, a malformed `autobuild.toml`) is not a placement failure: default
261
+ startup reports it as a repository resolution error naming its cause, and
262
+ neither explicit mode bypasses it. Origin mode (`--repository` or
263
+ `AB_REPOSITORY`) and hosted cron dispatch bypass this check. Placement is a startup snapshot, not a
256
264
  liveness probe or a polling input. Operator agents' prohibition on running dispatch includes viewer.
257
265
 
258
266
  Resident checkout-backed `ab dispatch` starts a launcher and one dispatcher
@@ -471,7 +479,12 @@ files, including development configs, remain exactly as installed.
471
479
  automatic recovery with an `abandoned` resolution and diagnostic reason. The
472
480
  ticket is left unchanged; an operator can leave it finished or cancelled, or
473
481
  inspect ownership and explicitly return it to Ready for another attempt. These
474
- cases stop provider polling and diagnostic appends. Recovery failures are
482
+ cases stop provider polling and further durable diagnostic appends. The tick
483
+ that records the abandonment reports one dispatcher diagnostic naming the
484
+ ticket and attempt, whether the claim was confirmed or its provider outcome is
485
+ unknown, and the recorded reason. If that tick fails for any reason, its
486
+ failure error carries the diagnostics instead. Later ticks do not repeat it.
487
+ Recovery failures are
475
488
  reported without preventing janitor, lease sweep, or other dispatch recovery.
476
489
  This is not general process
477
490
  crash recovery. Confirmed Ready/Triage transitions settle idempotently, so a
@@ -503,6 +516,14 @@ by sequence. It contains scheduling metadata only, never counts or lifecycle
503
516
  state, and is distinct from reducer checkpoints. Missing or stale metadata
504
517
  falls back to the recorded fact and can cause one safe extra scan without
505
518
  reconstructing history. Successful unchanged scans advance this cache only.
519
+ While less than one interval has elapsed since the recorded fact's
520
+ measurement, with unchanged readiness and criteria fingerprints and no
521
+ admission following an observation measurement, a tick defers without reading
522
+ the cache, because the cache only acknowledges that measurement or a later one.
523
+ If the wall clock moved backwards, a cache entry dated later than the current
524
+ clock is therefore consulted only once that window ends, at most one scan
525
+ interval after the recorded measurement; the dispatcher then treats it as a
526
+ clock rollback, rescans, and resets the cache to the current clock.
506
527
 
507
528
 
508
529
  ### 3.4 The event log spine
@@ -727,18 +748,27 @@ the standard — moving failure to the cheapest point instead of launching a
727
748
  build that will thrash and escalate.
728
749
 
729
750
  **Build identity at dispatch:** once the final conforming spec is in hand,
730
- the selected runtime proposes a short kebab-case slug from its substance —
731
- judgment proposes; the dispatcher validates, deduplicates against the store,
732
- and falls back to a deterministic title-derived name on any absence, invalid
733
- output, error, or timeout. Naming failure never prevents build creation. The
734
- slug and its `ab/<slug>` branch are recorded once and never renamed.
751
+ the selected runtime may propose a short kebab-case slug from its substance.
752
+ Judgment proposes; the dispatcher validates the proposal under a hard
753
+ deadline. A missing capability, invalid output, error, or timeout falls back
754
+ to a deterministic title-derived name, so a failed proposal never prevents
755
+ build creation. The dispatcher then deduplicates the base with `-2`, `-3`, …
756
+ suffixes against the store and, when the forge can answer, against `ab/` or
757
+ `ab-node/` build branches already on the remote, so a build never takes a
758
+ branch another store owns. That check is not best effort: if a remote branch
759
+ lookup fails, or the base and its `-2` … `-100` candidates are all taken, the
760
+ claim fails at the naming stage, no build is created, and the ticket returns
761
+ to configured Ready under the dispatcher's preparation recovery contract
762
+ (§3.3). The slug and its `ab/<slug>` (or `ab-node/<slug>` for a node) branch
763
+ are recorded once and never renamed.
735
764
 
736
765
  **Immutability:** the spec cannot change during a build except through the
737
766
  explicit operator revision protocol (leaf escalation or the node exception below). Every downstream reviewer approves
738
767
  conformance *to it*; a drifting spec silently converts approvals into
739
768
  approvals-of-something-else. A phase discovering the spec itself is wrong
740
- raises an `escalation`; a human uses `ab answer --revise-spec` (or
741
- `--revise-spec-from-ticket`), the spec gets rev N+1, and the leaf restarts
769
+ raises an `escalation`; the operator agent or a human answers with
770
+ `ab answer --revise-spec` (or `--revise-spec-from-ticket`), the spec gets
771
+ rev N+1, and the leaf restarts
742
772
  from `plan` (cheap — downstream was invalidated anyway).
743
773
 
744
774
  If a leaf spec revision arrives during an unfinished reconcile, the same reconcile attempt resumes under the revised spec on its retained frozen target. Its replay and committed contribution remain owned by reconcile. Confirmed publication must settle before the fresh plan loop opens; prior approvals and verification remain invalidated.
@@ -917,7 +947,7 @@ ticket's other durable data and never expire on their own.
917
947
  Hosted ticket assets live in the ticket service's repository-keyed storage,
918
948
  regardless of where builds run or which BuildStore is selected. File tickets use
919
949
  native portable storage composed with legacy BuildStore attachments; Linear
920
- tickets retain BuildStore storage. Existing service assets need no migration;
950
+ and GitHub tickets retain BuildStore storage. Existing service assets need no migration;
921
951
  old local hosted-ticket attachments are not moved or used as a fallback.
922
952
 
923
953
  Each put creates a new increasing **revision**; earlier revisions stay retrievable.
@@ -1044,12 +1074,14 @@ Operator UIs additionally have a repository-scoped batch read,
1044
1074
  `getRepoBuildDigests(repo)`: the projection of every build's log onto its
1045
1075
  terminal fact, its `observation.recorded` occurrences with their event
1046
1076
  timestamps, and the ts of its latest `pr.merged`, derived from the event log on
1047
- each call. It lets a dashboard snapshot count unclaimed observations and gate
1048
- rows without reading the full history of finished builds (§16.1), and it backs
1049
- the harvest-launch pressure gate (dispatcher and harvest runner alike): launch
1077
+ each call. It lets a dashboard snapshot gate rows without reading the full
1078
+ history of finished builds (§16.1), and it backs the harvest-launch pressure gate (dispatcher and harvest runner alike): launch
1050
1079
  decisions evaluate from digests and the repository journal alone, so
1051
1080
  gate-evaluation cost is flat in accumulated build history, with the full
1052
1081
  per-build scan paid only when a gate actually trips and a scan packet is built.
1082
+ The digest also carries the build's node targets, every node its target or
1083
+ parent moves ever named, so the dispatcher finds a node's child builds from
1084
+ digests and reads full facts only for builds that name that node.
1053
1085
 
1054
1086
  Stateless repository-level readers also have a bounded journal read,
1055
1087
  `getRepoStateEvents(repo)` (AUT-489): every durable, slow-growing event type
@@ -1196,7 +1228,9 @@ The base-selection invariants make this safe with Git:
1196
1228
  resume). It validates that immutable base against HEAD and records it verbatim.
1197
1229
  A moving or rewritten destination never changes the review range, and review
1198
1230
  requires no target fetch or merge-base calculation. Missing provenance fails
1199
- before publication. Successful restacks establish the baseline for later loops
1231
+ before publication. A HEAD equal to the base is an empty contribution: `ab done`
1232
+ records an `implement` escalation naming the build and both SHAs as the
1233
+ session's terminal, instead of a completion or publication request. Successful restacks establish the baseline for later loops
1200
1234
  and collapses. Historical event ranges stay immutable; the current
1201
1235
  `implement.commits` projection advances to `targetBase..headSha`
1202
1236
  on successful leaf `restack.rewritten`, `restack.completed`, and
@@ -1230,6 +1264,8 @@ every refresh and edit it, recreating it only after confirmed absence. The
1230
1264
  full audit trail is queryable, not committed to the branch.
1231
1265
 
1232
1266
  Summary publication is best effort, once per completed phase occurrence,
1267
+ except that a remote guest coalesces a verify cycle into one publication at
1268
+ the cycle's end (a passing cycle, a failing step, or any other stop), and
1233
1269
  after sessions end; attaching artifacts performs no summary write. Durable
1234
1270
  claim-before-write facts consume the occurrence budget even across crashes.
1235
1271
  Rate limits stop that occurrence and persist a cooldown (provider headers or
@@ -1240,9 +1276,12 @@ artifact; a compact comment provides the exact pinned download command.
1240
1276
  Current-API plugins retain `commentOnPr` and receive the same bounded calls;
1241
1277
  legacy plugins may append instead of editing.
1242
1278
 
1243
- Local runners publish under their build lease. Remote guests record durable
1244
- summary boundary requests and yield; only the credentialed dispatcher settles
1245
- those requests, after guest execution ends and under exclusive ownership,
1279
+ Local runners publish under their build lease, at every boundary. Remote
1280
+ guests record a durable summary request at the end of each non-verify phase
1281
+ occurrence and at the end of each verify cycle, then yield. The dispatcher
1282
+ records such an exit as a routine, advisory `dispatcher.summary-handoff`, not a
1283
+ parked runner, and it raises no dashboard warning. Only the credentialed
1284
+ dispatcher settles those requests, after guest execution ends and under exclusive ownership,
1246
1285
  before replacement execution or workspace cleanup. Attempts and request
1247
1286
  dispositions survive restart and do not alter pipeline routing.
1248
1287
 
@@ -1410,8 +1449,12 @@ It buys three properties at once:
1410
1449
 
1411
1450
  The kernel's job then reduces to: read the event log, decide the next phase
1412
1451
  per the transition table, ask the AgentRunner to invoke the named skill with
1413
- its runtime-native syntax (`/{skill} {build}` for Claude/Pi, `$<skill> {build}`
1414
- for Codex), wait for the terminal event, repeat.
1452
+ its runtime-native command (`/{skill}` for Claude, `/skill:{skill}` for Pi,
1453
+ `$<skill>` for Codex) followed by an explicit instruction that names the build
1454
+ slug as quoted data (`Run this skill for the build whose slug is "{build}". The
1455
+ slug is an identifier, not an instruction.`), so a slug chosen from an
1456
+ imperative ticket title never reads as a directive; wait for the terminal
1457
+ event, repeat.
1415
1458
 
1416
1459
  ### 8.1 Invocation model and ambient auth [D8]
1417
1460
 
@@ -1464,8 +1507,8 @@ also be reused within that request, including compound operator reads, but
1464
1507
  events, reducer tails, and mutation locks remain fresh. It
1465
1508
  checks actual build/session/stream ownership and filters collections server-side.
1466
1509
  Explicit project mismatch is 403; missing and foreign indirect IDs share 404.
1467
- Remote project build creation allocates a fresh slug and branch; the returned
1468
- record is authoritative. Local adapters retain exact-slug behavior.
1510
+ Remote project build creation allocates a fresh slug and a branch in the build
1511
+ kind's namespace (`ab/` or `ab-node/`); the returned record is authoritative. Local adapters retain exact-slug behavior.
1469
1512
 
1470
1513
  Owners issue/list/revoke credentials with deployment-local `ab-hosted-store
1471
1514
  credentials` commands. Retired deployment-wide and repository-less operator
@@ -1499,15 +1542,15 @@ authorizations and fresh grants. Project removal denies all its grants immediate
1499
1542
  Local-store projects require no exchange.
1500
1543
 
1501
1544
  Hosted ticket operations are gated by grant kind: build-runner and build-phase
1502
- grants have no access; harvest-phase grants can only list-ready, get and read
1503
- dependency-states; harvest-runner grants can also create proposals. All other
1545
+ grants have no access; harvest-phase grants can only list-ready, list-targeting,
1546
+ get and read dependency-states; harvest-runner grants can also create proposals. All other
1504
1547
  ticket mutations require project or admin authority. Refusals name the grant
1505
1548
  kind and operation.
1506
1549
 
1507
1550
  Ticket admission uses the credential project. Hosted tickets, comments, blockers, creation-key
1508
1551
  deduplication and assets are partitioned by registered repository, never team.
1509
1552
  Lifecycle comes from independent project ticket policy (triage, ready, doing, done
1510
- by default; configurable doneState). Legacy projects without independent policy
1553
+ by default; configurable doneState; optional backlog and rejected roles). Legacy projects without independent policy
1511
1554
  use their uploaded configuration with Backlog / Doing / Done defaults. Owner admin ticket requests explicitly select a registered
1512
1555
  repository. The service has no Linear ticket backend: external tracker and
1513
1556
  file sources remain dispatcher-side, and service ticket surfaces refuse those
@@ -1534,7 +1577,7 @@ sessions need no separate global installation.
1534
1577
  | `ab observe --kind <followup\|refactor\|latent-bug> …` | structured observation, any phase, any time | no |
1535
1578
  | `ab done` | complete a producer phase (validates, then runs phase plumbing) | **yes** |
1536
1579
  | `ab verdict <approve\|revise\|escalate\|pass\|fail\|skip> …` | complete a review/verify phase | **yes** |
1537
- | `ab escalate <question>` | park the build for human input | **yes** |
1580
+ | `ab escalate <question>` | park the build for external judgment | **yes** |
1538
1581
  | `ab mcp [--store <ref>] [--repo <id>]` | serve the agent tool registry as an MCP server over stdio; fails closed inside a phase | no |
1539
1582
 
1540
1583
  The read-only `ab builds`, `ab build status`, and `ab artifact download` forms
@@ -1652,14 +1695,21 @@ facts retain the mixed-version wait gate and durable compatibility diagnostic.
1652
1695
  When the scoped `ab context` initial own-build read fails, the CLI best-effort
1653
1696
  writes `session.build-read-failed` with exact session, phase, round, operation
1654
1697
  `context`, reason `own-build-read`, and diagnostic. A valid terminal from that
1655
- session wins if the agent recovers. Otherwise settlement records `phase.deferred`
1698
+ session, or from its native continuation, wins if the agent recovers; a
1699
+ continuation inherits its predecessor's pending deferral, so a chain parks at
1700
+ most once. A later successful own-build read in the same session records
1701
+ `session.build-read-recovered`, which a newer classified failure invalidates. A
1702
+ finalize post-step, which has no terminal, settles as recovered only with that
1703
+ evidence and a completed turn, and the kernel then records its
1704
+ `finalize.step-completed`. Otherwise settlement records `phase.deferred`
1656
1705
  and `phase.deferral-escalated`, immediately projecting ordinary blocked attention.
1657
1706
  The raise cites `own-build-read:<evidenceSeq>`; replay repairs either settlement
1658
1707
  crash gap before launching another agent. An `escalation.answered` retry or
1659
1708
  guidance authorizes one fresh session without resetting genuine phase failures;
1660
1709
  a new classified failure parks again. There are zero automatic paid retries
1661
1710
  after this deferral. If evidence cannot be written, ordinary recovery applies;
1662
- agent output and `no-terminal` alone never classify a read failure.
1711
+ agent output and `no-terminal` alone never classify a read failure or settle
1712
+ one as recovered.
1663
1713
 
1664
1714
  A kernel store write rejected with HTTP 413 raises `StoreWriteTooLargeError`
1665
1715
  and records `phase.failed {willRetry:false}` on its first attempt, including
@@ -1802,7 +1852,8 @@ implementer: ab context (findings.json now materialized) → …
1802
1852
 
1803
1853
  Human/pre-build ticket grooming uses one configured-source namespace
1804
1854
  (`ab ticket create|update|block|unblock|list|show|move`, plus the ticket-asset
1805
- forms below). Migration adds `ab ticket export <dir>` and `ab ticket import <dir>`,
1855
+ forms below). Migration adds `ab ticket export <dir>` and
1856
+ `ab ticket import <dir> [--states <state,…>]`,
1806
1857
  plus `ab ticket migration record <dir>`
1807
1858
  (see [Ticket source migration](#ticket-source-migration)). These commands are
1808
1859
  sessionless, source-agnostic, and never available as a mid-build spec
@@ -1856,9 +1907,16 @@ dispatch-settings reducer as dispatcher decisions and the dashboard. An absent
1856
1907
  repository stream reduces as an empty journal and reports intake on, repository
1857
1908
  pause off; the query does not create that stream,
1858
1909
  append an event, claim a ticket, attach a runner, or start dispatcher work.
1859
- The CLI additionally loads mutable advisory `operator.registrations`, with each
1860
- live registration's ID, host, PID, original startedAt, heartbeatAt and heartbeatAgeMs.
1861
- Human output includes one `operator: absent` or `operator: present (N registrations)` line.
1910
+ The CLI additionally loads mutable advisory presence and reports
1911
+ `operator.presence: "loaded"` with `operator.registrations`, each live
1912
+ registration's ID, host, PID, original startedAt, heartbeatAt and heartbeatAgeMs.
1913
+ Other surfaces sharing the projection — the operator registry's
1914
+ `repository.status` over MCP and HTTP `GET …/status` — do not load presence and
1915
+ report `operator.presence: "unavailable"` with a `reason` and no `registrations`.
1916
+ Unavailable is not evidence of absence; only a loaded empty list is. Human
1917
+ output includes exactly one of `operator: absent`,
1918
+ `operator: present (N registrations)` or
1919
+ `operator: unavailable (presence not loaded)`.
1862
1920
 
1863
1921
  `ab watch --operator` opts into repository-wide advisory presence. Named slugs
1864
1922
  and ambient build/scoped sessions are usage errors. Unflagged watches remain
@@ -2213,7 +2271,7 @@ converge<A>(
2213
2271
  reviewer marks persistence — judgment; the kernel applies the threshold —
2214
2272
  determinism).
2215
2273
  - **Round ceiling:** `policy.maxReviewRounds` is the default absolute cap for
2216
- each loop. Once its `review-round-limit` escalation is open, a human may
2274
+ each loop. Once its `review-round-limit` escalation is open, the operator agent or a human may
2217
2275
  answer it with an optional positive `reviewRoundCeiling`. That value replaces
2218
2276
  the configured cap for only the escalation's plan or code loop and current
2219
2277
  spec revision. It is absolute, durable, and cleared by `spec.revised`; the
@@ -2305,6 +2363,13 @@ signals (telemetry, observations)
2305
2363
  → build → PR → merge
2306
2364
  ```
2307
2365
 
2366
+ **Intake order.** When a slot is free, dispatch takes ready candidates urgent
2367
+ first, then normal, each class in the source's listing order (see Ticket
2368
+ priority in §13). Every admission gate is unchanged — blockers, labels,
2369
+ creation holds, capacity, intake off and repository pause — so a blocked urgent
2370
+ ticket never holds back normal work. Priority never preempts: an urgent ticket
2371
+ does not stop, pause or displace a running build.
2372
+
2308
2373
  Additional scheduled ingesters such as `ingest:sentry` remain an open design
2309
2374
  thread and have no shipped config surface. Observation harvest is
2310
2375
  pressure-driven: on the existing one-pass scan of repository build streams, the
@@ -2386,6 +2451,11 @@ event-level mechanics live in the repository catalog and reducer tests):
2386
2451
  ordinary parked run and clears every exhaustion barrier. It never
2387
2452
  resurrects a terminal run. Completed and escalated runs are irrevocable; a
2388
2453
  deliberate escalation consumes its snapshot and is never auto-recovered.
2454
+ - **A live hosted execution owns its run.** While a `harvest.execution.started`
2455
+ has no release and its provider reports it running (or cannot answer),
2456
+ dispatch launches no harvest and never judges its open session. Only after
2457
+ settlement records the release does the next launch record an interrupted
2458
+ session, once, and recovery proceeds.
2389
2459
  - **The harvester only proposes.** It never claims, grooms, or dispatches a
2390
2460
  proposal, and it files every one into the same configured state rather than
2391
2461
  ranking them. Humans own Triage → Ready by default. A repository that points
@@ -2406,13 +2476,40 @@ repository; an owner selects a registered repository explicitly. Team and state
2406
2476
  fields from clients convey no authority or lifecycle policy. Tickets, comments,
2407
2477
  blockers, creation-key deduplication and assets are isolated by repository.
2408
2478
  Independent project ticket policy supplies hosted lifecycle names: triage, ready,
2409
- doing, done (`doneState`), and create/proposal equal to triage by default. Hosted
2410
- readyState defaults to ready; other sources require it. Legacy clients without
2411
- independent policy use uploaded dispatcher config and its old defaults. Configured roles may overlap.
2479
+ doing, done (`doneState`), and create/proposal equal to triage by default, plus
2480
+ the optional backlog and rejected roles. Hosted
2481
+ and GitHub readyState defaults to ready; other sources require it. Legacy clients without
2482
+ independent policy use uploaded dispatcher config and its old defaults. Configured roles may overlap,
2483
+ except the backlog and rejected roles below.
2412
2484
  The service has no Linear backend and never relays external ticket sources.
2413
- Projects using Linear, files or plugins keep their direct dispatcher connection;
2485
+ Projects using Linear, GitHub, files or plugins keep their direct dispatcher connection;
2414
2486
  service ticket surfaces refuse with project/source feedback instead of empty data.
2415
2487
 
2488
+ **GitHub tickets are the forge repository's issues.** `[tickets] source = "github"`
2489
+ selects the issues of the GitHub repository `origin` names and authenticates as the
2490
+ `github` forge does: `GITHUB_TOKEN`, then `GH_TOKEN`, then the gh CLI login.
2491
+ Ticket ids are issue numbers, and pull requests are never tickets. Lifecycle
2492
+ defaults are triage, ready, doing and done, with create and proposal equal to
2493
+ triage and `readyLabels` defaulting to `["autobuild"]`. A state is an
2494
+ `autobuild:<state>` label on an open issue; an open issue with no state label is
2495
+ in triage, and one with two or more is excluded with a diagnostic. Closing
2496
+ reasons carry the terminal states: closed as completed (or with no recorded
2497
+ reason) is done; closed as not planned or duplicate is the rejected role's
2498
+ state, or a fixed `not-planned` state, never ready and never resolving a
2499
+ blocker, when no rejected role is configured. Reopening an issue on GitHub
2500
+ returns it to triage, and the adapter strips a stale pre-reopen state label the
2501
+ first time it reads the issue. Blockers are GitHub's native issue dependencies,
2502
+ and a blocker in another repository never resolves. Assets live in the
2503
+ BuildStore, with notes posted as issue comments, and `get` carries no comment
2504
+ history; export and import read it explicitly. A ticket's own issue is an implicit `closes` link. A node is an issue
2505
+ with the exact `node` label, and a ticket targets a node by being a sub-issue
2506
+ of the node's issue (§13.1). The source has no guarded writes. Export and import are supported (see
2507
+ [Ticket source migration](#ticket-source-migration)). Dispatcher reads are
2508
+ conditional requests whose validators live only under the local state root, so
2509
+ an unchanged repository costs a tick no primary rate-limit budget; display-only
2510
+ state counts are one fresh GraphQL request per call, plus one per further
2511
+ page of 100 `autobuild:` labels, and are never cached.
2512
+
2416
2513
 
2417
2514
  The TicketSource **initiates and receives projections; it is never consulted
2418
2515
  mid-build and never used as artifact storage.** Dispatch reads the ticket
@@ -2431,7 +2528,7 @@ replacing, or removing an asset instead leaves a note on the ticket through the
2431
2528
  existing `comment()` port — the outward projection every source, including the
2432
2529
  plugin surface, already supports. The note names the asset, its revision, file
2433
2530
  count, and size, and gives the `ab ticket asset get` command that fetches it, so
2434
- a person reading the ticket in Linear, the hosted service, or a local file knows
2531
+ a person reading the ticket in Linear, GitHub, the hosted service, or a local file knows
2435
2532
  the asset exists. The note is a projection outward only; nothing reads it back,
2436
2533
  and existing sources and plugins need no asset capability.
2437
2534
 
@@ -2455,11 +2552,28 @@ boundary: a label name need not already exist for either create or update.
2455
2552
  Adapters own reconciliation with provider-side label registries, including
2456
2553
  concurrent attempts to create the same name; callers never pre-register labels.
2457
2554
 
2555
+ **Lifecycle roles.** The roles are triage, backlog, ready, claimed, done and
2556
+ rejected, plus the create and proposal placements. Each source maps them to its
2557
+ own native state names through `[tickets].*State`. Backlog holds work that is
2558
+ deliberately deferred, and rejected holds work that was considered and declined.
2559
+ Both are optional and have no default: `backlogState` and `rejectedState` unset
2560
+ means the role does not exist, and a state that merely shares the role's name
2561
+ holds no role. Neither may share its native state with the ready, claimed, done,
2562
+ triage or proposal role, or with each other. The dispatcher never claims from,
2563
+ moves into, or files harvest proposals into either. A ticket in the rejected
2564
+ state never resolves a blocker, and a rejected child no longer keeps its node
2565
+ incomplete; a backlog child still does, as triage and ready children do. Moving
2566
+ a ticket out of the rejected state restores ordinary behavior. Agents and
2567
+ operators move tickets by role (`ab ticket move <id> --role backlog`); a role
2568
+ the repository has not configured is refused with the key to set. "Building"
2569
+ is the claimed role, not a role of its own.
2570
+
2458
2571
  **Ticket dependencies.** A ticket may declare blockers within its source, at
2459
2572
  creation or later. The source owns representation (how a blocker is stored)
2460
2573
  and completion semantics (what "done" means); the dispatcher owns the
2461
2574
  decision — an unresolved blocker means the ticket is not claimed and creates
2462
- no build. Dependencies are written during grooming or by an approved harvest
2575
+ no build. A blocker in the configured rejected state never resolves, whatever
2576
+ the source's native completion semantics. Dependencies are written during grooming or by an approved harvest
2463
2577
  create, then read at dispatch time. Harvest validates agent-declared source-local ids
2464
2578
  and automatically derives unresolved same-source observation origins through
2465
2579
  fresh configured-source lifecycle reads before creating the proposal ticket.
@@ -2470,6 +2584,112 @@ dependency-blocked ticket stays
2470
2584
  queued source work rather than becoming a blocked build: the runtime `blocked`
2471
2585
  status is for builds awaiting a human.
2472
2586
 
2587
+ **Forge issue links.** A ticket may record the forge issues it addresses, each
2588
+ as `{issue, intent}`: `issue` is a positive issue number and `intent` is
2589
+ `closes` (the default; the work fully resolves the issue) or `refs` (the work
2590
+ only partly addresses it). Issue numbers are unique within a ticket and reads
2591
+ return links sorted by number; absent means none. Create sets links; update
2592
+ replaces the whole set, and an empty set clears it. Sources declare support.
2593
+ The file and hosted sources store links. The GitHub source stores each link to
2594
+ another issue as an `autobuild-link:<intent> #<n>` label and always reports the
2595
+ ticket's own issue as a `closes` link that cannot be removed. The Linear source
2596
+ refuses them, because Linear links GitHub issues natively through its own
2597
+ integration.
2598
+ A source that cannot store links refuses any create or update that names
2599
+ them, including an empty set, with a typed error naming the source, before
2600
+ anything is written; it never drops them. Writes that name no links are
2601
+ unaffected. `ab ticket create` and `update` take `--issues N[:refs],...`;
2602
+ operator and MCP ticket requests take `issueLinks`.
2603
+
2604
+ **Ticket priority.** A ticket's priority is `urgent` or `normal`; absent means
2605
+ normal. Urgent ready work is claimed before normal ready work (§12) and nothing
2606
+ else changes. Sources declare support. The file source stores
2607
+ `priority = "urgent"` in its frontmatter, writes no key for normal, and covers
2608
+ urgent priority in its revisions; the in-memory fake behaves the same way.
2609
+ The hosted source stores priority in the hosted ticket store, covers it in its
2610
+ revision, and lists urgent ready tickets first; an update that omits priority
2611
+ never changes it. The Linear source maps its native Urgent priority (1) to
2612
+ `urgent` and reads every other value as normal; it writes Urgent for `urgent`,
2613
+ clears only a current Urgent to No priority for `normal`, and covers urgent
2614
+ priority in its revisions. Plugins without the capability read every ticket
2615
+ as normal and refuse a create or
2616
+ update naming `urgent` with a typed error naming the source, before anything is
2617
+ written. Naming `normal` on such a source is a successful no-op. `ab ticket
2618
+ create` and `update` take `--priority urgent|normal`; operator and MCP ticket
2619
+ requests take `priority`; JSON ticket output always names it. Harvest files
2620
+ every proposal normal; grooming marks one urgent.
2621
+
2622
+ A build freezes its ticket's links into `build.created` when it claims the
2623
+ ticket, from the same sample as the body. Later ticket edits and spec revisions
2624
+ never change them. An agent in the build may downgrade one linked `closes`
2625
+ issue to `refs` with `ab issue downgrade <N> --reason <text>`, recorded as the
2626
+ agent fact `issue-link.downgraded {issue, reason}`. No fact expresses an
2627
+ upgrade, and downgrading a `refs` or unlinked issue is refused. Before the
2628
+ first PR side effect, local finalize appends the kernel fact
2629
+ `issue-links.sealed`; remote finalize is sealed by its
2630
+ `publication.requested {operation: finalize}`. The reducer applies a downgrade
2631
+ only when it precedes the seal, so retries and an adopted PR always compose the
2632
+ same links. `ab context` and `ab build status` show the effective links and
2633
+ any downgrade reason.
2634
+
2635
+ A forge declares the `closesIssues` capability when closing keywords that
2636
+ reach the default branch close issues; GitHub does, `local-git` does not. Only
2637
+ for a leaf whose target is the configured base branch, through such a forge,
2638
+ the kernel passes the sealed links to the adapter, which composes them with
2639
+ `kernel/issue-keywords.ts`. The PR body ends with one `Closes #N` or `Refs #N`
2640
+ line per link, ascending by number, whatever the description says. The landed
2641
+ squash message, including forge auto-merge and the janitor's freshness
2642
+ comparison, carries the same paragraph immediately before its terminal
2643
+ trailer block. Every closing keyword aimed at a `refs` issue in the PR title,
2644
+ body or landing message, including `owner/name#N` and issue URLs for the
2645
+ adapter's own repository, is rewritten to `refs`. A forge without the
2646
+ capability records links without emitting them.
2647
+
2648
+ A leaf targeting a node cannot close anything, because only the default
2649
+ branch closes issues. Its PR body still ends with one `Refs #N` line per linked
2650
+ issue, ascending by number, whatever each link's intent, so each issue shows
2651
+ the PR, and every closing keyword aimed at a linked issue in its title or body
2652
+ is rewritten to `refs`. Its landed commit carries no keyword lines. Its links
2653
+ travel to the node. When a child of node N, a leaf or a nested node, reaches `pr.merged`
2654
+ by kernel landing, human merge or abort cleanup, the dispatcher appends
2655
+ `node.issue-links-recorded {build, issueLinks}` to N before the child completes.
2656
+ Until that fact exists, a merged child with links that has not completed stays
2657
+ one of N's open children, even when it is aborted or its ticket no longer
2658
+ targets N, so N cannot verify or land without its contribution. The payload is the child's contribution: a leaf's effective links, with
2659
+ `downgraded: true` where a downgrade applied before its seal, or a nested node's
2660
+ set: its own effective links, with the same downgrade provenance, merged with
2661
+ its union. Every contributing child gets its own fact, even when the union does
2662
+ not change, and N's reducer keeps the recorded child slugs so a retry never
2663
+ records twice. N's reducer folds contributions into a running union, never
2664
+ re-reading child history. Per issue, a downgrade by any child makes it `refs`;
2665
+ otherwise any `closes` makes it `closes`; an issue every child only references
2666
+ stays `refs`.
2667
+
2668
+ A node's set is its own effective links merged with its union under the same
2669
+ per-issue rules. A root node's PR into the default branch carries the set, and
2670
+ only through a forge with both `closesIssues` and `updatePrIssueLinks`. The PR
2671
+ opens with the set, and each later contribution rewrites the body's keyword
2672
+ lines through `updatePrIssueLinks`, which preserves prose, neutralizes closing
2673
+ references to `refs` issues in the title, writes only on change and confirms by
2674
+ readback. `node.issue-links-published {pr, issueLinks}` records the confirmed
2675
+ lines, so a poll compares reduced state and calls the forge only when the set
2676
+ or PR changed. An open root PR whose confirmed lines predate the node's own
2677
+ links gains them on its next sync. Before the kernel lands a root node it
2678
+ refreshes the body to the final set and confirms the readback, whatever was
2679
+ published; a failure stops the attempt before any merge request. Merging the node PR, by the
2680
+ kernel's rebase landing or a human, closes every fully resolved issue. Landed
2681
+ child commits keep their own messages and carry no keywords, so one child's
2682
+ `Closes` cannot override another child's downgrade. A nested node's PR into its
2683
+ parent carries its set as refs-only lines, kept current the same way. A forge
2684
+ lacking either capability records the union and emits nothing.
2685
+
2686
+ When a `closesIssues` adapter's `openPr` adopts an existing open PR for the
2687
+ head with links, it converges that PR as a fresh one would be composed: it
2688
+ neutralizes the kept title, recomposes the body's keyword lines, writes only on
2689
+ change and confirms by readback. The title, prose and merge message are never
2690
+ replaced, so a retry, re-finalize, reconcile or hand-opened PR carries the same
2691
+ lines as the first publication, never duplicated.
2692
+
2473
2693
  In repositories with integration nodes, a blocker that has a build resolves only
2474
2694
  when its change identity is present in the dependent's sampled target head
2475
2695
  (the configured root branch when no target is set). Source completion or an
@@ -2481,13 +2701,24 @@ is excluded. An empty completed node contributes nothing; missing or ambiguous
2481
2701
  completion evidence does not mean empty. The newest build generation is used,
2482
2702
  with ties diagnosed rather than falling back to older successful work.
2483
2703
 
2484
- Destination observations retain versioned, head-bound Git witnesses (reachable
2485
- commit SHAs and direct build trailers) and a fixed-length evidence digest. Current
2704
+ Destination observations record a head-bound, query-scoped probe rather than
2705
+ the destination's history: only the commit SHAs and direct build trailers in the
2706
+ proof closure of the identities being decided (blocker identities, plus the
2707
+ landings and confirmed foreign aliases that could transport them), which of those
2708
+ are reachable from the sampled head, presence answers for only those identities,
2709
+ and a fixed-length evidence digest. Observation size is bounded by that closure,
2710
+ independent of the destination's reachable commit count and of repository history.
2711
+ While the head is unchanged and the probe covers the current questions, current
2486
2712
  confirmed landings and aliases from only the destination's accepted ancestry are
2487
- reapplied before reuse. Unrelated merged history and ready destinations do not
2488
- invalidate this proof. Head changes require a fresh Git sample; legacy observations
2489
- without witnesses refresh once rather than replaying repository history. Current
2490
- readiness and newest-generation checks still apply before claim.
2713
+ reapplied without Git; unrelated merged history and ready-set changes neither
2714
+ invalidate it nor append events. A moved head requires a fresh Git sample. A
2715
+ newly relevant landing or a new question needs only a new probe: a dispatcher
2716
+ still holding the full in-memory witness for that branch and head compacts one
2717
+ without Git, and otherwise samples Git once. Observations without a probe,
2718
+ including older full-history witnesses, are never trusted for admission: they
2719
+ are re-derived once the same way, and an unavailable sample leaves the dependent
2720
+ queued; neither replays repository history. Current readiness and
2721
+ newest-generation checks still apply before claim.
2491
2722
 
2492
2723
  Demand-driven restacking supplies ancestor changes to descendants. Sibling changes
2493
2724
  wait for their node to merge in the common ancestor and presence demand into the target;
@@ -2506,7 +2737,12 @@ that support idempotent creation preserve it through create, adoption, get, and
2506
2737
  ready listing. The reservation fact precedes the external side effect — that
2507
2738
  ordering, not provider behavior, is what makes filing crash-safe. Dispatch
2508
2739
  uses the key only to withhold unfinished Autobuild creates; its absence fails
2509
- open for legacy/plugin tickets and introduces no new readiness gate.
2740
+ open for legacy/plugin tickets and introduces no new readiness gate. A keyed
2741
+ create may also carry `idempotencyKeyReservedAt`, the earliest time the key could
2742
+ first have been used, which callers repeat unchanged on every retry. A source
2743
+ whose key lookup is bounded by time, such as GitHub, refuses a keyed create
2744
+ without it; harvest passes its reservation fact's time, and migration import
2745
+ passes the time its migration identity was first saved.
2510
2746
 
2511
2747
  ### 13.1 Node tickets and targets
2512
2748
 
@@ -2519,14 +2755,19 @@ the branch is open to targeting tickets immediately, without a PR. Idle integrat
2519
2755
  builds use no provisioned workspace, runner, execution lease, or dispatch capacity.
2520
2756
 
2521
2757
  A node requesting reconcile or verification is admitted before new ticket
2522
- claims. Its candidate occupancy excludes itself and capacity-bearing blocked or
2758
+ claims. The request is durable: a prepared verification cycle or a restack
2759
+ conflict, with no runner yet. Until the node holds its slot, intake reserves one
2760
+ slot for it, and the dispatcher checks its admission every tick regardless of
2761
+ idle node polling, so a slot freed in any tick goes to the node, not to a new
2762
+ claim. Its candidate occupancy excludes itself and capacity-bearing blocked or
2523
2763
  paused descendants, following accepted source-qualified build target ancestry.
2524
2764
  Running descendants and unrelated builds still count; ordinary blocked and
2525
2765
  paused work retains its slot for every other admission. Provisioning reserves
2526
2766
  node occupancy before the runner starts. This exception never raises the budget
2527
2767
  for new claims. Status and both dashboards report actual occupancy, configured
2528
2768
  capacity, effective display capacity and the nodes using descendant-held slots.
2529
- Idle collecting nodes remain free.
2769
+ Status, `ab builds` and both dashboards report each node waiting for a slot
2770
+ ahead of new ticket claims. Idle collecting nodes remain free.
2530
2771
 
2531
2772
  An empty node has no PR and reports `integration`, `target`, and `empty`.
2532
2773
  Once it holds commits its current parent lacks, the dispatcher opens or adopts
@@ -2538,8 +2779,8 @@ metadata changes. Missing, unopened, merged, closed or aborted targets remain
2538
2779
  queued with a diagnostic. The newest generation wins; a closed generation never
2539
2780
  falls back to an older open one. Blockers remain a separate graph.
2540
2781
 
2541
- A node is complete when exhaustive native ticket enumeration finds no unresolved
2542
- ticket targeting it, no unsettled frozen child claim remains, and a merged
2782
+ A node is complete when exhaustive native enumeration of the tickets targeting
2783
+ it (the optional `listTargeting`, else `listAll`) finds no unresolved one, no unsettled frozen child claim remains, and a merged
2543
2784
  contribution is durably known. Triage, backlog and ready children keep it open;
2544
2785
  done and cancelled children do not. Listing diagnostics fail closed. Completeness
2545
2786
  is sampled again before verification and publication. Source edits cannot be
@@ -2557,6 +2798,9 @@ Merge refuses incomplete nodes and names open children; `ab hold` remains availa
2557
2798
  Node parents and local-git roots receive guarded fast-forwards, preserving one
2558
2799
  commit and identity trailer per contributing build. GitHub shared roots use the
2559
2800
  PR rebase endpoint guarded on verified head, after a final parent freshness read.
2801
+ A root node's PR body carries the node's own issue links and its landed
2802
+ children's, and is refreshed before landing, so merging it closes them (see
2803
+ Forge issue links).
2560
2804
  Authoritative enforced up-to-date protection records fenced merge; uncertainty
2561
2805
  records unfenced merge and triggers immutable merged-tree comparison. A mismatch
2562
2806
  raises operator attention and never rewrites the shared parent.
@@ -2610,7 +2854,7 @@ deduplicated `node.parent-rejected` diagnostics when invalid, preserving effecti
2610
2854
  ancestry. Restoring the effective target records `node.parent-rejection-cleared`,
2611
2855
  removing the current refusal while retaining its historical fact. Rejection deduplication
2612
2856
  compares revision, target and reason independently of persistence key order.
2613
- Missing source reads withhold parent acceptance; ordinary cascade and PR handling
2857
+ Missing source reads withhold parent acceptance; ordinary demand-driven restack and PR handling
2614
2858
  continue against durable effective ancestry. Accepted moves finish their reserved
2615
2859
  Git and PR effects independently of tracker availability. A PR merged or closed
2616
2860
  by a human follows ordinary terminal handling. Changing a claimed work ticket's target is
@@ -2636,8 +2880,11 @@ pending while ancestors restack or reconcile. A durable availability observation
2636
2880
  allows unchanged idle ticks, including after restart, to skip repository preparation
2637
2881
  and native auto-merge cancellation. Exact node/parent heads, contribution base,
2638
2882
  request contents, accepted ancestry, foreign aliases and confirmed landing evidence
2639
- invalidate that observation when they change; polling timestamps do not. Failed
2640
- assessments never establish unavailability. Availability is not proof of destination
2883
+ invalidate that observation when they change; polling timestamps do not. Confirmed
2884
+ landing evidence comes from every repository build, including mixed-version deferred
2885
+ builds whose own decisions stay withheld, so the dispatcher check and the node
2886
+ transaction assess the same fingerprint. Failed assessments never establish
2887
+ unavailability. Availability is not proof of destination
2641
2888
  coverage. Moving to another destination branch explicitly settles obsolete requests
2642
2889
  with `destination-changed`; losing identities on the same branch leaves them waiting.
2643
2890
  Native auto-merge is suspended with confirmed, reusable receipts only when replay
@@ -2739,6 +2986,18 @@ the parent relation. Label replacements can demote nodes and receive the same
2739
2986
  guards; explicit kind and label instructions must agree about `node`. Label
2740
2987
  and parent connections are fully paginated. Linear still refuses guarded writes.
2741
2988
 
2989
+ GitHub uses the exact `node` issue label for kind and the sub-issue relation for
2990
+ target, only when the parent issue carries that label and is in the same
2991
+ repository. Any other parent is grouping: it imposes no target, never blocks
2992
+ dispatch and is never removed or replaced. A target write on a sub-issue of a
2993
+ grouping parent is refused, naming the parent; a target clear leaves grouping
2994
+ alone; setting a target replaces a node parent. Sub-issue and label changes
2995
+ made on GitHub read back the same as `ab ticket` writes. Demotion checks the
2996
+ node's fully paginated sub-issue list. A repository label that differs from
2997
+ `node` only by case is refused before any write. Integration observation reads
2998
+ the node issue and its sub-issues conditionally, so its cost follows the
2999
+ node's children, not the repository. GitHub refuses guarded writes.
3000
+
2742
3001
  Hosted sources support kind and target with project-scoped transactional validation.
2743
3002
  Existing tickets default to work with no target. Metadata changes increment the
2744
3003
  revision once; equivalent aliases and unchanged values do not. Node demotion
@@ -2853,7 +3112,16 @@ request against the base branch and records published/publish-failed journal
2853
3112
  facts.
2854
3113
 
2855
3114
  Successful dispatcher ticks with no effects, counters, diagnostics, queue change,
2856
- or attention transition append no tick boundary events. The first queue baseline,
3115
+ sampled triage-count change, or attention transition append no tick boundary
3116
+ events. Only a dispatcher feeding an interactive dashboard samples the triage
3117
+ count, at most once per 60 s, outside dispatcher ticks, from the ticket
3118
+ source's state counts; each tick publishes the last good sample. A viewer
3119
+ (`ab dispatch --viewer`, or the default viewer placement for hosted dispatch)
3120
+ reads the configured triage state's count itself, at most once per 60 s while
3121
+ its dashboard runs, through the ticket source's bounded state-count answer
3122
+ (`countStates`, the hosted `state-counts` operation). It never lists tickets
3123
+ or reads events for it, and its header shows only its own last successful
3124
+ count, never published status; a headless tick still makes no triage read. The first queue baseline,
2857
3125
  failed ticks, meaningful ticks, diagnostic clearing, failure recovery, and the
2858
3126
  first retry after a source cooldown remain recorded. Recorded starts may arrive
2859
3127
  with completion; optional `startedAt` preserves the actual start time, falling
@@ -3018,7 +3286,7 @@ with illustrative members:
3018
3286
  | 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) |
3019
3287
  | Merge policy | `landing.decided` (candidate, matched rule/default, labels, target, mode); `landing.native-enable-started`; `landing.native-applied` |
3020
3288
  | Spec | `spec.imported`, `spec.authored`, `spec.revised` (either positive `escalation` sequence or exclusive `operator: {user, via?}` provenance for an idle node; optionally carrying `assets`, a re-pin of the ticket's assets, §6.3) |
3021
- | Sessions | `session.started` (including optional write-ahead continuation intent and budget ceiling); `session.suspended` with partial transcript and active duration; `session.resumed` acceptance (stale reports are inert); reasoned `session.resume-fallback`; kernel-only `session.native-handle-recorded` with bracket and native execution identity; `session.ended` with transcript ref and usage (ordinary completion — the analysis corpus), or `session.ended {outcome: reclaimed, reclaimedBy: {instance, resumedFromSeq}}` (explicit transcriptless takeover) |
3289
+ | Sessions | `session.started` (including optional write-ahead continuation intent, budget ceiling, and the effective first `prompt` the bracket sent: the start prompt, the live continuation message, or the interruption notice); `session.suspended` with partial transcript and active duration; `session.resumed` acceptance (stale reports are inert); reasoned `session.resume-fallback`; kernel-only `session.native-handle-recorded` with bracket and native execution identity; `session.ended` with transcript ref and usage (ordinary completion — the analysis corpus), or `session.ended {outcome: reclaimed, reclaimedBy: {instance, resumedFromSeq}}` (explicit transcriptless takeover) |
3022
3290
  | Plan/code loops | `plan.started` … `plan-review.verdict`; `implement.started` … `code-review.verdict` |
3023
3291
  | Verify/finalize | `verify.started {step, attempt, feedback?, baseSha?, headSha?, restackId?}`, `verify.completed {step, outcome, skipCause?, baseSha?, headSha?, restackId?}`, `verify.cancelled {step, attempt, cause: {step}, baseSha?, headSha?, restackId?}`, `verify.stage-failed {attempt, cycle, stage, failed, cancelled, baseSha?, headSha?, restackId?}`, `verify.reconcile-policy-captured {reconcileSeq, steps}`, `finalize.completed {pr}`, `finalize.step-started {step}`, `finalize.step-completed {step, ok, headSha?}` |
3024
3292
  | Integration attention | Kernel/dispatcher `integration.verification-failed {id, head, parent, steps, guidance}`: one durable failed-cycle notification, recovered from exact verification receipts |
@@ -3026,7 +3294,7 @@ with illustrative members:
3026
3294
  | PR attachments | `pr-attachment.designated`, `pr-attachment.hosted`, `pr-attachment.reclaimed`, `pr-attachment.reclaim-failed` |
3027
3295
  | Leaf restacking | `target.moved {branch, sha, lineage?}`, `target.rewritten {branch, previousSha, sha}`, `target.rewrite-cleared {branch, sha, lineage?}`, advisory `target.distance {branch, sha, head, count}`, `restack.prepared`, `restack.replayed`, `restack.publish-intended`, `restack.rewritten`, `restack.contended`, `restack.completed` |
3028
3296
  | 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` |
3029
- | Cross-cutting | `observation.recorded`, `escalation.raised`, `phase.failed`, `session.build-read-failed`, `phase.deferred`, `phase.deferral-escalated` |
3297
+ | Cross-cutting | `observation.recorded`, `escalation.raised`, `phase.failed`, `session.build-read-failed`, `session.build-read-recovered`, `phase.deferred`, `phase.deferral-escalated` |
3030
3298
  | Repository journal | dispatcher setting facts; run lifecycle, effective config, tick/queue diagnostics, reload and runner outcomes; the `harvest.*` workflow, recovery, and ledger facts |
3031
3299
 
3032
3300
  Abort cleanup is a dispatcher-owned ordered saga. While an execution lease is
@@ -3283,7 +3551,11 @@ Passed or skipped target-movement, restack and reconcile cycles consume zero.
3283
3551
  Cycle identifiers remain monotonic independently of this budget. The history
3284
3552
  pass, pass, pass, fail uses one failure even when the failing cycle is attempt 4.
3285
3553
  The third distinct failed cycle at the default limit escalates. Budget
3286
- exhausted → `escalation.raised {source: "policy"}`. Guidance answering that
3554
+ exhausted → `escalation.raised {source: "policy"}`. The budget is build-wide, so
3555
+ its question lists each counted failed attempt with that attempt's failed steps.
3556
+ It says a step failed in every counted cycle only when it did; otherwise it names
3557
+ the latest failed cycle and its steps. The escalation still targets the last failed
3558
+ `verify:<step>`. Guidance answering that
3287
3559
  policy escalation routes to `implement` and outranks the pending report. By
3288
3560
  contrast, when the agent verifier itself uses `ab escalate`, guidance answering
3289
3561
  it reruns that same step with `verify.started {feedback: {guidance}}`; `ab context`
@@ -3334,7 +3606,10 @@ compatibility deferral. Interrupted pairs and historical logs remain readable
3334
3606
  with runtime null in JSON and `runtime unrecorded` in human detail.
3335
3607
 
3336
3608
  The runtime is captured once per executing process from its own distribution,
3337
- never the consuming repository or dispatcher on behalf of a runner. It includes
3609
+ never the consuming repository or dispatcher on behalf of a runner. Capture
3610
+ happens on first need, no later than the process's first runtime-recorded
3611
+ companion (the runner's construction or the dispatcher's run start); importing
3612
+ modules performs no capture. It includes
3338
3613
  `version`, `commit` (a Git object id or explicit `unknown`), and
3339
3614
  `source: {kind: source | package, location}` with an absolute distribution root
3340
3615
  (realpath when available). A source distribution owns its Git top level,
@@ -3355,8 +3630,8 @@ setup under the claimed lease before announcing another attachment. Another
3355
3630
  failure appends only a new failure fact; success appends `runner.attached
3356
3631
  {resumedFromSeq}` and clears the current error projection. After
3357
3632
  `policy.maxSetupAttempts`, the kernel raises one policy escalation targeted at
3358
- `setup`; lease sweeps and fresh dispatcher startup leave it parked until a human
3359
- answer re-arms the setup budget. Its exhaustion guard considers only setup-targeted
3633
+ `setup`; lease sweeps and fresh dispatcher startup leave it parked until an answer
3634
+ from the operator agent or a human re-arms the setup budget. Its exhaustion guard considers only setup-targeted
3360
3635
  policy raises, independently of phase-policy exhaustion. After claiming the lease,
3361
3636
  however, a runner honors an engine-selected pause or abort acknowledgement before
3362
3637
  setup-failure gating, even while that escalation is open. This control-only path
@@ -3373,11 +3648,24 @@ non-destructive execution fence for the exact workspace and execution generation
3373
3648
  It preserves unpublished branch commits and distinct detached producer candidates
3374
3649
  under immutable `refs/autobuild/archive/<build>/<sha>` refs, verifies their exact
3375
3650
  readback, and records `workspace.commits-preserved` before cleanup. Replacement
3376
- provisioning restores those exact refs before starting an agent. Preservation
3377
- never advances the public build branch. A confirmed absent environment records
3378
- `workspace.commits-lost`, naming known candidates and explicitly noting that any
3379
- additional unpublished SHAs could not be inspected. Unknown fencing, inspection,
3380
- transport, or receipt-write outcomes leave the workspace and snapshots intact.
3651
+ provisioning restores those exact refs before starting an agent. A preserved
3652
+ branch head that the build's latest 64 replaced heads cover, as the replaced
3653
+ head itself or one of its ancestors, is kept only as archived objects: it is
3654
+ never preserved or restored as the branch, and provisioning records the skip as
3655
+ `restorationSkipped` on `workspace.provisioned`. Rewrites older than that bound,
3656
+ and unpublished divergent branch work, are still refused. Preservation
3657
+ never advances the public build branch. A confirmed absent environment, or one
3658
+ that exists without a provisioned checkout, records `workspace.commits-lost`,
3659
+ naming known candidates and explicitly noting that any additional unpublished
3660
+ SHAs could not be inspected. An environment that never started executing holds
3661
+ no unpublished work: objects its checkout lacks mean nothing to preserve, so
3662
+ cleanup records `workspace.commits-preserved` carrying forward earlier preserved
3663
+ heads, then releases and replaces it. Unknown fencing, inspection, transport, or
3664
+ receipt-write outcomes leave the workspace and snapshots intact. A workspace
3665
+ flagged by `workspace.cleanup-required` is never launched into: the dispatcher
3666
+ releases it and provisions the next generation. A preservation or release
3667
+ failure is recorded against its build, as an infrastructure failure or janitor
3668
+ attention, and never stops the dispatcher from advancing other builds.
3381
3669
  Fencing is revalidated after restart; a saved receipt alone never authorizes
3382
3670
  cleanup of a newer execution. Current recovery notes are linked by the session
3383
3671
  manifest's `workspaceRecovery` field. Recovery notes apply to the next session
@@ -3533,9 +3821,11 @@ history and rewrite facts, plus both heads and the temporary change, under immut
3533
3821
  namespace or permission failures stop publication without a branch/tag fallback. Remote
3534
3822
  archives also publish commits present only on the remote: GitHub uses create-only
3535
3823
  Git-reference REST creation when the workspace lacks the commit, retaining guarded Git
3536
- pushes for local objects. Exact remote readback confirms publication, then a depth-one
3537
- fetch by the archive ref (without tags or configured refmap expansion) restores missing
3538
- commits and verifies them locally before returning.
3824
+ pushes for local objects. Exact remote readback confirms publication, then a non-shallow
3825
+ fetch of only that exact archive ref (without tags, configured refmap expansion or a
3826
+ depth limit) restores missing commits and their missing ancestry, writes no shallow
3827
+ boundary, leaves an already-shallow repository's existing boundaries unchanged, and
3828
+ verifies the commits locally before returning.
3539
3829
  Publication requests and loss records alone are not retained Git history: their
3540
3830
  unpublished objects may have died with a released sandbox. A separately published
3541
3831
  or reviewed tip remains an archive requirement even when an earlier request named
@@ -3599,7 +3889,9 @@ in Forge failure recovery; publication intent and frozen target remain unchanged
3599
3889
 
3600
3890
  **Stable merged identity.** A root-target leaf kernel merge remains one squash commit and
3601
3891
  preserves the forge's existing message except for normalizing terminal build
3602
- identity trailers to exactly one final `Autobuild-Build: <immutable slug>`.
3892
+ identity trailers to exactly one final `Autobuild-Build: <immutable slug>` and,
3893
+ for a build with issue links on a `closesIssues` forge, the issue keyword
3894
+ composition described under Forge issue links.
3603
3895
  Implementation commits and deposited PR descriptions are unchanged. The janitor
3604
3896
  records `pr.merged { sha, buildTrailerPresent? }` from the actual merged message,
3605
3897
  including human merges. True and false are successful observations; historical
@@ -3609,11 +3901,16 @@ completion. This evidence does not change reduction or display semantics.
3609
3901
 
3610
3902
  A node-target child merge instead fast-forwards its already canonical
3611
3903
  single-change commit, preserving exactly one terminal source-build identity.
3612
- The guarded destination write is authoritative: its pushed SHA and identity
3613
- produce the durable merge receipt independently of forge PR state. PR
3614
- acknowledgement is best-effort: observe a provider-reported merge, or comment
3615
- with the merged SHA and close a still-open review. Acknowledgement failure never
3616
- retries or fails the merge.
3904
+ The guarded destination write is authoritative once confirmed: the durable
3905
+ merge receipt, carrying the candidate SHA and identity, is recorded only after
3906
+ exact authoritative readback of the destination shows that candidate, or from
3907
+ the durable receipt of an accepted write overtaken before readback,
3908
+ independently of forge PR state. A different observed head is contention and
3909
+ records no merge; a failed readback records nothing and is retried; recovery of
3910
+ an interrupted merge uses the same exact readback. PR acknowledgement is
3911
+ best-effort: observe a provider-reported merge, or comment with the merged SHA
3912
+ and close a still-open review. Acknowledgement failure never retries or fails
3913
+ the merge.
3617
3914
 
3618
3915
  GitHub uses its authoritative viewer squash headline and body with an expected
3619
3916
  head guard. Native auto-merge messages are checked against fresh server defaults
@@ -3673,8 +3970,10 @@ Quiet polls append no attempt facts. Native application receipts and janitor
3673
3970
  bookkeeping are not pipeline execution progress.
3674
3971
 
3675
3972
  Native auto-merge is reconciled on every janitor poll against durable desired
3676
- merge state using the native state in the existing PR read, without additional
3677
- forge reads. A native write is issued only when observed and desired state disagree. It is disabled while held, unauthorized, unready, or replacement
3973
+ merge state using the native state in the existing PR read; an armed, authorized
3974
+ request on an eligible poll additionally gets the forge's landing-identity
3975
+ readback. A native write is issued only when observed and desired state,
3976
+ including that identity, disagree. It is disabled while held, unauthorized, unready, or replacement
3678
3977
  publication is pending or just completed; enabling binds to the current head
3679
3978
  through the forge's expected-head guard. Every replacement publication confirms
3680
3979
  cancellation first, and its first following poll re-reads and reconciles native
@@ -3742,7 +4041,7 @@ committer are Git's ordinary resolved repository identity, exactly as for a plai
3742
4041
  local commit; commit signing remains disabled. Before offering the candidate,
3743
4042
  the adapter resolves both identities through Git. If either is unavailable,
3744
4043
  consent remains pending and one reason-bearing follow-up names the missing
3745
- `user.name` / `user.email` configuration; later polls retry after the operator
4044
+ `user.name` / `user.email` configuration; later polls retry after the user
3746
4045
  configures it. When the base branch is checked out, Git's two-tree
3747
4046
  `read-tree -m -u` transition preflights and merges the old-to-squash tree:
3748
4047
  tracked/index changes on untouched paths and
@@ -3750,8 +4049,8 @@ untracked non-colliding files survive, while a tracked or untracked overwrite
3750
4049
  leaves consent pending and records one path-bearing follow-up instead of failing
3751
4050
  the dispatcher. Its durable pending-merge record is written before moving the
3752
4051
  base ref. A poll after a crash retries that same old-to-merged transition without
3753
- rolling back the ref or overwriting operator work; the PR remains open and
3754
- retryable until checkout repair succeeds. No merge is ever assumed: a build
4052
+ rolling back the ref or overwriting local work in the checkout; the PR remains
4053
+ open and retryable until checkout repair succeeds. No merge is ever assumed: a build
3755
4054
  reaches `merged` only when a later poll observes the merge and any required
3756
4055
  checkout synchronization. Without authorization, the local branch and PR record
3757
4056
  remain open for inspection with ordinary Git.
@@ -4276,19 +4575,24 @@ Every ticket read includes an opaque `revision`. Pass it as `expectedRevision`
4276
4575
  `move`, `block` and `unblock`. A stale write fails without changing anything and
4277
4576
  reports the current revision. Omission preserves unguarded behavior. Blocker
4278
4577
  checks cover the entire batch. Dispatcher moves remain unguarded and change the
4279
- revision. Sources without guarded writes, including Linear, refuse supplied
4280
- revisions rather than ignoring them.
4578
+ revision. Sources without guarded writes, including Linear and GitHub, refuse
4579
+ supplied revisions rather than ignoring them.
4281
4580
 
4282
4581
  `ab ticket edit <id>` opens `$VISUAL`, falling back to `$EDITOR`, using TOML
4283
4582
  frontmatter and a Markdown body. Only title, body and labels are editable;
4284
- kind, target, id, blockers, creation key and reference comments are read-only. It saves only
4285
- changed fields with the opening revision. Unchanged or formatting-only edits
4583
+ kind, target, id, blockers, issue links, priority, creation key and reference comments are read-only. It saves only
4584
+ changed fields with the opening revision. Sources without guarded writes,
4585
+ including Linear and GitHub, re-read the ticket immediately before an
4586
+ unguarded write and refuse a changed revision, with the no-lock race window of file checks. Unchanged or formatting-only edits
4286
4587
  write nothing. On conflict, invalid input or editor failure, the error names an
4287
4588
  absolute file path containing the edited text. Read the current ticket and
4288
4589
  reapply the intended changes before retrying; conflicts are never merged.
4289
4590
 
4290
- File and Linear revisions fingerprint kind, target, title, body, canonical label/blocker sets
4291
- and state; reverting identical content restores its fingerprint. File checks
4591
+ File and Linear revisions fingerprint kind, target, title, body, canonical label/blocker sets,
4592
+ state and urgent priority; file revisions also cover nonempty issue links. GitHub revisions
4593
+ fingerprint kind, target, title, body, canonical label/blocker sets, state and issue links,
4594
+ including the ticket's own issue; GitHub tickets carry no comments. Reverting
4595
+ identical content restores its fingerprint. File checks
4292
4596
  re-read immediately before writing, with the existing no-lock race window.
4293
4597
  Direct file edits and state-directory moves change revisions. File revisions also
4294
4598
  cover structured comments and portable attachments. Legacy file comments change
@@ -4316,7 +4620,8 @@ journals remain exclusively in the selected BuildStore.
4316
4620
  portable file tracker atomically to an absent or empty destination.
4317
4621
  `ab ticket import <dir>` preflights the entire tracker and target inventory, then
4318
4622
  creates or adopts tickets, maps blockers, deduplicates comments by exact body and
4319
- restores current attachments. Both run sessionless without forge access.
4623
+ restores current attachments. Both run sessionless without forge access. File,
4624
+ hosted and GitHub sources support import; every built-in source supports export.
4320
4625
 
4321
4626
  TicketCreateOptions includes optional `requestedId`. Unsupported sources reject
4322
4627
  it. File keeps safe ids exactly; hosted preserves canonical own-team positive
@@ -4325,6 +4630,27 @@ adoption precedes collision checks. Known kept-number clashes stop import before
4325
4630
  any target mutation. Stable migration identities and atomic mapping files make
4326
4631
  interrupted imports resumable without content-based adoption.
4327
4632
 
4633
+ A source whose ids cannot be chosen declares `allocatesIds`; GitHub does. Import
4634
+ then plans no requested ids and runs no target inventory: every ticket is created
4635
+ without `requestedId`, remapped to the id the source returns, and adopted on
4636
+ resume by its creation key inside `create`. Optional `readComments(id)` returns
4637
+ comment history for export and import only, never on a recurring path, so `get`
4638
+ may stay comment-free. Optional `importProblems` reports every destination
4639
+ refusal (unrepresentable states, colliding labels, unusable creation keys)
4640
+ before any write, together with import's own preflight problems. Issue links are
4641
+ rewritten through the mapping only for an export from GitHub, whose issue
4642
+ numbers are the exported tickets.
4643
+
4644
+ The export manifest records `roles`: each state directory's lifecycle roles under
4645
+ the exporting configuration. Import lands a role-holding state in the
4646
+ destination's state for its first role in the order done, rejected, claimed,
4647
+ ready, backlog, triage, proposal, create, and refuses when the destination
4648
+ configures no state for that role. `ab ticket import <dir> --states <a,b>`
4649
+ imports only tickets in the named states. A blocker on an excluded ticket in the
4650
+ done role is dropped as resolved; any other blocker, target or GitHub issue link
4651
+ naming an excluded ticket, and any unfinished build whose ticket or target is
4652
+ excluded, is refused before any write.
4653
+
4328
4654
  File frontmatter additionally supports optional structured `comments` (body,
4329
4655
  createdAt, optional author) and `attachments` (kind, name, layout, entries with
4330
4656
  file base64 bytes or directory paths). Legacy absent fields retain old behavior;
@@ -4334,8 +4660,9 @@ assets. Build claims and spec re-pins freeze native assets into durable snapshot
4334
4660
 
4335
4661
  State normalization and the complete operator procedure are documented in
4336
4662
  [Ticket migration](docs/ticket-migration.md). The same reference is delivered in
4337
- the installed guide. Export keeps lifecycle membership without inferring roles;
4338
- import reuses unique case-insensitive states and creates normalized missing ones.
4663
+ the installed guide. Export keeps each ticket's state and records the configured
4664
+ roles each state held; import maps role-holding states by role, reuses unique
4665
+ case-insensitive states for the rest and creates normalized missing ones.
4339
4666
 
4340
4667
 
4341
4668
  Completed `ab ticket import <dir> [--store <ref>]` records a durable repository
@@ -4448,12 +4775,30 @@ Classified rate limits retain repository cooldown and consume no publication
4448
4775
  retry allowance. Rejected pushes, lease conflicts, dirty trees and unclassified
4449
4776
  errors retain their existing behavior.
4450
4777
 
4778
+ A forge that refuses a dispatcher-side finalize PR create with a non-transient,
4779
+ non-rate-limit answer (a 4xx such as a validation error or GitHub's "No commits
4780
+ between" 422) is a question for the operator, not a provider failure. The
4781
+ kernel raises one `finalize` escalation (`policy`, `non-retryable-phase-failure`)
4782
+ whose question names the forge, the HTTP status and the forge's message
4783
+ verbatim. It records no `infrastructure.failed` and consumes no
4784
+ `maxInfrastructureAttempts`. While it is open the request is parked without
4785
+ calling the forge. A `retry` answer re-attempts the PR create once; a repeat
4786
+ refusal raises a new escalation. Rate limits and transient forge failures keep
4787
+ their existing handling.
4788
+
4451
4789
  Janitor failures are durable per-build episodes. Eligible failures retry after
4452
4790
  30, 60, 120, 240 seconds, then at the configured cap (300 seconds by default).
4453
- Skipped polls preserve the episode across restart. After
4791
+ A classified forge rate limit is repository cooldown, not a janitor failure:
4792
+ neither the first limited response nor the cooldown that follows starts or ages
4793
+ an episode. Skipped polls preserve the episode across restart. After
4454
4794
  `policy.janitorFailureAttentionSeconds` (600 by default), `build.janitor-failing`
4455
4795
  notifies default watchers and appears on the build row. A successful attempt
4456
4796
  clears it. `policy.janitorBackoffMaxSeconds` sets the positive integer cap.
4797
+ A dispatcher that cannot execute Git for kernel node work (a missing or
4798
+ unloadable `git` for the bare clone) records no janitor failures. It records
4799
+ one durable `dispatcher.kernel-git-unavailable` repository condition, node work
4800
+ waits, and `dispatcher.kernel-git-recovered` closes the condition once a clone
4801
+ succeeds.
4457
4802
 
4458
4803
  A classified forge rate limit records repository degradation with `resetAt`.
4459
4804
  Forge work waits during cooldown; passing the deadline permits a recovery