@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
package/docs/accounts.md CHANGED
@@ -5,6 +5,44 @@ subscription within ordinary individual usage. Claude and Kimi credentials are
5
5
  provisioned manually; Autobuild never runs `claude setup-token`. ChatGPT
6
6
  accounts use OpenAI's browser authorization through the CLI.
7
7
 
8
+ ## Dispatcher admission
9
+
10
+ Before taking the repository lease, a local dispatcher checks every account
11
+ selected by an effective primary or alternate route, including internal roles
12
+ and agent verify/finalize steps. Unused declared accounts do not block dispatch;
13
+ `ab init --validate` still checks them for readiness. Availability means a
14
+ nonempty configured environment variable or a matching, safely owned local
15
+ refreshing login (`bun ab accounts login NAME --local`). A failed, unsafe,
16
+ mismatched local record fails closed. Startup inspects a ready login owned by a
17
+ live peer without claiming it, so a second dispatcher can yield to the repository
18
+ lease holder; execution claims the login only after acquiring the lease. An external access
19
+ token remains usable when no local login record exists. Startup checks presence,
20
+ without inference or provider validation. Local worktree Claude execution can
21
+ also use the host login without a configured token; sandbox and hosted execution
22
+ require the configured credential slot. Missing sources produce one error with
23
+ all account names, variable names and remedies, before any work is claimed.
24
+
25
+ Successor preflight checks the same sources without claiming or refreshing the
26
+ predecessor's login. A missing source refuses handoff and raises upgrade
27
+ attention while the predecessor stays active. Accepted config changes that
28
+ require unavailable accounts hold new account-dependent work.
29
+
30
+ Hosted ticks resolve selected accounts only from project secrets, never from
31
+ deployment credentials or local logins. An absent secret raises one durable
32
+ repository condition per account; repeated ticks do not repeat the condition or
33
+ spend build infrastructure attempts. Set it with `bun ab secrets set VARIABLE`,
34
+ or renew ChatGPT with `bun ab accounts login NAME --project`. The next tick
35
+ recovers automatically, without a per-build retry. Running executions continue
36
+ to be observed and their policies repaired; controls and cleanup continue.
37
+ A provisioning race uses the same repository condition and remains retryable.
38
+ Presence and rejection are separate: present but rejected credentials retain
39
+ account-specific rejection attention.
40
+
41
+ For local Claude subscriptions, renew with `claude setup-token` and set the
42
+ dispatcher credential variable. For Kimi, replace the membership key in that
43
+ variable. For local ChatGPT, sign in again with `bun ab accounts login NAME
44
+ --local`. Diagnostics contain source names and remedies, never secret values.
45
+
8
46
  ```toml
9
47
  [accounts.personal]
10
48
  kind = "claude-subscription"
@@ -35,6 +73,12 @@ requires its membership key. Invalid credentials need renewal (`claude setup-tok
35
73
  for Claude, replacement membership key for Kimi); quota and overload failures
36
74
  retain alternate fallback.
37
75
 
76
+ Selected Claude/Kimi credentials stay out of process arguments: each invocation
77
+ uses a private 0700 directory and a regular 0600 settings file, removed after
78
+ normal exit, launch failure or cancellation. The settings preserve selected-account
79
+ authentication precedence over saved user/project settings. Remote settings and
80
+ environments continue to contain placeholders only.
81
+
38
82
  Choose the region of your Kimi membership. The default `overseas` selects
39
83
  `https://api.kimi.ai/coding/`; `china` selects `https://api.kimi.com/coding/`.
40
84
  The base URL and egress hostname are fixed together and cannot be overridden
@@ -90,7 +134,12 @@ client identifier belongs to the authorized ChatGPT registration. Reauthorizatio
90
134
  keeps identity and registration associated. Never copy the ambient Codex login.
91
135
 
92
136
  Exactly one owner refreshes each connection: the local dispatcher or the
93
- hosted refreshing secret. Credentials rotate atomically before delivery. Expired access tokens remain
137
+ hosted refreshing secret. Both owners refresh only at or after the maximum of
138
+ any provider earliest-refresh floor and their pre-expiry threshold. Local renewal
139
+ uses a one-minute margin; hosted renewal uses ten minutes to tolerate a delayed
140
+ five-minute tick. Before refresh is due, still-valid access is supplied unchanged.
141
+ Expired access behind a future provider floor is never delivered.
142
+ Credentials rotate atomically before delivery. Expired access tokens remain
94
143
  refreshable after dispatcher downtime; a live validator or dispatcher claim
95
144
  cannot be displaced. Only a proven dead process or a released claim permits
96
145
  a successor to own renewal.
@@ -78,6 +78,8 @@ pre-revision reviews, verification, and finalize completion do not satisfy the
78
78
  new run. Historical phase runs remain pinned to the revision they saw. An
79
79
  already-open pull request is retained and updated rather than duplicated.
80
80
 
81
+ 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.
82
+
81
83
  The two events make interrupted work safely resumable. If the answer was
82
84
  recorded but `spec.revised` was not, a repeated revision command publishes the
83
85
  body named by that earlier answer; it does not read or authorize a newly
@@ -104,4 +106,5 @@ Active verification/reconcile or writer work, restack/reparent work, pause,
104
106
  pending controls, merge intent and ended PRs refuse the no-escalation path.
105
107
  A concurrent state change refuses publication with a retry explanation;
106
108
  uncited artifacts are inert. Leaves still require an open escalation and
107
- restart from `plan`.
109
+ restart from `plan` after any unfinished reconcile resumes under the revised
110
+ spec and its publication is confirmed.
@@ -148,6 +148,13 @@ shape changes without a bump. Current-state consumers use the typed persisted
148
148
  read helpers in `store/reduced-reads.ts`; whole-array reducers remain pure
149
149
  reference projections for tests and explicit historical output.
150
150
 
151
+ **Ticket scan cadence.** BuildStore keeps one replaceable `scan_cadence` row
152
+ per repository, shared by fresh dispatcher processes. It acknowledges the
153
+ canonical changed-outcome scan event by sequence and stores only its scheduling
154
+ baseline, mode and input fingerprints. It is disposable coordination metadata,
155
+ not a reducer snapshot or authoritative outcome; loss permits a safe extra scan.
156
+ Keyed reads and atomic upserts have constant cost and never read journal rows.
157
+
151
158
  **Reducer snapshots.** The `BuildStore` port can keep, per scope (one build log
152
159
  or the repository journal) and registered reducer, that reducer's accumulator as
153
160
  of a cursor: `getReducerSnapshot(scope, reducer, version)` and
@@ -186,10 +193,23 @@ describes recovery and the supported-window boundary.
186
193
  All event-derived checkpoints include the combined read-catalog fingerprint in
187
194
  their keys, independently of numeric reducer versions. Snapshot envelopes validate
188
195
  that fingerprint; another catalog's rows remain untouched. Remote named values
189
- are canonical regardless of `x-autobuild-catalog-identity`, keeping their strict
190
- three-field JSON body unchanged. A reducer version mismatch, invalid envelope or
191
- unrepresentable finished shape raises `ReducerValueIncompatibilityError` with
192
- client/server versions and validation detail. No remote named read replays events.
196
+ keep their strict three-field JSON body `{version, cursor, value}`. Clients sending
197
+ both `x-autobuild-reducer-value-projection: 1` and an unrecognized
198
+ `x-autobuild-catalog-identity` receive the canonical answer, including source clients
199
+ whose catalog identity differs from the service's. The client projects the value
200
+ onto its own shape (`projectReducerValue` in `store/reducer-value-validation.ts`),
201
+ dropping unknown properties, so reducer version skew alone is not an error.
202
+ Published clients with a recorded published catalog identity, or without a catalog
203
+ identity, receive answers projected onto their
204
+ frozen released contracts in `store/remote/released-reducer-values/` and stamped
205
+ with their released reducer versions, including projection-capable published clients.
206
+ `reducerValueForClient` omits optional `lastEvent` fields with newer event variants,
207
+ including nested build state, and filters `seenTypes` to known event types while
208
+ preserving canonical cursor, progress, and compatibility facts. An invalid envelope
209
+ or an unrepresentable required value raises `ReducerValueIncompatibilityError`
210
+ with client/server versions and validation detail. See the
211
+ [reduced-value protocol](remote-store-protocol.md) for the response
212
+ contract. No remote named read replays events.
193
213
  Repository digest batches likewise return the server batch with one scoped
194
214
  request and no discovery or per-build fallback.
195
215
 
@@ -268,7 +288,12 @@ Operator passes are single-flight per repository, with requests arriving during
268
288
  pass queued for one trailing pass. Fresh readers use persisted cache rows too;
269
289
  steady-state event-row cost depends on newly appended events at fixed build/run
270
290
  cardinality, not on log length. Reduced collections may legitimately grow in JSON
271
- size. Cache loss or corruption can replay history once to recover the same answer.
291
+ size. Ordinary reducer cache loss or corruption can replay history once to recover
292
+ the same answer. Checkpoint-backed `buildStreamSeed` and `repositoryAttention`
293
+ generations instead fail with typed `checkpoint-integrity` for missing admitted
294
+ canonical state, corrupt existing state or unreadable storage. New-identity rebuilds
295
+ and valid legacy-coverage repair remain separate cases; see the
296
+ [checkpoint rules](remote-store-protocol.md#hosted-event-bounds-and-exact-resume).
272
297
 
273
298
  Watch and wait register from a compound persisted `buildStreamSeed` at cursor C.
274
299
  Its build accumulator, deferral ledger and insertion-ordered historical PR
@@ -276,8 +301,11 @@ eligibility describe that same prefix. Ordinary polling, including the first
276
301
  batch on an old build, reads only events after the cursor and advances that seed
277
302
  event by event, preserving state at event N in each emitted record. Watch uses
278
303
  historical eligibility for baseline suppression; wait retains its separate
279
- current-attention registration policy. Only an explicit `--since` older than C
280
- reconstructs a historical prefix once in `cli/historical-build-state.ts`.
304
+ current-attention registration policy. For an explicit `--since` older than C,
305
+ hosted stores retrieve an exact server-owned checkpoint and read only the bounded delta; local adapters retain
306
+ historical prefix reconstruction in `cli/historical-build-state.ts`. Hosted
307
+ cursors outside the tail window fail without replay; see
308
+ [hosted event bounds and exact resume](remote-store-protocol.md#hosted-event-bounds-and-exact-resume).
281
309
  Actual event listings, transcripts and cursor streams remain raw reads. The
282
310
  interactive terminal frontend retains its independently established incremental
283
311
  feed. `tools/persisted-reduced-reads.test.ts` scans production TypeScript calls
@@ -539,7 +567,17 @@ completion samples with journal ticks. Heartbeat renewal cannot invent progress.
539
567
  The memory, SQLite, Postgres and remote adapters share this contract, including
540
568
  no mutation after lease expiry and no partial publication on validation failure.
541
569
  Repository read failures fail a watch tick and retry on the next iteration;
542
- continuous failures use the existing five-minute persistent-tick attention.
570
+ continuous durably reported failures use the existing five-minute persistent-tick attention.
571
+ Watch mode keeps running when both a tick and its failure publication fail,
572
+ warning locally with both errors. Failed iterations wait at least the configured
573
+ interval or one second, whichever is longer. One bounded in-memory episode
574
+ retains the original error, count and observation window; recovery appends a
575
+ standalone `dispatcher.tick-failed` diagnostic before the next operational tick.
576
+ An unacknowledged diagnostic remains pending and may be duplicated after a lost
577
+ response. Reporting never closes a later tick boundary or gates committed
578
+ handoff acceptance. Explicit shutdown, supersession and fatal forge publication
579
+ still stop the loop; once mode rethrows the original tick error even if reporting
580
+ fails. Stopping before recovery leaves only local warnings for unreported failures.
543
581
  Failure settlement writes through the fenced backing store without reading the
544
582
  failed projection. Repository view writes distinguish a committed result from a
545
583
  subsequent refresh failure, retaining the last complete snapshot while propagating
@@ -574,6 +612,33 @@ counts actual schedules, not suppressed polls. Open session history is never a
574
612
  lock: a legacy dead session may remain open, while an actual takeover closes it
575
613
  explicitly.
576
614
 
615
+ `processes/workspace-preservation.ts` owns the non-destructive fence, immutable
616
+ checkpoint and durable receipt ordering shared by both release paths in the
617
+ dispatcher. `ports/workspace/commit-preservation.ts` inventories the unpublished
618
+ change and restores exact refs, keeping detached producer objects separate from
619
+ the named branch. Provider provisioning and start failures signal
620
+ `WorkspaceCleanupRequired`; they cannot delete an existing build checkout.
621
+
622
+ Before releasing or replacing a build workspace, the dispatcher confirms a
623
+ non-destructive execution fence for the exact workspace and execution generation.
624
+ It preserves unpublished branch commits and distinct detached producer candidates
625
+ under immutable `refs/autobuild/archive/<build>/<sha>` refs, verifies their exact
626
+ readback, and records `workspace.commits-preserved` before cleanup. Replacement
627
+ provisioning restores those exact refs before starting an agent. Preservation
628
+ never advances the public build branch. A confirmed absent environment records
629
+ `workspace.commits-lost`, naming known candidates and explicitly noting that any
630
+ additional unpublished SHAs could not be inspected. Unknown fencing, inspection,
631
+ transport, or receipt-write outcomes leave the workspace and snapshots intact.
632
+ Fencing is revalidated after restart; a saved receipt alone never authorizes
633
+ cleanup of a newer execution. Current recovery notes are linked by the session
634
+ manifest's `workspaceRecovery` field. Recovery notes apply to the next session
635
+ and repeat hydration within it; empty checkpoints produce no note. Checkpoints survive
636
+ repeated replacement until a published reconcile or restack rewrite retires them,
637
+ so an old preserved branch cannot overwrite that rewrite. Before the first
638
+ branch publication, preservation compares against the recorded workspace base.
639
+ A confirmed `snapshot_not_found` response means the sandbox filesystem is gone;
640
+ cleanup records loss and deletes its stale name before replacement.
641
+
577
642
  **Store authority.** `packages/core/src/store/build-scope.ts` wraps every adapter with one
578
643
  build's authority. Own-build record/event/artifact/lease/subscription calls
579
644
  delegate; foreign-build, collection/admin, close, and repository-journal calls
@@ -597,6 +662,17 @@ and workspace adapter fields stay pinned; changed values are durable restart
597
662
  notices rather than partial adapter swaps. `--once` retains static startup
598
663
  configuration.
599
664
 
665
+ Lease sweeps in `processes/dispatcher.ts` retain at most 128 parsed build
666
+ effective-config pins in deterministic LRU order. Each sweep probes
667
+ `BuildStore.getLatestArtifactMeta` (one latest metadata row, no blob or revision
668
+ listing) before reuse; artifact-only revision changes force a full reread.
669
+ Current facts, live deployment settings and cycle captures are composed afresh.
670
+ Errors invalidate reuse and retain diagnostic/refusal and repair behavior.
671
+ Launch, resume and merge boundaries still read fresh artifacts. Restart,
672
+ eviction and adapters lacking metadata support preserve decisions with full
673
+ reads. Remote clients remember explicit unsupported-route/operation responses
674
+ per client and fall back to full artifact reads, never event replay.
675
+
600
676
  `config/pipeline-source.ts` strictly reads the runner's execution checkout.
601
677
  `processes/verify-cycle-config.ts` deposits immutable cycle config and checks
602
678
  build-owned identity and source ancestry at settled stage boundaries. Typed
@@ -737,6 +813,14 @@ full gate inspection and refreshed durable consent/engine eligibility precede
737
813
  any repair. Body comparison tolerates provider trimming of trailing whitespace
738
814
  while preserving the complete headline, body content, and squash method.
739
815
 
816
+ Destination observations retain versioned, head-bound Git witnesses (reachable
817
+ commit SHAs and direct build trailers) and a fixed-length evidence digest. Current
818
+ confirmed landings and aliases from only the destination's accepted ancestry are
819
+ reapplied before reuse. Unrelated merged history and ready destinations do not
820
+ invalidate this proof. Head changes require a fresh Git sample; legacy observations
821
+ without witnesses refresh once rather than replaying repository history. Current
822
+ readiness and newest-generation checks still apply before claim.
823
+
740
824
  Optional `Forge.readCommitMessage` and `Forge.containsBuild` capabilities expose
741
825
  actual merged messages and exact trailer presence in reachable branch history.
742
826
  The janitor records optional `pr.merged.buildTrailerPresent` for normal and abort
@@ -767,9 +851,11 @@ permanent-failure classifier), and `session-env.ts` (per-turn environment merge
767
851
  that fronts `bin/agent/ab` on `PATH`). The pi CLI owns its login and model
768
852
  catalog; the shipped bridge limits tools and refreshes each turn's subprocess
769
853
  environment without writing session state into the workspace. Adapters own
770
- native error extraction; processes own durable failure policy — the transcript
771
- is always deposited, and a turn's typed terminal always beats a late failure
772
- signal.
854
+ native error extraction; processes own durable failure policy — transcript
855
+ deposition is attempted, and a turn's typed terminal always beats a late failure
856
+ signal. An oversized transcript deposition after a successful durable terminal
857
+ preserves that terminal without failing or retrying the completed phase; without
858
+ a terminal, the oversized write parks the phase as described below.
773
859
 
774
860
  **Plugin bootstrap and CLI composition.** `packages/core/src/plugins/load.ts` resolves
775
861
  repository-path modules from the config-bearing root and bare packages from an
@@ -902,6 +988,32 @@ queue. The supervised kernel child owns every slow
902
988
  adapter operation, so slug naming, provisioning, runners, and Harvest cannot
903
989
  block input.
904
990
 
991
+ Startup restores a validated `dispatchFrontend` checkpoint incrementally only
992
+ when its cursor is within the 1,000-event repository tail window. Older caches
993
+ use the repository-state recovery seed instead. Startup catch-up and prelaunch
994
+ boundary reads enforce that window at selection, including concurrent appends;
995
+ cursor expiry permits one additional seed recovery, never historical gap replay.
996
+ Transfer is bounded by the existing state seed plus a fixed number of windowed
997
+ tails, independently of discarded history (the seed itself retains durable facts
998
+ and the latest run tail). High water is sampled before the sparse seed so later
999
+ updates remain consumable. Steady-state reads and save cadence are unchanged.
1000
+
1001
+ The frontend's `dispatchFrontend` checkpoint retains dashboard facts plus only
1002
+ the latest run-started fact and the sampled lease holder's start (deduplicated).
1003
+ Identity history is always partial, including normalized legacy version-4
1004
+ caches; a missing holder is resolved through the bounded per-run reduced read.
1005
+ Successful lease samples select or clear the retained holder; failed metadata
1006
+ reads preserve the last selection. Snapshot saves track cursor and effective
1007
+ retained-state changes locally: written, refused and unsupported attempts settle
1008
+ that projection and are never repeated unchanged. Ordinary dirty saves are at
1009
+ least 30 seconds apart. Transport/store failures retry without new events after
1010
+ 30, 60, 120, 240, then 300 seconds (capped). Concurrent saves share one request;
1011
+ only its captured projection is acknowledged. Teardown forces a dirty save past
1012
+ the time gate, while settled state stays quiet. Equal-cursor refusal does not
1013
+ make correlation durable: restart reconstructs it through bounded holder lookup,
1014
+ and the next advancing-cursor checkpoint carries it without relaxing snapshot
1015
+ ordering. A validated, already normalized restored checkpoint starts clean.
1016
+
905
1017
  `packages/core/src/cli/dashboard/refresh.ts` owns the shared presentation read
906
1018
  scheduler for both terminal paths: focused by default, independent of focus for
907
1019
  local stores, and 5-second polling when unfocused for network stores,
@@ -1057,6 +1169,34 @@ A claim freezes the ticket's current assets into the build (SPEC §6.3):
1057
1169
  reducer projects them, `getPinnedTicketAsset` reads them back by pinned revision,
1058
1170
  and `ab context` writes them under `$AB_CONTEXT_DIR/assets/`.
1059
1171
 
1172
+ `kernel/ticket-preparation.ts` projects unfinished `ticket-preparation.*` facts
1173
+ through `repositoryReadFacts`; `processes/dispatcher.ts` retries them under the
1174
+ existing repository ownership before intake. This pre-record recovery differs
1175
+ from `dispatch.failed`, which completes an already established build.
1176
+
1177
+ Before claiming, the dispatcher journals a repository-scoped preparation intent;
1178
+ a won claim and the exact selected creation slug are durable boundaries. Caught
1179
+ asset-copy, spec-authoring, naming, and build-creation failures return the ticket
1180
+ to configured Ready; a nonconforming spec goes to configured Triage. Recovery
1181
+ checks the exact selected build first: a matching record and atomic
1182
+ `build.created` retain ownership even if creation threw after committing.
1183
+ Unavailable or conflicting readback never authorizes release or a replacement
1184
+ build. Pending attempts retain the original failure, latest recovery error and
1185
+ retry deadline in the canonical repository reduced value; resolved attempts
1186
+ leave that value. Under repository ownership, each tick admits at most eight
1187
+ due recovery attempts, before intake and independently of capacity or intake
1188
+ settings, with a 30-second durable retry delay after recovery failure. Unresolved
1189
+ ticket identities remain withheld. An uncertain claim outcome or unrelated
1190
+ external ticket state, missing ticket/state, or conflicting slug ownership terminates
1191
+ automatic recovery with an `abandoned` resolution and diagnostic reason. The
1192
+ ticket is left unchanged; an operator can leave it finished or cancelled, or
1193
+ inspect ownership and explicitly return it to Ready for another attempt. These
1194
+ cases stop provider polling and diagnostic appends. Recovery failures are
1195
+ reported without preventing janitor, lease sweep, or other dispatch recovery.
1196
+ This is not general process
1197
+ crash recovery. Confirmed Ready/Triage transitions settle idempotently, so a
1198
+ failed bounce comment does not return an invalid ticket to Ready.
1199
+
1060
1200
  For hosted tickets, `store/ticket-asset-snapshots.ts` copies exact revisions
1061
1201
  into chunked immutable repository artifacts in the build store before pinning.
1062
1202
  Reads use explicit manifest/chunk revisions without a ticket connection. Old
@@ -1236,7 +1376,9 @@ validates issuance, durable lifecycle bindings and the 60-second terminal grace;
1236
1376
  principals. `remote-store-server.ts` enforces resource mutations before deposits,
1237
1377
  including body-selected and addressed-stream resources. Operator routes reject
1238
1378
  these principals. Build-runner and build-phase grants may append only the
1239
- kernel's `dispatcher.forge-degraded` repository fact, in their own project,
1379
+ kernel's `dispatcher.forge-degraded` repository fact, in their own project
1380
+ (the exact repository in the delegated claim, enforced by the preceding
1381
+ `requireProject` check),
1240
1382
  so runner/CLI guards can record a newly observed rate limit and wait for
1241
1383
  durable dispatcher recovery. This exception grants no repository administration,
1242
1384
  recovery, lease, or other journal writes. The agent-visible build-scoped Store
@@ -1300,6 +1442,14 @@ explicit ticket URL. Project registration and ticket policy publication through
1300
1442
  `ab connect --tickets URL` work before dispatch. Policy is a durable per-registration
1301
1443
  record, outside BuildStore events/artifacts; legacy uploaded configuration remains
1302
1444
  a compatibility fallback. Hosted lifecycle defaults are triage/ready/doing/done.
1445
+ Hosted state initialization checks only the distinct configured role names through
1446
+ an indexed project/name lookup. Already-present names require no state mutation
1447
+ lock or writes. Missing names are rechecked under the project advisory lock and
1448
+ inserted in the same transaction. Custom-state creation and policy publication
1449
+ always take that lock; publication reads the previous policy under it and retains
1450
+ former role names atomically. Ordinary service requests do not eagerly list state
1451
+ counts; explicit state listings and legacy policy materialization still do.
1452
+
1303
1453
  Independent harvest uses revocable, expiring, service-bound ticket grants with
1304
1454
  read/create runner authority and read-only child authority. Build state and harvest
1305
1455
  journals remain exclusively in the selected BuildStore.
@@ -1334,6 +1484,8 @@ commit in the existing branch's history. Comparison uses reachability, so an
1334
1484
  advanced parent never makes an empty node nonempty. The janitor opens PRs lazily
1335
1485
  and reuses terminal cleanup without leaf reconcile or auto-merge.
1336
1486
 
1487
+ 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.
1488
+
1337
1489
  ### Leaf and reconcile restacking
1338
1490
 
1339
1491
  The kernel prepares a detached replay of one net build change on the base frozen
@@ -1344,6 +1496,11 @@ Historical merge completions retain their original shape and semantics.
1344
1496
 
1345
1497
  The optional grouped Forge rewrite capability owns authoritative head snapshots,
1346
1498
  immutable `refs/autobuild/archive/<slug>/<sha>` publication and expected-head CAS.
1499
+ Remote archives also publish commits present only on the remote: GitHub uses create-only
1500
+ Git-reference REST creation when the workspace lacks the commit, retaining guarded Git
1501
+ pushes for local objects. Exact remote readback confirms publication, then a depth-one
1502
+ fetch by the archive ref (without tags or configured refmap expansion) restores missing
1503
+ commits and verifies them locally before returning.
1347
1504
  GitHub uses explicit Git transport leases; local-git uses shared-database
1348
1505
  `update-ref` CAS without network calls. Exact authoritative readback acknowledges
1349
1506
  publication. Remote-backed local refs are caches refreshed without expected-old
@@ -1371,6 +1528,8 @@ verification when build-owned config is unchanged, even when the old pin commit
1371
1528
  is no longer an ancestor. Changed config still supersedes while waiting.
1372
1529
  Ancestry gates cycles that run further steps; those cycles capture fresh config.
1373
1530
  Object packs retain newly introduced replay trees/blobs as well as commit bytes.
1531
+ Replay retention stores thin Git packs in bounded binary chunks, with a fixed-size completion manifest written only after every chunk is acknowledged. Digest-keyed chunks make interrupted writes retryable; incomplete uploads are never restored. Recovery validates all chunk sizes and the pack digest before installation, and requires the base objects (restoring node prefixes in order). Existing single-artifact base64 packs remain readable. Retained replay artifacts are read only when the requested commit is missing locally, never by idle polling.
1532
+
1374
1533
 
1375
1534
  GitHub archive push/fresh-fetch and rewrite contracts are manual opt-in cases in
1376
1535
  `ports/forge/github.live.test.ts`, using `AB_RUN_LIVE_PORT_CONTRACTS=1` and an
@@ -1379,6 +1538,13 @@ live provider evidence.
1379
1538
 
1380
1539
  ### Descendant node restacking
1381
1540
 
1541
+ `kernel/node-restack-demand.ts` fingerprints semantic presence evidence for durable
1542
+ `node.restack-availability-observed` facts. The dispatcher checks this reduced value
1543
+ before repository preparation; transactions retain unavailable requests and explicitly
1544
+ settle obsolete destinations. Landing and ancestry changes invalidate waiting results
1545
+ even at unchanged Git heads. Targeting-leaf cancellation runs only at the actionable
1546
+ replay boundary using `landing-publication.ts` receipts, including recovery.
1547
+
1382
1548
  `kernel/node-restack.ts` inventories the contribution above the durable previous
1383
1549
  base, proves foreign merge safety against the sampled parent's full identity set,
1384
1550
  and replays individual changes. `kernel/node-restack-state.ts` reduces writer
@@ -1547,6 +1713,19 @@ a new classified failure parks again. There are zero automatic paid retries
1547
1713
  after this deferral. If evidence cannot be written, ordinary recovery applies;
1548
1714
  agent output and `no-terminal` alone never classify a read failure.
1549
1715
 
1716
+ A kernel store write rejected with HTTP 413 raises `StoreWriteTooLargeError`
1717
+ and records `phase.failed {willRetry:false}` on its first attempt, including
1718
+ for automatic restack and session preparation. Its diagnostic names an oversized
1719
+ store write, the HTTP method and route, exact UTF-8 request bytes, and the
1720
+ server message (including any reported ceiling). It parks with
1721
+ `non-retryable-phase-failure`; an operator answer authorizes a fresh attempt,
1722
+ which parks immediately again if still rejected. Store failures never select an
1723
+ alternate provider. After a successful durable terminal, an oversized transcript
1724
+ deposition during optional cleanup preserves that terminal without recording a
1725
+ phase failure or retrying the completed phase. Without a terminal, the oversized
1726
+ write follows the parking policy above. Other store statuses retain their
1727
+ existing retry policy.
1728
+
1550
1729
  Ordinary silence, provider failures and session timeouts retain the runner's
1551
1730
  phase failure limit (`BuildRunnerOpts.maxPhaseAttempts`, default 2). This is
1552
1731
  an internal runner option, not an accepted `[policy]` TOML key. Reconcile
@@ -1554,6 +1733,51 @@ execution and unchanged-base progress budgets retain their existing accounting.
1554
1733
 
1555
1734
  ## Forge failure recovery
1556
1735
 
1736
+ Destination heads come only from the authoritative forge branch; dispatcher-host
1737
+ refs are never a fallback. Failed remote reads retain the accepted observation;
1738
+ classified rate limits use repository forge degradation and cooldown. Changed
1739
+ heads require immutable commit ancestry proof against the accepted target and
1740
+ the destination base already used by replay. Missing capability or failed proof
1741
+ defers new replay. A non-descendant without kernel lineage records
1742
+ `target.rewritten` with branch,
1743
+ previous SHA and observed SHA, retains the accepted target, and raises watch/wait
1744
+ attention. Repeated rewrite pairs are deduplicated. Returning to a safe target
1745
+ clears attention (`target.rewrite-cleared` when the accepted tip is unchanged).
1746
+ Upstream force-pushes are never adopted automatically. Accepted node reparenting
1747
+ starts a new branch scope; frozen transactions recover their retained inputs.
1748
+
1749
+ Kernel restacks of a node are admitted through durable guarded publication
1750
+ receipts, not treated as external force-pushes. The dispatcher walks an index
1751
+ keyed by node and previous head, at most 64 receipt lookups from each child
1752
+ baseline; cost is capped independently of journal length or total receipts.
1753
+ Exact links use point lookups. When forward child landings separate restacks,
1754
+ the dispatcher walks backwards from the latest publication with an indexed
1755
+ previous-receipt cursor. Every gap requires immutable ancestry from the earlier
1756
+ published head to the later receipt's previous head, as do the baseline and tip
1757
+ ends of the proof. Missing links never imply rewrite authority.
1758
+ The proven receipts travel in `target.moved.lineage`; build-scoped runners use
1759
+ that recorded proof without reading another build. Clearing attention for an
1760
+ unchanged accepted SHA retains newly proven lineage in `target.rewrite-cleared`.
1761
+ Missing receipts or a gap
1762
+ over 64 still record `target.rewritten` and raise attention. Each hop makes at
1763
+ most two immutable ancestry comparisons. The exact walk and gap recovery share
1764
+ the same 64-read cap, including unsuccessful lookups. Unchanged accepted
1765
+ polls read no receipts or event rows.
1766
+
1767
+
1768
+ A historical `publication.lost` does not prove that every copy of its candidate
1769
+ is gone. Recovery checks the exact branch and private archive refs and retained
1770
+ replay objects first. An available candidate continues guarded publication.
1771
+ A genuinely missing reconcile or automatic restack candidate records
1772
+ `publication.candidate-retired`, abandons its obsolete request, and replays the
1773
+ producing operation with a fresh transaction identity. Its frozen target,
1774
+ reconcile occurrence or automatic trigger, cycle, and message survive. The
1775
+ retired candidate is excluded from archive requirements unless independently
1776
+ required by proven history. This reconstruction consumes no infrastructure
1777
+ attempt and no additional conflict occurrence; it needs no operator guidance.
1778
+ A bare retry also clears an existing infrastructure-limit escalation through
1779
+ ordinary retry semantics. Unavailable inspection defers rather than proving loss.
1780
+
1557
1781
  `kernel/publication-retry.ts` selects eligibility from the publication ledger
1558
1782
  and shares the policy between `processes/build-runner.ts` and trusted
1559
1783
  `cli/publication-settlement.ts`. The lease sweep skips ineligible retained intents;
@@ -1563,7 +1787,7 @@ Leaf restack and reconcile publication retry classified transient forge or trans
1563
1787
  failures six times after the initial attempt, waiting 30, 60, 120, 240, 300 and
1564
1788
  300 seconds. `publication.retry-scheduled` records the operation, frozen rewrite
1565
1789
  identity, episode anchor, failure ordinal, last error and absolute retry time;
1566
- restart resumes that schedule without rerunning the resolver. These retries do
1790
+ restart resumes that schedule without rerunning a resolver whose candidate remains available. These retries do
1567
1791
  not consume `maxPhaseAttempts`. A seventh transient failure records
1568
1792
  `publication.retry-exhausted` and raises `publication-retry-limit`, naming the last
1569
1793
  error and six retries. Answering that escalation opens a fresh publication episode
@@ -1582,7 +1806,15 @@ clears it. `policy.janitorBackoffMaxSeconds` sets the positive integer cap.
1582
1806
 
1583
1807
  A classified forge rate limit records repository degradation with `resetAt`.
1584
1808
  Forge work waits during cooldown; passing the deadline permits a recovery
1585
- request, and only success clears degradation. A further limit extends cooldown.
1809
+ request; a successful probe records automatic recovery. An authorized operator
1810
+ may explicitly override erroneous recorded state with
1811
+ `ab repository forge-clear --forge <name> --reason <text>` or
1812
+ `repository.forge_clear {repo, forge, reason}`. This appends a human-attributed
1813
+ `dispatcher.forge-recovered` fact with the reason; it does not prove provider
1814
+ success. A subsequent actual limit records a fresh cooldown. Hosted admission
1815
+ requires a schema-valid finite ISO `resetAt` no later than server time plus
1816
+ 24 hours, inclusive; past deadlines remain valid. Rejection never clamps or
1817
+ invents a provider reset, and historical events remain readable.
1586
1818
  Native merge application failures keep candidate-specific retry eligibility,
1587
1819
  including automatic decisions without a human command. Retries recheck consent,
1588
1820
  holds, verification and the exact candidate. Uncertain enables remain pending
@@ -1648,14 +1880,23 @@ Active verification/reconcile or writer work, restack/reparent work, pause,
1648
1880
  pending controls, merge intent and ended PRs refuse the no-escalation path.
1649
1881
  A concurrent state change refuses publication with a retry explanation;
1650
1882
  uncited artifacts are inert. Leaves still require an open escalation and
1651
- restart from `plan`.
1883
+ restart from `plan` after any unfinished reconcile resumes under the revised
1884
+ spec and its publication is confirmed.
1652
1885
 
1653
1886
  Verification stages are planned purely in `kernel/verify-stages.ts`, shared by
1654
1887
  leaf and integration decisions in `kernel/engine.ts`. The build runner keeps
1655
1888
  only live per-member handles and recovery contexts; durable starts, outcomes,
1656
1889
  cancellations and failed-stage receipts drive every barrier and restart.
1657
- Fail-fast cancellation records facts before whole-execution teardown and
1658
- replacement. `kernel/verify-stage-state.ts` owns occurrence/session associations,
1890
+ Normal stage transitions drain terminal-reached agent turns before stage-local
1891
+ interruption, retaining session budgets and parent shutdown. This closes session
1892
+ brackets and deposits trailing evidence before summary publication. Fail-fast
1893
+ cancellation records facts before immediate whole-execution teardown and replacement.
1894
+ The dispatcher's lease sweep treats eligible running orphaned open brackets as
1895
+ pending cleanup even on an engine wait. It excludes live leases/executions,
1896
+ blocked or paused builds and idle collecting nodes, then uses ordinary runner
1897
+ attachment/reclamation. Proved-ended pending work bypasses first-claim grace;
1898
+ healthy ended workspaces are reused and lost environments follow fenced recovery.
1899
+ The predicate uses existing canonical reduced facts and adds no event-log reads. `kernel/verify-stage-state.ts` owns occurrence/session associations,
1659
1900
  including escalation supersession and complete implement feedback references.
1660
1901
 
1661
1902
  Human access uses `postgres-store/src/organizations.ts` and the shared hosted
@@ -1738,6 +1979,12 @@ and leaving ambient login untouched.
1738
1979
  Hosted validation uses write-only metadata and states that the first hosted
1739
1980
  build is the live check; local validation makes a minimal runtime request.
1740
1981
 
1982
+ Selected Claude/Kimi credentials stay out of process arguments: each invocation
1983
+ uses a private 0700 directory and a regular 0600 settings file, removed after
1984
+ normal exit, launch failure or cancellation. The settings preserve selected-account
1985
+ authentication precedence over saved user/project settings. Remote settings and
1986
+ environments continue to contain placeholders only.
1987
+
1741
1988
  Local sessions resolve host credentials after ambient merging. Remote sessions
1742
1989
  receive account placeholders; exact provider hostname and placeholder header
1743
1990
  matches broker real credentials on the host. Both Kimi endpoint and host derive
@@ -1752,6 +1999,18 @@ deltas and prior values retained across rotation.
1752
1999
 
1753
2000
  ### Hosted project deletion
1754
2001
 
2002
+ The browser requires the exact full repository identity in a transient dialog field;
2003
+ confirm stays disabled for empty or mismatched input and focus starts in the field.
2004
+ The handler independently binds that identity to the selected repository and its
2005
+ fresh validated preview. Only JSON `{deleted:true}` acknowledges completion.
2006
+ After any failed or unrecognized deletion response, the browser shows
2007
+ “Deletion outcome unknown; reload to check” and holds the row in its original slot
2008
+ without actions, even after dismissal. Only a complete successful discovery begun
2009
+ by Reload after the attempt settles it: absence removes the row, presence restores
2010
+ its authorized actions, and pending cleanup restores Finish deletion with a fresh
2011
+ preview and exact typing. An earlier or unsuccessful read cannot settle the outcome.
2012
+ The server's `{repo}` body and generation-bound If-Match contract are unchanged.
2013
+
1755
2014
  The Projects web surface allows super users and organization owners to preview
1756
2015
  counts and permanently delete their authorized projects with the shared confirmation dialog.
1757
2016
  PostgreSQL fences the registration generation before physical blob cleanup and
@@ -1767,3 +2026,25 @@ revokes credentials only; admin `projects remove` unregisters without purging.
1767
2026
  See [project deletion protocol](operator-api.md#permanent-project-deletion).
1768
2027
 
1769
2028
  The ticket-source port optionally exposes `listPage(criteria, page)` for paged operator reads. PostgreSQL counts matches and applies SQL LIMIT/OFFSET; other sources retain exhaustive-read slicing. CLI and dispatcher reads stay exhaustive. See [ticket source contract](ticket-sources.md#writing-your-own).
2029
+
2030
+
2031
+ Hosted event reads use the bounded capabilities in `store/event-reads.ts`:
2032
+ repository cursors must be at least `max(0, head - 1000)`, and build pages
2033
+ contain at most 256 events with `cursor` and `hasMore`. PostgreSQL seeks and
2034
+ limits at the database boundary, including held reads; remote complete-array
2035
+ reads reject partial suffixes. Protocol 7 is next-minor preparation for 1.4;
2036
+ supported published protocol-6 clients retain complete bounded arrays and
2037
+ legacy `conflict` refusals. Same-line runtime and published identities are
2038
+ admitted together, and both health surfaces use the shared validated identity
2039
+ projection without store reads. See [wire compatibility](remote-store-protocol.md).
2040
+ Exact historical watch/wait seeds come from
2041
+ rolling server-owned checkpoints in `postgres-store/src/stream-seeds.ts`.
2042
+ The canonical reducer fold publishes its cache and trailing checkpoints
2043
+ atomically under a reader-only lock. Initial adoption is an explicit resumable
2044
+ migration; later new identities rebuild once, then advance durably with deltas.
2045
+ Two live generations and permanent indexed retirement tombstones support
2046
+ adjacent runtimes without letting old processes evict newer ones. Watch/wait
2047
+ propagate expiry and integrity errors, preserving valid cursors across reducer
2048
+ upgrades. Expired cursors require re-arming without `--since` and status
2049
+ reconciliation. Harvest completion uses reduced session terminal receipts;
2050
+ explicit harvest history uses reverse indexed pages.
@@ -83,3 +83,21 @@ To add a backend:
83
83
  2. Pass the unchanged `describeBuildStoreContract` and `describeBlobStoreContract` suites from `@defrex/autobuild/testing`, on isolated fixtures with real persistence.
84
84
 
85
85
  To serve it to the shipped CLI, implement the normative remote store protocol, not a new route catalog. Meet its conformance section and test the real remote client against your server.
86
+
87
+ ## Hosted dispatch and local viewing
88
+
89
+ A plain `ab dispatch` reads dispatch placement once before starting local execution.
90
+ For a hosted project it opens the Store-only viewer automatically, displaying
91
+ `viewer · dispatched by <host>` from the placement origin (including a nondefault
92
+ port). `--once`, `--plain`, and `--interval` retain their viewer meanings.
93
+ `--takeover` explicitly dispatches locally, with a warning that it can displace
94
+ the hosted dispatcher; it cannot be combined with `--viewer`. Startup intake
95
+ flags require `--takeover` when placement selects viewer.
96
+
97
+ An unreadable placement fails closed with a typed error naming the cause:
98
+ use `--viewer` to watch or `--takeover` to dispatch locally. Both explicit modes
99
+ skip placement discovery. Older services without the capability and projects
100
+ with unknown or nonhosted placement retain local dispatch behavior. Local stores
101
+ need no placement request. Origin mode (`--repository` or `AB_REPOSITORY`) and
102
+ hosted cron dispatch bypass this check. Placement is a startup snapshot, not a
103
+ liveness probe or a polling input.
package/docs/builds.md CHANGED
@@ -35,8 +35,12 @@ bun ab answer <slug> --revise-spec revised-spec.md
35
35
  | `plan ⇄ plan-review` | planner proposes a plan | the spec |
36
36
  | `implement ⇄ code-review` | implementer makes local commits | the spec and plan |
37
37
 
38
+ 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.
39
+
38
40
  Either reviewer approves, requests revisions with structured findings, or escalates a question.
39
41
 
42
+ The planner and plan reviewer also check whether the required work fits one implement session. Most plans need no estimate; ordinary large plans and plans comfortably under the ceiling proceed. When the concrete work clearly exceeds that ceiling, the planner escalates before depositing a plan, or the plan reviewer escalates instead of requesting removal of required scope. The escalation carries evidence and a proposed split: seams, what each resulting ticket owns, and the blocker graph. See [sizing and splitting](spec-standard.md#fit-one-implement-session) for the sizing signals and seam guidance.
43
+
40
44
  - **Sessions.** Each phase gets its own session; the producer keeps it across a loop's rounds, and each reviewer round starts fresh.
41
45
  - **Context** passes between phases as durable artifacts: spec, approved plan, implementation notes, findings, and verification reports.
42
46
 
@@ -61,10 +65,12 @@ Once verification passes, the finalize agent writes the PR description; Autobuil
61
65
 
62
66
  ## When a human is needed
63
67
 
64
- After grooming, escalations are the judgment gates. A build parks with a recorded question on an unclear requirement, a persistent review disagreement, or an exhausted policy bound.
68
+ After grooming, escalations are the judgment gates. A build parks with a recorded question on an unclear requirement, required work that clearly exceeds one implement session, a persistent review disagreement, or an exhausted policy bound.
65
69
 
66
70
  Your operator agent answers bounded questions from your instructions and brings unresolved product decisions to you. Restarting dispatch doesn't answer a question, and an answer doesn't force success.
67
71
 
72
+ For an oversized-work escalation, your operator agent decides the split and files the resulting tickets, bringing unresolved product decisions to you. Autobuild does not split or file them automatically.
73
+
68
74
  Merge consent is a separate policy decision your operator agent manages. Repositories can require it even for a green build; verification, forge checks, and merge gates still apply. See [integration and merge policy](integration-overview.md).
69
75
 
70
76
 
package/docs/cli.md CHANGED
@@ -13,7 +13,7 @@ Run `bun ab <command>`; `bun ab help <command>` lists flags and subcommands. See
13
13
 
14
14
  - `accounts` — Authorize a ChatGPT subscription for a local dispatcher or connected project.
15
15
 
16
- - `dispatch` — Run the dispatcher and dashboard.
16
+ - `dispatch` — Run the dispatcher and dashboard; missing selected account credentials refuse local startup before the lease. See [account admission](accounts.md#dispatcher-admission).
17
17
  - `init` — Install skills and hand setup to a coding agent.
18
18
  - `upgrade` — Update Autobuild and merge default skills.
19
19
  - `connect` — Connect to a hosted service with browser approval.