@defrex/autobuild 1.2.0 → 1.4.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 (164) hide show
  1. package/README.md +1 -1
  2. package/SPEC.md +416 -36
  3. package/docs/accounts.md +50 -1
  4. package/docs/answering-blocked-builds.md +4 -1
  5. package/docs/architecture.md +298 -17
  6. package/docs/build-store.md +18 -0
  7. package/docs/builds.md +7 -1
  8. package/docs/cli.md +1 -1
  9. package/docs/configuration-overview.md +6 -0
  10. package/docs/configuration.md +44 -19
  11. package/docs/dispatcher-hosting.md +42 -0
  12. package/docs/dispatcher.md +41 -0
  13. package/docs/forges.md +5 -0
  14. package/docs/integration-tree.md +24 -5
  15. package/docs/operating.md +11 -3
  16. package/docs/operator-api.md +81 -10
  17. package/docs/operator-surfaces.md +29 -0
  18. package/docs/plugin-authoring.md +51 -2
  19. package/docs/remote-store-protocol.md +321 -46
  20. package/docs/remote-ticket-protocol.md +12 -10
  21. package/docs/restacking.md +105 -3
  22. package/docs/setup.md +37 -8
  23. package/docs/skills.md +1 -1
  24. package/docs/spec-standard.md +41 -5
  25. package/docs/ticket-dependencies.md +8 -0
  26. package/docs/troubleshooting.md +9 -0
  27. package/docs/workspaces.md +1 -1
  28. package/package.json +4 -3
  29. package/packages/core/src/accounts/availability.ts +96 -0
  30. package/packages/core/src/accounts/local-owner.ts +49 -2
  31. package/packages/core/src/cli/attention.ts +2 -0
  32. package/packages/core/src/cli/binary.ts +17 -1
  33. package/packages/core/src/cli/context.ts +62 -0
  34. package/packages/core/src/cli/dashboard/model.ts +12 -3
  35. package/packages/core/src/cli/dashboard/poll.ts +65 -8
  36. package/packages/core/src/cli/dashboard/refresh.ts +2 -0
  37. package/packages/core/src/cli/dashboard/render.ts +46 -5
  38. package/packages/core/src/cli/dispatch-args.ts +27 -3
  39. package/packages/core/src/cli/dispatch-frontend.ts +179 -52
  40. package/packages/core/src/cli/dispatch-mode.ts +94 -0
  41. package/packages/core/src/cli/dispatch-preflight.ts +43 -0
  42. package/packages/core/src/cli/dispatch-repository-feed.ts +150 -33
  43. package/packages/core/src/cli/dispatch.ts +209 -36
  44. package/packages/core/src/cli/dispatcher-liveness.ts +6 -1
  45. package/packages/core/src/cli/forge-clear.ts +30 -0
  46. package/packages/core/src/cli/harvest.ts +2 -1
  47. package/packages/core/src/cli/help.ts +17 -3
  48. package/packages/core/src/cli/historical-build-state.ts +6 -0
  49. package/packages/core/src/cli/main.ts +43 -2
  50. package/packages/core/src/cli/publication-settlement.ts +17 -0
  51. package/packages/core/src/cli/remote-poll.ts +11 -1
  52. package/packages/core/src/cli/repository-status.ts +11 -0
  53. package/packages/core/src/cli/status.ts +7 -1
  54. package/packages/core/src/cli/wait.ts +9 -2
  55. package/packages/core/src/cli/watch.ts +47 -16
  56. package/packages/core/src/config/roles.ts +16 -1
  57. package/packages/core/src/events/catalog.ts +8 -0
  58. package/packages/core/src/events/forge-degradation-policy.ts +11 -0
  59. package/packages/core/src/events/payloads.ts +95 -2
  60. package/packages/core/src/events/policy.ts +19 -0
  61. package/packages/core/src/events/repository.ts +108 -2
  62. package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +464 -0
  63. package/packages/core/src/kernel/change-presence.ts +74 -8
  64. package/packages/core/src/kernel/dispatch-placement.ts +30 -0
  65. package/packages/core/src/kernel/engine.ts +27 -12
  66. package/packages/core/src/kernel/generators/leaf-restack-log.ts +17 -1
  67. package/packages/core/src/kernel/generators/node-restack-log.ts +14 -0
  68. package/packages/core/src/kernel/leaf-restack-state.ts +24 -2
  69. package/packages/core/src/kernel/log-index.ts +1 -1
  70. package/packages/core/src/kernel/node-landing.ts +27 -10
  71. package/packages/core/src/kernel/node-polling.ts +40 -7
  72. package/packages/core/src/kernel/node-restack-demand.ts +75 -0
  73. package/packages/core/src/kernel/node-restack-state.ts +20 -1
  74. package/packages/core/src/kernel/node-restack-transaction.ts +47 -1
  75. package/packages/core/src/kernel/read-facts.ts +120 -9
  76. package/packages/core/src/kernel/reconcile-head.ts +34 -11
  77. package/packages/core/src/kernel/reconcile-restack.ts +106 -72
  78. package/packages/core/src/kernel/reducer-registry.ts +6 -0
  79. package/packages/core/src/kernel/reducer.ts +20 -2
  80. package/packages/core/src/kernel/replay-retention.ts +176 -0
  81. package/packages/core/src/kernel/target-lineage.ts +65 -0
  82. package/packages/core/src/kernel/target-observation.ts +117 -0
  83. package/packages/core/src/kernel/ticket-preparation.ts +66 -0
  84. package/packages/core/src/operator/annotations.ts +6 -0
  85. package/packages/core/src/operator/control.ts +20 -0
  86. package/packages/core/src/operator/index.ts +2 -0
  87. package/packages/core/src/operator/registry.ts +25 -13
  88. package/packages/core/src/operator/tickets.ts +8 -2
  89. package/packages/core/src/plugin-sdk/index.ts +1 -0
  90. package/packages/core/src/ports/forge/fake.ts +22 -0
  91. package/packages/core/src/ports/forge/git-rewrite.ts +49 -12
  92. package/packages/core/src/ports/forge/github.ts +42 -10
  93. package/packages/core/src/ports/forge/local-git.ts +16 -1
  94. package/packages/core/src/ports/runner/account-env.ts +60 -9
  95. package/packages/core/src/ports/runner/claude.ts +49 -45
  96. package/packages/core/src/ports/types.ts +58 -4
  97. package/packages/core/src/ports/workspace/account-policy.ts +2 -1
  98. package/packages/core/src/ports/workspace/commit-preservation.ts +175 -0
  99. package/packages/core/src/ports/workspace/create.ts +2 -0
  100. package/packages/core/src/ports/workspace/fake.ts +4 -0
  101. package/packages/core/src/ports/workspace/git-worktree.ts +22 -1
  102. package/packages/core/src/ports/workspace/vercel-sandbox.ts +304 -56
  103. package/packages/core/src/processes/build-runner.ts +240 -111
  104. package/packages/core/src/processes/dispatcher-selectors.ts +3 -2
  105. package/packages/core/src/processes/dispatcher.ts +732 -201
  106. package/packages/core/src/processes/execution-no-progress.ts +8 -0
  107. package/packages/core/src/processes/harvest-runner.ts +6 -7
  108. package/packages/core/src/processes/harvest.ts +11 -16
  109. package/packages/core/src/processes/publication-state.ts +2 -1
  110. package/packages/core/src/processes/repo-view.ts +25 -0
  111. package/packages/core/src/processes/workspace-preservation.ts +164 -0
  112. package/packages/core/src/scenarios/harness.ts +7 -0
  113. package/packages/core/src/store/adapter.ts +9 -0
  114. package/packages/core/src/store/artifact-meta.ts +7 -0
  115. package/packages/core/src/store/build-scope.ts +28 -0
  116. package/packages/core/src/store/contract.ts +182 -0
  117. package/packages/core/src/store/event-reads.ts +156 -0
  118. package/packages/core/src/store/local/schema.ts +11 -0
  119. package/packages/core/src/store/local/store.ts +117 -2
  120. package/packages/core/src/store/memory.ts +241 -0
  121. package/packages/core/src/store/phase-session.ts +47 -0
  122. package/packages/core/src/store/reduced-reads.ts +8 -0
  123. package/packages/core/src/store/reducer-value-shapes.json +10546 -8877
  124. package/packages/core/src/store/reducer-value-validation.ts +109 -6
  125. package/packages/core/src/store/reducer-values.ts +62 -2
  126. package/packages/core/src/store/remote/client.ts +208 -23
  127. package/packages/core/src/store/remote/compatibility.ts +195 -25
  128. package/packages/core/src/store/remote/errors.ts +16 -0
  129. package/packages/core/src/store/remote/index.ts +17 -0
  130. package/packages/core/src/store/remote/protocol.ts +30 -1
  131. package/packages/core/src/store/remote/released-clients.json +37 -0
  132. package/packages/core/src/store/remote/released-clients.ts +88 -0
  133. package/packages/core/src/store/remote/released-reducer-values/1.2.0.json +8129 -0
  134. package/packages/core/src/store/remote/released-reducer-values/1.3.0.json +25093 -0
  135. package/packages/core/src/store/remote/released-reducer-values/1.4.0.json +26128 -0
  136. package/packages/core/src/store/remote/released-reducer-values/index.ts +13 -0
  137. package/packages/core/src/store/remote/version.ts +8 -1
  138. package/packages/core/src/store/repo-state-events.ts +6 -3
  139. package/packages/core/src/store/scan-cadence.ts +15 -0
  140. package/packages/core/src/store/session-handle.ts +18 -0
  141. package/packages/core/src/store/snapshots.ts +16 -3
  142. package/packages/core/src/store/types.ts +29 -6
  143. package/packages/core/src/testing/dispatch-read-budget.ts +457 -7
  144. package/packages/core/src/testing/index.ts +6 -1
  145. package/packages/core/src/testing/reduced-read-budget.ts +1240 -9
  146. package/skills/guide/SKILL.md +220 -22
  147. package/skills/guide/references/accounts.md +50 -1
  148. package/skills/guide/references/integration-tree.md +24 -5
  149. package/skills/guide/references/operator-api.md +81 -10
  150. package/skills/guide/references/plugin-authoring.md +51 -2
  151. package/skills/guide/references/remote-store-protocol.md +321 -46
  152. package/skills/guide/references/remote-ticket-protocol.md +12 -10
  153. package/skills/guide/references/restacking.md +105 -3
  154. package/skills/guide/references/setup.md +37 -8
  155. package/skills/guide/references/spec-standard.md +41 -5
  156. package/skills/guide/references/ticket-dependencies.md +8 -0
  157. package/skills/implement/SKILL.md +12 -3
  158. package/skills/operate/SKILL.md +85 -12
  159. package/skills/plan/SKILL.md +27 -4
  160. package/skills/plan-review/SKILL.md +22 -2
  161. package/skills/reconcile/SKILL.md +16 -1
  162. package/skills/spec/SKILL.md +7 -4
  163. package/skills/tickets/SKILL.md +7 -3
  164. package/templates/hosted-service/package.json +2 -2
@@ -2,9 +2,9 @@
2
2
 
3
3
  A conforming hosted instance implements this normative polling-oriented operator
4
4
  contract at
5
- `/operator/v1/repos/{repo}`. It is versioned with remote store protocol **6**.
5
+ `/operator/v1/repos/{repo}`. It is versioned with remote store protocol **7**.
6
6
  Every request must send `X-Autobuild-Version`,
7
- `X-Autobuild-Protocol-Version: 6`, and `Authorization: Bearer …`. Identity is
7
+ `X-Autobuild-Protocol-Version: 7`, and `Authorization: Bearer …`. Identity is
8
8
  checked before authentication or resource lookup.
9
9
 
10
10
  Project credentials are opaque `abp_1_<id>_<secret>` bearer values bound to one
@@ -166,7 +166,8 @@ Active verification/reconcile or writer work, restack/reparent work, pause,
166
166
  pending controls, merge intent and ended PRs refuse the no-escalation path.
167
167
  A concurrent state change refuses publication with a retry explanation;
168
168
  uncited artifacts are inert. Leaves still require an open escalation and
169
- restart from `plan`.
169
+ restart from `plan` after any unfinished reconcile resumes under the revised
170
+ spec and its publication is confirmed.
170
171
 
171
172
  ## The registry's protocol face: `POST …/tools/{tool}`
172
173
 
@@ -241,18 +242,23 @@ Dispatcher liveness is also visible through `ab repository status --json`:
241
242
  of `latestRun`. Each run includes its recorded `runtime` (version, commit, and
242
243
  source kind/location), or null for unrecorded historical starts. Heartbeat age measures attributable renewals; tick age measures
243
244
  durable progress. Missing historical evidence is null. The liveness query uses
244
- bounded repository facts first, with a full-history fallback when a later
245
- invocation hides the holder start or the latest stop. Other state reads retain
246
- their bounded semantics.
245
+ persisted repository and exact per-run reduced values, including when newer
246
+ invocations hide an older holder or stop. Missing facts never trigger a full-log
247
+ fallback.
247
248
 
248
249
  Repository-following `ab watch` additionally emits a read-only `dispatcher.lost`
249
250
  observation when an observed lease expires without a matching stop or validated
250
- successor takeover. A completed ownership transfer suppresses predecessor loss
251
+ successor takeover. Any recorded stop, normal or abnormal, suppresses loss;
252
+ abnormal stops retain their own default attention event. A completed ownership transfer suppresses predecessor loss
251
253
  even while its sessions drain; a handoff without takeover still reports loss on
252
254
  expiry. Successor loss and upgrade-failure/rollback attention remain independent. JSON carries
253
255
  `observation` instead of `event`, with run, observedAt, leaseExpiresAt and available
254
256
  identity, plus the usual repo/build/state/cursor fields. It invents no durable
255
257
  sequence or actor. Retain the cursor to avoid repeat reports across invocations.
258
+ A watch retains sampled owners after authoritative lease release. Once-run teardown
259
+ stops heartbeat and releases only its own lease; release is best effort because
260
+ expiry fences ambiguous ownership. A retained sample or failed release cannot
261
+ override a persisted stop.
256
262
  No lease alone is not evidence of death. SIGINT, SIGHUP and SIGTERM drain dispatch,
257
263
  record the first signal in the stop fact, and release its lease before exit.
258
264
 
@@ -265,7 +271,7 @@ The default watch reports actionable conditions only:
265
271
  - `build.janitor-failing`: a build has reached the configured consecutive-failure threshold; a successful janitor attempt clears it.
266
272
  - `dispatcher.forge-persistent`: forge degradation remains after a completed post-reset retry opportunity; successful recovery clears it.
267
273
 
268
- - Build `escalation.raised`, `integration.landed`, `node.item-conflicted`, or
274
+ - Build `escalation.raised`, `integration.landed`, `node.item-conflicted`, `target.rewritten`, or
269
275
  conflicted `restack.replayed` events. `build.consent-ready` is the single
270
276
  signal for a ready consent or held merge, including first repository-wide
271
277
  discovery. Its target has the queue entry shape `{kind, branch, ticket?, build?}`.
@@ -284,7 +290,10 @@ The default watch reports actionable conditions only:
284
290
  for five minutes in one run. A successful tick, new run, or matching stop
285
291
  ends the episode. Source grace and cooldown-driven failures do not start
286
292
  this clock; after grace, the first qualifying failure starts a new five-minute
287
- interval. Each persistence episode is reported once.
293
+ interval. Each persistence episode is reported once. Unavailable failure writes delay durable visibility:
294
+ watch keeps running, warns locally and reports one bounded unreported window
295
+ on recovery. These local warnings do not start the durable attention clock
296
+ retroactively. Explicit stops still stop dispatch.
288
297
 
289
298
  Repository conditions are included with no slugs or with `--repository`.
290
299
  Routine outcomes and self-healing failures are silent. Repeatable
@@ -302,7 +311,7 @@ have `repo` and null build/state. Source observations also report
302
311
 
303
312
  Every record carries a cursor, including timer-only records. Resuming suppresses
304
313
  delivered merge decisions and persistence episodes even when stream positions
305
- did not advance. Old v1 cursors remain valid: historical eligible merge
314
+ did not advance. Old v1 cursors remain valid inside the hosted 1,000-position resume window: historical eligible merge
306
315
  decisions are treated as consumed; active overdue repository episodes may
307
316
  report because old watches had no persistence notification. Fresh attachment
308
317
  silently baselines historical direct events and merge decisions, but retains
@@ -319,11 +328,32 @@ self-healing failures. A merge match uses the watch observation with
319
328
  `condition: "attention"`. Explicit `--event` globs remain event-only.
320
329
  Watch and wait preserve each other's cursor notification metadata.
321
330
 
331
+ Normal re-arms retain `--since`. Hosted watch/wait resume is gap-proportional
332
+ inside a 1,000-sequence-position window, inclusive at `head - 1000`. Expired
333
+ cursors fail with typed `cursor-too-old` and the oldest servable cursor; re-arm
334
+ without `--since` and reconcile repository/build status, acknowledging the lost
335
+ historical gap. An ordinary reducer upgrade preserves valid cursors. A retired
336
+ seed generation instead requires an upgrade/restart before fresh attachment;
337
+ checkpoint integrity errors are terminal and never trigger replay from zero.
338
+
339
+ The MCP `builds.events` tool returns `{events, cursor, hasMore}`, at most 256
340
+ events per call. Follow `cursor` while `hasMore` is true to traverse a build's
341
+ complete history without omission. Waiting remains bounded and applies only
342
+ when no events are available. Repository event reads have a 1,000-position
343
+ window; build history itself remains available through explicit pages.
344
+
345
+
322
346
  Hosted ticket tools resolve independent project ticket policy before legacy uploaded
323
347
  configuration. Queue, detail, state discovery and mutations work before any build
324
348
  or dispatcher run; detail reports a null matching build. Ticket policy publication
325
349
  never creates synthetic build or repository history.
326
350
 
351
+ Ticket detail and mutation results prefer exact normalized ticket ids when associating
352
+ a build. If no exact match exists, only legacy hosted `ticket-<uuid>` storage
353
+ references require optional alias resolution, once per distinct reference. Readable
354
+ historical ids require no ticket lookup. Failed optional alias resolution does not
355
+ fail ticket detail or a completed mutation; matches already resolved remain eligible.
356
+
327
357
  Ticket results include kind (default work) and optional same-source node target.
328
358
  Metadata-only patches are accepted. Target validation and demotion guards apply
329
359
  to CLI, HTTP and MCP alike; unsupported sources refuse even explicit defaults
@@ -442,6 +472,18 @@ projects return the same unknown-repository result as absent projects. Machine c
442
472
 
443
473
  ### Permanent project deletion
444
474
 
475
+ The browser requires the exact full repository identity in a transient dialog field;
476
+ confirm stays disabled for empty or mismatched input and focus starts in the field.
477
+ The handler independently binds that identity to the selected repository and its
478
+ fresh validated preview. Only JSON `{deleted:true}` acknowledges completion.
479
+ After any failed or unrecognized deletion response, the browser shows
480
+ “Deletion outcome unknown; reload to check” and holds the row in its original slot
481
+ without actions, even after dismissal. Only a complete successful discovery begun
482
+ by Reload after the attempt settles it: absence removes the row, presence restores
483
+ its authorized actions, and pending cleanup restores Finish deletion with a fresh
484
+ preview and exact typing. An earlier or unsuccessful read cannot settle the outcome.
485
+ The server's `{repo}` body and generation-bound If-Match contract are unchanged.
486
+
445
487
  Super users and the owner of a project's organization can delete it from the
446
488
  Projects page. Owners see only projects in organizations they own; Move and
447
489
  Assign remain super-user operations. The shared confirmation dialog names the project,
@@ -502,3 +544,32 @@ the same store identity, token and prefixed pathname as uploads. Missing objects
502
544
  are successful cleanup; provider errors never count as completed deletion.
503
545
 
504
546
  Paged ticket listings use the source's optional native `listPage(criteria, page)` capability when present, otherwise read the full listing and reverse/slice it. Native errors propagate. PostgreSQL counts matches without bodies and reads only the requested window. Zero limits and offsets past the end still report the full matching total. Unpaged listings remain exhaustive; the wire payload is the same for both paths.
547
+
548
+
549
+ ### Forge cooldown admission and explicit recovery
550
+
551
+ Hosted repository event appends and atomic artifact deposits validate
552
+ `dispatcher.forge-degraded` before any durable mutation. The payload must match
553
+ its event schema, with a finite ISO `resetAt` at most 24 hours after server time
554
+ (inclusive). Already-expired deadlines are accepted. Invalid or out-of-horizon
555
+ writes return `400 validation` (the remote adapter exposes `EventValidationError`);
556
+ the server never clamps or invents a provider reset. Historical decoding has no clock-relative restriction.
557
+
558
+ Build-runner and build-phase grants may POST only the kernel-authored
559
+ `dispatcher.forge-degraded` repository fact through the events route. The
560
+ preceding `requireProject` check binds this exception to the exact repository
561
+ in the delegated claim. A hosted project identifies one repository. Delegates
562
+ cannot write recovery, deposits or other repository facts, regardless of the
563
+ actor claimed in an envelope.
564
+
565
+ An authorized operator can explicitly clear erroneous state through
566
+ `repository.forge_clear {repo, forge, reason}` or
567
+ `ab repository forge-clear --forge <name> --reason <text> [--json] [--store <ref>]`.
568
+ The reason is required and nonblank. The result contains the durable recovery
569
+ `event`, attributed to the authenticated human with normal `via` attribution.
570
+ Build and harvest delegates cannot invoke this operator mutation. CLI use
571
+ requires an operator outside build/harvest sessions. This is an override, not
572
+ proof of provider success. A clear appends once without reading history, even
573
+ when already healthy; later degradation wins by ordinary journal order.
574
+ Existing dispatcher/kernel automatic recovery and old payloads remain valid;
575
+ the recovered payload additionally accepts an optional nonblank `reason`.
@@ -27,7 +27,7 @@ Import public types only from `@defrex/autobuild/plugin-sdk`; internal module pa
27
27
 
28
28
  All four manifest maps have production selectors. Omitted forge and workspace selectors default to builtin `github` and `git-worktree`; roles keep normal runtime inheritance.
29
29
 
30
- `BuildStore` and `BlobStore` contract types are exported for remote-server authors, but BuildStore is **not** an in-process manifest map: implement the language-neutral remote store protocol and run its conformance path. `TelemetrySource` is a frozen port type with no plugin registration surface in this release.
30
+ `BuildStore` and `BlobStore` contract types are exported for remote-server authors, but BuildStore is **not** an in-process manifest map: implement the language-neutral remote store protocol and run its conformance path. The optional `BuildStore.getLatestArtifactMeta` capability must return only the latest metadata in constant-size reads without loading blob content or listing revisions; omit it when unsupported. `TelemetrySource` is a frozen port type with no plugin registration surface in this release.
31
31
 
32
32
  ### `ticket-source`
33
33
 
@@ -61,7 +61,12 @@ Declare served model prefixes and a default. Optional tool-free `oneShot` sits b
61
61
  Reconcile requires the optional grouped `Forge.rewrite` capability:
62
62
 
63
63
  1. Snapshot the actual build branch into a build-private ref.
64
- 2. Publish immutable exact-SHA refs under `refs/autobuild/archive/<slug>/<sha>`.
64
+ 2. Publish immutable exact-SHA refs under `refs/autobuild/archive/<slug>/<sha>`. Remote
65
+ archives also publish commits present only on the remote: GitHub uses create-only
66
+ Git-reference REST creation when the workspace lacks the commit, retaining guarded
67
+ Git pushes for local objects. Exact remote readback confirms publication, then a
68
+ depth-one fetch by the archive ref (without tags or configured refmap expansion)
69
+ restores missing commits and verifies them locally before returning.
65
70
  3. Replace the explicit branch, leased on an explicit expected remote head.
66
71
 
67
72
  - Return `lease-mismatch` separately from transport, auth and policy failures.
@@ -71,6 +76,45 @@ Reconcile requires the optional grouped `Forge.rewrite` capability:
71
76
  - Older forge plugins still load; reconcile refuses them actionably.
72
77
  - Remote workspace providers also need trusted `WorkspacePublication.rewrite` after guest teardown; ordinary `publish` can't publish a restack.
73
78
 
79
+ ### Destination observation and ancestry
80
+
81
+ `remoteBranchSha(branch)` must read the authoritative forge branch. Its absence
82
+ or failure defers observation; there is no host-checkout fallback. The optional
83
+ `isCommitAncestor(ancestor, descendant)` compares immutable full OIDs: return
84
+ false only for a proven non-descendant, and throw for missing objects, transport,
85
+ authentication, malformed responses or rate limits. Missing capability withholds
86
+ new replay requiring proof. GitHub uses exact-SHA comparison; local-git requires
87
+ an explicit served `repoRoot`. Unknown ancestry never authorizes replay.
88
+
89
+ Stores may expose `getNodeRewrite(node, previousHead, beforePrevious)` as a bounded point
90
+ lookup of a durable `node.rewritten` receipt. Built-in adapters index these
91
+ validated publication facts atomically with append, including transactional
92
+ deposits. The dispatcher uses at most 64 hops per baseline to prove kernel node
93
+ restacks and records `target.moved.lineage` for scoped runners. There is no
94
+ history-download fallback when the capability or a receipt is absent.
95
+ With `beforePrevious`, return the publication immediately preceding the latest
96
+ receipt keyed by that previous head, using indexed cursor and result lookups.
97
+ This lets lineage proofs cross forward sibling landings between restacks; every
98
+ intervening forward gap still requires immutable ancestry proof.
99
+
100
+
101
+ ### Workspace preservation
102
+
103
+ Remote providers expose trusted `WorkspacePublication.preserve` and
104
+ `recoverCandidate`; local providers may supply `WorkspaceProvider.preservation`
105
+ without changing the remote-publication discriminator. Missing capabilities fail
106
+ safely at destructive boundaries. `WorkspaceRecovery.fence(handle)` reports
107
+ confirmed, absent, or unknown without deleting an environment or its snapshots.
108
+ Only dispatcher-authorized reap follows the durable fence and preservation/loss
109
+ receipt. `provision` accepts exact `restoration` heads; branch ancestry must be
110
+ verified, and detached producer objects must never overwrite the named branch.
111
+ Provision/start failures signal `WorkspaceCleanupRequired` rather than deleting
112
+ or implicitly recreating an existing checkout. A confirmed `snapshot_not_found`
113
+ lookup establishes filesystem absence, while retaining the stale name for
114
+ dispatcher-authorized deletion. Other provider failures remain unknown and must
115
+ never be converted into loss evidence. Credentials stay in trusted transport policy,
116
+ never guest environment or agent commands.
117
+
74
118
  ### Publication readback
75
119
 
76
120
  Publication succeeds only when an authoritative branch-head readback equals the frozen intended SHA, including recovery after a failed push. Unconfirmed candidate ancestry never proves publication.
@@ -445,3 +489,8 @@ listings, CLI ticket lists and dispatcher ready scans remain exhaustive through
445
489
  `listReady`/`listAll`. The hosted PostgreSQL source counts matches without
446
490
  bodies and reads only the SQL-bounded window. File, Linear and the remote
447
491
  `HostedTicketSource` retain fallback; the POST list-ready protocol stays exhaustive.
492
+
493
+ Hosted cooldown recording rejects observed reset deadlines beyond the 24-hour
494
+ admission horizon explicitly; adapters must not shorten or invent a provider
495
+ reset to evade this validation. Operator forge-clear is an audited override,
496
+ not a successful provider observation.