@defrex/autobuild 1.3.0 → 1.4.1

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 (144) hide show
  1. package/README.md +1 -1
  2. package/SPEC.md +307 -27
  3. package/docs/accounts.md +38 -0
  4. package/docs/architecture.md +198 -25
  5. package/docs/build-store.md +18 -0
  6. package/docs/builds.md +5 -1
  7. package/docs/cli.md +1 -1
  8. package/docs/configuration.md +38 -19
  9. package/docs/dispatcher-hosting.md +42 -0
  10. package/docs/dispatcher.md +41 -0
  11. package/docs/forges.md +5 -0
  12. package/docs/integration-tree.md +8 -0
  13. package/docs/operating.md +11 -3
  14. package/docs/operator-api.md +37 -4
  15. package/docs/plugin-authoring.md +45 -1
  16. package/docs/remote-store-protocol.md +262 -42
  17. package/docs/remote-ticket-protocol.md +12 -10
  18. package/docs/restacking.md +60 -3
  19. package/docs/setup.md +37 -8
  20. package/docs/skills.md +1 -1
  21. package/docs/spec-standard.md +37 -3
  22. package/docs/troubleshooting.md +9 -0
  23. package/docs/workspaces.md +1 -1
  24. package/package.json +4 -3
  25. package/packages/core/src/accounts/availability.ts +96 -0
  26. package/packages/core/src/accounts/local-owner.ts +49 -2
  27. package/packages/core/src/cli/attention.ts +2 -0
  28. package/packages/core/src/cli/binary.ts +17 -1
  29. package/packages/core/src/cli/context.ts +62 -0
  30. package/packages/core/src/cli/dashboard/model.ts +12 -3
  31. package/packages/core/src/cli/dashboard/poll.ts +65 -8
  32. package/packages/core/src/cli/dashboard/refresh.ts +2 -0
  33. package/packages/core/src/cli/dashboard/render.ts +46 -5
  34. package/packages/core/src/cli/dispatch-args.ts +27 -3
  35. package/packages/core/src/cli/dispatch-frontend.ts +187 -53
  36. package/packages/core/src/cli/dispatch-mode.ts +94 -0
  37. package/packages/core/src/cli/dispatch-preflight.ts +43 -0
  38. package/packages/core/src/cli/dispatch-repository-feed.ts +45 -9
  39. package/packages/core/src/cli/dispatch.ts +145 -11
  40. package/packages/core/src/cli/harvest.ts +2 -1
  41. package/packages/core/src/cli/help.ts +16 -3
  42. package/packages/core/src/cli/historical-build-state.ts +6 -0
  43. package/packages/core/src/cli/main.ts +15 -2
  44. package/packages/core/src/cli/publication-settlement.ts +17 -0
  45. package/packages/core/src/cli/remote-poll.ts +11 -1
  46. package/packages/core/src/cli/repository-status.ts +11 -0
  47. package/packages/core/src/cli/status.ts +7 -1
  48. package/packages/core/src/cli/wait.ts +9 -2
  49. package/packages/core/src/cli/watch.ts +38 -3
  50. package/packages/core/src/config/roles.ts +16 -1
  51. package/packages/core/src/events/catalog.ts +7 -0
  52. package/packages/core/src/events/payloads.ts +85 -2
  53. package/packages/core/src/events/policy.ts +10 -0
  54. package/packages/core/src/events/repository.ts +35 -0
  55. package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +189 -0
  56. package/packages/core/src/kernel/dispatch-placement.ts +30 -0
  57. package/packages/core/src/kernel/engine.ts +19 -12
  58. package/packages/core/src/kernel/generators/leaf-restack-log.ts +17 -1
  59. package/packages/core/src/kernel/leaf-restack-state.ts +24 -2
  60. package/packages/core/src/kernel/log-index.ts +1 -1
  61. package/packages/core/src/kernel/node-landing.ts +27 -10
  62. package/packages/core/src/kernel/node-restack-demand.ts +1 -0
  63. package/packages/core/src/kernel/node-restack-state.ts +16 -1
  64. package/packages/core/src/kernel/node-restack-transaction.ts +14 -0
  65. package/packages/core/src/kernel/read-facts.ts +114 -9
  66. package/packages/core/src/kernel/reconcile-head.ts +34 -11
  67. package/packages/core/src/kernel/reconcile-restack.ts +106 -72
  68. package/packages/core/src/kernel/reducer-registry.ts +3 -0
  69. package/packages/core/src/kernel/reducer.ts +20 -2
  70. package/packages/core/src/kernel/replay-retention.ts +176 -0
  71. package/packages/core/src/kernel/target-lineage.ts +65 -0
  72. package/packages/core/src/kernel/target-observation.ts +117 -0
  73. package/packages/core/src/operator/registry.ts +5 -13
  74. package/packages/core/src/operator/tickets.ts +8 -2
  75. package/packages/core/src/plugin-sdk/index.ts +1 -0
  76. package/packages/core/src/ports/forge/fake.ts +22 -0
  77. package/packages/core/src/ports/forge/git-rewrite.ts +49 -12
  78. package/packages/core/src/ports/forge/github.ts +42 -10
  79. package/packages/core/src/ports/forge/local-git.ts +16 -1
  80. package/packages/core/src/ports/types.ts +58 -4
  81. package/packages/core/src/ports/workspace/account-policy.ts +2 -1
  82. package/packages/core/src/ports/workspace/commit-preservation.ts +175 -0
  83. package/packages/core/src/ports/workspace/create.ts +2 -0
  84. package/packages/core/src/ports/workspace/distribution-archive.ts +14 -4
  85. package/packages/core/src/ports/workspace/fake.ts +4 -0
  86. package/packages/core/src/ports/workspace/git-worktree.ts +22 -1
  87. package/packages/core/src/ports/workspace/vercel-sandbox.ts +304 -56
  88. package/packages/core/src/processes/build-runner.ts +240 -111
  89. package/packages/core/src/processes/dispatcher-selectors.ts +3 -2
  90. package/packages/core/src/processes/dispatcher.ts +262 -80
  91. package/packages/core/src/processes/execution-no-progress.ts +7 -0
  92. package/packages/core/src/processes/harvest-runner.ts +6 -7
  93. package/packages/core/src/processes/publication-state.ts +2 -1
  94. package/packages/core/src/processes/repo-view.ts +22 -0
  95. package/packages/core/src/processes/tick-publication.ts +35 -47
  96. package/packages/core/src/processes/workspace-preservation.ts +164 -0
  97. package/packages/core/src/scenarios/harness.ts +7 -0
  98. package/packages/core/src/store/adapter.ts +9 -0
  99. package/packages/core/src/store/build-scope.ts +28 -0
  100. package/packages/core/src/store/contract.ts +125 -0
  101. package/packages/core/src/store/event-reads.ts +156 -0
  102. package/packages/core/src/store/local/schema.ts +11 -0
  103. package/packages/core/src/store/local/store.ts +117 -2
  104. package/packages/core/src/store/memory.ts +237 -0
  105. package/packages/core/src/store/phase-session.ts +47 -0
  106. package/packages/core/src/store/reduced-reads.ts +8 -0
  107. package/packages/core/src/store/reducer-value-shapes.json +6262 -5227
  108. package/packages/core/src/store/reducer-value-validation.ts +3 -0
  109. package/packages/core/src/store/reducer-values.ts +62 -2
  110. package/packages/core/src/store/remote/client.ts +161 -16
  111. package/packages/core/src/store/remote/compatibility.ts +177 -46
  112. package/packages/core/src/store/remote/errors.ts +16 -0
  113. package/packages/core/src/store/remote/index.ts +11 -0
  114. package/packages/core/src/store/remote/protocol.ts +22 -0
  115. package/packages/core/src/store/remote/released-clients.json +48 -0
  116. package/packages/core/src/store/remote/released-clients.ts +88 -0
  117. package/packages/core/src/store/remote/released-reducer-values/1.3.0.json +25093 -0
  118. package/packages/core/src/store/remote/released-reducer-values/1.4.0.json +26128 -0
  119. package/packages/core/src/store/remote/released-reducer-values/index.ts +13 -0
  120. package/packages/core/src/store/remote/version.ts +5 -2
  121. package/packages/core/src/store/repo-state-events.ts +4 -3
  122. package/packages/core/src/store/scan-cadence.ts +15 -0
  123. package/packages/core/src/store/session-handle.ts +18 -0
  124. package/packages/core/src/store/types.ts +27 -6
  125. package/packages/core/src/testing/dispatch-read-budget.ts +313 -2
  126. package/packages/core/src/testing/index.ts +5 -0
  127. package/packages/core/src/testing/reduced-read-budget.ts +728 -5
  128. package/skills/guide/SKILL.md +201 -18
  129. package/skills/guide/references/accounts.md +38 -0
  130. package/skills/guide/references/integration-tree.md +8 -0
  131. package/skills/guide/references/operator-api.md +37 -4
  132. package/skills/guide/references/plugin-authoring.md +45 -1
  133. package/skills/guide/references/remote-store-protocol.md +262 -42
  134. package/skills/guide/references/remote-ticket-protocol.md +12 -10
  135. package/skills/guide/references/restacking.md +60 -3
  136. package/skills/guide/references/setup.md +37 -8
  137. package/skills/guide/references/spec-standard.md +37 -3
  138. package/skills/implement/SKILL.md +12 -3
  139. package/skills/operate/SKILL.md +87 -15
  140. package/skills/plan/SKILL.md +27 -4
  141. package/skills/plan-review/SKILL.md +22 -2
  142. package/skills/reconcile/SKILL.md +10 -1
  143. package/skills/spec/SKILL.md +7 -4
  144. package/templates/hosted-service/package.json +2 -2
@@ -56,9 +56,10 @@ projection, plugin SDK, and reusable contract suites. The optional
56
56
  `packages/hosted-store-service` workspace composes the public remote-server
57
57
  surface with `packages/postgres-store`; the separate optional
58
58
  `packages/hosted-dispatcher` workspace owns the cron-driven hosted dispatcher
59
- (the `/api/dispatch` route driver, the deploy-time `pack-distribution` command,
60
- and the packed-distribution trace helper) and peers on both the core and the
61
- store service. The optional `packages/vercel-sandbox` workspace publishes the
59
+ (the `/api/dispatch` route driver, and the deploy-time `pack-distribution` and
60
+ `ship-deployment` commands that pack the guest archive and ship it, its
61
+ manifest and the selected provider plugins into the dispatch function) and
62
+ peers on both the core and the store service. The optional `packages/vercel-sandbox` workspace publishes the
62
63
  `@defrex/autobuild-vercel-sandbox` provider plugin (AUT-517): while the
63
64
  builtin hosts the implementation, its manifest re-registers the provider name
64
65
  over the shared capability object and the loader skips it with a notice.
@@ -80,7 +81,7 @@ remote-store protocol requires matching client and server versions.
80
81
  | `packages/core/src/store/` | BuildStore contract spanning builds, the repository journal, and operator sessions; interface-enforced build, operator-session, and local ambient-session scope wrappers; memory, SQLite/blob, and remote HTTP adapters | §7 |
81
82
  | `packages/core/src/store/streams/` | The stream primitive's shared core (§7.6): record/chunk types and the `ai-ui-message-stream/v1` constants, SDK-backed close-time `UIMessage[]` assembly, and the uniform bounded-wait read loop | §7.6 |
82
83
  | `packages/hosted-store-service/` | Environment-only hosted Fetch handler, lazy PostgreSQL/blob composition, offline token binary, the Next.js operator web app (`app/`, `server.ts`, `next.config.ts`, `vercel.json`), tests, and deployment guide | §7.2, §18 |
83
- | `packages/hosted-dispatcher/` | The optional cron-driven hosted dispatcher: endpoint driver, deploy-time `pack-distribution` binary, packed-distribution trace helper, tests, and operator guide | §7.2, §12, §18 |
84
+ | `packages/hosted-dispatcher/` | The optional cron-driven hosted dispatcher: endpoint driver, deploy-time `pack-distribution` and `ship-deployment` binary, packed-distribution trace helper, provider plugin shipper, tests, and operator guide | §7.2, §12, §18 |
84
85
  | `packages/vercel-sandbox/` | Published `@defrex/autobuild-vercel-sandbox` provider plugin: transitional manifest over the shared capability object with a guarded factory (implementation stays builtin-hosted until AUT-505) | §3.2.1 |
85
86
  | `packages/hosted-store-service/server.ts`, `packages/hosted-store-service/vercel.json` | One host-neutral Bun listener used locally and by Vercel's Bun preset | §7.2 |
86
87
  | `packages/core/src/kernel/` | Phase table, build reducer, engine; pure harvest, dispatcher-settings, dispatcher-status, and PR-attachment selectors; converge, stall detection, verify gating | §5, §7.5, §10, §12, §14, §15.4–15.5 |
@@ -148,6 +149,13 @@ shape changes without a bump. Current-state consumers use the typed persisted
148
149
  read helpers in `store/reduced-reads.ts`; whole-array reducers remain pure
149
150
  reference projections for tests and explicit historical output.
150
151
 
152
+ **Ticket scan cadence.** BuildStore keeps one replaceable `scan_cadence` row
153
+ per repository, shared by fresh dispatcher processes. It acknowledges the
154
+ canonical changed-outcome scan event by sequence and stores only its scheduling
155
+ baseline, mode and input fingerprints. It is disposable coordination metadata,
156
+ not a reducer snapshot or authoritative outcome; loss permits a safe extra scan.
157
+ Keyed reads and atomic upserts have constant cost and never read journal rows.
158
+
151
159
  **Reducer snapshots.** The `BuildStore` port can keep, per scope (one build log
152
160
  or the repository journal) and registered reducer, that reducer's accumulator as
153
161
  of a cursor: `getReducerSnapshot(scope, reducer, version)` and
@@ -186,16 +194,23 @@ describes recovery and the supported-window boundary.
186
194
  All event-derived checkpoints include the combined read-catalog fingerprint in
187
195
  their keys, independently of numeric reducer versions. Snapshot envelopes validate
188
196
  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. The client projects the value onto its own
191
- shape (`projectReducerValue` in `store/reducer-value-validation.ts`), dropping
192
- unknown properties, so reducer version skew alone is not an error. An invalid
193
- envelope or a value the client's shape cannot represent raises
194
- `ReducerValueIncompatibilityError` with client/server versions and validation
195
- detail. Exact-version 1.2.0 clients, which predate the
196
- `x-autobuild-reducer-value-projection` capability, receive answers projected onto
197
- the frozen catalog in `store/remote/released-reducer-values/` by
198
- `reducerValueForClient`. No remote named read replays events.
197
+ keep their strict three-field JSON body `{version, cursor, value}`. Clients sending
198
+ both `x-autobuild-reducer-value-projection: 1` and an unrecognized
199
+ `x-autobuild-catalog-identity` receive the canonical answer, including source clients
200
+ whose catalog identity differs from the service's. The client projects the value
201
+ onto its own shape (`projectReducerValue` in `store/reducer-value-validation.ts`),
202
+ dropping unknown properties, so reducer version skew alone is not an error.
203
+ Published clients with a recorded published catalog identity, or without a catalog
204
+ identity, receive answers projected onto their
205
+ frozen released contracts in `store/remote/released-reducer-values/` and stamped
206
+ with their released reducer versions, including projection-capable published clients.
207
+ `reducerValueForClient` omits optional `lastEvent` fields with newer event variants,
208
+ including nested build state, and filters `seenTypes` to known event types while
209
+ preserving canonical cursor, progress, and compatibility facts. An invalid envelope
210
+ or an unrepresentable required value raises `ReducerValueIncompatibilityError`
211
+ with client/server versions and validation detail. See the
212
+ [reduced-value protocol](remote-store-protocol.md) for the response
213
+ contract. No remote named read replays events.
199
214
  Repository digest batches likewise return the server batch with one scoped
200
215
  request and no discovery or per-build fallback.
201
216
 
@@ -274,7 +289,12 @@ Operator passes are single-flight per repository, with requests arriving during
274
289
  pass queued for one trailing pass. Fresh readers use persisted cache rows too;
275
290
  steady-state event-row cost depends on newly appended events at fixed build/run
276
291
  cardinality, not on log length. Reduced collections may legitimately grow in JSON
277
- size. Cache loss or corruption can replay history once to recover the same answer.
292
+ size. Ordinary reducer cache loss or corruption can replay history once to recover
293
+ the same answer. Checkpoint-backed `buildStreamSeed` and `repositoryAttention`
294
+ generations instead fail with typed `checkpoint-integrity` for missing admitted
295
+ canonical state, corrupt existing state or unreadable storage. New-identity rebuilds
296
+ and valid legacy-coverage repair remain separate cases; see the
297
+ [checkpoint rules](remote-store-protocol.md#hosted-event-bounds-and-exact-resume).
278
298
 
279
299
  Watch and wait register from a compound persisted `buildStreamSeed` at cursor C.
280
300
  Its build accumulator, deferral ledger and insertion-ordered historical PR
@@ -282,8 +302,11 @@ eligibility describe that same prefix. Ordinary polling, including the first
282
302
  batch on an old build, reads only events after the cursor and advances that seed
283
303
  event by event, preserving state at event N in each emitted record. Watch uses
284
304
  historical eligibility for baseline suppression; wait retains its separate
285
- current-attention registration policy. Only an explicit `--since` older than C
286
- reconstructs a historical prefix once in `cli/historical-build-state.ts`.
305
+ current-attention registration policy. For an explicit `--since` older than C,
306
+ hosted stores retrieve an exact server-owned checkpoint and read only the bounded delta; local adapters retain
307
+ historical prefix reconstruction in `cli/historical-build-state.ts`. Hosted
308
+ cursors outside the tail window fail without replay; see
309
+ [hosted event bounds and exact resume](remote-store-protocol.md#hosted-event-bounds-and-exact-resume).
287
310
  Actual event listings, transcripts and cursor streams remain raw reads. The
288
311
  interactive terminal frontend retains its independently established incremental
289
312
  feed. `tools/persisted-reduced-reads.test.ts` scans production TypeScript calls
@@ -536,8 +559,12 @@ kernel child is reaped, after which a non-SIGINT terminating signal is replayed
536
559
  in the frontend. A parent-liveness watch remains the detached-kernel fallback.
537
560
  The repository record carries constant-size, lease-holder-fenced tick telemetry:
538
561
  `beginRepoTick` opens the unsafe boundary, and `finishRepoTick` atomically closes
539
- it and appends selected tick facts. Successful unchanged ticks append nothing;
540
- queue transitions, counters, diagnostics, attention resets/retries, and failures
562
+ it and appends selected tick facts. Unchanged standing ticket counts and diagnostics do
563
+ not publish tick pairs. Changes to those counts or diagnostics, per-tick activity,
564
+ recovery from a failed tick, and due attention retries still publish. The last published
565
+ diagnostics remain visible while lease-fenced completion telemetry advances
566
+ independently of the journal cursor. Successful unchanged ticks append nothing;
567
+ queue transitions, activity counters, changed diagnostics, attention resets/retries, and failures
541
568
  retain their journal evidence. Buffered starts preserve actual `startedAt` for
542
569
  attention cooldowns; old starts use their envelope time. Liveness reads refresh
543
570
  the repository record even with an unchanged event cursor, merging matching-run
@@ -590,6 +617,33 @@ counts actual schedules, not suppressed polls. Open session history is never a
590
617
  lock: a legacy dead session may remain open, while an actual takeover closes it
591
618
  explicitly.
592
619
 
620
+ `processes/workspace-preservation.ts` owns the non-destructive fence, immutable
621
+ checkpoint and durable receipt ordering shared by both release paths in the
622
+ dispatcher. `ports/workspace/commit-preservation.ts` inventories the unpublished
623
+ change and restores exact refs, keeping detached producer objects separate from
624
+ the named branch. Provider provisioning and start failures signal
625
+ `WorkspaceCleanupRequired`; they cannot delete an existing build checkout.
626
+
627
+ Before releasing or replacing a build workspace, the dispatcher confirms a
628
+ non-destructive execution fence for the exact workspace and execution generation.
629
+ It preserves unpublished branch commits and distinct detached producer candidates
630
+ under immutable `refs/autobuild/archive/<build>/<sha>` refs, verifies their exact
631
+ readback, and records `workspace.commits-preserved` before cleanup. Replacement
632
+ provisioning restores those exact refs before starting an agent. Preservation
633
+ never advances the public build branch. A confirmed absent environment records
634
+ `workspace.commits-lost`, naming known candidates and explicitly noting that any
635
+ additional unpublished SHAs could not be inspected. Unknown fencing, inspection,
636
+ transport, or receipt-write outcomes leave the workspace and snapshots intact.
637
+ Fencing is revalidated after restart; a saved receipt alone never authorizes
638
+ cleanup of a newer execution. Current recovery notes are linked by the session
639
+ manifest's `workspaceRecovery` field. Recovery notes apply to the next session
640
+ and repeat hydration within it; empty checkpoints produce no note. Checkpoints survive
641
+ repeated replacement until a published reconcile or restack rewrite retires them,
642
+ so an old preserved branch cannot overwrite that rewrite. Before the first
643
+ branch publication, preservation compares against the recorded workspace base.
644
+ A confirmed `snapshot_not_found` response means the sandbox filesystem is gone;
645
+ cleanup records loss and deletes its stale name before replacement.
646
+
593
647
  **Store authority.** `packages/core/src/store/build-scope.ts` wraps every adapter with one
594
648
  build's authority. Own-build record/event/artifact/lease/subscription calls
595
649
  delegate; foreign-build, collection/admin, close, and repository-journal calls
@@ -802,9 +856,11 @@ permanent-failure classifier), and `session-env.ts` (per-turn environment merge
802
856
  that fronts `bin/agent/ab` on `PATH`). The pi CLI owns its login and model
803
857
  catalog; the shipped bridge limits tools and refreshes each turn's subprocess
804
858
  environment without writing session state into the workspace. Adapters own
805
- native error extraction; processes own durable failure policy — the transcript
806
- is always deposited, and a turn's typed terminal always beats a late failure
807
- signal.
859
+ native error extraction; processes own durable failure policy — transcript
860
+ deposition is attempted, and a turn's typed terminal always beats a late failure
861
+ signal. An oversized transcript deposition after a successful durable terminal
862
+ preserves that terminal without failing or retrying the completed phase; without
863
+ a terminal, the oversized write parks the phase as described below.
808
864
 
809
865
  **Plugin bootstrap and CLI composition.** `packages/core/src/plugins/load.ts` resolves
810
866
  repository-path modules from the config-bearing root and bare packages from an
@@ -937,6 +993,16 @@ queue. The supervised kernel child owns every slow
937
993
  adapter operation, so slug naming, provisioning, runners, and Harvest cannot
938
994
  block input.
939
995
 
996
+ Startup restores a validated `dispatchFrontend` checkpoint incrementally only
997
+ when its cursor is within the 1,000-event repository tail window. Older caches
998
+ use the repository-state recovery seed instead. Startup catch-up and prelaunch
999
+ boundary reads enforce that window at selection, including concurrent appends;
1000
+ cursor expiry permits one additional seed recovery, never historical gap replay.
1001
+ Transfer is bounded by the existing state seed plus a fixed number of windowed
1002
+ tails, independently of discarded history (the seed itself retains durable facts
1003
+ and the latest run tail). High water is sampled before the sparse seed so later
1004
+ updates remain consumable. Steady-state reads and save cadence are unchanged.
1005
+
940
1006
  The frontend's `dispatchFrontend` checkpoint retains dashboard facts plus only
941
1007
  the latest run-started fact and the sampled lease holder's start (deduplicated).
942
1008
  Identity history is always partial, including normalized legacy version-4
@@ -1435,6 +1501,11 @@ Historical merge completions retain their original shape and semantics.
1435
1501
 
1436
1502
  The optional grouped Forge rewrite capability owns authoritative head snapshots,
1437
1503
  immutable `refs/autobuild/archive/<slug>/<sha>` publication and expected-head CAS.
1504
+ Remote archives also publish commits present only on the remote: GitHub uses create-only
1505
+ Git-reference REST creation when the workspace lacks the commit, retaining guarded Git
1506
+ pushes for local objects. Exact remote readback confirms publication, then a depth-one
1507
+ fetch by the archive ref (without tags or configured refmap expansion) restores missing
1508
+ commits and verifies them locally before returning.
1438
1509
  GitHub uses explicit Git transport leases; local-git uses shared-database
1439
1510
  `update-ref` CAS without network calls. Exact authoritative readback acknowledges
1440
1511
  publication. Remote-backed local refs are caches refreshed without expected-old
@@ -1462,6 +1533,8 @@ verification when build-owned config is unchanged, even when the old pin commit
1462
1533
  is no longer an ancestor. Changed config still supersedes while waiting.
1463
1534
  Ancestry gates cycles that run further steps; those cycles capture fresh config.
1464
1535
  Object packs retain newly introduced replay trees/blobs as well as commit bytes.
1536
+ 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.
1537
+
1465
1538
 
1466
1539
  GitHub archive push/fresh-fetch and rewrite contracts are manual opt-in cases in
1467
1540
  `ports/forge/github.live.test.ts`, using `AB_RUN_LIVE_PORT_CONTRACTS=1` and an
@@ -1645,6 +1718,19 @@ a new classified failure parks again. There are zero automatic paid retries
1645
1718
  after this deferral. If evidence cannot be written, ordinary recovery applies;
1646
1719
  agent output and `no-terminal` alone never classify a read failure.
1647
1720
 
1721
+ A kernel store write rejected with HTTP 413 raises `StoreWriteTooLargeError`
1722
+ and records `phase.failed {willRetry:false}` on its first attempt, including
1723
+ for automatic restack and session preparation. Its diagnostic names an oversized
1724
+ store write, the HTTP method and route, exact UTF-8 request bytes, and the
1725
+ server message (including any reported ceiling). It parks with
1726
+ `non-retryable-phase-failure`; an operator answer authorizes a fresh attempt,
1727
+ which parks immediately again if still rejected. Store failures never select an
1728
+ alternate provider. After a successful durable terminal, an oversized transcript
1729
+ deposition during optional cleanup preserves that terminal without recording a
1730
+ phase failure or retrying the completed phase. Without a terminal, the oversized
1731
+ write follows the parking policy above. Other store statuses retain their
1732
+ existing retry policy.
1733
+
1648
1734
  Ordinary silence, provider failures and session timeouts retain the runner's
1649
1735
  phase failure limit (`BuildRunnerOpts.maxPhaseAttempts`, default 2). This is
1650
1736
  an internal runner option, not an accepted `[policy]` TOML key. Reconcile
@@ -1652,6 +1738,51 @@ execution and unchanged-base progress budgets retain their existing accounting.
1652
1738
 
1653
1739
  ## Forge failure recovery
1654
1740
 
1741
+ Destination heads come only from the authoritative forge branch; dispatcher-host
1742
+ refs are never a fallback. Failed remote reads retain the accepted observation;
1743
+ classified rate limits use repository forge degradation and cooldown. Changed
1744
+ heads require immutable commit ancestry proof against the accepted target and
1745
+ the destination base already used by replay. Missing capability or failed proof
1746
+ defers new replay. A non-descendant without kernel lineage records
1747
+ `target.rewritten` with branch,
1748
+ previous SHA and observed SHA, retains the accepted target, and raises watch/wait
1749
+ attention. Repeated rewrite pairs are deduplicated. Returning to a safe target
1750
+ clears attention (`target.rewrite-cleared` when the accepted tip is unchanged).
1751
+ Upstream force-pushes are never adopted automatically. Accepted node reparenting
1752
+ starts a new branch scope; frozen transactions recover their retained inputs.
1753
+
1754
+ Kernel restacks of a node are admitted through durable guarded publication
1755
+ receipts, not treated as external force-pushes. The dispatcher walks an index
1756
+ keyed by node and previous head, at most 64 receipt lookups from each child
1757
+ baseline; cost is capped independently of journal length or total receipts.
1758
+ Exact links use point lookups. When forward child landings separate restacks,
1759
+ the dispatcher walks backwards from the latest publication with an indexed
1760
+ previous-receipt cursor. Every gap requires immutable ancestry from the earlier
1761
+ published head to the later receipt's previous head, as do the baseline and tip
1762
+ ends of the proof. Missing links never imply rewrite authority.
1763
+ The proven receipts travel in `target.moved.lineage`; build-scoped runners use
1764
+ that recorded proof without reading another build. Clearing attention for an
1765
+ unchanged accepted SHA retains newly proven lineage in `target.rewrite-cleared`.
1766
+ Missing receipts or a gap
1767
+ over 64 still record `target.rewritten` and raise attention. Each hop makes at
1768
+ most two immutable ancestry comparisons. The exact walk and gap recovery share
1769
+ the same 64-read cap, including unsuccessful lookups. Unchanged accepted
1770
+ polls read no receipts or event rows.
1771
+
1772
+
1773
+ A historical `publication.lost` does not prove that every copy of its candidate
1774
+ is gone. Recovery checks the exact branch and private archive refs and retained
1775
+ replay objects first. An available candidate continues guarded publication.
1776
+ A genuinely missing reconcile or automatic restack candidate records
1777
+ `publication.candidate-retired`, abandons its obsolete request, and replays the
1778
+ producing operation with a fresh transaction identity. Its frozen target,
1779
+ reconcile occurrence or automatic trigger, cycle, and message survive. The
1780
+ retired candidate is excluded from archive requirements unless independently
1781
+ required by proven history. This reconstruction consumes no infrastructure
1782
+ attempt and no additional conflict occurrence; it needs no operator guidance.
1783
+ A bare retry also clears an existing infrastructure-limit escalation through
1784
+ ordinary retry semantics. Unavailable inspection defers rather than proving loss.
1785
+
1655
1786
  `kernel/publication-retry.ts` selects eligibility from the publication ledger
1656
1787
  and shares the policy between `processes/build-runner.ts` and trusted
1657
1788
  `cli/publication-settlement.ts`. The lease sweep skips ineligible retained intents;
@@ -1661,7 +1792,7 @@ Leaf restack and reconcile publication retry classified transient forge or trans
1661
1792
  failures six times after the initial attempt, waiting 30, 60, 120, 240, 300 and
1662
1793
  300 seconds. `publication.retry-scheduled` records the operation, frozen rewrite
1663
1794
  identity, episode anchor, failure ordinal, last error and absolute retry time;
1664
- restart resumes that schedule without rerunning the resolver. These retries do
1795
+ restart resumes that schedule without rerunning a resolver whose candidate remains available. These retries do
1665
1796
  not consume `maxPhaseAttempts`. A seventh transient failure records
1666
1797
  `publication.retry-exhausted` and raises `publication-retry-limit`, naming the last
1667
1798
  error and six retries. Answering that escalation opens a fresh publication episode
@@ -1761,8 +1892,16 @@ Verification stages are planned purely in `kernel/verify-stages.ts`, shared by
1761
1892
  leaf and integration decisions in `kernel/engine.ts`. The build runner keeps
1762
1893
  only live per-member handles and recovery contexts; durable starts, outcomes,
1763
1894
  cancellations and failed-stage receipts drive every barrier and restart.
1764
- Fail-fast cancellation records facts before whole-execution teardown and
1765
- replacement. `kernel/verify-stage-state.ts` owns occurrence/session associations,
1895
+ Normal stage transitions drain terminal-reached agent turns before stage-local
1896
+ interruption, retaining session budgets and parent shutdown. This closes session
1897
+ brackets and deposits trailing evidence before summary publication. Fail-fast
1898
+ cancellation records facts before immediate whole-execution teardown and replacement.
1899
+ The dispatcher's lease sweep treats eligible running orphaned open brackets as
1900
+ pending cleanup even on an engine wait. It excludes live leases/executions,
1901
+ blocked or paused builds and idle collecting nodes, then uses ordinary runner
1902
+ attachment/reclamation. Proved-ended pending work bypasses first-claim grace;
1903
+ healthy ended workspaces are reused and lost environments follow fenced recovery.
1904
+ The predicate uses existing canonical reduced facts and adds no event-log reads. `kernel/verify-stage-state.ts` owns occurrence/session associations,
1766
1905
  including escalation supersession and complete implement feedback references.
1767
1906
 
1768
1907
  Human access uses `postgres-store/src/organizations.ts` and the shared hosted
@@ -1865,6 +2004,18 @@ deltas and prior values retained across rotation.
1865
2004
 
1866
2005
  ### Hosted project deletion
1867
2006
 
2007
+ The browser requires the exact full repository identity in a transient dialog field;
2008
+ confirm stays disabled for empty or mismatched input and focus starts in the field.
2009
+ The handler independently binds that identity to the selected repository and its
2010
+ fresh validated preview. Only JSON `{deleted:true}` acknowledges completion.
2011
+ After any failed or unrecognized deletion response, the browser shows
2012
+ “Deletion outcome unknown; reload to check” and holds the row in its original slot
2013
+ without actions, even after dismissal. Only a complete successful discovery begun
2014
+ by Reload after the attempt settles it: absence removes the row, presence restores
2015
+ its authorized actions, and pending cleanup restores Finish deletion with a fresh
2016
+ preview and exact typing. An earlier or unsuccessful read cannot settle the outcome.
2017
+ The server's `{repo}` body and generation-bound If-Match contract are unchanged.
2018
+
1868
2019
  The Projects web surface allows super users and organization owners to preview
1869
2020
  counts and permanently delete their authorized projects with the shared confirmation dialog.
1870
2021
  PostgreSQL fences the registration generation before physical blob cleanup and
@@ -1880,3 +2031,25 @@ revokes credentials only; admin `projects remove` unregisters without purging.
1880
2031
  See [project deletion protocol](operator-api.md#permanent-project-deletion).
1881
2032
 
1882
2033
  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).
2034
+
2035
+
2036
+ Hosted event reads use the bounded capabilities in `store/event-reads.ts`:
2037
+ repository cursors must be at least `max(0, head - 1000)`, and build pages
2038
+ contain at most 256 events with `cursor` and `hasMore`. PostgreSQL seeks and
2039
+ limits at the database boundary, including held reads; remote complete-array
2040
+ reads reject partial suffixes. Protocol 7 is next-minor preparation for 1.4;
2041
+ supported published protocol-6 clients retain complete bounded arrays and
2042
+ legacy `conflict` refusals. Same-line runtime and published identities are
2043
+ admitted together, and both health surfaces use the shared validated identity
2044
+ projection without store reads. See [wire compatibility](remote-store-protocol.md).
2045
+ Exact historical watch/wait seeds come from
2046
+ rolling server-owned checkpoints in `postgres-store/src/stream-seeds.ts`.
2047
+ The canonical reducer fold publishes its cache and trailing checkpoints
2048
+ atomically under a reader-only lock. Initial adoption is an explicit resumable
2049
+ migration; later new identities rebuild once, then advance durably with deltas.
2050
+ Two live generations and permanent indexed retirement tombstones support
2051
+ adjacent runtimes without letting old processes evict newer ones. Watch/wait
2052
+ propagate expiry and integrity errors, preserving valid cursors across reducer
2053
+ upgrades. Expired cursors require re-arming without `--since` and status
2054
+ reconciliation. Harvest completion uses reduced session terminal receipts;
2055
+ 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
@@ -39,6 +39,8 @@ If a leaf spec revision arrives during an unfinished reconcile, the same reconci
39
39
 
40
40
  Either reviewer approves, requests revisions with structured findings, or escalates a question.
41
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
+
42
44
  - **Sessions.** Each phase gets its own session; the producer keeps it across a loop's rounds, and each reviewer round starts fresh.
43
45
  - **Context** passes between phases as durable artifacts: spec, approved plan, implementation notes, findings, and verification reports.
44
46
 
@@ -63,10 +65,12 @@ Once verification passes, the finalize agent writes the PR description; Autobuil
63
65
 
64
66
  ## When a human is needed
65
67
 
66
- 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.
67
69
 
68
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.
69
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
+
70
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).
71
75
 
72
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.
@@ -497,6 +497,17 @@ one scan interval plus one tick when capacity permits. Observation while intake
497
497
  is off shares the cadence; an observation measurement cannot suppress a fresh
498
498
  admission scan when intake is enabled.
499
499
 
500
+ Only changed scan outcomes append `dispatcher.ticket-scan-completed`; comparison
501
+ includes counts, ordered diagnostics, readiness and criteria fingerprints, and
502
+ mode. Its `startedAt` is the measurement time of the last recorded outcome,
503
+ not a last-scanned heartbeat. A single replaceable, repository-keyed cadence
504
+ cache survives fresh dispatcher processes and acknowledges that canonical fact
505
+ by sequence. It contains scheduling metadata only, never counts or lifecycle
506
+ state, and is distinct from reducer checkpoints. Missing or stale metadata
507
+ falls back to the recorded fact and can cause one safe extra scan without
508
+ reconstructing history. Successful unchanged scans advance this cache only.
509
+
510
+
500
511
  ### Plugin modules
501
512
 
502
513
  <!-- config-fragment:plugins -->
@@ -1322,23 +1333,29 @@ the execution lease is released. The supervisor uses a narrow credential
1322
1333
  transform for a fixed non-force push and verifies the remote head before
1323
1334
  recording completion; PR API work stays local. If that acknowledgement is lost
1324
1335
  after the push succeeds, the next launch observes the exact remote branch head and
1325
- records the missing completion before allowing a replacement phase to run. If
1326
- the commit is absent, release of the old workspace abandons its request and the
1327
- replacement reruns the phase. Before every guest runner launch, the provider
1328
- reasserts the normal receive-pack-free policy, so a failed policy
1336
+ records the missing completion before allowing a replacement phase to run.
1337
+ Available candidates continue publication; confirmed missing candidates require
1338
+ reconstruction by the producing phase or, for reconcile/restack, a fresh replay
1339
+ under the retained intent and frozen target. Before every guest runner launch,
1340
+ the provider reasserts the normal receive-pack-free policy, so a failed policy
1329
1341
  restore cannot expose publication authority to later setup or plugin code.
1330
1342
  Ordinary completion deletes the sandbox.
1331
1343
 
1332
1344
  A Vercel VM is disposable, not durable build state. Every execution records its
1333
1345
  Autobuild instance, deterministic sandbox name, and Vercel session id. After a
1334
- lease expires, recovery first stops/deletes the exact old name and confirms its
1335
- absence; only then does it provision the next generation. An interrupted create
1336
- is retried with the same deterministic generation/name, so an unknown response
1337
- cannot fan out duplicate VMs. Recovery uses the published build branch when it
1338
- exists and otherwise the original recorded branch-cut SHA, never a newly moved
1339
- base. Setup reruns and open sessions are reclaimed by the normal durable
1346
+ lease expires, recovery first fences the exact old name without deleting it.
1347
+ Before deletion, it verifies archival of reachable unpublished commits to private
1348
+ refs and records a durable preservation receipt, or records a loss receipt for
1349
+ confirmed absence. Unknown inspection or transport outcomes defer cleanup. Only
1350
+ after that boundary does it delete the old environment and provision the next
1351
+ generation. An interrupted create is retried with the same deterministic generation/name, so an unknown response
1352
+ cannot fan out duplicate VMs. Provisioning starts from the published build branch
1353
+ when it exists and otherwise the original recorded branch-cut SHA, then restores
1354
+ the exact preserved private refs with branch ancestry checks before sessions
1355
+ resume. Setup reruns and open sessions are reclaimed by the normal durable
1340
1356
  protocol. Uncommitted files and `.ab` scratch may be lost; Store events/artifacts
1341
- and published Git checkpoints remain authoritative.
1357
+ and verified Git checkpoints remain authoritative. See the
1358
+ [workspace recovery contract](architecture.md#key-boundaries).
1342
1359
 
1343
1360
  Paused and policy-blocked builds release their sandbox after the execution
1344
1361
  lease expires. Resume creates a replacement and reruns setup. Graceful shutdown
@@ -3534,12 +3551,13 @@ progress is not shown. Harvest does not consume build capacity.
3534
3551
 
3535
3552
  ## Hosted service client compatibility
3536
3553
 
3537
- A service accepts stable and prerelease clients from its own `major.minor`
3538
- release line and the two preceding minor lines in the same major. A major starts a new family:
3539
- X.0 accepts only X.0, X.1 accepts X.0/X.1, and X.2 onward accepts three lines.
3540
- Patch versions are interchangeable in both directions and must never change
3541
- the protocol. Keep project clients within the instance’s published window. Supported release lines retain their wire handlers and known
3542
- protocol identities; an unknown protocol is refused independently of version.
3554
+ A published release line stays supported by a service until both at least two newer minor lines have been published and 90 days have passed since the first release of the line that superseded it. The rule spans majors: a new major keeps supporting earlier lines on the same terms. The policy floor is 1.2: lines before 1.2 are refused regardless of publication dates because their clients rebuild server state from the journal. Lines newer than the service stay unsupported (service first). Supported means the published clients of that line can use the service’s retained protocol handlers and read its reduced answers in the shapes their released clients accept.
3555
+
3556
+ Stable patches never reset a line’s first-publication date. Only actually published
3557
+ lines at or below the service line count; prereleases do not start retirement clocks.
3558
+ Publication facts survive removal of retired identities, contracts, and handlers.
3559
+ Patch releases must retain their line’s protocol identity. Unknown historical
3560
+ protocol identities are refused independently of the numeric window.
3543
3561
  Stable and prerelease service and client identities share their numeric major/minor
3544
3562
  line. Malformed or missing identities, build metadata (`+…`), prefixes and
3545
3563
  whitespace are refused with HTTP 409.
@@ -3550,8 +3568,9 @@ and supported range.
3550
3568
  Unauthenticated `GET /health` publishes `ok`, `autobuildVersion`,
3551
3569
  `protocolVersion`, and `supportedClientRange: { minVersion, maxVersionExclusive }`.
3552
3570
  Range endpoints remain stable versions. The range is inclusive at the minimum
3553
- and exclusive at the maximum; a 0.11.x
3554
- service publishes `>=0.9.0 <0.12.0`. Health needs no credentials, version
3571
+ and exclusive at the maximum; a 1.3.x
3572
+ service publishes `>=1.2.0 <1.4.0` until later publication facts permit retirement.
3573
+ The service reads the clock for each decision, so retirement needs no redeploy. Health needs no credentials, version
3555
3574
  headers, or available backend.
3556
3575
 
3557
3576
  Remote workspace factories must use `delegateCredential(storeRef, undefined,
@@ -12,6 +12,35 @@ order: 11
12
12
 
13
13
  The dispatcher claims eligible tickets, starts and observes build runners, settles publication and merge, and recovers durable work. Local and origin-mode arrangements run the same kernel. Your operator agent acts through the CLI or MCP; Autobuild never starts it.
14
14
 
15
+ ## Viewing from a local checkout
16
+
17
+ A plain `ab dispatch` reads dispatch placement once before starting local execution.
18
+ For a hosted project it opens the Store-only viewer automatically, displaying
19
+ `viewer · dispatched by <host>` from the placement origin (including a nondefault
20
+ port). `--once`, `--plain`, and `--interval` retain their viewer meanings.
21
+ `--takeover` explicitly dispatches locally, with a warning that it can displace
22
+ the hosted dispatcher; it cannot be combined with `--viewer`. Startup intake
23
+ flags require `--takeover` when placement selects viewer.
24
+
25
+ An unreadable placement fails closed with a typed error naming the cause:
26
+ use `--viewer` to watch or `--takeover` to dispatch locally. Both explicit modes
27
+ skip placement discovery. Older services without the capability and projects
28
+ with unknown or nonhosted placement retain local dispatch behavior. Local stores
29
+ need no placement request. Origin mode (`--repository` or `AB_REPOSITORY`) and
30
+ hosted cron dispatch bypass this check. Placement is a startup snapshot, not a
31
+ liveness probe or a polling input.
32
+
33
+
34
+ Humans can watch any arrangement through `bun ab dispatch --viewer`, optionally
35
+ adding `--dispatched-by <label>` to name where dispatching runs. An explicitly supplied label is descriptive input. Each frame keeps `viewer` visible; plain
36
+ output states it at startup. This mode only reads shared state until an operator
37
+ uses a shared-store control. It takes no lease and performs no dispatch work.
38
+ Ctrl-C closes the viewer without stopping the dispatcher. `--once` reads one
39
+ snapshot, `--plain` selects line output, and `--interval <s>` sets polling cadence.
40
+ It requires a checkout and rejects `--repository` and startup intake flags.
41
+ See [viewer controls](dispatcher.md#watch-a-dispatcher-running-elsewhere).
42
+ Operator agents must not launch it.
43
+
15
44
  ## Shipped arrangements
16
45
 
17
46
  ### Local process
@@ -32,6 +61,12 @@ bun ab dispatch
32
61
  bun ab dispatch --once
33
62
  ```
34
63
 
64
+ Local startup checks selected primary and alternate account sources before
65
+ acquiring the repository lease, in both watch and `--once` modes. Missing
66
+ credentials refuse startup with every account's source and remedy. Successor
67
+ preflight also refuses missing sources and keeps the running generation active.
68
+ Unused declared accounts do not block dispatch. See [account admission](accounts.md#dispatcher-admission).
69
+
35
70
  The host needs:
36
71
 
37
72
  - the runtime CLI, dependencies, Git and check tools ([Workspaces](workspaces.md))
@@ -40,6 +75,13 @@ The host needs:
40
75
 
41
76
  A service manager may own the process under an identity with the same configuration and credentials. To restart, stop gracefully and let drain and suspension finish; work resumes from durable state. A restart never answers escalations or grants merge consent. See [the dispatcher lifecycle](dispatcher.md).
42
77
 
78
+ Hosted cron ticks hold new account-dependent work behind one durable repository
79
+ condition per missing project secret. Use `bun ab secrets set VARIABLE`, or
80
+ `bun ab accounts login NAME --project` for refreshing ChatGPT credentials; the
81
+ next tick recovers automatically without spending build infrastructure attempts.
82
+ Project account slots never fall back to service-environment credentials.
83
+ Observation, controls and cleanup continue during the hold.
84
+
43
85
  ### Origin-mode dispatcher with remote workspaces
44
86
 
45
87
  Commit a remote-compatible configuration to the base branch:
@@ -17,6 +17,29 @@ bun ab dispatch
17
17
  It watches your ticket source, claims eligible tickets, pins their specs, and starts isolated build-runners up to capacity.
18
18
 
19
19
 
20
+ ## Watch a dispatcher running elsewhere
21
+
22
+ A human can open the terminal dashboard from a local checkout without dispatching:
23
+
24
+ ```sh
25
+ bun ab dispatch --viewer --dispatched-by app.autobuild.run
26
+ ```
27
+
28
+ The optional label is descriptive input. Every frame says `viewer · dispatched by
29
+ <label>`, or simply `viewer` when omitted. Plain/non-TTY output states the mode
30
+ at startup and prints state changes. `--once` reads one snapshot; `--interval <s>`
31
+ sets the polling cadence. Without a recorded configuration it waits for the dispatcher.
32
+
33
+ The viewer takes no repository lease and starts no build, harvest, scan, janitor,
34
+ or dispatcher process. Ctrl-C closes only the viewer. Shared-store controls
35
+ remain available: merge consent, hold, pause/resume, blocked feedback/retry,
36
+ intake and harvest gates, harvest resume/acknowledgement, queued discard and
37
+ confirmed abort. Navigation and session inspection work as usual. These record
38
+ operator intent for the dispatcher to execute. No current control needs a local
39
+ dispatcher. Startup intake flags and `--repository` are rejected; use a local
40
+ checkout with its configured Store or `--store`. Operator agents still must not
41
+ run `ab dispatch`, including `--viewer`.
42
+
20
43
  ## Ready work becomes a build
21
44
 
22
45
  A ticket is claimed when it passes every gate:
@@ -57,3 +80,21 @@ A restart loses nothing. The dispatcher continues each build from its recorded p
57
80
  Your operator agent is an external coding agent you direct, like Claude Code or Codex. It files and grooms tickets with you, operates the builds the repository's dispatcher dispatches, answers bounded escalations and manages merge consent, using the `ab` CLI locally or the same tools over MCP. You make the product calls. Autobuild never hosts or starts it, and its chat isn't part of the build's paper trail.
58
81
 
59
82
  Next: [operator surfaces](operator-surfaces.md) for the controls, [one build end to end](builds.md) for the phases.
83
+
84
+ ## Hosted dispatch and local viewing
85
+
86
+ A plain `ab dispatch` reads dispatch placement once before starting local execution.
87
+ For a hosted project it opens the Store-only viewer automatically, displaying
88
+ `viewer · dispatched by <host>` from the placement origin (including a nondefault
89
+ port). `--once`, `--plain`, and `--interval` retain their viewer meanings.
90
+ `--takeover` explicitly dispatches locally, with a warning that it can displace
91
+ the hosted dispatcher; it cannot be combined with `--viewer`. Startup intake
92
+ flags require `--takeover` when placement selects viewer.
93
+
94
+ An unreadable placement fails closed with a typed error naming the cause:
95
+ use `--viewer` to watch or `--takeover` to dispatch locally. Both explicit modes
96
+ skip placement discovery. Older services without the capability and projects
97
+ with unknown or nonhosted placement retain local dispatch behavior. Local stores
98
+ need no placement request. Origin mode (`--repository` or `AB_REPOSITORY`) and
99
+ hosted cron dispatch bypass this check. Placement is a startup snapshot, not a
100
+ liveness probe or a polling input.
package/docs/forges.md CHANGED
@@ -119,3 +119,8 @@ Classify failures with `ForgeFailure` (API 1.8):
119
119
  Ordinary policy or permission refusals stay deferrals.
120
120
 
121
121
  Optional `observeRequests` observers count every wire request, including failures and pagination, attributed to a build when known, excluding skipped calls and credential discovery; no observer means "unknown", not zero. Keep tokens out of failures and telemetry.
122
+
123
+ Destination polling requires authoritative `remoteBranchSha`; automatic restack
124
+ admission also requires immutable `isCommitAncestor` proof. Failed reads or
125
+ missing capabilities defer work. Proven upstream rewrites retain the accepted
126
+ target and raise attention; local dispatcher refs never substitute for the forge.