@defrex/autobuild 1.0.0-beta.1 → 1.0.0-beta.2

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 (158) hide show
  1. package/SPEC.md +285 -53
  2. package/bin/ab-build-runner.ts +10 -8
  3. package/docs/architecture.md +173 -23
  4. package/docs/configuration.md +35 -4
  5. package/docs/hosted-service.md +35 -0
  6. package/docs/integration-tree.md +81 -4
  7. package/docs/landing-policy.md +11 -0
  8. package/docs/migration-1.0.md +9 -0
  9. package/docs/operator-api.md +18 -0
  10. package/docs/remote-store-protocol.md +11 -0
  11. package/docs/restacking.md +42 -7
  12. package/docs/setup.md +21 -0
  13. package/docs/ticket-dependencies.md +6 -45
  14. package/package.json +3 -3
  15. package/packages/core/src/cli/attention.ts +4 -1
  16. package/packages/core/src/cli/binary.ts +17 -1
  17. package/packages/core/src/cli/context.ts +53 -1
  18. package/packages/core/src/cli/dashboard/actions.ts +4 -0
  19. package/packages/core/src/cli/dashboard/detail.ts +45 -1
  20. package/packages/core/src/cli/dashboard/facts.ts +7 -2
  21. package/packages/core/src/cli/dashboard/integration-detail.ts +142 -0
  22. package/packages/core/src/cli/dashboard/integration-row.ts +248 -0
  23. package/packages/core/src/cli/dashboard/landing-display.ts +64 -0
  24. package/packages/core/src/cli/dashboard/model.ts +140 -16
  25. package/packages/core/src/cli/dashboard/poll.ts +40 -4
  26. package/packages/core/src/cli/dashboard/render.ts +106 -5
  27. package/packages/core/src/cli/dashboard/transcript.ts +2 -1
  28. package/packages/core/src/cli/dispatch-frontend.ts +6 -0
  29. package/packages/core/src/cli/dispatch.ts +44 -14
  30. package/packages/core/src/cli/help.ts +16 -1
  31. package/packages/core/src/cli/main.ts +37 -0
  32. package/packages/core/src/cli/publication-settlement.ts +49 -5
  33. package/packages/core/src/cli/repository-status.ts +97 -2
  34. package/packages/core/src/cli/status.ts +24 -1
  35. package/packages/core/src/cli/terminals.ts +94 -93
  36. package/packages/core/src/cli/wait.ts +11 -2
  37. package/packages/core/src/cli/watch.ts +12 -0
  38. package/packages/core/src/config/schema.ts +3 -0
  39. package/packages/core/src/events/catalog.ts +38 -0
  40. package/packages/core/src/events/compatibility.ts +183 -0
  41. package/packages/core/src/events/native-session.ts +13 -0
  42. package/packages/core/src/events/payloads.ts +148 -2
  43. package/packages/core/src/events/policy.ts +209 -0
  44. package/packages/core/src/events/repository.ts +48 -0
  45. package/packages/core/src/integration/harness.ts +4 -4
  46. package/packages/core/src/kernel/__snapshots__/{reducer-registry.test.ts.snap → reducer-accumulator-shapes.json} +771 -538
  47. package/packages/core/src/kernel/change-presence.ts +4 -2
  48. package/packages/core/src/kernel/dispatch-capacity.ts +119 -0
  49. package/packages/core/src/kernel/dispatcher-liveness.ts +5 -1
  50. package/packages/core/src/kernel/engine.ts +25 -5
  51. package/packages/core/src/kernel/forge-health.ts +19 -0
  52. package/packages/core/src/kernel/generators/build-log.ts +18 -0
  53. package/packages/core/src/kernel/generators/node-restack-log.ts +1 -1
  54. package/packages/core/src/kernel/generators/repository-journals.ts +10 -0
  55. package/packages/core/src/kernel/guarded-forge.ts +159 -0
  56. package/packages/core/src/kernel/incremental.ts +4 -2
  57. package/packages/core/src/kernel/integration-completeness.ts +61 -0
  58. package/packages/core/src/kernel/integration-landing.ts +5 -4
  59. package/packages/core/src/kernel/janitor-failure.ts +36 -0
  60. package/packages/core/src/kernel/landing-publication.ts +35 -15
  61. package/packages/core/src/kernel/landing-state.ts +7 -0
  62. package/packages/core/src/kernel/leaf-restack-state.ts +1 -1
  63. package/packages/core/src/kernel/log-index.ts +12 -1
  64. package/packages/core/src/kernel/mixed-version.ts +52 -0
  65. package/packages/core/src/kernel/node-landing.ts +14 -11
  66. package/packages/core/src/kernel/node-restack-demand.ts +29 -0
  67. package/packages/core/src/kernel/node-restack-state.ts +46 -16
  68. package/packages/core/src/kernel/node-restack-transaction.ts +151 -8
  69. package/packages/core/src/kernel/node-restack.ts +34 -10
  70. package/packages/core/src/kernel/publication.ts +22 -0
  71. package/packages/core/src/kernel/read-deferrals.ts +111 -0
  72. package/packages/core/src/kernel/read-facts.ts +27 -6
  73. package/packages/core/src/kernel/reconcile-restack.ts +23 -2
  74. package/packages/core/src/kernel/reducer-registry.ts +15 -2
  75. package/packages/core/src/kernel/reducer.ts +196 -10
  76. package/packages/core/src/kernel/repository-attention.ts +38 -1
  77. package/packages/core/src/kernel/terminal-guard.ts +11 -4
  78. package/packages/core/src/operator/annotations.ts +6 -0
  79. package/packages/core/src/operator/index.ts +2 -0
  80. package/packages/core/src/operator/presentation.ts +5 -0
  81. package/packages/core/src/operator/query.ts +45 -11
  82. package/packages/core/src/operator/registry.ts +17 -1
  83. package/packages/core/src/operator/restack.ts +51 -0
  84. package/packages/core/src/plugin-sdk/index.ts +10 -0
  85. package/packages/core/src/plugins/manifest.ts +1 -1
  86. package/packages/core/src/ports/forge/contract.ts +23 -0
  87. package/packages/core/src/ports/forge/fake.ts +6 -2
  88. package/packages/core/src/ports/forge/git-rewrite.ts +92 -64
  89. package/packages/core/src/ports/forge/github-transport.ts +45 -2
  90. package/packages/core/src/ports/forge/github.ts +56 -17
  91. package/packages/core/src/ports/forge/local-git.ts +7 -2
  92. package/packages/core/src/ports/forge-failure.ts +40 -0
  93. package/packages/core/src/ports/forge-request-context.ts +35 -0
  94. package/packages/core/src/ports/forge-telemetry.ts +16 -0
  95. package/packages/core/src/ports/runner/claude.ts +136 -9
  96. package/packages/core/src/ports/runner/codex.ts +112 -7
  97. package/packages/core/src/ports/runner/contract.ts +78 -0
  98. package/packages/core/src/ports/runner/fake.ts +59 -1
  99. package/packages/core/src/ports/runner/native-cli-fixture.ts +86 -0
  100. package/packages/core/src/ports/runner/native-process-fixture.ts +38 -0
  101. package/packages/core/src/ports/runner/native-session.ts +110 -0
  102. package/packages/core/src/ports/runner/pi-rpc.ts +7 -1
  103. package/packages/core/src/ports/runner/pi.ts +162 -2
  104. package/packages/core/src/ports/types.ts +53 -5
  105. package/packages/core/src/ports/workspace/git-worktree.ts +45 -51
  106. package/packages/core/src/ports/workspace/vercel-sandbox.ts +28 -12
  107. package/packages/core/src/processes/build-child-exit.ts +50 -2
  108. package/packages/core/src/processes/build-child.ts +15 -7
  109. package/packages/core/src/processes/build-runner.ts +909 -213
  110. package/packages/core/src/processes/dispatcher.ts +652 -334
  111. package/packages/core/src/processes/execution-no-progress.ts +15 -0
  112. package/packages/core/src/processes/pause-execution-fixture.ts +37 -0
  113. package/packages/core/src/processes/phase-failure-budget.ts +2 -1
  114. package/packages/core/src/processes/publication-loss.ts +7 -3
  115. package/packages/core/src/processes/repo-view.ts +53 -6
  116. package/packages/core/src/processes/tick-publication.ts +6 -2
  117. package/packages/core/src/runtime-identity.ts +37 -0
  118. package/packages/core/src/store/adapter.ts +4 -2
  119. package/packages/core/src/store/build-scope.ts +9 -0
  120. package/packages/core/src/store/contract.ts +203 -16
  121. package/packages/core/src/store/digest.ts +20 -2
  122. package/packages/core/src/store/local/schema.ts +6 -0
  123. package/packages/core/src/store/local/store.ts +57 -4
  124. package/packages/core/src/store/memory.ts +83 -2
  125. package/packages/core/src/store/new-build.ts +2 -2
  126. package/packages/core/src/store/phase-session.ts +13 -0
  127. package/packages/core/src/store/reduced-reads.ts +43 -4
  128. package/packages/core/src/store/reducer-value-shapes.json +8238 -5764
  129. package/packages/core/src/store/reducer-value-validation.ts +103 -3
  130. package/packages/core/src/store/reducer-values.ts +21 -6
  131. package/packages/core/src/store/remote/client.ts +145 -20
  132. package/packages/core/src/store/remote/index.ts +2 -0
  133. package/packages/core/src/store/remote/protocol.ts +19 -0
  134. package/packages/core/src/store/remote/version.ts +2 -0
  135. package/packages/core/src/store/repo-state-events.ts +3 -1
  136. package/packages/core/src/store/repo-tick.ts +6 -1
  137. package/packages/core/src/store/session-handle.ts +8 -0
  138. package/packages/core/src/store/snapshots.ts +21 -5
  139. package/packages/core/src/store/types.ts +17 -1
  140. package/packages/core/src/testing/dispatch-read-budget.ts +17 -2
  141. package/packages/core/src/testing/index.ts +7 -0
  142. package/packages/core/src/testing/newer-writer.ts +37 -0
  143. package/packages/core/src/testing/reduced-read-budget.ts +3 -0
  144. package/skills/guide/SKILL.md +137 -24
  145. package/skills/guide/references/integration-tree.md +81 -4
  146. package/skills/guide/references/landing-policy.md +11 -0
  147. package/skills/guide/references/migration-1.0.md +9 -0
  148. package/skills/guide/references/operator-api.md +18 -0
  149. package/skills/guide/references/plugin-authoring.md +47 -4
  150. package/skills/guide/references/remote-store-protocol.md +11 -0
  151. package/skills/guide/references/restacking.md +42 -7
  152. package/skills/guide/references/setup.md +21 -0
  153. package/skills/guide/references/ticket-dependencies.md +6 -45
  154. package/skills/implement/SKILL.md +4 -2
  155. package/skills/operate/SKILL.md +63 -6
  156. package/skills/reconcile/SKILL.md +3 -1
  157. package/skills/spec/SKILL.md +49 -39
  158. package/skills/tickets/SKILL.md +15 -43
@@ -19,8 +19,8 @@ paths are not API.
19
19
  |---|---|---|---|
20
20
  | `ticket-source` | `ticketSources` | `TicketSource` | Initiates a build by listing/getting/claiming tickets and receives comments/transitions/creates/updates. It owns lifecycle names, dependency completion, idempotent creation, stable external creation-key projection, and partial-list diagnostics. It is never consulted mid-build and is not artifact storage. |
21
21
  | `agent-runtime` | `agentRuntimes` | `RuntimeRegistration` | Wrap an `AgentRunner` that supports start/continue/end, complete transcripts and usage, per-turn environment refresh and cancellation, typed failures with verbatim messages, the retry-compatible `permanent` bit, and optional `cause: availability | exhaustion | credentials | configuration` routing evidence, plus the distribution-managed `ab` launcher. A cancelled turn must retain an endable handle for transcript deposition. Declare served model prefixes/default; optional tool-free `oneShot` is a capability beside the runner interface. |
22
- | `workspace-provider` | `workspaceProviders` | `WorkspaceProvider` | Provision an absolute, writable working copy for the requested branch, return durable base evidence, resume an intact branch non-destructively, rematerialize a lost copy, and make release idempotent. Never silently re-cut resumed work from a newer base. |
23
- | `forge` | `forges` | `Forge` | Implement kernel-owned regular pushes, idempotent PR opening, PR-state projection, gated/ungated auto-merge behavior, head-guarded squash merge, and comments. API 1.2 adds optional idempotent `closePr` and `deleteBranch` abort-cleanup capabilities; `closePr` must preserve a racing merge. Without them abort cleanup remains visibly pending. Agents never receive forge credentials or push. `prAttachments` is an optional image-hosting capability; absence must preserve the supported text-only path. |
22
+ | `workspace-provider` | `workspaceProviders` | `WorkspaceProvider` | Provision an absolute, writable working copy for the requested branch, return durable base evidence, resume an intact branch non-destructively, rematerialize a lost copy, and make release idempotent. Never silently re-cut resumed work from a newer base. Optional `provision.publication` supplies a durable confirmed SHA and known cache tips for authoritative readback and cache repair; preserve unknown unpublished work. |
23
+ | `forge` | `forges` | `Forge` | Implement kernel-owned regular pushes, idempotent PR opening, PR-state projection, gated/ungated auto-merge behavior, head-guarded squash merge, and comments. API 1.2 adds optional idempotent `closePr` and `deleteBranch` abort-cleanup capabilities; `closePr` must preserve a racing merge. Without them abort cleanup remains visibly pending. Agents never receive forge credentials or push. `prAttachments` is an optional image-hosting capability; absence must preserve the supported text-only path. Optional API 1.8 failure classification and request observers are described below. |
24
24
 
25
25
  Reconcile requires the optional grouped `Forge.rewrite` capability: snapshot the
26
26
  actual build branch into a build-private ref, publish immutable exact-SHA refs
@@ -36,8 +36,20 @@ fall back to merging, ordinary pushes, archive branches or tags. Older forge
36
36
  plugins remain loadable and receive an actionable refusal at reconcile time.
37
37
  Remote workspace providers additionally need trusted `WorkspacePublication.rewrite`
38
38
  after guest execution teardown; ordinary `publish` cannot publish a restack.
39
- A local-ref acknowledgement has its own `localExpected` guard, separate from
40
- the authoritative remote lease when another writer advanced the remote branch.
39
+ Every publication succeeds only after authoritative branch-head readback equals
40
+ its frozen intended SHA, including recovery after a failed push. Remote-backed
41
+ local refs are caches: set them unconditionally after confirmation, fetching the
42
+ advertised ref if objects are missing, without resetting checkout files.
43
+ `localExpected` is historical input only. Local-git's shared ref database remains
44
+ authoritative and keeps CAS. Ordinary `pushBranch(workspacePath, branch, sha?)`
45
+ receives the frozen SHA from kernel callers and remains fast-forward only;
46
+ legacy callers may omit SHA to select HEAD. Implement `confirmPublication`
47
+ to inspect the authoritative head and refresh caches only on an exact SHA match;
48
+ kernel callers refuse adapters without it before attempting a push. Hosted `WorkspacePublication` must
49
+ provide authoritative `isPublished` and confirm after writing, as well as before
50
+ retrying. Remote inspection must not resume a stopped guest or run commands in
51
+ it: refresh the guest cache inside trusted publication before stopping it. Missing inspection fails actionably. Unconfirmed candidate ancestry
52
+ never proves publication.
41
53
 
42
54
  Plugin API 1.3 adds the optional AgentRunner failure `cause` and the
43
55
  `exhaustion-failure` shared-contract scenario. Legacy failures without `cause`
@@ -59,6 +71,37 @@ the durable provider locator as `BuildExecutionStart.workspaceRef`; local PID
59
71
  supervision remains host-owned. A workspace plugin relying on these fields
60
72
  should declare an API range containing `^1.5.0`.
61
73
 
74
+ Plugin API 1.8 adds optional forge failure classification and request accounting.
75
+ Import the runtime `ForgeFailure` constructor and `isForgeFailure`, plus types
76
+ `ForgeFailureDetails`, `ForgeRequestObserver`, and `ForgeRequestContext` from
77
+ `@defrex/autobuild/plugin-sdk`. Throw
78
+ `new ForgeFailure(message, { kind: 'rate-limited', resetAt })` with a valid ISO
79
+ reset timestamp, or `{ kind: 'transient', retry: 'retryable' }` for retryable
80
+ transport errors. Ordinary policy/permission refusals remain deferrals. Never
81
+ include credentials. The `forgeFailure: 'autobuild.forge-failure.v1'` discriminant
82
+ and validated details work across separately loaded SDK copies.
83
+
84
+ Optionally implement `Forge.observeRequests(observer): () => void`; return a
85
+ disposer and call registered observers once per wire request, including failed
86
+ requests and pagination. Pass `ForgeRequestContext` with the build slug when
87
+ known, or `{}` when unknown. The host fills missing build attribution from its
88
+ current build-scoped operation; otherwise the request is repository/unattributed.
89
+ Credential discovery and skipped calls are not provider requests. For example:
90
+
91
+ ```ts
92
+ observeRequests(observer: ForgeRequestObserver) {
93
+ this.observers.add(observer)
94
+ return () => { this.observers.delete(observer) }
95
+ }
96
+ // At the actual transport boundary:
97
+ for (const observer of this.observers) observer({ build: context.build })
98
+ return transport(method, path, options)
99
+ ```
100
+
101
+ Declare `apiVersion: '^1.8.0'` when using these capabilities. Compatible legacy
102
+ 1.x plugins still load without observers and show unavailable counts. Arbitrary
103
+ legacy errors are not classified automatically.
104
+
62
105
  Plugin API 1.7 extends the workspace-provider factory context with the
63
106
  host-derived seams a store-requiring remote provider needs. Workspace-provider
64
107
  factories additionally receive `storeRef` and `delegateCredential` (guaranteed present
@@ -316,6 +316,7 @@ it to exist. An unknown build returns `404 not-found`.
316
316
  | `append` | `POST /builds/{slug}/events` | event write | `201` + build event envelope |
317
317
  | `appendIfCurrent` | `POST /builds/{slug}/events/conditional` | `{"expectedSeq": nonnegative integer, "event": event write}` | appended: `201` + build event envelope; stream advanced: `200 null` |
318
318
  | `getEvents` | `GET /builds/{slug}/events?since={n}&wait={s}` | optional `since` query value, parsed below; absence defaults to `0`. Optional `wait` in whole seconds, parsed per the event-wait rules below | `200` + envelopes whose `seq` is strictly greater than parsed `since`, in increasing sequence order |
319
+ | `appendWithArtifactsIfCurrent` | `POST /builds/{slug}/deposits/conditional` | atomic deposit request plus `expectedSeq` | `201` + `{event, artifacts}`, or `200` + `null` on stale head |
319
320
  | `appendWithArtifacts` | `POST /builds/{slug}/deposits` | atomic deposit request | `201` + `{event, artifacts}` |
320
321
  | `getReducerSnapshot` | `GET /builds/{slug}/snapshots/{reducer}?version={n}` | required `version` query value, a positive integer; `reducer` is a registry name (`^[A-Za-z][A-Za-z0-9._-]{0,63}$`) | `200` + `{"version", "cursor", "state"}` or `200 null` when absent, written by another reducer version, or ahead of the build log's tail; an unknown build is `404`, which the shipped client also maps to `null` |
321
322
  | `putReducerSnapshot` | `PUT /builds/{slug}/snapshots/{reducer}` | `{"version": int >= 1, "cursor": int >= 0, "state": JSON}`, at most 16 MiB (`413` above) | `200 {"written": boolean}`; the stored cursor never decreases, so a write at an equal or lower cursor (or an equal cursor at an equal or lower version) and one past the log's tail answer `written: false` |
@@ -1085,6 +1086,16 @@ and metadata is the visibility boundary. Revision assignment, substitution,
1085
1086
  event validation, and metadata/event commit must be serialized or
1086
1087
  transactional so concurrent deposits receive distinct revisions and events.
1087
1088
 
1089
+ Conditional build deposits use `POST /builds/{slug}/deposits/conditional` and
1090
+ require nonnegative integer `expectedSeq`. The distinct endpoint fails closed
1091
+ against an older server; the client never falls back to an unguarded deposit.
1092
+ The backing store compares the head under the same transaction
1093
+ or build lock as the deposit. A stale head returns `200 null` without artifact
1094
+ metadata, revision allocation, timestamp updates, retention pruning or event
1095
+ append. A matching head follows the normal validation/rollback contract and
1096
+ returns `201 {event, artifacts}`. Immutable orphan blobs remain harmless.
1097
+ Terminal and suspension writers re-read and revalidate after a comparison miss.
1098
+
1088
1099
  These rules apply identically to build, repository, and session deposits.
1089
1100
 
1090
1101
  ## 9. Errors and validation
@@ -25,17 +25,46 @@ verification; reports retain their actual cycle base/head. Conflicted replay
25
25
  runs reconcile and verification, and initial verification cannot be skipped
26
26
  through post-reconcile policy.
27
27
 
28
- Every open node observes its parent and cascades movement to descendants,
29
- including empty nodes without PRs. Movement coalesces onto the newest sample
30
- after an active frozen transaction finishes; no separate throttle is configured.
31
- Unlike clean waiting leaves, nodes must reverify any changed head or parent.
28
+ Nodes observe parent movement durably but restack only on demand: before a
29
+ complete nonempty node verifies; before landing if its parent moved; when queued
30
+ dependency presence requires an ancestor change; on `ab restack <node>`; or on
31
+ accepted re-parenting. There is no eager mode or cadence option. Nested nodes
32
+ need their own demand. Existing frozen transactions, including ones reserved
33
+ before upgrade, finish first; later demand coalesces onto the latest parent.
34
+ Leaves keep verify-entry and awaiting-landing restacks for every target.
35
+
36
+ Presence demand uses change identities, never ticket resolution alone. It follows
37
+ only the path from the nearest proven ancestor source down to the dependent's
38
+ actual destination, processing ancestors first. Unrelated siblings stay idle;
39
+ changes absent from all ancestors cannot trigger a speculative replay. Tickets
40
+ remain queued until presence is observed in their destination.
41
+
42
+ `ab restack <node>` (operator tool `builds.restack`, input `{repo, slug}`) records
43
+ a durable request, coalescing pending demand. It refuses leaves, terminal nodes,
44
+ and unopened nodes. Paused or blocked nodes wait for their normal safety gates.
45
+ A request arriving during replay survives until its parent and required identities
46
+ are covered. Re-parenting invalidates requests for the old destination.
47
+
48
+ Both dashboards show `parent N commits ahead`, `parent current`, or
49
+ `parent distance unknown`. Distance counts commits reachable from the observed
50
+ parent but not the last confirmed contribution base; it is not elapsed time or
51
+ poll count. Samples are invalidated by replay or re-parenting. A stale node
52
+ cannot verify or land; inventory and child landings continue while it collects.
32
53
 
33
54
  Before replacement the kernel publishes retained tips, displaced heads and the
34
55
  temporary change under immutable exact archive refs. `restack.*` facts record
35
56
  preparation, replay, intent, archived replacement, contention and completion.
36
57
  Unpublished request/loss records alone cannot preserve objects from a released
37
- sandbox. Publication uses exact expected-head CAS; contention retains evidence
38
- and retries without overwriting another writer. Remote guests park for trusted
58
+ sandbox. The forge is authoritative for publication: after a push or on recovery,
59
+ its branch head must equal the intended SHA before completion. Local refs are
60
+ caches refreshed without an expected-old guard after confirmation; checkout files
61
+ are untouched. Local-git's shared database is the forge and retains authoritative
62
+ CAS. Remote publication uses exact expected-head leases and durable reservations; contention retains evidence
63
+ and retries without overwriting another writer. An overtaken successful guarded
64
+ write can retain its factual receipt, but unconfirmed candidate ancestry cannot
65
+ prove a write or promote a base. Contribution ownership uses recorded boundaries,
66
+ stable build identities and confirmed foreign rewrite aliases, never a merge-base
67
+ against the current destination. Remote guests park for trusted
39
68
  publication after teardown. Historical merge reconciliations keep their original
40
69
  interpretation and supply a promoted contribution base for later replay.
41
70
 
@@ -52,7 +81,8 @@ child landings. Reservations freeze expected head, parent, contribution boundary
52
81
  archives, changes and merge proofs. Lease expiry recovers the same operation,
53
82
  not a competing one. Prepared/conflicted/replayed item receipts, publication
54
83
  intent, proven replacement and settlement distinguish each recovery boundary.
55
- Inventory exposes source identities, node-owned foreign commits, active operation,
84
+ Inventory retains its sampled source boundary even while the confirmed parent
85
+ boundary stays unchanged. It exposes source identities, node-owned foreign commits, active operation,
56
86
  conflict item and unsafe merge evidence.
57
87
 
58
88
  Only a conflicted item attaches a reconcile runner. It receives the original
@@ -77,3 +107,8 @@ never preserves merge topology or decomposes an unsafe merge automatically.
77
107
 
78
108
  See [integration trees](integration-tree.md), [landing](landing-policy.md), and
79
109
  [migration](migration-1.0.md).
110
+
111
+ Native cancellation receipts are candidate- and operation-specific. Publication
112
+ retries confirm forge state before reusing a receipt; external re-enables require
113
+ another confirmed cancellation. Classified transient landing failures retain
114
+ retry eligibility and recheck authorization after repository forge cooldown.
@@ -156,6 +156,27 @@ Vercel team/project credential set; provide separate private-clone credentials;
156
156
  use an HTTPS GitHub origin and hosted Store; authorize the Store token; or commit
157
157
  and push the selected base branch.
158
158
 
159
+ ## Keep per-build records in separate fragments
160
+
161
+ When a repository keeps per-build records, such as changelog entries, write a
162
+ separate fragment file for each build and assemble the consolidated record at
163
+ release. For example, use distinct filenames per build (these names are
164
+ illustrative):
165
+
166
+ ```text
167
+ changelog.d/
168
+ build-alpha.md
169
+ build-beta.md
170
+ CHANGELOG.md # assembled from the fragments at release
171
+ ```
172
+
173
+ Shared append-only files are an anti-pattern for finalize steps. Under the
174
+ integration tree, independent builds that append to the same shared lines can
175
+ conflict when their commits are replayed onto a destination that already has
176
+ other entries, including during restacks and node cascades. Each conflicting
177
+ replay costs an agent reconcile session. Separate fragment files remove that
178
+ shared edit surface; the repository owns the release-time assembly tooling.
179
+
159
180
  ## Repository identity is the origin, not a checkout path
160
181
 
161
182
  Repository identity in the Store, dispatcher, `ab builds`, `ab build status`,
@@ -60,49 +60,10 @@ and claims the ticket only after they resolve and other readiness gates pass.
60
60
 
61
61
  ## Node tickets and targets
62
62
 
63
- Tickets have `kind = "work"` by default, or `kind = "node"` for a named
64
- integration point. The optional `target` is a node ticket id in the same source;
65
- omission means the configured `baseBranch` root. Nodes may target other nodes.
66
- A ready node opens an integration branch; a targeting build freezes that node
67
- as its base and landing destination. The existing cascade restacks descendants
68
- when a parent moves. Blockers remain a separate graph.
69
-
70
- Use `ab ticket create "Integration" --body spec.md --kind node`, then
71
- `ab ticket update <id> --target <node-id>`. Clear a target with `--no-target`;
72
- reset kind with `--kind work`. Omitted fields preserve existing values.
73
- `ab ticket show <id> [--json]` exposes both fields; `ab ticket tree [--json]`
74
- shows the configured root and every ticket, including completed work and empty
75
- nodes, nested by target with state. Siblings are sorted by id. Invalid external
76
- graphs and listing diagnostics are reported explicitly.
77
-
78
- Targets must exist and be nodes in the configured source. Self-targeting,
79
- ancestor cycles and demoting a node with targeting tickets are refused before
80
- any part of the requested update is written, regardless of ticket state.
81
- Clear or reparent its children before demotion. File frontmatter persists the
82
- fields; `ab ticket edit` displays them read-only. Change them through update.
83
- Kind and target participate in content revisions and revision-checked writes.
84
- File writes retain their existing best-effort, unlocked concurrency semantics.
85
-
86
- Linear uses the exact `node` issue label for kind and the parent relation for
87
- target, only when the parent carries that label. Ordinary grouping parents do
88
- not impose targets and survive unrelated updates. Explicit target clear clears
89
- the parent relation. Label replacements can demote nodes and receive the same
90
- guards; explicit kind and label instructions must agree about `node`. Label
91
- and parent connections are fully paginated. Linear still refuses guarded writes.
92
-
93
- Hosted sources support kind and target with project-scoped transactional validation.
94
- Existing tickets default to work with no target. Metadata changes increment the
95
- revision once; equivalent aliases and unchanged values do not. Node demotion
96
- checks all targeting tickets, including completed work. Legacy plugins without
97
- integrationTree support read as work with no target and refuse metadata writes.
98
-
99
-
100
- A node remains incomplete while any ticket targeting it is unresolved, including
101
- triage and backlog tickets. Done and cancelled tickets are terminal. A complete
102
- node with landed contributions verifies its exact head before explicit per-build
103
- landing consent can publish it. If node verification fails, file a repair child
104
- with that node as its target; landing the repair triggers a fresh cycle. Human
105
- forge merges are recorded escape hatches from these gates.
63
+ Read [nodes and targets](integration-tree.md) for lifecycle, validation and
64
+ source storage, and [choosing a destination](integration-tree.md#choosing-a-destination)
65
+ when filing a feature set. Blockers order work independently of landing targets;
66
+ landing authorization follows the repository's matched policy.
106
67
 
107
68
  ## When a blocker resolves
108
69
 
@@ -117,8 +78,8 @@ an open or aborted node, or ambiguous newest build generations remain queued.
117
78
  Older successful generations are never substituted for the newest build.
118
79
 
119
80
  - Same node: the blocking change lands directly into the target.
120
- - Ancestor: the change lands into an ancestor, then the cascade restacks the target.
121
- - Sibling: the blocking node lands into their common ancestor, then the cascade reaches the target.
81
+ - Ancestor: the change lands into an ancestor, then presence demand restacks only the required path to the target.
82
+ - Sibling: the blocking node lands into their common ancestor, then presence demand reaches the target through the minimal ancestor path.
122
83
  - Descendant: the blocking node lands into the dependent's target ancestor.
123
84
 
124
85
  Blockers that never had a build, and repositories without nodes, retain the
@@ -35,8 +35,10 @@ You never push — the push is plumbing that happens when you finish.
35
35
  reach the store only through this flag; the file is never committed.
36
36
 
37
37
  `ab done` requires a **clean worktree** (everything committed) and the
38
- notes deposit. In a local workspace it validates, pushes the branch, and
39
- completes the phase. In a remote workspace it records one publication
38
+ notes deposit. In a local workspace it validates the recorded contribution boundary, pushes
39
+ the frozen HEAD SHA, confirms the authoritative branch head, and completes
40
+ the phase. Push/readback failures write no completion or pending publication
41
+ request; fix the failure and retry in the same session. In a remote workspace it records one publication
40
42
  request and parks while the dispatcher publishes and records completion;
41
43
  **do not run `ab done` again** after that success message. It is your only
42
44
  terminal command besides `ab escalate`. If it reports a validation error,
@@ -84,10 +84,10 @@ the same resolved working directory.
84
84
  ### Watch for attention events
85
85
 
86
86
  `ab watch --json` is the standing monitor. Keep its default filter: every
87
- record calls for action. It reports build escalations and merge decisions,
87
+ record calls for action. It reports build escalations, persistent janitor failures and merge decisions,
88
88
  harvest escalations/recovery exhaustion, rejected configuration, reloads needing
89
- restart, abnormal dispatcher stops/loss, degradation past reset (15 minutes
90
- without reset), and five minutes of continuous tick failures. Advertised resets
89
+ restart, abnormal dispatcher stops/loss, ticket-source and forge degradation past reset (15 minutes
90
+ for ticket sources without reset), and five minutes of continuous tick failures. Advertised resets
91
91
  wait for a post-reset tick to finish before requiring action; ordinary recovery
92
92
  on that retry stays silent. Source grace and cooldown-driven failures do not
93
93
  start the tick-failure clock. Routine outcomes and self-healing failures stay silent.
@@ -210,7 +210,11 @@ Read events with a cursor or a small `--events` count; logs are long.
210
210
  `--review-round-ceiling <n>` raises the round limit, `--revise-spec <file>`
211
211
  resolves with a revised spec. Run `ab help answer` for the full menu.
212
212
  - `ab pause <slug>` / `ab resume <slug>`; `ab pause --all` / `ab resume --all`
213
- hold and release the whole repository.
213
+ hold and release the whole repository. Pause immediately interrupts live agent
214
+ sessions and acknowledges after they stop. Resume continues the same native
215
+ session where supported; remote or unsupported sessions rerun fresh, with a
216
+ reason recorded in session.resume-fallback. Without a live agent (including
217
+ check-only verify), pause still takes effect at the next boundary.
214
218
  - `ab abort <slug>` — destructive: closes the PR, removes branches, and
215
219
  returns the ticket to triage.
216
220
  - `ab hold <slug>` — persistently hold a landing and revoke earlier consent.
@@ -225,6 +229,11 @@ Read events with a cursor or a small `--events` count; logs are long.
225
229
 
226
230
  ### Tickets
227
231
 
232
+ For feature sets you file yourself, consult the shared
233
+ [destination choice guidance](../ab-guide/references/integration-tree.md#choosing-a-destination):
234
+ explicitly choose root or a node, evaluate the repository's effective landing
235
+ policy, and explain the landing flow to the human. Ask when intent is unclear.
236
+
228
237
  `ab ticket create|update|block|unblock|list|show|move|states` file, edit, and
229
238
  move tickets; the `ab-tickets` skill covers the tracker's details. Moving a
230
239
  ticket into the ready state sends it to dispatch — do that only when the
@@ -336,7 +345,10 @@ Treat every default-watch record as a call to act:
336
345
  the reported blocker.
337
346
  - Dispatcher loss, abnormal stop, restart-required reload, rejected config, or
338
347
  persistent tick failure: diagnose through repository status and report the
339
- condition to the operator. Never start or run a dispatcher.
348
+ condition to the operator. Repository read failures fail the watch tick and
349
+ retry on the next tick, using the existing five-minute persistent-failure
350
+ attention. For validation failures, inspect the stored tick error for reducer,
351
+ scope, cursor, field path, and running version/commit. Never start or run a dispatcher.
340
352
  - Persistent source degradation: inspect the source cause and reset evidence,
341
353
  diagnose and report the continuing intake problem.
342
354
 
@@ -423,6 +435,51 @@ entry position: resuming suppresses the same episode, while a new candidate or
423
435
  exit/re-entry can notify again. Explicit `--event` globs remain event-only.
424
436
  Use `ab wait --for consent --for node-landed --for restack-conflicted --json`
425
437
  for one wake; state waits return immediately when already satisfied. `--for
426
- attention` also includes consent readiness and landing/conflict attention.
438
+ attention` also includes consent readiness, janitor failure attention and landing/conflict attention.
427
439
  Resume event backlogs with `--since <cursor>`; keep handling emitted records
428
440
  before interpreting terminal completion.
441
+
442
+ ### Own-build read deferral attention
443
+
444
+ `phase.deferral-escalated` is ordinary blocked attention: repair the scoped
445
+ CLI/store access described in its question before answering retry or guidance.
446
+ The answer authorizes a fresh session and clears no genuine phase failures.
447
+ Repeated classified read failures park immediately again; they do not consume
448
+ the phase failure allowance. Default watch and attention waits deliver the new
449
+ raise with its own event type.
450
+
451
+ ## Forge failure recovery
452
+
453
+ Janitor failures are durable per-build episodes. Eligible failures retry after
454
+ 30, 60, 120, 240 seconds, then at the configured cap (300 seconds by default).
455
+ Skipped polls preserve the episode across restart. After
456
+ `policy.janitorFailureAttentionSeconds` (600 by default), `build.janitor-failing`
457
+ notifies default watchers and appears on the build row. A successful attempt
458
+ clears it. `policy.janitorBackoffMaxSeconds` sets the positive integer cap.
459
+
460
+ A classified forge rate limit records repository degradation with `resetAt`.
461
+ Forge work waits during cooldown; passing the deadline permits a recovery
462
+ request, and only success clears degradation. A further limit extends cooldown.
463
+ Native landing application failures keep candidate-specific retry eligibility,
464
+ including automatic decisions without a human command. Retries recheck consent,
465
+ holds, verification and the exact candidate. Uncertain enables remain pending
466
+ until cancellation can be confirmed after cooldown. Publication retries reuse
467
+ cancellation receipts only when the forge confirms the same disabled state for
468
+ the same candidate and publication operation.
469
+
470
+ Tick telemetry counts provider wire requests, including failures. Counts are
471
+ unavailable for uninstrumented adapters. Attribution retains at most ten builds
472
+ ordered by descending count then build name; repository requests are unattributed.
473
+ Repository status names a hotspot only when one build makes at least two requests
474
+ and more than half of attributed requests. Telemetry never controls workflow.
475
+
476
+ ## Intentional node staleness
477
+
478
+ An open collecting node may intentionally trail its parent. Parent movement is
479
+ observed without starting replay. Use `ab restack <node>` (or `builds.restack`
480
+ with `{repo, slug}`) to request freshness; paused or blocked nodes retain the
481
+ request until their ordinary safety gates permit it. Completeness, landing,
482
+ queued dependency presence and accepted re-parenting supply automatic demand.
483
+ Nested nodes need independent demand. Inspect the shared parent commit distance
484
+ readout; unknown is unavailable evidence, not zero. Existing transactions finish
485
+ before fresh demand is evaluated. Leaves keep their usual restack points.
@@ -47,7 +47,9 @@ publish, collapse the node, choose another item, or rewrite the public branch.
47
47
  Legacy tracked scratch may be inherited unchanged from either input; do not
48
48
  author scratch changes as part of resolution.
49
49
  5. Run `ab done --notes <notesPath>`. The kernel validates, archives recorded
50
- evidence, and publishes with an exact expected-head lease. If the branch
50
+ evidence, and publishes with an exact expected-head lease. Exact forge
51
+ readback confirms publication; local refs are caches. Candidate ancestry alone
52
+ cannot establish an unconfirmed write or contribution boundary. If the branch
51
53
  changed, it prepares another replay of the observed complete contribution
52
54
  onto the same frozen base. Read context again, inspect and resolve that replay,
53
55
  run checks, update notes, then retry completion. Never push yourself.
@@ -15,38 +15,30 @@ session.
15
15
 
16
16
  ## Node tickets and targets
17
17
 
18
- Tickets have `kind = "work"` by default, or `kind = "node"` for a named
19
- integration point. The optional `target` is a node ticket id in the same source;
20
- omission means the configured `baseBranch` root. Nodes may target other nodes.
21
- These fields currently describe intent only: dispatch, branches and landing
22
- behavior are unchanged in this increment. Blockers remain a separate graph.
23
-
24
- Use `ab ticket create "Integration" --body spec.md --kind node`, then
25
- `ab ticket update <id> --target <node-id>`. Clear a target with `--no-target`;
26
- reset kind with `--kind work`. Omitted fields preserve existing values.
27
- `ab ticket show <id> [--json]` exposes both fields; `ab ticket tree [--json]`
28
- shows the configured root and every ticket, including completed work and empty
29
- nodes, nested by target with state. Siblings are sorted by id. Invalid external
30
- graphs and listing diagnostics are reported explicitly.
31
-
32
- Targets must exist and be nodes in the configured source. Self-targeting,
33
- ancestor cycles and demoting a node with targeting tickets are refused before
34
- any part of the requested update is written, regardless of ticket state.
35
- Clear or reparent its children before demotion. File frontmatter persists the
36
- fields; `ab ticket edit` displays them read-only. Change them through update.
37
- Kind and target participate in content revisions and revision-checked writes.
38
- File writes retain their existing best-effort, unlocked concurrency semantics.
39
-
40
- Linear uses the exact `node` issue label for kind and the parent relation for
41
- target, only when the parent carries that label. Ordinary grouping parents do
42
- not impose targets and survive unrelated updates. Explicit target clear clears
43
- the parent relation. Label replacements can demote nodes and receive the same
44
- guards; explicit kind and label instructions must agree about `node`. Label
45
- and parent connections are fully paginated. Linear still refuses guarded writes.
46
-
47
- Hosted sources and legacy plugins read as work with no target and refuse any
48
- explicit metadata write, including clears and mixed patches, with guidance to
49
- use a capable source. No hosted storage or protocol change is implied.
18
+ For node lifecycle, target validation and source-specific storage, read
19
+ [nodes and targets](../ab-guide/references/integration-tree.md). When filing
20
+ related work, follow the shared
21
+ [destination choice](../ab-guide/references/integration-tree.md#choosing-a-destination)
22
+ guidance before choosing root or a node.
23
+
24
+ ```sh
25
+ ab ticket create "Integration" --body spec.md --kind node
26
+ ab ticket create "Child" --body child.md --target <node-id>
27
+ ab ticket update <id> --target <node-id>
28
+ ab ticket update <id> --no-target
29
+ ab ticket update <id> --kind work
30
+ ab ticket show <id> --json
31
+ ab ticket tree --json
32
+ ```
33
+
34
+ Whenever grooming produces more than one ticket for a feature, explicitly choose
35
+ root or a node before filing, including when fleshing out an existing ticket
36
+ splits it into several tickets. Consult the shared destination criteria and read
37
+ the repository's effective landing policy in `autobuild.toml`; explain the actual
38
+ landing and consent flow to the human in plain terms. Ask the human when the
39
+ choice is unclear from grooming. Root is valid when each ticket can ship alone.
40
+ Choosing root or a node never changes the requested workflow state or silently
41
+ promotes tickets; the placement instructions below still apply.
50
42
 
51
43
  ## Ticket operations
52
44
 
@@ -104,25 +96,43 @@ blockers at creation, read back and verify them, then move to ready last. The
104
96
  human's requested final placement still wins; temporary staging needs no new
105
97
  placement question. Never assume the source default is non-ready.
106
98
 
107
- For a dependency chain, create in dependency order and obtain each new id from
108
- the command's complete JSON result. This example assumes the repository's triage
109
- state is `Triage`, its ready state is `Ready`, and the human requested ready:
99
+ For a dependency chain explicitly chosen to ship together under a node, create
100
+ in dependency order and obtain each new id from the command's complete JSON
101
+ result. Write a spec-standard node body in `integration.md` as well as the child
102
+ specs. This example assumes the repository's triage state is `Triage`, its ready
103
+ state is `Ready`, and the human requested ready placement for the whole set.
104
+ Use the repository's actual states; if final placement is non-ready, leave the
105
+ set there after verification instead of promoting it. Root remains a valid
106
+ explicit choice when each ticket is independently useful and safe to ship:
110
107
 
111
108
  ```sh
112
- ab ticket create "A" --body a.md --json --state Triage > a-ticket.json
109
+ ab ticket create "Integration" --body integration.md --kind node --json --state Triage > node-ticket.json
110
+ node_id="$(jq -r '.ref.id' node-ticket.json)"
111
+ ab ticket create "A" --body a.md --target "$node_id" --json --state Triage > a-ticket.json
113
112
  a_id="$(jq -r '.ref.id' a-ticket.json)"
114
- ab ticket create "B" --body b.md --blocked-by "$a_id" --json --state Triage > b-ticket.json
113
+ ab ticket create "B" --body b.md --blocked-by "$a_id" --target "$node_id" --json --state Triage > b-ticket.json
115
114
  b_id="$(jq -r '.ref.id' b-ticket.json)"
116
- ab ticket create "C" --body c.md --blocked-by "$b_id" --json --state Triage > c-ticket.json
115
+ ab ticket create "C" --body c.md --blocked-by "$b_id" --target "$node_id" --json --state Triage > c-ticket.json
117
116
  c_id="$(jq -r '.ref.id' c-ticket.json)"
117
+ ab ticket show "$node_id" --json
118
+ ab ticket show "$a_id" --json
118
119
  ab ticket show "$b_id" --json
119
120
  ab ticket show "$c_id" --json
120
- # Verify both tickets remain in Triage and their full blocker sets are present.
121
+ # Verify the node and all children remain in Triage, all child targets equal
122
+ # node_id, and every complete blocker set is correct (A: none; B: A; C: B).
123
+ # Repair and read back any mismatch before publishing any ticket.
124
+ ab ticket move "$node_id" Ready --json
121
125
  ab ticket move "$a_id" Ready --json
122
126
  ab ticket move "$b_id" Ready --json
123
127
  ab ticket move "$c_id" Ready --json
124
128
  ```
125
129
 
130
+ Register and verify all planned children before making the node ready, so it
131
+ cannot collect a partial feature. The node must satisfy the repository's ready
132
+ gates and open before children can be claimed; a CLI move alone does not prove
133
+ admission. After publication, read back the final states, targets and blockers;
134
+ repair partial writes without blindly creating duplicates.
135
+
126
136
  Never parse an id from the human-readable confirmation line: it can contain the
127
137
  new ticket id and blocker ids in the same source-local form. Dependency order
128
138
  alone does not close the ready-publication race. Blockers are evaluated when
@@ -11,49 +11,21 @@ content and blocker relationships. The default file source needs no secret.
11
11
 
12
12
  ## Node tickets and targets
13
13
 
14
- Tickets have `kind = "work"` by default, or `kind = "node"` for a named
15
- integration point. The optional `target` is a node ticket id in the same source;
16
- omission means the configured `baseBranch` root. Nodes may target other nodes.
17
- Ready node tickets open integration branches. Work claims freeze their target
18
- identity and branch. Blockers remain a separate graph.
19
-
20
- Use `ab ticket create "Integration" --body spec.md --kind node`, then
21
- `ab ticket update <id> --target <node-id>`. Clear a target with `--no-target`;
22
- reset kind with `--kind work`. Omitted fields preserve existing values.
23
- `ab ticket show <id> [--json]` exposes both fields; `ab ticket tree [--json]`
24
- shows the configured root and every ticket, including completed work and empty
25
- nodes, nested by target with state. Siblings are sorted by id. Invalid external
26
- graphs and listing diagnostics are reported explicitly.
27
-
28
- Changing an open node target re-parents its branch and existing PR; `--no-target`
29
- moves it to the configured root. The dispatcher confirms source metadata, replays
30
- only node-owned contributions onto the new parent, then retargets the same review.
31
- Children follow through the ordinary cascade; conflicts use normal source-aware
32
- reconcile. Pending moves block verification and landing. Cycles, non-open parents,
33
- landing/closing nodes and unsupported forge retargeting are refused with a reason.
34
- Busy operations must settle first. Changing a claimed work target is refused before
35
- any combined patch is written: abort and re-dispatch instead. Direct provider edits
36
- are observed too; invalid edits leave effective ancestry unchanged with a durable
37
- diagnostic. Status shows effective ancestry; ticket tree shows source metadata.
38
-
39
- Targets must exist and be nodes in the configured source. Self-targeting,
40
- ancestor cycles and demoting a node with targeting tickets are refused before
41
- any part of the requested update is written, regardless of ticket state.
42
- Clear or reparent its children before demotion. File frontmatter persists the
43
- fields; `ab ticket edit` displays them read-only. Change them through update.
44
- Kind and target participate in content revisions and revision-checked writes.
45
- File writes retain their existing best-effort, unlocked concurrency semantics.
46
-
47
- Linear uses the exact `node` issue label for kind and the parent relation for
48
- target, only when the parent carries that label. Ordinary grouping parents do
49
- not impose targets and survive unrelated updates. Explicit target clear clears
50
- the parent relation. Label replacements can demote nodes and receive the same
51
- guards; explicit kind and label instructions must agree about `node`. Label
52
- and parent connections are fully paginated. Linear still refuses guarded writes.
53
-
54
- Hosted sources and legacy plugins read as work with no target and refuse any
55
- explicit metadata write, including clears and mixed patches, with guidance to
56
- use a capable source. No hosted storage or protocol change is implied.
14
+ For node lifecycle, target validation and source-specific storage, read
15
+ [nodes and targets](../ab-guide/references/integration-tree.md). When filing
16
+ related work, follow the shared
17
+ [destination choice](../ab-guide/references/integration-tree.md#choosing-a-destination)
18
+ guidance before choosing root or a node.
19
+
20
+ ```sh
21
+ ab ticket create "Integration" --body spec.md --kind node
22
+ ab ticket create "Child" --body child.md --target <node-id>
23
+ ab ticket update <id> --target <node-id>
24
+ ab ticket update <id> --no-target
25
+ ab ticket update <id> --kind work
26
+ ab ticket show <id> --json
27
+ ab ticket tree --json
28
+ ```
57
29
 
58
30
  ## Hosted ticket ids
59
31