@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/SPEC.md CHANGED
@@ -219,6 +219,42 @@ surface remains the remote HTTP protocol rather than in-process registration.
219
219
 
220
220
  Small, independently runnable, crash-safe:
221
221
 
222
+ Explicit human `ab dispatch --viewer` is a Store-only dashboard lifecycle,
223
+ available from a local checkout in TTY and plain/non-TTY modes. It bypasses the
224
+ resident launcher, execution configuration/plugins, account admission and kernel
225
+ wiring. It never takes or renews a repository lease, starts a child, writes
226
+ dispatch lifecycle facts, or runs intake scans, janitor, sweep, harvest or builds.
227
+ Canonical repository facts supply the observed dispatcher's status and effective
228
+ configuration, independent of the viewer's operator correlation identity. With no
229
+ configuration the display waits, polling bounded canonical state. Fresh viewers
230
+ reuse saved server reductions; missing presentation caches never trigger event
231
+ history reconstruction. Idle polls read zero event rows.
232
+
233
+ Every frame reserves a row for `viewer`, optionally `viewer · dispatched by
234
+ <label>` from explicit `--dispatched-by` input. Plain output states the mode at
235
+ startup. `--once` reads one snapshot, `--interval` sets polling cadence, and Ctrl-C
236
+ closes only presentation. All existing Store-level controls remain available:
237
+ merge/hold, build and global pause/resume, blocked feedback/retry, intake/harvest
238
+ gates, harvest resume/acknowledgement, discard and confirmed abort, plus navigation
239
+ and session inspection. No current control requires a local dispatcher. Viewer
240
+ rejects startup intake flags and explicit `--repository`.
241
+
242
+ A plain `ab dispatch` reads dispatch placement once before starting local execution.
243
+ For a hosted project it opens the Store-only viewer automatically, displaying
244
+ `viewer · dispatched by <host>` from the placement origin (including a nondefault
245
+ port). `--once`, `--plain`, and `--interval` retain their viewer meanings.
246
+ `--takeover` explicitly dispatches locally, with a warning that it can displace
247
+ the hosted dispatcher; it cannot be combined with `--viewer`. Startup intake
248
+ flags require `--takeover` when placement selects viewer.
249
+
250
+ An unreadable placement fails closed with a typed error naming the cause:
251
+ use `--viewer` to watch or `--takeover` to dispatch locally. Both explicit modes
252
+ skip placement discovery. Older services without the capability and projects
253
+ with unknown or nonhosted placement retain local dispatch behavior. Local stores
254
+ need no placement request. Origin mode (`--repository` or `AB_REPOSITORY`) and
255
+ hosted cron dispatch bypass this check. Placement is a startup snapshot, not a
256
+ liveness probe or a polling input. Operator agents' prohibition on running dispatch includes viewer.
257
+
222
258
  Resident checkout-backed `ab dispatch` starts a launcher and one dispatcher
223
259
  **generation**. The launcher eagerly loads its own filesystem/process code,
224
260
  opens no Store, holds no repository/execution lease and makes no kernel
@@ -418,6 +454,28 @@ files, including development configs, remain exactly as installed.
418
454
  It also owns observation back-pressure: settling
419
455
  outstanding recoverable harvest runs takes priority over starting new scans
420
456
  (§12). Cron-friendly.
457
+ Before claiming, the dispatcher journals a repository-scoped preparation intent;
458
+ a won claim and the exact selected creation slug are durable boundaries. Caught
459
+ asset-copy, spec-authoring, naming, and build-creation failures return the ticket
460
+ to configured Ready; a nonconforming spec goes to configured Triage. Recovery
461
+ checks the exact selected build first: a matching record and atomic
462
+ `build.created` retain ownership even if creation threw after committing.
463
+ Unavailable or conflicting readback never authorizes release or a replacement
464
+ build. Pending attempts retain the original failure, latest recovery error and
465
+ retry deadline in the canonical repository reduced value; resolved attempts
466
+ leave that value. Under repository ownership, each tick admits at most eight
467
+ due recovery attempts, before intake and independently of capacity or intake
468
+ settings, with a 30-second durable retry delay after recovery failure. Unresolved
469
+ ticket identities remain withheld. An uncertain claim outcome or unrelated
470
+ external ticket state, missing ticket/state, or conflicting slug ownership terminates
471
+ automatic recovery with an `abandoned` resolution and diagnostic reason. The
472
+ ticket is left unchanged; an operator can leave it finished or cancelled, or
473
+ inspect ownership and explicitly return it to Ready for another attempt. These
474
+ cases stop provider polling and diagnostic appends. Recovery failures are
475
+ reported without preventing janitor, lease sweep, or other dispatch recovery.
476
+ This is not general process
477
+ crash recovery. Confirmed Ready/Triage transitions settle idempotently, so a
478
+ failed bounce comment does not return an invalid ticket to Ready.
421
479
  - **harvest-runner** — one staged repository workflow (`scan → synthesize ⇄
422
480
  review → file`) under a repository lease; not a build and not a phase.
423
481
  - **ingesters** — other outer-loop processes turning signals into proposals (§12).
@@ -436,6 +494,17 @@ one scan interval plus one tick when capacity permits. Observation while intake
436
494
  is off shares the cadence; an observation measurement cannot suppress a fresh
437
495
  admission scan when intake is enabled.
438
496
 
497
+ Only changed scan outcomes append `dispatcher.ticket-scan-completed`; comparison
498
+ includes counts, ordered diagnostics, readiness and criteria fingerprints, and
499
+ mode. Its `startedAt` is the measurement time of the last recorded outcome,
500
+ not a last-scanned heartbeat. A single replaceable, repository-keyed cadence
501
+ cache survives fresh dispatcher processes and acknowledges that canonical fact
502
+ by sequence. It contains scheduling metadata only, never counts or lifecycle
503
+ state, and is distinct from reducer checkpoints. Missing or stale metadata
504
+ falls back to the recorded fact and can cause one safe extra scan without
505
+ reconstructing history. Successful unchanged scans advance this cache only.
506
+
507
+
439
508
  ### 3.4 The event log spine
440
509
 
441
510
  Build processes append typed events to per-build logs; repository-scoped outer
@@ -538,6 +607,10 @@ repeated names are errors. Plain string lists retain serial event sequences.
538
607
  Every member resolves post-reconcile policy, approved selection/`always`, then
539
608
  path applicability at stage entry. Only pass or skip satisfies a member. The
540
609
  next stage, or finalize after the last, waits for every member to pass or skip.
610
+ On a normal stage transition the runner drains agent turns before stage-local
611
+ shutdown: a terminal may precede trailing artifacts, transcript deposit and
612
+ `session.ended`. Parent shutdown and session budgets still interrupt this drain;
613
+ fail-fast retains immediate whole-execution cancellation.
541
614
 
542
615
  By default a failure lets all siblings finish; the settled stage routes once
543
616
  with every failed report, and no later stage runs. `failFast = true` on either
@@ -622,8 +695,9 @@ Two things wear the name:
622
695
 
623
696
  A reference document defining "buildable": what/why not how, acceptance
624
697
  criteria, explicit out-of-scope, evidence links — plus sizing guidance:
625
- fewer, larger tickets, split only at clean seams into a wide blocker graph so
626
- independent tickets build in parallel. It is a shared resource
698
+ fewer, larger tickets, each small enough for one implement session to finish,
699
+ split only at clean seams into a wide blocker graph so independent tickets
700
+ build in parallel. It is a shared resource
627
701
  cited by **every ticket-producing surface** — `/spec`, `harvest`, every
628
702
  `ingest:*`, and `dispatch`. An ingester's proposal is a spec written to the
629
703
  same standard with weaker evidence.
@@ -667,6 +741,8 @@ raises an `escalation`; a human uses `ab answer --revise-spec` (or
667
741
  `--revise-spec-from-ticket`), the spec gets rev N+1, and the leaf restarts
668
742
  from `plan` (cheap — downstream was invalidated anyway).
669
743
 
744
+ 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.
745
+
670
746
  Operators may explicitly revise an opened idle collecting node or a node blocked on failed
671
747
  integration verification without an escalation. Use
672
748
  `ab answer <node> --revise-spec replacement.md` or, after amending its ticket,
@@ -683,7 +759,11 @@ Active verification/reconcile or writer work, restack/reparent work, pause,
683
759
  pending controls, merge intent and ended PRs refuse the no-escalation path.
684
760
  A concurrent state change refuses publication with a retry explanation;
685
761
  uncited artifacts are inert. Leaves still require an open escalation and
686
- restart from `plan`.
762
+ restart from `plan` after any unfinished reconcile resumes under the revised
763
+ spec and its publication is confirmed.
764
+
765
+ Caught preparation failures before an established build follow the durable
766
+ claim recovery contract in §5; incomplete hosted snapshots never launch a build.
687
767
 
688
768
  **Ticket assets are frozen with the spec.** Claiming a ticket pins the
689
769
  ticket's current assets (§7.1.3) into the build the same way the spec becomes
@@ -935,13 +1015,13 @@ conformance suite):
935
1015
  client, is the conformance bar. Autobuild does not load in-process BuildStore
936
1016
  plugins. Git worktrees and default file tickets necessarily remain local.
937
1017
 
938
- A service accepts stable and prerelease clients from its own `major.minor`
939
- release line and the two preceding minor lines in the same major. A major starts a new family:
940
- X.0 accepts only X.0, X.1 accepts X.0/X.1, and X.2 onward accepts three lines.
941
- Patch versions are interchangeable in both directions and must never change
942
- the protocol. Upgrade the service first, then projects independently within
943
- its window. Supported release lines retain their wire handlers and known
944
- protocol identities; an unknown protocol is refused independently of version.
1018
+ 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.
1019
+
1020
+ Stable patches never reset a line’s first-publication date. Only actually published
1021
+ lines at or below the service line count; prereleases do not start retirement clocks.
1022
+ Publication facts survive removal of retired identities, contracts, and handlers.
1023
+ Patch releases must retain their line’s protocol identity. Unknown historical
1024
+ protocol identities are refused independently of the numeric window.
945
1025
  Stable and prerelease service and client identities share their numeric major/minor
946
1026
  line. Malformed or missing identities, build metadata (`+…`), prefixes and
947
1027
  whitespace are refused with HTTP 409.
@@ -952,8 +1032,9 @@ and supported range.
952
1032
  Unauthenticated `GET /health` publishes `ok`, `autobuildVersion`,
953
1033
  `protocolVersion`, and `supportedClientRange: { minVersion, maxVersionExclusive }`.
954
1034
  Range endpoints remain stable versions. The range is inclusive at the minimum
955
- and exclusive at the maximum; a 0.11.x
956
- service publishes `>=0.9.0 <0.12.0`. Health needs no credentials, version
1035
+ and exclusive at the maximum; a 1.3.x
1036
+ service publishes `>=1.2.0 <1.4.0` until later publication facts permit retirement.
1037
+ The service reads the clock for each decision, so retirement needs no redeploy. Health needs no credentials, version
957
1038
  headers, or available backend.
958
1039
 
959
1040
  `subscribe` is specced in the interface; the current implementation is polling
@@ -1032,6 +1113,46 @@ processes. Absence does not consume the marker. Restarts or later variable
1032
1113
  edits cannot resurrect removals. Deployments migrate the pinned schema before
1033
1114
  starting services; runtime initialization never runs DDL.
1034
1115
 
1116
+ ### Hosted dispatch placement
1117
+
1118
+ The hosted service publishes a durable advisory repository fact,
1119
+ `dispatcher.placement-set`, and serves its canonical `dispatchPlacement` reduction.
1120
+ The fact says whether this service dispatches a registered project; a hosted value
1121
+ includes its public `AB_DISPATCHER_ORIGIN`, never credentials. It is configured
1122
+ responsibility, not liveness. Unrecorded placement is unknown. Bounded repository
1123
+ journal reads retain only the latest placement publication across run anchors.
1124
+
1125
+ Hosted responsibility requires the cron endpoint to be enabled: unset or blank
1126
+ `CRON_SECRET` publishes `{ hosted: false }` for every admitted project, without
1127
+ requiring `AB_DISPATCHER_ORIGIN`. Cron authorization and read-time publication
1128
+ share this enablement check. When enabled, selection and origin configuration
1129
+ are validated before publication.
1130
+
1131
+ Cron and read-time publication share the `AB_DISPATCHER_REPOSITORIES` parser:
1132
+ unset selects every registered project, and an explicit normalized, deduplicated
1133
+ CSV selects only registered members. No web-selection fallback applies. Cron
1134
+ synchronizes included and excluded projects using its existing registry listing;
1135
+ a project read synchronizes only that admitted key, including before first cron.
1136
+ Configuration changes are published on next synchronization. Invalid configuration
1137
+ fails without overwriting placement. Account secrets are unnecessary for publication.
1138
+
1139
+ Compare, append-if-changed and canonical reduction persistence are one transaction
1140
+ under a per-project serialization lock, with registration-generation admission.
1141
+ Initialization may reduce that scope/identity once and saves it durably; idle reads
1142
+ fetch zero event rows and a constant number of keyed records, independent of log
1143
+ length and project count. Changed reads consume only the incremental tail.
1144
+
1145
+ Authorized project members and dispatcher credentials read
1146
+ `GET /repos/{encodedRepo}/placement`; delegated build/harvest grants are refused.
1147
+ The optional health capability `dispatch-placement-v1` is advertised only with a
1148
+ provider. The core client negotiates once per instance and returns typed unknown
1149
+ (`unsupported-capability`) for older services, without probing the route or
1150
+ reconstructing state from events. Other failures remain failures. External event
1151
+ publication cannot forge service placement. Existing protocol identity and
1152
+ supported released reducer shapes remain unchanged. Checkout-backed dispatch uses this fact to select viewer mode before launching
1153
+ any local dispatcher; explicit takeover authorizes local execution. See [the remote protocol](docs/remote-store-protocol.md#hosted-dispatch-placement)
1154
+ for response shapes and authority semantics.
1155
+
1035
1156
  ### 7.3 Persistence granularity
1036
1157
 
1037
1158
  Required phase outputs persist at **phase/round boundaries**; a killed phase
@@ -1094,7 +1215,9 @@ The base-selection invariants make this safe with Git:
1094
1215
  samples are deduplicated; destination changes and rewrites invalidate samples.
1095
1216
  Sampling never provisions a workspace, renders Git reads, or gates restacking.
1096
1217
  - **Observation never mutates a running workspace.** `target.moved` records an
1097
- exact observed head, even during a session. Transactions freeze their target;
1218
+ accepted remote head, even during a session. Non-descendant observations without
1219
+ indexed kernel publication lineage record `target.rewritten` and attention
1220
+ without changing the accepted target. Transactions freeze their target;
1098
1221
  later observations coalesce into one follow-on transaction for the newest
1099
1222
  snapshot at the next eligible point. Session and execution settlement fence
1100
1223
  rewrites, and trusted publication waits for remote guest teardown.
@@ -1234,6 +1357,41 @@ decision reads stream content; outcomes travel only the typed CLI. Writers
1234
1357
  (agent runners emitting parts) and readers (operator UIs) are separate
1235
1358
  tickets; this section defines only the primitive.
1236
1359
 
1360
+ ### Hosted event-read limits
1361
+
1362
+ Hosted repository journals serve only cursors at or above
1363
+ `max(0, head - 1000)`, inclusive; an expired cursor returns typed
1364
+ `cursor-too-old` with the oldest servable cursor before any event rows are read.
1365
+ Build history uses pages of at most 256 events with continuation cursor and
1366
+ `hasMore`. The remote complete-suffix array method throws
1367
+ `IncompleteEventReadError` if another page exists. Local SQLite and memory
1368
+ full-history methods remain available.
1369
+
1370
+ Protocol 7's page envelope is prepared for the next minor line, 1.4, without
1371
+ changing package versions. Supported published 1.2 and 1.3 clients retain
1372
+ protocol 6: complete build suffixes fitting one page return plain arrays;
1373
+ larger suffixes and expired repository cursors return legacy-decodable
1374
+ `conflict` errors. Bounds apply before protocol projection. Same-line admission
1375
+ accepts runtime and published ledger protocols. Public health advertises a
1376
+ validated same-line request's protocol, otherwise the service line's published
1377
+ protocol (or runtime protocol for an unpublished line), with truthful package
1378
+ version and support range and no store reads.
1379
+
1380
+ Watch/wait resume uses exact server-owned historical seed checkpoints within
1381
+ the same 1,000-position window for build and repository streams, then reads
1382
+ only the gap. Ordinary reducer/catalog upgrades preserve in-window cursors:
1383
+ one serialized canonical rebuild per identity also captures the trailing
1384
+ checkpoints and saves both atomically, with no second event replay. Later
1385
+ requests and fresh processes reuse that durable result. Two identities per
1386
+ scope retain checkpoints; retired identities have permanent indexed tombstones
1387
+ and cannot re-admit themselves. Missing/corrupt checkpoint coverage fails with
1388
+ a typed integrity error. Appends never depend on checkpoint availability.
1389
+ Expired resume cursors terminate watch/wait with fresh-attachment instructions:
1390
+ re-arm without `--since`, reconcile status, and acknowledge the unavailable gap.
1391
+ Explicit harvest history uses reverse indexed filtered pages rather than a
1392
+ journal replay. See `docs/remote-store-protocol.md` for the wire contract,
1393
+ initial migration bootstrap and generation-retirement recovery.
1394
+
1237
1395
  ## 8. The `ab` CLI
1238
1396
 
1239
1397
  The **only** channel between agents and the store — and the enforcement
@@ -1503,6 +1661,15 @@ a new classified failure parks again. There are zero automatic paid retries
1503
1661
  after this deferral. If evidence cannot be written, ordinary recovery applies;
1504
1662
  agent output and `no-terminal` alone never classify a read failure.
1505
1663
 
1664
+ A kernel store write rejected with HTTP 413 raises `StoreWriteTooLargeError`
1665
+ and records `phase.failed {willRetry:false}` on its first attempt, including
1666
+ for automatic restack and session preparation. Its diagnostic names an oversized
1667
+ store write, the HTTP method and route, exact UTF-8 request bytes, and the
1668
+ server message (including any reported ceiling). It parks with
1669
+ `non-retryable-phase-failure`; an operator answer authorizes a fresh attempt,
1670
+ which parks immediately again if still rejected. Store failures never select an
1671
+ alternate provider. Other store statuses retain their existing retry policy.
1672
+
1506
1673
  Ordinary silence, provider failures and session timeouts retain the runner's
1507
1674
  phase failure limit (`BuildRunnerOpts.maxPhaseAttempts`, default 2). This is
1508
1675
  an internal runner option, not an accepted `[policy]` TOML key. Reconcile
@@ -2314,6 +2481,14 @@ is excluded. An empty completed node contributes nothing; missing or ambiguous
2314
2481
  completion evidence does not mean empty. The newest build generation is used,
2315
2482
  with ties diagnosed rather than falling back to older successful work.
2316
2483
 
2484
+ Destination observations retain versioned, head-bound Git witnesses (reachable
2485
+ commit SHAs and direct build trailers) and a fixed-length evidence digest. Current
2486
+ confirmed landings and aliases from only the destination's accepted ancestry are
2487
+ reapplied before reuse. Unrelated merged history and ready destinations do not
2488
+ invalidate this proof. Head changes require a fresh Git sample; legacy observations
2489
+ without witnesses refresh once rather than replaying repository history. Current
2490
+ readiness and newest-generation checks still apply before claim.
2491
+
2317
2492
  Demand-driven restacking supplies ancestor changes to descendants. Sibling changes
2318
2493
  wait for their node to merge in the common ancestor and presence demand into the target;
2319
2494
  descendant changes wait for their node to merge into the target ancestor. Same-node
@@ -2456,6 +2631,19 @@ actual destination, processing ancestors first. Unrelated siblings stay idle;
2456
2631
  changes absent from all ancestors cannot trigger a speculative replay. Tickets
2457
2632
  remain queued until presence is observed in their destination.
2458
2633
 
2634
+ A presence request whose identities are absent from its immediate parent remains
2635
+ pending while ancestors restack or reconcile. A durable availability observation
2636
+ allows unchanged idle ticks, including after restart, to skip repository preparation
2637
+ and native auto-merge cancellation. Exact node/parent heads, contribution base,
2638
+ request contents, accepted ancestry, foreign aliases and confirmed landing evidence
2639
+ invalidate that observation when they change; polling timestamps do not. Failed
2640
+ assessments never establish unavailability. Availability is not proof of destination
2641
+ coverage. Moving to another destination branch explicitly settles obsolete requests
2642
+ with `destination-changed`; losing identities on the same branch leaves them waiting.
2643
+ Native auto-merge is suspended with confirmed, reusable receipts only when replay
2644
+ is actionable, and is revalidated during recovery before rewrite effects.
2645
+
2646
+
2459
2647
  `ab restack <node>` (operator tool `builds.restack`, input `{repo, slug}`) records
2460
2648
  a durable request, coalescing pending demand. It refuses leaves, terminal nodes,
2461
2649
  and unopened nodes. Paused or blocked nodes wait for their normal safety gates.
@@ -2671,6 +2859,17 @@ first retry after a source cooldown remain recorded. Recorded starts may arrive
2671
2859
  with completion; optional `startedAt` preserves the actual start time, falling
2672
2860
  back to envelope time for historical journals.
2673
2861
 
2862
+ Watch mode keeps running when both a tick and its failure publication fail,
2863
+ warning locally with both errors. Failed iterations wait at least the configured
2864
+ interval or one second, whichever is longer. One bounded in-memory episode
2865
+ retains the original error, count and observation window; recovery appends a
2866
+ standalone `dispatcher.tick-failed` diagnostic before the next operational tick.
2867
+ An unacknowledged diagnostic remains pending and may be duplicated after a lost
2868
+ response. Reporting never closes a later tick boundary or gates committed
2869
+ handoff acceptance. Explicit shutdown, supersession and fatal forge publication
2870
+ still stop the loop; once mode rethrows the original tick error even if reporting
2871
+ fails. Stopping before recovery leaves only local warnings for unreported failures.
2872
+
2674
2873
  Repository tick telemetry is bounded mutable operational metadata, like leases.
2675
2874
  `beginRepoTick` persists the open boundary before unsafe work; `finishRepoTick`
2676
2875
  atomically replaces it with actual completion time and outcome and appends any
@@ -2811,7 +3010,7 @@ with illustrative members:
2811
3010
 
2812
3011
  | Family | Examples |
2813
3012
  |---|---|
2814
- | Build lifecycle | `build.created` (carrying `assets`, the claim-time pin, §6.3), `workspace.provisioned`, `workspace.released`, `execution.started`, `execution.ended`, `infrastructure.failed`, `infrastructure.cleanup-attempted`, `dispatch.comment-posted`, `dispatch.failed`, `runner.attached`, `runner.runtime-recorded`, `runner.setup-failed`, `abort.remote-branch-deleted`, `abort.local-branch-deleted`, `abort.ticket-returned`, `build.completed` |
3013
+ | Build lifecycle | `build.created` (carrying `assets`, the claim-time pin, §6.3), `workspace.provisioned`, `workspace.cleanup-required`, `workspace.fenced`, `workspace.commits-preserved`, `workspace.commits-lost`, `workspace.released`, `execution.started`, `execution.ended`, `infrastructure.failed`, `infrastructure.cleanup-attempted`, `dispatch.comment-posted`, `dispatch.failed`, `runner.attached`, `runner.runtime-recorded`, `runner.setup-failed`, `abort.remote-branch-deleted`, `abort.local-branch-deleted`, `abort.ticket-returned`, `build.completed` |
2815
3014
  | Operator commands [D2] | `build.pause-requested` → `build.paused`; `build.discard-requested`; `build.hold-requested`; `build.land-requested` → `landing.command-acknowledged`; `escalation.answered` (optionally carrying a validated `reviewRoundCeiling`, or the `assets` sampled with a revise-from-ticket authorization) |
2816
3015
  | Merge policy | `landing.decided` (candidate, matched rule/default, labels, target, mode); `landing.native-enable-started`; `landing.native-applied` |
2817
3016
  | Spec | `spec.imported`, `spec.authored`, `spec.revised` (either positive `escalation` sequence or exclusive `operator: {user, via?}` provenance for an idle node; optionally carrying `assets`, a re-pin of the ticket's assets, §6.3) |
@@ -2821,7 +3020,7 @@ with illustrative members:
2821
3020
  | Integration attention | Kernel/dispatcher `integration.verification-failed {id, head, parent, steps, guidance}`: one durable failed-cycle notification, recovered from exact verification receipts |
2822
3021
  | PR summary | Kernel-authored `pr-summary.requested {occurrence, boundary}`, `pr-summary.attempted {occurrence, boundary, pr}`, `pr-summary.result {attempt, outcome, eligibleAfter?}`, `pr-summary.settled {request, disposition}`; sequence identities correlate durable starts, completed boundaries, attempts, and handoffs (§7.5) |
2823
3022
  | PR attachments | `pr-attachment.designated`, `pr-attachment.hosted`, `pr-attachment.reclaimed`, `pr-attachment.reclaim-failed` |
2824
- | Leaf restacking | `target.moved {branch, sha}`, advisory `target.distance {branch, sha, head, count}`, `restack.prepared`, `restack.replayed`, `restack.publish-intended`, `restack.rewritten`, `restack.contended`, `restack.completed` |
3023
+ | Leaf restacking | `target.moved {branch, sha, lineage?}`, `target.rewritten {branch, previousSha, sha}`, `target.rewrite-cleared {branch, sha, lineage?}`, advisory `target.distance {branch, sha, head, count}`, `restack.prepared`, `restack.replayed`, `restack.publish-intended`, `restack.rewritten`, `restack.contended`, `restack.completed` |
2825
3024
  | Post-PR [D1] | `pr.merged`, `pr.conflicted`, `reconcile.progress-checked`, `reconcile.started`, `reconcile.prepared`, `reconcile.replayed`, `reconcile.publish-intended`, `reconcile.rewritten`, `reconcile.contended`, `reconcile.completed` |
2826
3025
  | Cross-cutting | `observation.recorded`, `escalation.raised`, `phase.failed`, `session.build-read-failed`, `phase.deferred`, `phase.deferral-escalated` |
2827
3026
  | Repository journal | dispatcher setting facts; run lifecycle, effective config, tick/queue diagnostics, reload and runner outcomes; the `harvest.*` workflow, recovery, and ledger facts |
@@ -2916,10 +3115,25 @@ read-decoder revision. Named and generic checkpoints use catalog-specific keys;
2916
3115
  legacy/foreign-catalog snapshots are misses and are preserved. Unrecognized
2917
3116
  reducer versions replay without repairing their cache. No lower-version write
2918
3117
  replaces a higher-version row, even at a later cursor. Corrupt caches of the
2919
- reader's own version may be conditionally repaired. Hosted named answers are canonical: the client accepts a representable finished
2920
- value at its reducer version regardless of catalog identity. Version mismatches,
2921
- invalid envelopes and invalid finished values fail with a typed incompatibility
2922
- error naming the reducer and client/server versions. Remote clients never
3118
+ reader's own version may be conditionally repaired. Hosted named answers are canonical: the client accepts any finished value its own shape
3119
+ can represent, regardless of reducer version or catalog identity. A reducer
3120
+ version is the server's cache identity, not a compatibility gate. The client
3121
+ drops object properties its shape does not know, so additive server changes
3122
+ reach older readers. Invalid envelopes and values the client cannot represent
3123
+ (a missing field, an unknown variant) fail with a typed incompatibility error
3124
+ naming the reducer and client/server versions. Clients send
3125
+ `x-autobuild-reducer-value-projection: 1`. The service retains frozen contracts for
3126
+ every supported published client, including clients with projection capability.
3127
+ It adapts canonical answers to the released finished shape and reducer version.
3128
+ Unknown event variants in optional `lastEvent` are omitted, also in nested build
3129
+ state, while cursor, progress, and compatibility facts remain canonical. The
3130
+ required `seenTypes` set retains the event types known to that released reader.
3131
+ Unrepresentable required values remain typed incompatibilities. A request may
3132
+ identify its generated finished-value catalog in `x-autobuild-catalog-identity`;
3133
+ a recorded published identity selects its frozen contract. An unrecognized catalog
3134
+ identity with projection capability retains the canonical answer, including source
3135
+ catalogs whose package version still names an older release. Release preparation
3136
+ records the header identity sent by each published client. Remote clients never
2923
3137
  reconstruct named answers from event logs. Catalog identity travels in response
2924
3138
  header `x-autobuild-catalog-identity`; strict JSON bodies remain exactly
2925
3139
  `{version, cursor, value}`. Missing/malformed headers do not reject an answer.
@@ -2949,6 +3163,9 @@ restacking). Durable `node.restack-requested` facts retain operator/presence dem
2949
3163
  including destination, sampled parent, dependent ticket and required identities.
2950
3164
  Reservations freeze covered request ids; confirmed settlement acknowledges only
2951
3165
  that coverage, and `node.restack-satisfied` records coverage or destination change.
3166
+ `node.restack-availability-observed` retains a versioned semantic fingerprint, sampled
3167
+ branches/heads/base and available request IDs; it is an optimization fact, never
3168
+ positive presence proof.
2952
3169
  `target.distance` records advisory leaf distance with immutable destination and
2953
3170
  build tips; null count means unknown (a known count requires a head).
2954
3171
  `node.parent-distance` records immutable base/parent/branch and count (null when unknown).
@@ -3147,12 +3364,33 @@ The setup target belongs only to escalation metadata and is not a pipeline `Phas
3147
3364
  native continuation described in §9. The following remote-sandbox recovery
3148
3365
  retains its fresh-session fallback.
3149
3366
 
3367
+ Before releasing or replacing a build workspace, the dispatcher confirms a
3368
+ non-destructive execution fence for the exact workspace and execution generation.
3369
+ It preserves unpublished branch commits and distinct detached producer candidates
3370
+ under immutable `refs/autobuild/archive/<build>/<sha>` refs, verifies their exact
3371
+ readback, and records `workspace.commits-preserved` before cleanup. Replacement
3372
+ provisioning restores those exact refs before starting an agent. Preservation
3373
+ never advances the public build branch. A confirmed absent environment records
3374
+ `workspace.commits-lost`, naming known candidates and explicitly noting that any
3375
+ additional unpublished SHAs could not be inspected. Unknown fencing, inspection,
3376
+ transport, or receipt-write outcomes leave the workspace and snapshots intact.
3377
+ Fencing is revalidated after restart; a saved receipt alone never authorizes
3378
+ cleanup of a newer execution. Current recovery notes are linked by the session
3379
+ manifest's `workspaceRecovery` field. Recovery notes apply to the next session
3380
+ and repeat hydration within it; empty checkpoints produce no note. Checkpoints survive
3381
+ repeated replacement until a published reconcile or restack rewrite retires them,
3382
+ so an old preserved branch cannot overwrite that rewrite. Before the first
3383
+ branch publication, preservation compares against the recorded workspace base.
3384
+ A confirmed `snapshot_not_found` response means the sandbox filesystem is gone;
3385
+ cleanup records loss and deletes its stale name before replacement.
3386
+
3150
3387
  **Remote sandbox death:** log ends at `session.started {session: old}` after
3151
3388
  `implement.started {round: 2}`; heartbeat goes stale → dispatcher expires the
3152
- lease, records the old execution identity, stops/deletes its exact deterministic
3153
- sandbox name, and confirms absence before recording `workspace.released` → it
3389
+ lease, records the old execution identity, fences and preserves its committed
3390
+ work before deleting the exact deterministic sandbox name, and confirms absence
3391
+ before recording `workspace.released` → it
3154
3392
  provisions the next generation from the published build head (or the original
3155
- recorded branch-cut SHA when no checkpoint exists) → `workspace.provisioned
3393
+ recorded branch-cut SHA), then restores preserved branch and producer refs → `workspace.provisioned
3156
3394
  {base: {source: existing, sha}}` → the workspace execution capability starts a
3157
3395
  fresh process and records the replacement sandbox/session identity. The
3158
3396
  supervising kernel first claims the lease for that execution
@@ -3165,9 +3403,10 @@ started-not-completed, so the process re-runs the phase from its start and opens
3165
3403
  one fresh session. For a `publication.requested` fact issued before the old
3166
3404
  `workspace.released`, the supervisor first compares its exact SHA with the
3167
3405
  durable remote branch: a match repairs the missing completion fact before the
3168
- replacement starts, covering a lost post-push acknowledgement; otherwise the
3169
- commit existed only in the deleted sandbox, the request is abandoned, and the
3170
- phase rerun must issue a new request. A crash while closing several sessions
3406
+ replacement starts, covering a lost post-push acknowledgement. Otherwise exact
3407
+ private refs and replay objects distinguish preserved continuation from genuine
3408
+ loss. Missing rewrite candidates restart their producing replay under retained
3409
+ intent; an implementation rerun issues a new publication request. A crash while closing several sessions
3171
3410
  merges no attachment;
3172
3411
  the next recovery closes only those still open, so repeated takeover converges.
3173
3412
  Historical orphan-only logs remain valid and require no repair.
@@ -3227,6 +3466,18 @@ every actionable build on its first tick rather than waiting for the sweep;
3227
3466
  lease claiming stays the exclusivity gate, so a genuinely live old runner
3228
3467
  wins harmlessly.
3229
3468
 
3469
+ A running, unblocked, unpaused build with an orphaned open session has pending
3470
+ kernel cleanup even when the phase engine waits on its PR. With no live lease
3471
+ or execution, the next admitted sweep attaches a runner through ordinary session
3472
+ reclamation before summary and landing readiness can proceed. A provider-proved
3473
+ end reuses the healthy workspace; a proved loss uses fenced replacement. An
3474
+ unobserved open execution is not proof of death. Intentionally suspended sessions
3475
+ and idle collecting nodes do not trigger this cleanup. A proved-ended execution
3476
+ with actionable work or eligible cleanup bypasses absent-lease first-claim grace;
3477
+ never-attached builds retain grace. Detection uses canonical reduced facts, with
3478
+ no history replay or new poll. Existing infrastructure failure attention and
3479
+ retry budgets govern failed recovery.
3480
+
3230
3481
  Verification's current result boundary also advances on `verify.config-captured`
3231
3482
  and `verify.config-superseded` (§16.1). These facts do not change reconcile
3232
3483
  identity or its policy snapshot; replay gates still refer to the code/reconcile
@@ -3275,7 +3526,12 @@ should drain work before upgrading rather than run mixed-version writers.
3275
3526
  Before branch replacement the kernel publishes Git tips named by retained
3276
3527
  history and rewrite facts, plus both heads and the temporary change, under immutable non-branch refs
3277
3528
  `refs/autobuild/archive/<slug>/<sha>`. Archives must be fetchable by exact ref;
3278
- namespace or permission failures stop publication without a branch/tag fallback.
3529
+ namespace or permission failures stop publication without a branch/tag fallback. Remote
3530
+ archives also publish commits present only on the remote: GitHub uses create-only
3531
+ Git-reference REST creation when the workspace lacks the commit, retaining guarded Git
3532
+ pushes for local objects. Exact remote readback confirms publication, then a depth-one
3533
+ fetch by the archive ref (without tags or configured refmap expansion) restores missing
3534
+ commits and verifies them locally before returning.
3279
3535
  Publication requests and loss records alone are not retained Git history: their
3280
3536
  unpublished objects may have died with a released sandbox. A separately published
3281
3537
  or reviewed tip remains an archive requirement even when an earlier request named
@@ -3307,6 +3563,8 @@ no agent and do not fabricate `reconcile.completed`. A conflicted replay is adop
3307
3563
  by `reconcile.started {restackId}` without another collapse or target selection.
3308
3564
  Resolver completion links back to the automatic transaction. Retained commit bytes
3309
3565
  and replay object packs recover disposable-workspace objects before publication.
3566
+ 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.
3567
+
3310
3568
 
3311
3569
  `reconcile.prepared` records transaction identity, attempt, branch, old head,
3312
3570
  effective old base, target base and temporary single-change SHA before checkout.
@@ -3509,6 +3767,8 @@ risky — semantic conflicts, spec-relevant choices — escalates rather than
3509
3767
  guesses. Reconcile skips `code-review` by default (escalation covers the
3510
3768
  judgment cases; policy can force it).
3511
3769
 
3770
+ 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.
3771
+
3512
3772
  On each repeat conflict, the runner records a fresh authoritative base snapshot
3513
3773
  on `reconcile.progress-checked`, tied to that conflict and the most recently
3514
3774
  completed attempt. The kernel compares it with that attempt's matching latest
@@ -3711,6 +3971,17 @@ decide where a build's effective configuration is composed from:
3711
3971
  | Deployment-owned (live) | `[roles]` (runtime, model, args, alternates, per-role `sessionBudgetSeconds`) and `[policy]` (budgets, retry bounds, stall and harvest knobs) | The dispatcher's live snapshot; an accepted reload delivers these to active builds. |
3712
3972
  | Dispatcher-owned | `baseBranch`, `capacity`, `ticketScanIntervalSeconds`, `forge`, `plugins`, `pr`, `tickets`, `orchestrator`, `merge`, `upgrade` | The dispatcher's live snapshot; the build runner never interprets them. |
3713
3973
 
3974
+ Dispatcher lease sweeps may reuse parsed effective-config pins in a disposable
3975
+ 128-entry LRU, validated on each lookup by the latest artifact metadata revision.
3976
+ Artifact-only deposits invalidate reuse independently of build events. Each
3977
+ sweep recomputes decisions from current reduced facts, live deployment settings,
3978
+ and the applicable cycle capture. Missing pins retain the existing live-config
3979
+ fallback; unreadable or invalid pins invalidate reuse and withhold decisions
3980
+ until a successful read or repair. Launch, resume and merge action boundaries
3981
+ continue reading fresh full artifacts. Restart and eviction change read volume
3982
+ only. Adapters without the optional latest-metadata capability retain full
3983
+ artifact reads; metadata lookup never lists revision history or loads blobs.
3984
+
3714
3985
  A build's pipeline definition is therefore composed from the build's own
3715
3986
  branch: in origin mode the dispatcher reads `autobuild.toml` at the build's
3716
3987
  recorded base commit (or its branch head once the build has published commits)
@@ -4115,11 +4386,55 @@ by the shared projection vocabulary and reused by terminal and CLI text.
4115
4386
 
4116
4387
  ## Forge failure recovery
4117
4388
 
4389
+ Destination heads come only from the authoritative forge branch; dispatcher-host
4390
+ refs are never a fallback. Failed remote reads retain the accepted observation;
4391
+ classified rate limits use repository forge degradation and cooldown. Changed
4392
+ heads require immutable commit ancestry proof against the accepted target and
4393
+ the destination base already used by replay. Missing capability or failed proof
4394
+ defers new replay. A non-descendant without kernel lineage records
4395
+ `target.rewritten` with branch,
4396
+ previous SHA and observed SHA, retains the accepted target, and raises watch/wait
4397
+ attention. Repeated rewrite pairs are deduplicated. Returning to a safe target
4398
+ clears attention (`target.rewrite-cleared` when the accepted tip is unchanged).
4399
+ Upstream force-pushes are never adopted automatically. Accepted node reparenting
4400
+ starts a new branch scope; frozen transactions recover their retained inputs.
4401
+
4402
+ Kernel restacks of a node are admitted through durable guarded publication
4403
+ receipts, not treated as external force-pushes. The dispatcher walks an index
4404
+ keyed by node and previous head, at most 64 receipt lookups from each child
4405
+ baseline; cost is capped independently of journal length or total receipts.
4406
+ Exact links use point lookups. When forward child landings separate restacks,
4407
+ the dispatcher walks backwards from the latest publication with an indexed
4408
+ previous-receipt cursor. Every gap requires immutable ancestry from the earlier
4409
+ published head to the later receipt's previous head, as do the baseline and tip
4410
+ ends of the proof. Missing links never imply rewrite authority.
4411
+ The proven receipts travel in `target.moved.lineage`; build-scoped runners use
4412
+ that recorded proof without reading another build. Clearing attention for an
4413
+ unchanged accepted SHA retains newly proven lineage in `target.rewrite-cleared`.
4414
+ Missing receipts or a gap
4415
+ over 64 still record `target.rewritten` and raise attention. Each hop makes at
4416
+ most two immutable ancestry comparisons. The exact walk and gap recovery share
4417
+ the same 64-read cap, including unsuccessful lookups. Unchanged accepted
4418
+ polls read no receipts or event rows.
4419
+
4420
+ A historical `publication.lost` does not prove that every copy of its candidate
4421
+ is gone. Recovery checks the exact branch and private archive refs and retained
4422
+ replay objects first. An available candidate continues guarded publication.
4423
+ A genuinely missing reconcile or automatic restack candidate records
4424
+ `publication.candidate-retired`, abandons its obsolete request, and replays the
4425
+ producing operation with a fresh transaction identity. Its frozen target,
4426
+ reconcile occurrence or automatic trigger, cycle, and message survive. The
4427
+ retired candidate is excluded from archive requirements unless independently
4428
+ required by proven history. This reconstruction consumes no infrastructure
4429
+ attempt and no additional conflict occurrence; it needs no operator guidance.
4430
+ A bare retry also clears an existing infrastructure-limit escalation through
4431
+ ordinary retry semantics. Unavailable inspection defers rather than proving loss.
4432
+
4118
4433
  Leaf restack and reconcile publication retry classified transient forge or transport
4119
4434
  failures six times after the initial attempt, waiting 30, 60, 120, 240, 300 and
4120
4435
  300 seconds. `publication.retry-scheduled` records the operation, frozen rewrite
4121
4436
  identity, episode anchor, failure ordinal, last error and absolute retry time;
4122
- restart resumes that schedule without rerunning the resolver. These retries do
4437
+ restart resumes that schedule without rerunning a resolver whose candidate remains available. These retries do
4123
4438
  not consume `maxPhaseAttempts`. A seventh transient failure records
4124
4439
  `publication.retry-exhausted` and raises `publication-retry-limit`, naming the last
4125
4440
  error and six retries. Answering that escalation opens a fresh publication episode
@@ -4138,7 +4453,15 @@ clears it. `policy.janitorBackoffMaxSeconds` sets the positive integer cap.
4138
4453
 
4139
4454
  A classified forge rate limit records repository degradation with `resetAt`.
4140
4455
  Forge work waits during cooldown; passing the deadline permits a recovery
4141
- request, and only success clears degradation. A further limit extends cooldown.
4456
+ request; a successful probe records automatic recovery. An authorized operator
4457
+ may explicitly override erroneous recorded state with
4458
+ `ab repository forge-clear --forge <name> --reason <text>` or
4459
+ `repository.forge_clear {repo, forge, reason}`. This appends a human-attributed
4460
+ `dispatcher.forge-recovered` fact with the reason; it does not prove provider
4461
+ success. A subsequent actual limit records a fresh cooldown. Hosted admission
4462
+ requires a schema-valid finite ISO `resetAt` no later than server time plus
4463
+ 24 hours, inclusive; past deadlines remain valid. Rejection never clamps or
4464
+ invents a provider reset, and historical events remain readable.
4142
4465
  Native merge application failures keep candidate-specific retry eligibility,
4143
4466
  including automatic decisions without a human command. Retries recheck consent,
4144
4467
  holds, verification and the exact candidate. Uncertain enables remain pending
@@ -4174,9 +4497,15 @@ GitHub-only changes are discovered on the next due check, within the idle
4174
4497
  interval plus normal tick scheduling while the dispatcher is running; failure,
4175
4498
  cooldown and transport-budget gates still apply. Pending operations retain
4176
4499
  active polling and action-time readiness checks remain fresh. Successful
4177
- `node.poll-checked` facts preserve quiet history across restarts; missing facts
4178
- force a fresh check. `ab build status` reports active or idle cadence and the
4179
- last successful check (or unrecorded evidence).
4500
+ `node.poll-checked` advisory facts preserve quiet history across restarts.
4501
+ Each successfully observed activity or policy epoch records one quiet-period
4502
+ anchor; unchanged active checks add no checkpoints. At the quiet threshold a
4503
+ check may be immediately due, then each successful due idle check records its
4504
+ completion. Growth is bounded by one anchor per observed epoch plus due idle
4505
+ checks. Missing or unusable evidence forces a fresh check; interrupted or
4506
+ contended writes leave the durable deadline unchanged and retry conservatively. `ab build status` reports active or idle cadence and the
4507
+ last durably recorded successful check (or unrecorded evidence); this timestamp
4508
+ can trail successful active checks.
4180
4509
 
4181
4510
 
4182
4511
  The total includes all attempted requests. Optional `restPrimary`,
@@ -4217,11 +4546,12 @@ snapshot before handoff. Local dispatch behavior
4217
4546
  is unchanged. Refresh kinds serialize external rotation with a committed CAS
4218
4547
  attempt, persist replacement state before delivery, and fail expired attempts
4219
4548
  without takeover. A failed credential requires explicit replacement. Valid
4220
- credentials before their earliest refresh time remain usable, even inside a
4221
- requested future validity horizon. The first eligible five-minute hosted tick
4222
- refreshes and persists rotation before supply, including expired access state
4223
- after downtime when the refresh credential remains ready. Providers without an
4224
- earliest refresh time use a ten-minute pre-expiry margin. Failed or uncertain
4549
+ credentials before refresh is due remain usable, even inside a requested future
4550
+ validity horizon. Hosted refresh is due at or after both the ten-minute
4551
+ pre-expiry threshold and any provider earliest-refresh floor. The first eligible
4552
+ five-minute hosted tick persists rotation before supply, including expired access
4553
+ state after downtime when both gates hold and the refresh credential remains
4554
+ ready. Expired access behind a future floor is never supplied. Failed or uncertain
4225
4555
  refresh attempts prevent supply. A refresh window shorter than five minutes plus a one-minute
4226
4556
  margin emits typed advisory metadata, never invalidates a valid credential and
4227
4557
  never causes revocation. The public
@@ -4254,6 +4584,44 @@ and leaving ambient login untouched.
4254
4584
  Hosted validation uses write-only metadata and states that the first hosted
4255
4585
  build is the live check; local validation makes a minimal runtime request.
4256
4586
 
4587
+ Dispatch credential admission uses only effective primary and alternate routes,
4588
+ including internal roles and agent verify/finalize runners; unused descriptors
4589
+ remain readiness targets only. Local dispatch refuses missing selected sources
4590
+ before acquiring the repository lease. A nonempty environment slot counts when
4591
+ no local login record exists; a matching safely owned refreshing local record
4592
+ may supply it, while failed, mismatched or unsafe records fail closed. Startup
4593
+ inspects ready peer-owned records without claiming them, allowing a losing
4594
+ invocation to yield to the repository lease holder. Execution ownership is
4595
+ claimed only after acquiring that lease; foreign ownership then fails closed.
4596
+ Local worktree Claude routes can use the host login without a named token;
4597
+ sandbox and hosted routes require the configured slot. Presence checks make no
4598
+ inference request. Successor preflight inspects
4599
+ transferable predecessor ownership without claiming or rotating it; missing
4600
+ sources refuse yield and retain the running generation with upgrade attention.
4601
+ Actual successor admission checks again.
4602
+
4603
+ Hosted dispatch uses the project-secret snapshot exclusively for selected account
4604
+ slots, including an empty snapshot; service environment and local logins cannot
4605
+ supply a fallback. Missing selected accounts hold new account-dependent work,
4606
+ including resumed work and harvest, while observation, policy repair, controls
4607
+ and cleanup continue. One durable unavailable condition per account carries its
4608
+ nonsecret descriptor, source and remedy; unchanged ticks append nothing, recovery
4609
+ or removal from routes clears it. A new dispatcher run never clears it. The next
4610
+ tick after setting `ab secrets set VARIABLE` (or `ab accounts login NAME --project`
4611
+ for ChatGPT renewal) admits work automatically. Local remedies retain
4612
+ `claude setup-token` plus setting the dispatcher variable, replacement of a Kimi
4613
+ membership key, or `ab accounts login NAME --local`. Missing credentials at a
4614
+ provisioning race are typed repository conditions, never infrastructure failures,
4615
+ setup failures or build escalations; genuine missing environments keep their
4616
+ infrastructure budget. Present rejected credentials keep account-specific rejection
4617
+ attention. Repository status, watch and both dashboards expose the same condition.
4618
+
4619
+ Selected Claude/Kimi credentials stay out of process arguments: each invocation
4620
+ uses a private 0700 directory and a regular 0600 settings file, removed after
4621
+ normal exit, launch failure or cancellation. The settings preserve selected-account
4622
+ authentication precedence over saved user/project settings. Remote settings and
4623
+ environments continue to contain placeholders only.
4624
+
4257
4625
  Local sessions resolve host credentials after ambient merging. Remote sessions
4258
4626
  receive account placeholders; exact provider hostname and placeholder header
4259
4627
  matches broker real credentials on the host. Both Kimi endpoint and host derive
@@ -4268,6 +4636,18 @@ deltas and prior values retained across rotation.
4268
4636
 
4269
4637
  ### Hosted project deletion
4270
4638
 
4639
+ The browser requires the exact full repository identity in a transient dialog field;
4640
+ confirm stays disabled for empty or mismatched input and focus starts in the field.
4641
+ The handler independently binds that identity to the selected repository and its
4642
+ fresh validated preview. Only JSON `{deleted:true}` acknowledges completion.
4643
+ After any failed or unrecognized deletion response, the browser shows
4644
+ “Deletion outcome unknown; reload to check” and holds the row in its original slot
4645
+ without actions, even after dismissal. Only a complete successful discovery begun
4646
+ by Reload after the attempt settles it: absence removes the row, presence restores
4647
+ its authorized actions, and pending cleanup restores Finish deletion with a fresh
4648
+ preview and exact typing. An earlier or unsuccessful read cannot settle the outcome.
4649
+ The server's `{repo}` body and generation-bound If-Match contract are unchanged.
4650
+
4271
4651
  The Projects web surface allows super users and organization owners to preview
4272
4652
  counts and permanently delete their authorized projects with the shared confirmation dialog.
4273
4653
  PostgreSQL fences the registration generation before physical blob cleanup and