@defrex/autobuild 1.2.0 → 1.3.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 (82) hide show
  1. package/README.md +1 -1
  2. package/SPEC.md +118 -14
  3. package/docs/accounts.md +12 -1
  4. package/docs/answering-blocked-builds.md +4 -1
  5. package/docs/architecture.md +120 -7
  6. package/docs/builds.md +2 -0
  7. package/docs/configuration-overview.md +6 -0
  8. package/docs/configuration.md +6 -0
  9. package/docs/integration-tree.md +16 -5
  10. package/docs/operator-api.md +44 -6
  11. package/docs/operator-surfaces.md +29 -0
  12. package/docs/plugin-authoring.md +6 -1
  13. package/docs/remote-store-protocol.md +69 -10
  14. package/docs/restacking.md +45 -0
  15. package/docs/spec-standard.md +4 -2
  16. package/docs/ticket-dependencies.md +8 -0
  17. package/package.json +3 -3
  18. package/packages/core/src/cli/dispatch-frontend.ts +1 -0
  19. package/packages/core/src/cli/dispatch-repository-feed.ts +107 -26
  20. package/packages/core/src/cli/dispatch.ts +64 -25
  21. package/packages/core/src/cli/dispatcher-liveness.ts +6 -1
  22. package/packages/core/src/cli/forge-clear.ts +30 -0
  23. package/packages/core/src/cli/help.ts +1 -0
  24. package/packages/core/src/cli/main.ts +28 -0
  25. package/packages/core/src/cli/watch.ts +9 -13
  26. package/packages/core/src/events/catalog.ts +1 -0
  27. package/packages/core/src/events/forge-degradation-policy.ts +11 -0
  28. package/packages/core/src/events/payloads.ts +10 -0
  29. package/packages/core/src/events/policy.ts +9 -0
  30. package/packages/core/src/events/repository.ts +73 -2
  31. package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +275 -0
  32. package/packages/core/src/kernel/change-presence.ts +74 -8
  33. package/packages/core/src/kernel/engine.ts +8 -0
  34. package/packages/core/src/kernel/generators/node-restack-log.ts +14 -0
  35. package/packages/core/src/kernel/node-polling.ts +40 -7
  36. package/packages/core/src/kernel/node-restack-demand.ts +74 -0
  37. package/packages/core/src/kernel/node-restack-state.ts +5 -1
  38. package/packages/core/src/kernel/node-restack-transaction.ts +33 -1
  39. package/packages/core/src/kernel/read-facts.ts +6 -0
  40. package/packages/core/src/kernel/reducer-registry.ts +3 -0
  41. package/packages/core/src/kernel/reducer.ts +1 -1
  42. package/packages/core/src/kernel/ticket-preparation.ts +66 -0
  43. package/packages/core/src/operator/annotations.ts +6 -0
  44. package/packages/core/src/operator/control.ts +20 -0
  45. package/packages/core/src/operator/index.ts +2 -0
  46. package/packages/core/src/operator/registry.ts +20 -0
  47. package/packages/core/src/ports/runner/account-env.ts +60 -9
  48. package/packages/core/src/ports/runner/claude.ts +49 -45
  49. package/packages/core/src/processes/dispatcher.ts +470 -121
  50. package/packages/core/src/processes/execution-no-progress.ts +1 -0
  51. package/packages/core/src/processes/harvest.ts +11 -16
  52. package/packages/core/src/processes/repo-view.ts +3 -0
  53. package/packages/core/src/store/artifact-meta.ts +7 -0
  54. package/packages/core/src/store/contract.ts +57 -0
  55. package/packages/core/src/store/memory.ts +4 -0
  56. package/packages/core/src/store/reducer-value-shapes.json +7302 -6668
  57. package/packages/core/src/store/reducer-value-validation.ts +106 -6
  58. package/packages/core/src/store/remote/client.ts +48 -8
  59. package/packages/core/src/store/remote/compatibility.ts +39 -0
  60. package/packages/core/src/store/remote/index.ts +6 -0
  61. package/packages/core/src/store/remote/protocol.ts +8 -1
  62. package/packages/core/src/store/remote/released-reducer-values/1.2.0.json +8129 -0
  63. package/packages/core/src/store/remote/version.ts +4 -0
  64. package/packages/core/src/store/repo-state-events.ts +4 -2
  65. package/packages/core/src/store/snapshots.ts +16 -3
  66. package/packages/core/src/store/types.ts +2 -0
  67. package/packages/core/src/testing/dispatch-read-budget.ts +144 -5
  68. package/packages/core/src/testing/index.ts +1 -1
  69. package/packages/core/src/testing/reduced-read-budget.ts +513 -5
  70. package/skills/guide/SKILL.md +44 -7
  71. package/skills/guide/references/accounts.md +12 -1
  72. package/skills/guide/references/integration-tree.md +16 -5
  73. package/skills/guide/references/operator-api.md +44 -6
  74. package/skills/guide/references/plugin-authoring.md +6 -1
  75. package/skills/guide/references/remote-store-protocol.md +69 -10
  76. package/skills/guide/references/restacking.md +45 -0
  77. package/skills/guide/references/spec-standard.md +4 -2
  78. package/skills/guide/references/ticket-dependencies.md +8 -0
  79. package/skills/operate/SKILL.md +21 -5
  80. package/skills/reconcile/SKILL.md +6 -0
  81. package/skills/tickets/SKILL.md +7 -3
  82. package/templates/hosted-service/package.json +2 -2
package/README.md CHANGED
@@ -26,7 +26,7 @@ From the repository you want built, install Autobuild as a development dependenc
26
26
  <!-- release-install:start -->
27
27
 
28
28
  ```sh
29
- bun add -d --exact @defrex/autobuild@1.2.0
29
+ bun add -d --exact @defrex/autobuild@1.3.0
30
30
  ```
31
31
 
32
32
  <!-- release-install:end -->
package/SPEC.md CHANGED
@@ -418,6 +418,28 @@ files, including development configs, remain exactly as installed.
418
418
  It also owns observation back-pressure: settling
419
419
  outstanding recoverable harvest runs takes priority over starting new scans
420
420
  (§12). Cron-friendly.
421
+ Before claiming, the dispatcher journals a repository-scoped preparation intent;
422
+ a won claim and the exact selected creation slug are durable boundaries. Caught
423
+ asset-copy, spec-authoring, naming, and build-creation failures return the ticket
424
+ to configured Ready; a nonconforming spec goes to configured Triage. Recovery
425
+ checks the exact selected build first: a matching record and atomic
426
+ `build.created` retain ownership even if creation threw after committing.
427
+ Unavailable or conflicting readback never authorizes release or a replacement
428
+ build. Pending attempts retain the original failure, latest recovery error and
429
+ retry deadline in the canonical repository reduced value; resolved attempts
430
+ leave that value. Under repository ownership, each tick admits at most eight
431
+ due recovery attempts, before intake and independently of capacity or intake
432
+ settings, with a 30-second durable retry delay after recovery failure. Unresolved
433
+ ticket identities remain withheld. An uncertain claim outcome or unrelated
434
+ external ticket state, missing ticket/state, or conflicting slug ownership terminates
435
+ automatic recovery with an `abandoned` resolution and diagnostic reason. The
436
+ ticket is left unchanged; an operator can leave it finished or cancelled, or
437
+ inspect ownership and explicitly return it to Ready for another attempt. These
438
+ cases stop provider polling and diagnostic appends. Recovery failures are
439
+ reported without preventing janitor, lease sweep, or other dispatch recovery.
440
+ This is not general process
441
+ crash recovery. Confirmed Ready/Triage transitions settle idempotently, so a
442
+ failed bounce comment does not return an invalid ticket to Ready.
421
443
  - **harvest-runner** — one staged repository workflow (`scan → synthesize ⇄
422
444
  review → file`) under a repository lease; not a build and not a phase.
423
445
  - **ingesters** — other outer-loop processes turning signals into proposals (§12).
@@ -667,6 +689,8 @@ raises an `escalation`; a human uses `ab answer --revise-spec` (or
667
689
  `--revise-spec-from-ticket`), the spec gets rev N+1, and the leaf restarts
668
690
  from `plan` (cheap — downstream was invalidated anyway).
669
691
 
692
+ 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.
693
+
670
694
  Operators may explicitly revise an opened idle collecting node or a node blocked on failed
671
695
  integration verification without an escalation. Use
672
696
  `ab answer <node> --revise-spec replacement.md` or, after amending its ticket,
@@ -683,7 +707,11 @@ Active verification/reconcile or writer work, restack/reparent work, pause,
683
707
  pending controls, merge intent and ended PRs refuse the no-escalation path.
684
708
  A concurrent state change refuses publication with a retry explanation;
685
709
  uncited artifacts are inert. Leaves still require an open escalation and
686
- restart from `plan`.
710
+ restart from `plan` after any unfinished reconcile resumes under the revised
711
+ spec and its publication is confirmed.
712
+
713
+ Caught preparation failures before an established build follow the durable
714
+ claim recovery contract in §5; incomplete hosted snapshots never launch a build.
687
715
 
688
716
  **Ticket assets are frozen with the spec.** Claiming a ticket pins the
689
717
  ticket's current assets (§7.1.3) into the build the same way the spec becomes
@@ -2314,6 +2342,14 @@ is excluded. An empty completed node contributes nothing; missing or ambiguous
2314
2342
  completion evidence does not mean empty. The newest build generation is used,
2315
2343
  with ties diagnosed rather than falling back to older successful work.
2316
2344
 
2345
+ Destination observations retain versioned, head-bound Git witnesses (reachable
2346
+ commit SHAs and direct build trailers) and a fixed-length evidence digest. Current
2347
+ confirmed landings and aliases from only the destination's accepted ancestry are
2348
+ reapplied before reuse. Unrelated merged history and ready destinations do not
2349
+ invalidate this proof. Head changes require a fresh Git sample; legacy observations
2350
+ without witnesses refresh once rather than replaying repository history. Current
2351
+ readiness and newest-generation checks still apply before claim.
2352
+
2317
2353
  Demand-driven restacking supplies ancestor changes to descendants. Sibling changes
2318
2354
  wait for their node to merge in the common ancestor and presence demand into the target;
2319
2355
  descendant changes wait for their node to merge into the target ancestor. Same-node
@@ -2456,6 +2492,19 @@ actual destination, processing ancestors first. Unrelated siblings stay idle;
2456
2492
  changes absent from all ancestors cannot trigger a speculative replay. Tickets
2457
2493
  remain queued until presence is observed in their destination.
2458
2494
 
2495
+ A presence request whose identities are absent from its immediate parent remains
2496
+ pending while ancestors restack or reconcile. A durable availability observation
2497
+ allows unchanged idle ticks, including after restart, to skip repository preparation
2498
+ and native auto-merge cancellation. Exact node/parent heads, contribution base,
2499
+ request contents, accepted ancestry, foreign aliases and confirmed landing evidence
2500
+ invalidate that observation when they change; polling timestamps do not. Failed
2501
+ assessments never establish unavailability. Availability is not proof of destination
2502
+ coverage. Moving to another destination branch explicitly settles obsolete requests
2503
+ with `destination-changed`; losing identities on the same branch leaves them waiting.
2504
+ Native auto-merge is suspended with confirmed, reusable receipts only when replay
2505
+ is actionable, and is revalidated during recovery before rewrite effects.
2506
+
2507
+
2459
2508
  `ab restack <node>` (operator tool `builds.restack`, input `{repo, slug}`) records
2460
2509
  a durable request, coalescing pending demand. It refuses leaves, terminal nodes,
2461
2510
  and unopened nodes. Paused or blocked nodes wait for their normal safety gates.
@@ -2671,6 +2720,17 @@ first retry after a source cooldown remain recorded. Recorded starts may arrive
2671
2720
  with completion; optional `startedAt` preserves the actual start time, falling
2672
2721
  back to envelope time for historical journals.
2673
2722
 
2723
+ Watch mode keeps running when both a tick and its failure publication fail,
2724
+ warning locally with both errors. Failed iterations wait at least the configured
2725
+ interval or one second, whichever is longer. One bounded in-memory episode
2726
+ retains the original error, count and observation window; recovery appends a
2727
+ standalone `dispatcher.tick-failed` diagnostic before the next operational tick.
2728
+ An unacknowledged diagnostic remains pending and may be duplicated after a lost
2729
+ response. Reporting never closes a later tick boundary or gates committed
2730
+ handoff acceptance. Explicit shutdown, supersession and fatal forge publication
2731
+ still stop the loop; once mode rethrows the original tick error even if reporting
2732
+ fails. Stopping before recovery leaves only local warnings for unreported failures.
2733
+
2674
2734
  Repository tick telemetry is bounded mutable operational metadata, like leases.
2675
2735
  `beginRepoTick` persists the open boundary before unsafe work; `finishRepoTick`
2676
2736
  atomically replaces it with actual completion time and outcome and appends any
@@ -2916,10 +2976,17 @@ read-decoder revision. Named and generic checkpoints use catalog-specific keys;
2916
2976
  legacy/foreign-catalog snapshots are misses and are preserved. Unrecognized
2917
2977
  reducer versions replay without repairing their cache. No lower-version write
2918
2978
  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
2979
+ reader's own version may be conditionally repaired. Hosted named answers are canonical: the client accepts any finished value its own shape
2980
+ can represent, regardless of reducer version or catalog identity. A reducer
2981
+ version is the server's cache identity, not a compatibility gate. The client
2982
+ drops object properties its shape does not know, so additive server changes
2983
+ reach older readers. Invalid envelopes and values the client cannot represent
2984
+ (a missing field, an unknown variant) fail with a typed incompatibility error
2985
+ naming the reducer and client/server versions. Clients send
2986
+ `x-autobuild-reducer-value-projection: 1`. For a published client that predates
2987
+ this capability and checks exact versions (1.2.0), the service projects the
2988
+ answer onto that release's frozen shape and returns that release's reducer version,
2989
+ retaining the catalog while the release is in the supported window. Remote clients never
2923
2990
  reconstruct named answers from event logs. Catalog identity travels in response
2924
2991
  header `x-autobuild-catalog-identity`; strict JSON bodies remain exactly
2925
2992
  `{version, cursor, value}`. Missing/malformed headers do not reject an answer.
@@ -2949,6 +3016,9 @@ restacking). Durable `node.restack-requested` facts retain operator/presence dem
2949
3016
  including destination, sampled parent, dependent ticket and required identities.
2950
3017
  Reservations freeze covered request ids; confirmed settlement acknowledges only
2951
3018
  that coverage, and `node.restack-satisfied` records coverage or destination change.
3019
+ `node.restack-availability-observed` retains a versioned semantic fingerprint, sampled
3020
+ branches/heads/base and available request IDs; it is an optimization fact, never
3021
+ positive presence proof.
2952
3022
  `target.distance` records advisory leaf distance with immutable destination and
2953
3023
  build tips; null count means unknown (a known count requires a head).
2954
3024
  `node.parent-distance` records immutable base/parent/branch and count (null when unknown).
@@ -3509,6 +3579,8 @@ risky — semantic conflicts, spec-relevant choices — escalates rather than
3509
3579
  guesses. Reconcile skips `code-review` by default (escalation covers the
3510
3580
  judgment cases; policy can force it).
3511
3581
 
3582
+ 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.
3583
+
3512
3584
  On each repeat conflict, the runner records a fresh authoritative base snapshot
3513
3585
  on `reconcile.progress-checked`, tied to that conflict and the most recently
3514
3586
  completed attempt. The kernel compares it with that attempt's matching latest
@@ -3711,6 +3783,17 @@ decide where a build's effective configuration is composed from:
3711
3783
  | 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
3784
  | Dispatcher-owned | `baseBranch`, `capacity`, `ticketScanIntervalSeconds`, `forge`, `plugins`, `pr`, `tickets`, `orchestrator`, `merge`, `upgrade` | The dispatcher's live snapshot; the build runner never interprets them. |
3713
3785
 
3786
+ Dispatcher lease sweeps may reuse parsed effective-config pins in a disposable
3787
+ 128-entry LRU, validated on each lookup by the latest artifact metadata revision.
3788
+ Artifact-only deposits invalidate reuse independently of build events. Each
3789
+ sweep recomputes decisions from current reduced facts, live deployment settings,
3790
+ and the applicable cycle capture. Missing pins retain the existing live-config
3791
+ fallback; unreadable or invalid pins invalidate reuse and withhold decisions
3792
+ until a successful read or repair. Launch, resume and merge action boundaries
3793
+ continue reading fresh full artifacts. Restart and eviction change read volume
3794
+ only. Adapters without the optional latest-metadata capability retain full
3795
+ artifact reads; metadata lookup never lists revision history or loads blobs.
3796
+
3714
3797
  A build's pipeline definition is therefore composed from the build's own
3715
3798
  branch: in origin mode the dispatcher reads `autobuild.toml` at the build's
3716
3799
  recorded base commit (or its branch head once the build has published commits)
@@ -4138,7 +4221,15 @@ clears it. `policy.janitorBackoffMaxSeconds` sets the positive integer cap.
4138
4221
 
4139
4222
  A classified forge rate limit records repository degradation with `resetAt`.
4140
4223
  Forge work waits during cooldown; passing the deadline permits a recovery
4141
- request, and only success clears degradation. A further limit extends cooldown.
4224
+ request; a successful probe records automatic recovery. An authorized operator
4225
+ may explicitly override erroneous recorded state with
4226
+ `ab repository forge-clear --forge <name> --reason <text>` or
4227
+ `repository.forge_clear {repo, forge, reason}`. This appends a human-attributed
4228
+ `dispatcher.forge-recovered` fact with the reason; it does not prove provider
4229
+ success. A subsequent actual limit records a fresh cooldown. Hosted admission
4230
+ requires a schema-valid finite ISO `resetAt` no later than server time plus
4231
+ 24 hours, inclusive; past deadlines remain valid. Rejection never clamps or
4232
+ invents a provider reset, and historical events remain readable.
4142
4233
  Native merge application failures keep candidate-specific retry eligibility,
4143
4234
  including automatic decisions without a human command. Retries recheck consent,
4144
4235
  holds, verification and the exact candidate. Uncertain enables remain pending
@@ -4174,9 +4265,15 @@ GitHub-only changes are discovered on the next due check, within the idle
4174
4265
  interval plus normal tick scheduling while the dispatcher is running; failure,
4175
4266
  cooldown and transport-budget gates still apply. Pending operations retain
4176
4267
  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).
4268
+ `node.poll-checked` advisory facts preserve quiet history across restarts.
4269
+ Each successfully observed activity or policy epoch records one quiet-period
4270
+ anchor; unchanged active checks add no checkpoints. At the quiet threshold a
4271
+ check may be immediately due, then each successful due idle check records its
4272
+ completion. Growth is bounded by one anchor per observed epoch plus due idle
4273
+ checks. Missing or unusable evidence forces a fresh check; interrupted or
4274
+ contended writes leave the durable deadline unchanged and retry conservatively. `ab build status` reports active or idle cadence and the
4275
+ last durably recorded successful check (or unrecorded evidence); this timestamp
4276
+ can trail successful active checks.
4180
4277
 
4181
4278
 
4182
4279
  The total includes all attempted requests. Optional `restPrimary`,
@@ -4217,11 +4314,12 @@ snapshot before handoff. Local dispatch behavior
4217
4314
  is unchanged. Refresh kinds serialize external rotation with a committed CAS
4218
4315
  attempt, persist replacement state before delivery, and fail expired attempts
4219
4316
  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
4317
+ credentials before refresh is due remain usable, even inside a requested future
4318
+ validity horizon. Hosted refresh is due at or after both the ten-minute
4319
+ pre-expiry threshold and any provider earliest-refresh floor. The first eligible
4320
+ five-minute hosted tick persists rotation before supply, including expired access
4321
+ state after downtime when both gates hold and the refresh credential remains
4322
+ ready. Expired access behind a future floor is never supplied. Failed or uncertain
4225
4323
  refresh attempts prevent supply. A refresh window shorter than five minutes plus a one-minute
4226
4324
  margin emits typed advisory metadata, never invalidates a valid credential and
4227
4325
  never causes revocation. The public
@@ -4254,6 +4352,12 @@ and leaving ambient login untouched.
4254
4352
  Hosted validation uses write-only metadata and states that the first hosted
4255
4353
  build is the live check; local validation makes a minimal runtime request.
4256
4354
 
4355
+ Selected Claude/Kimi credentials stay out of process arguments: each invocation
4356
+ uses a private 0700 directory and a regular 0600 settings file, removed after
4357
+ normal exit, launch failure or cancellation. The settings preserve selected-account
4358
+ authentication precedence over saved user/project settings. Remote settings and
4359
+ environments continue to contain placeholders only.
4360
+
4257
4361
  Local sessions resolve host credentials after ambient merging. Remote sessions
4258
4362
  receive account placeholders; exact provider hostname and placeholder header
4259
4363
  matches broker real credentials on the host. Both Kimi endpoint and host derive
package/docs/accounts.md CHANGED
@@ -35,6 +35,12 @@ requires its membership key. Invalid credentials need renewal (`claude setup-tok
35
35
  for Claude, replacement membership key for Kimi); quota and overload failures
36
36
  retain alternate fallback.
37
37
 
38
+ Selected Claude/Kimi credentials stay out of process arguments: each invocation
39
+ uses a private 0700 directory and a regular 0600 settings file, removed after
40
+ normal exit, launch failure or cancellation. The settings preserve selected-account
41
+ authentication precedence over saved user/project settings. Remote settings and
42
+ environments continue to contain placeholders only.
43
+
38
44
  Choose the region of your Kimi membership. The default `overseas` selects
39
45
  `https://api.kimi.ai/coding/`; `china` selects `https://api.kimi.com/coding/`.
40
46
  The base URL and egress hostname are fixed together and cannot be overridden
@@ -90,7 +96,12 @@ client identifier belongs to the authorized ChatGPT registration. Reauthorizatio
90
96
  keeps identity and registration associated. Never copy the ambient Codex login.
91
97
 
92
98
  Exactly one owner refreshes each connection: the local dispatcher or the
93
- hosted refreshing secret. Credentials rotate atomically before delivery. Expired access tokens remain
99
+ hosted refreshing secret. Both owners refresh only at or after the maximum of
100
+ any provider earliest-refresh floor and their pre-expiry threshold. Local renewal
101
+ uses a one-minute margin; hosted renewal uses ten minutes to tolerate a delayed
102
+ five-minute tick. Before refresh is due, still-valid access is supplied unchanged.
103
+ Expired access behind a future provider floor is never delivered.
104
+ Credentials rotate atomically before delivery. Expired access tokens remain
94
105
  refreshable after dispatcher downtime; a live validator or dispatcher claim
95
106
  cannot be displaced. Only a proven dead process or a released claim permits
96
107
  a successor to own renewal.
@@ -78,6 +78,8 @@ pre-revision reviews, verification, and finalize completion do not satisfy the
78
78
  new run. Historical phase runs remain pinned to the revision they saw. An
79
79
  already-open pull request is retained and updated rather than duplicated.
80
80
 
81
+ If a leaf spec revision arrives during an unfinished reconcile, the same reconcile attempt resumes under the revised spec on its retained frozen target. Its replay and committed contribution remain owned by reconcile. Confirmed publication must settle before the fresh plan loop opens; prior approvals and verification remain invalidated.
82
+
81
83
  The two events make interrupted work safely resumable. If the answer was
82
84
  recorded but `spec.revised` was not, a repeated revision command publishes the
83
85
  body named by that earlier answer; it does not read or authorize a newly
@@ -104,4 +106,5 @@ Active verification/reconcile or writer work, restack/reparent work, pause,
104
106
  pending controls, merge intent and ended PRs refuse the no-escalation path.
105
107
  A concurrent state change refuses publication with a retry explanation;
106
108
  uncited artifacts are inert. Leaves still require an open escalation and
107
- restart from `plan`.
109
+ restart from `plan` after any unfinished reconcile resumes under the revised
110
+ spec and its publication is confirmed.
@@ -187,9 +187,15 @@ All event-derived checkpoints include the combined read-catalog fingerprint in
187
187
  their keys, independently of numeric reducer versions. Snapshot envelopes validate
188
188
  that fingerprint; another catalog's rows remain untouched. Remote named values
189
189
  are canonical regardless of `x-autobuild-catalog-identity`, keeping their strict
190
- three-field JSON body unchanged. A reducer version mismatch, invalid envelope or
191
- unrepresentable finished shape raises `ReducerValueIncompatibilityError` with
192
- client/server versions and validation detail. No remote named read replays events.
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.
193
199
  Repository digest batches likewise return the server batch with one scoped
194
200
  request and no discovery or per-build fallback.
195
201
 
@@ -539,7 +545,17 @@ completion samples with journal ticks. Heartbeat renewal cannot invent progress.
539
545
  The memory, SQLite, Postgres and remote adapters share this contract, including
540
546
  no mutation after lease expiry and no partial publication on validation failure.
541
547
  Repository read failures fail a watch tick and retry on the next iteration;
542
- continuous failures use the existing five-minute persistent-tick attention.
548
+ continuous durably reported failures use the existing five-minute persistent-tick attention.
549
+ Watch mode keeps running when both a tick and its failure publication fail,
550
+ warning locally with both errors. Failed iterations wait at least the configured
551
+ interval or one second, whichever is longer. One bounded in-memory episode
552
+ retains the original error, count and observation window; recovery appends a
553
+ standalone `dispatcher.tick-failed` diagnostic before the next operational tick.
554
+ An unacknowledged diagnostic remains pending and may be duplicated after a lost
555
+ response. Reporting never closes a later tick boundary or gates committed
556
+ handoff acceptance. Explicit shutdown, supersession and fatal forge publication
557
+ still stop the loop; once mode rethrows the original tick error even if reporting
558
+ fails. Stopping before recovery leaves only local warnings for unreported failures.
543
559
  Failure settlement writes through the fenced backing store without reading the
544
560
  failed projection. Repository view writes distinguish a committed result from a
545
561
  subsequent refresh failure, retaining the last complete snapshot while propagating
@@ -597,6 +613,17 @@ and workspace adapter fields stay pinned; changed values are durable restart
597
613
  notices rather than partial adapter swaps. `--once` retains static startup
598
614
  configuration.
599
615
 
616
+ Lease sweeps in `processes/dispatcher.ts` retain at most 128 parsed build
617
+ effective-config pins in deterministic LRU order. Each sweep probes
618
+ `BuildStore.getLatestArtifactMeta` (one latest metadata row, no blob or revision
619
+ listing) before reuse; artifact-only revision changes force a full reread.
620
+ Current facts, live deployment settings and cycle captures are composed afresh.
621
+ Errors invalidate reuse and retain diagnostic/refusal and repair behavior.
622
+ Launch, resume and merge boundaries still read fresh artifacts. Restart,
623
+ eviction and adapters lacking metadata support preserve decisions with full
624
+ reads. Remote clients remember explicit unsupported-route/operation responses
625
+ per client and fall back to full artifact reads, never event replay.
626
+
600
627
  `config/pipeline-source.ts` strictly reads the runner's execution checkout.
601
628
  `processes/verify-cycle-config.ts` deposits immutable cycle config and checks
602
629
  build-owned identity and source ancestry at settled stage boundaries. Typed
@@ -737,6 +764,14 @@ full gate inspection and refreshed durable consent/engine eligibility precede
737
764
  any repair. Body comparison tolerates provider trimming of trailing whitespace
738
765
  while preserving the complete headline, body content, and squash method.
739
766
 
767
+ Destination observations retain versioned, head-bound Git witnesses (reachable
768
+ commit SHAs and direct build trailers) and a fixed-length evidence digest. Current
769
+ confirmed landings and aliases from only the destination's accepted ancestry are
770
+ reapplied before reuse. Unrelated merged history and ready destinations do not
771
+ invalidate this proof. Head changes require a fresh Git sample; legacy observations
772
+ without witnesses refresh once rather than replaying repository history. Current
773
+ readiness and newest-generation checks still apply before claim.
774
+
740
775
  Optional `Forge.readCommitMessage` and `Forge.containsBuild` capabilities expose
741
776
  actual merged messages and exact trailer presence in reachable branch history.
742
777
  The janitor records optional `pr.merged.buildTrailerPresent` for normal and abort
@@ -902,6 +937,22 @@ queue. The supervised kernel child owns every slow
902
937
  adapter operation, so slug naming, provisioning, runners, and Harvest cannot
903
938
  block input.
904
939
 
940
+ The frontend's `dispatchFrontend` checkpoint retains dashboard facts plus only
941
+ the latest run-started fact and the sampled lease holder's start (deduplicated).
942
+ Identity history is always partial, including normalized legacy version-4
943
+ caches; a missing holder is resolved through the bounded per-run reduced read.
944
+ Successful lease samples select or clear the retained holder; failed metadata
945
+ reads preserve the last selection. Snapshot saves track cursor and effective
946
+ retained-state changes locally: written, refused and unsupported attempts settle
947
+ that projection and are never repeated unchanged. Ordinary dirty saves are at
948
+ least 30 seconds apart. Transport/store failures retry without new events after
949
+ 30, 60, 120, 240, then 300 seconds (capped). Concurrent saves share one request;
950
+ only its captured projection is acknowledged. Teardown forces a dirty save past
951
+ the time gate, while settled state stays quiet. Equal-cursor refusal does not
952
+ make correlation durable: restart reconstructs it through bounded holder lookup,
953
+ and the next advancing-cursor checkpoint carries it without relaxing snapshot
954
+ ordering. A validated, already normalized restored checkpoint starts clean.
955
+
905
956
  `packages/core/src/cli/dashboard/refresh.ts` owns the shared presentation read
906
957
  scheduler for both terminal paths: focused by default, independent of focus for
907
958
  local stores, and 5-second polling when unfocused for network stores,
@@ -1057,6 +1108,34 @@ A claim freezes the ticket's current assets into the build (SPEC §6.3):
1057
1108
  reducer projects them, `getPinnedTicketAsset` reads them back by pinned revision,
1058
1109
  and `ab context` writes them under `$AB_CONTEXT_DIR/assets/`.
1059
1110
 
1111
+ `kernel/ticket-preparation.ts` projects unfinished `ticket-preparation.*` facts
1112
+ through `repositoryReadFacts`; `processes/dispatcher.ts` retries them under the
1113
+ existing repository ownership before intake. This pre-record recovery differs
1114
+ from `dispatch.failed`, which completes an already established build.
1115
+
1116
+ Before claiming, the dispatcher journals a repository-scoped preparation intent;
1117
+ a won claim and the exact selected creation slug are durable boundaries. Caught
1118
+ asset-copy, spec-authoring, naming, and build-creation failures return the ticket
1119
+ to configured Ready; a nonconforming spec goes to configured Triage. Recovery
1120
+ checks the exact selected build first: a matching record and atomic
1121
+ `build.created` retain ownership even if creation threw after committing.
1122
+ Unavailable or conflicting readback never authorizes release or a replacement
1123
+ build. Pending attempts retain the original failure, latest recovery error and
1124
+ retry deadline in the canonical repository reduced value; resolved attempts
1125
+ leave that value. Under repository ownership, each tick admits at most eight
1126
+ due recovery attempts, before intake and independently of capacity or intake
1127
+ settings, with a 30-second durable retry delay after recovery failure. Unresolved
1128
+ ticket identities remain withheld. An uncertain claim outcome or unrelated
1129
+ external ticket state, missing ticket/state, or conflicting slug ownership terminates
1130
+ automatic recovery with an `abandoned` resolution and diagnostic reason. The
1131
+ ticket is left unchanged; an operator can leave it finished or cancelled, or
1132
+ inspect ownership and explicitly return it to Ready for another attempt. These
1133
+ cases stop provider polling and diagnostic appends. Recovery failures are
1134
+ reported without preventing janitor, lease sweep, or other dispatch recovery.
1135
+ This is not general process
1136
+ crash recovery. Confirmed Ready/Triage transitions settle idempotently, so a
1137
+ failed bounce comment does not return an invalid ticket to Ready.
1138
+
1060
1139
  For hosted tickets, `store/ticket-asset-snapshots.ts` copies exact revisions
1061
1140
  into chunked immutable repository artifacts in the build store before pinning.
1062
1141
  Reads use explicit manifest/chunk revisions without a ticket connection. Old
@@ -1236,7 +1315,9 @@ validates issuance, durable lifecycle bindings and the 60-second terminal grace;
1236
1315
  principals. `remote-store-server.ts` enforces resource mutations before deposits,
1237
1316
  including body-selected and addressed-stream resources. Operator routes reject
1238
1317
  these principals. Build-runner and build-phase grants may append only the
1239
- kernel's `dispatcher.forge-degraded` repository fact, in their own project,
1318
+ kernel's `dispatcher.forge-degraded` repository fact, in their own project
1319
+ (the exact repository in the delegated claim, enforced by the preceding
1320
+ `requireProject` check),
1240
1321
  so runner/CLI guards can record a newly observed rate limit and wait for
1241
1322
  durable dispatcher recovery. This exception grants no repository administration,
1242
1323
  recovery, lease, or other journal writes. The agent-visible build-scoped Store
@@ -1300,6 +1381,14 @@ explicit ticket URL. Project registration and ticket policy publication through
1300
1381
  `ab connect --tickets URL` work before dispatch. Policy is a durable per-registration
1301
1382
  record, outside BuildStore events/artifacts; legacy uploaded configuration remains
1302
1383
  a compatibility fallback. Hosted lifecycle defaults are triage/ready/doing/done.
1384
+ Hosted state initialization checks only the distinct configured role names through
1385
+ an indexed project/name lookup. Already-present names require no state mutation
1386
+ lock or writes. Missing names are rechecked under the project advisory lock and
1387
+ inserted in the same transaction. Custom-state creation and policy publication
1388
+ always take that lock; publication reads the previous policy under it and retains
1389
+ former role names atomically. Ordinary service requests do not eagerly list state
1390
+ counts; explicit state listings and legacy policy materialization still do.
1391
+
1303
1392
  Independent harvest uses revocable, expiring, service-bound ticket grants with
1304
1393
  read/create runner authority and read-only child authority. Build state and harvest
1305
1394
  journals remain exclusively in the selected BuildStore.
@@ -1334,6 +1423,8 @@ commit in the existing branch's history. Comparison uses reachability, so an
1334
1423
  advanced parent never makes an empty node nonempty. The janitor opens PRs lazily
1335
1424
  and reuses terminal cleanup without leaf reconcile or auto-merge.
1336
1425
 
1426
+ 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.
1427
+
1337
1428
  ### Leaf and reconcile restacking
1338
1429
 
1339
1430
  The kernel prepares a detached replay of one net build change on the base frozen
@@ -1379,6 +1470,13 @@ live provider evidence.
1379
1470
 
1380
1471
  ### Descendant node restacking
1381
1472
 
1473
+ `kernel/node-restack-demand.ts` fingerprints semantic presence evidence for durable
1474
+ `node.restack-availability-observed` facts. The dispatcher checks this reduced value
1475
+ before repository preparation; transactions retain unavailable requests and explicitly
1476
+ settle obsolete destinations. Landing and ancestry changes invalidate waiting results
1477
+ even at unchanged Git heads. Targeting-leaf cancellation runs only at the actionable
1478
+ replay boundary using `landing-publication.ts` receipts, including recovery.
1479
+
1382
1480
  `kernel/node-restack.ts` inventories the contribution above the durable previous
1383
1481
  base, proves foreign merge safety against the sampled parent's full identity set,
1384
1482
  and replays individual changes. `kernel/node-restack-state.ts` reduces writer
@@ -1582,7 +1680,15 @@ clears it. `policy.janitorBackoffMaxSeconds` sets the positive integer cap.
1582
1680
 
1583
1681
  A classified forge rate limit records repository degradation with `resetAt`.
1584
1682
  Forge work waits during cooldown; passing the deadline permits a recovery
1585
- request, and only success clears degradation. A further limit extends cooldown.
1683
+ request; a successful probe records automatic recovery. An authorized operator
1684
+ may explicitly override erroneous recorded state with
1685
+ `ab repository forge-clear --forge <name> --reason <text>` or
1686
+ `repository.forge_clear {repo, forge, reason}`. This appends a human-attributed
1687
+ `dispatcher.forge-recovered` fact with the reason; it does not prove provider
1688
+ success. A subsequent actual limit records a fresh cooldown. Hosted admission
1689
+ requires a schema-valid finite ISO `resetAt` no later than server time plus
1690
+ 24 hours, inclusive; past deadlines remain valid. Rejection never clamps or
1691
+ invents a provider reset, and historical events remain readable.
1586
1692
  Native merge application failures keep candidate-specific retry eligibility,
1587
1693
  including automatic decisions without a human command. Retries recheck consent,
1588
1694
  holds, verification and the exact candidate. Uncertain enables remain pending
@@ -1648,7 +1754,8 @@ Active verification/reconcile or writer work, restack/reparent work, pause,
1648
1754
  pending controls, merge intent and ended PRs refuse the no-escalation path.
1649
1755
  A concurrent state change refuses publication with a retry explanation;
1650
1756
  uncited artifacts are inert. Leaves still require an open escalation and
1651
- restart from `plan`.
1757
+ restart from `plan` after any unfinished reconcile resumes under the revised
1758
+ spec and its publication is confirmed.
1652
1759
 
1653
1760
  Verification stages are planned purely in `kernel/verify-stages.ts`, shared by
1654
1761
  leaf and integration decisions in `kernel/engine.ts`. The build runner keeps
@@ -1738,6 +1845,12 @@ and leaving ambient login untouched.
1738
1845
  Hosted validation uses write-only metadata and states that the first hosted
1739
1846
  build is the live check; local validation makes a minimal runtime request.
1740
1847
 
1848
+ Selected Claude/Kimi credentials stay out of process arguments: each invocation
1849
+ uses a private 0700 directory and a regular 0600 settings file, removed after
1850
+ normal exit, launch failure or cancellation. The settings preserve selected-account
1851
+ authentication precedence over saved user/project settings. Remote settings and
1852
+ environments continue to contain placeholders only.
1853
+
1741
1854
  Local sessions resolve host credentials after ambient merging. Remote sessions
1742
1855
  receive account placeholders; exact provider hostname and placeholder header
1743
1856
  matches broker real credentials on the host. Both Kimi endpoint and host derive
package/docs/builds.md CHANGED
@@ -35,6 +35,8 @@ bun ab answer <slug> --revise-spec revised-spec.md
35
35
  | `plan ⇄ plan-review` | planner proposes a plan | the spec |
36
36
  | `implement ⇄ code-review` | implementer makes local commits | the spec and plan |
37
37
 
38
+ If a leaf spec revision arrives during an unfinished reconcile, the same reconcile attempt resumes under the revised spec on its retained frozen target. Its replay and committed contribution remain owned by reconcile. Confirmed publication must settle before the fresh plan loop opens; prior approvals and verification remain invalidated.
39
+
38
40
  Either reviewer approves, requests revisions with structured findings, or escalates a question.
39
41
 
40
42
  - **Sessions.** Each phase gets its own session; the producer keeps it across a loop's rounds, and each reviewer round starts fresh.
@@ -101,6 +101,12 @@ requires its membership key. Invalid credentials need renewal (`claude setup-tok
101
101
  for Claude, replacement membership key for Kimi); quota and overload failures
102
102
  retain alternate fallback.
103
103
 
104
+ Selected Claude/Kimi credentials stay out of process arguments: each invocation
105
+ uses a private 0700 directory and a regular 0600 settings file, removed after
106
+ normal exit, launch failure or cancellation. The settings preserve selected-account
107
+ authentication precedence over saved user/project settings. Remote settings and
108
+ environments continue to contain placeholders only.
109
+
104
110
  Choose the region of your Kimi membership. The default `overseas` selects
105
111
  `https://api.kimi.ai/coding/`; `china` selects `https://api.kimi.com/coding/`.
106
112
  The base URL and egress hostname are fixed together and cannot be overridden
@@ -63,6 +63,12 @@ requires its membership key. Invalid Claude/Kimi credentials need renewal
63
63
  ChatGPT credentials require `ab accounts login NAME` for the owning destination;
64
64
  quota and overload failures retain alternate fallback.
65
65
 
66
+ Selected Claude/Kimi credentials stay out of process arguments: each invocation
67
+ uses a private 0700 directory and a regular 0600 settings file, removed after
68
+ normal exit, launch failure or cancellation. The settings preserve selected-account
69
+ authentication precedence over saved user/project settings. Remote settings and
70
+ environments continue to contain placeholders only.
71
+
66
72
  Choose the region of your Kimi membership. The default `overseas` selects
67
73
  `https://api.kimi.ai/coding/`; `china` selects `https://api.kimi.com/coding/`.
68
74
  The base URL and egress hostname are fixed together and cannot be overridden
@@ -249,7 +249,11 @@ metadata never changes completeness or merge eligibility.
249
249
  Collecting nodes may intentionally trail their parent. They refresh before
250
250
  verification and merge, for queued dependency presence, on operator request,
251
251
  and after accepted re-parenting. Descendants need independent demand; presence
252
- requests follow only the minimal proven ancestor path. See
252
+ requests follow only the minimal proven ancestor path. Unavailable immediate-parent
253
+ identities remain pending; durable availability facts bound idle preparation across
254
+ restart. Head, request, ancestry, alias and confirmed landing changes trigger a fresh
255
+ assessment. Re-parenting to another branch explicitly disposes of old destination
256
+ requests without claiming coverage. See
253
257
  [restacking](restacking.md#timing-and-evidence) for timing, requests and distance.
254
258
 
255
259
  ## Polling and status
@@ -263,9 +267,15 @@ GitHub-only changes are discovered on the next due check, within the idle
263
267
  interval plus normal tick scheduling while the dispatcher is running; failure,
264
268
  cooldown and transport-budget gates still apply. Pending operations retain
265
269
  active polling and action-time readiness checks remain fresh. Successful
266
- `node.poll-checked` facts preserve quiet history across restarts; missing facts
267
- force a fresh check. `ab build status` reports active or idle cadence and the
268
- last successful check (or unrecorded evidence).
270
+ `node.poll-checked` advisory facts preserve quiet history across restarts.
271
+ Each successfully observed activity or policy epoch records one quiet-period
272
+ anchor; unchanged active checks add no checkpoints. At the quiet threshold a
273
+ check may be immediately due, then each successful due idle check records its
274
+ completion. Growth is bounded by one anchor per observed epoch plus due idle
275
+ checks. Missing or unusable evidence forces a fresh check; interrupted or
276
+ contended writes leave the durable deadline unchanged and retry conservatively. `ab build status` reports active or idle cadence and the
277
+ last durably recorded successful check (or unrecorded evidence); this timestamp
278
+ can trail successful active checks.
269
279
 
270
280
  ## Operator node spec revisions
271
281
 
@@ -285,4 +295,5 @@ Active verification/reconcile or writer work, restack/reparent work, pause,
285
295
  pending controls, merge intent and ended PRs refuse the no-escalation path.
286
296
  A concurrent state change refuses publication with a retry explanation;
287
297
  uncited artifacts are inert. Leaves still require an open escalation and
288
- restart from `plan`.
298
+ restart from `plan` after any unfinished reconcile resumes under the revised
299
+ spec and its publication is confirmed.