@defrex/autobuild 1.1.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 (157) hide show
  1. package/README.md +5 -13
  2. package/SPEC.md +249 -15
  3. package/bin/ab-dispatch-generation.ts +11 -2
  4. package/docs/accounts.md +130 -0
  5. package/docs/agent-runtimes.md +4 -4
  6. package/docs/answering-blocked-builds.md +4 -1
  7. package/docs/architecture.md +224 -12
  8. package/docs/build-store.md +3 -41
  9. package/docs/builds.md +2 -0
  10. package/docs/cli.md +14 -0
  11. package/docs/configuration-overview.md +117 -0
  12. package/docs/configuration.md +266 -141
  13. package/docs/dispatcher-hosting.md +18 -33
  14. package/docs/intake.md +2 -0
  15. package/docs/integration-tree.md +16 -5
  16. package/docs/merge-policy.md +1 -3
  17. package/docs/operating.md +1 -2
  18. package/docs/operator-api.md +144 -53
  19. package/docs/operator-surfaces.md +32 -20
  20. package/docs/overview.md +1 -1
  21. package/docs/plugin-authoring.md +27 -1
  22. package/docs/remote-store-protocol.md +259 -91
  23. package/docs/remote-ticket-protocol.md +29 -49
  24. package/docs/restacking.md +45 -0
  25. package/docs/seams.md +8 -8
  26. package/docs/setup.md +34 -129
  27. package/docs/spec-standard.md +4 -2
  28. package/docs/ticket-dependencies.md +8 -0
  29. package/docs/ticket-sources.md +18 -0
  30. package/docs/troubleshooting.md +7 -11
  31. package/docs/upgrading.md +1 -1
  32. package/docs/workspaces.md +4 -4
  33. package/package.json +14 -5
  34. package/packages/core/src/accounts/chatgpt-oauth.ts +216 -0
  35. package/packages/core/src/accounts/chatgpt-state.ts +41 -0
  36. package/packages/core/src/accounts/local-credentials.ts +194 -0
  37. package/packages/core/src/accounts/local-inference.ts +106 -0
  38. package/packages/core/src/accounts/local-owner.ts +123 -0
  39. package/packages/core/src/accounts/sensitive.ts +2 -0
  40. package/packages/core/src/cli/accounts.ts +147 -0
  41. package/packages/core/src/cli/binary.ts +3 -1
  42. package/packages/core/src/cli/connect.ts +3 -3
  43. package/packages/core/src/cli/dispatch-frontend.ts +1 -0
  44. package/packages/core/src/cli/dispatch-handoff.ts +125 -44
  45. package/packages/core/src/cli/dispatch-launch-contract.ts +187 -0
  46. package/packages/core/src/cli/dispatch-launcher.ts +54 -21
  47. package/packages/core/src/cli/dispatch-preflight.ts +6 -1
  48. package/packages/core/src/cli/dispatch-repository-feed.ts +107 -26
  49. package/packages/core/src/cli/dispatch.ts +135 -27
  50. package/packages/core/src/cli/dispatcher-liveness.ts +6 -1
  51. package/packages/core/src/cli/forge-clear.ts +30 -0
  52. package/packages/core/src/cli/help.ts +17 -0
  53. package/packages/core/src/cli/init-readiness-remote.ts +22 -1
  54. package/packages/core/src/cli/init-readiness-shared.ts +5 -1
  55. package/packages/core/src/cli/init-validation.ts +160 -18
  56. package/packages/core/src/cli/main.ts +72 -0
  57. package/packages/core/src/cli/publication-settlement.ts +4 -1
  58. package/packages/core/src/cli/secrets.ts +173 -0
  59. package/packages/core/src/cli/store-opening.ts +11 -1
  60. package/packages/core/src/cli/upgrade-agent.ts +9 -1
  61. package/packages/core/src/cli/watch.ts +12 -14
  62. package/packages/core/src/config/accounts.ts +101 -0
  63. package/packages/core/src/config/live.ts +14 -1
  64. package/packages/core/src/config/roles.ts +54 -3
  65. package/packages/core/src/config/schema.ts +60 -0
  66. package/packages/core/src/events/catalog.ts +1 -0
  67. package/packages/core/src/events/compatibility.ts +2 -1
  68. package/packages/core/src/events/forge-degradation-policy.ts +11 -0
  69. package/packages/core/src/events/payloads.ts +13 -0
  70. package/packages/core/src/events/policy.ts +9 -0
  71. package/packages/core/src/events/repository.ts +75 -2
  72. package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +278 -0
  73. package/packages/core/src/kernel/change-presence.ts +74 -8
  74. package/packages/core/src/kernel/engine.ts +8 -0
  75. package/packages/core/src/kernel/generators/node-restack-log.ts +14 -0
  76. package/packages/core/src/kernel/node-polling.ts +40 -7
  77. package/packages/core/src/kernel/node-restack-demand.ts +74 -0
  78. package/packages/core/src/kernel/node-restack-state.ts +5 -1
  79. package/packages/core/src/kernel/node-restack-transaction.ts +33 -1
  80. package/packages/core/src/kernel/read-facts.ts +6 -0
  81. package/packages/core/src/kernel/reducer-registry.ts +3 -0
  82. package/packages/core/src/kernel/reducer.ts +4 -1
  83. package/packages/core/src/kernel/ticket-preparation.ts +66 -0
  84. package/packages/core/src/operator/annotations.ts +6 -0
  85. package/packages/core/src/operator/control.ts +20 -0
  86. package/packages/core/src/operator/index.ts +4 -0
  87. package/packages/core/src/operator/protocol.ts +6 -0
  88. package/packages/core/src/operator/registry.ts +42 -1
  89. package/packages/core/src/operator/tickets.ts +25 -4
  90. package/packages/core/src/plugins/manifest.ts +2 -1
  91. package/packages/core/src/ports/runner/account-env.ts +139 -0
  92. package/packages/core/src/ports/runner/chatgpt-provider.ts +85 -0
  93. package/packages/core/src/ports/runner/claude.ts +70 -42
  94. package/packages/core/src/ports/runner/codex.ts +63 -31
  95. package/packages/core/src/ports/runner/one-shot.ts +2 -0
  96. package/packages/core/src/ports/runner/provider-error.ts +5 -0
  97. package/packages/core/src/ports/runner/routing.ts +35 -4
  98. package/packages/core/src/ports/tickets/contract.ts +58 -0
  99. package/packages/core/src/ports/tickets/tree.ts +1 -1
  100. package/packages/core/src/ports/types.ts +28 -7
  101. package/packages/core/src/ports/workspace/account-policy.ts +72 -0
  102. package/packages/core/src/ports/workspace/build-execution.ts +6 -1
  103. package/packages/core/src/ports/workspace/builtin-capabilities.ts +1 -0
  104. package/packages/core/src/ports/workspace/create.ts +2 -0
  105. package/packages/core/src/ports/workspace/git-worktree.ts +6 -1
  106. package/packages/core/src/ports/workspace/provider-capabilities.ts +1 -0
  107. package/packages/core/src/ports/workspace/vercel-sandbox.ts +125 -35
  108. package/packages/core/src/processes/build-runner.ts +32 -1
  109. package/packages/core/src/processes/dispatcher.ts +493 -121
  110. package/packages/core/src/processes/execution-no-progress.ts +1 -0
  111. package/packages/core/src/processes/execution-settlement.ts +21 -3
  112. package/packages/core/src/processes/harvest-runner.ts +68 -8
  113. package/packages/core/src/processes/harvest.ts +11 -16
  114. package/packages/core/src/processes/repo-view.ts +3 -0
  115. package/packages/core/src/project-secrets.ts +105 -0
  116. package/packages/core/src/secret-name.ts +41 -0
  117. package/packages/core/src/store/account-redaction.ts +156 -0
  118. package/packages/core/src/store/artifact-meta.ts +7 -0
  119. package/packages/core/src/store/contract.ts +60 -1
  120. package/packages/core/src/store/memory.ts +4 -0
  121. package/packages/core/src/store/reducer-value-shapes.json +7389 -6647
  122. package/packages/core/src/store/reducer-value-validation.ts +106 -6
  123. package/packages/core/src/store/remote/client.ts +85 -50
  124. package/packages/core/src/store/remote/compatibility.ts +57 -0
  125. package/packages/core/src/store/remote/index.ts +6 -0
  126. package/packages/core/src/store/remote/protocol.ts +8 -1
  127. package/packages/core/src/store/remote/released-reducer-values/1.2.0.json +8129 -0
  128. package/packages/core/src/store/remote/version.ts +4 -0
  129. package/packages/core/src/store/repo-state-events.ts +4 -2
  130. package/packages/core/src/store/snapshots.ts +16 -3
  131. package/packages/core/src/store/types.ts +2 -0
  132. package/packages/core/src/testing/dispatch-read-budget.ts +266 -5
  133. package/packages/core/src/testing/index.ts +2 -1
  134. package/packages/core/src/testing/reduced-read-budget.ts +560 -5
  135. package/skills/guide/SKILL.md +164 -37
  136. package/skills/guide/references/accounts.md +130 -0
  137. package/skills/guide/references/integration-tree.md +16 -5
  138. package/skills/guide/references/merge-policy.md +1 -3
  139. package/skills/guide/references/operator-api.md +144 -53
  140. package/skills/guide/references/plugin-authoring.md +27 -1
  141. package/skills/guide/references/remote-store-protocol.md +259 -91
  142. package/skills/guide/references/remote-ticket-protocol.md +29 -49
  143. package/skills/guide/references/restacking.md +45 -0
  144. package/skills/guide/references/setup.md +34 -129
  145. package/skills/guide/references/spec-standard.md +4 -2
  146. package/skills/guide/references/ticket-dependencies.md +8 -0
  147. package/skills/harvest/SKILL.md +3 -1
  148. package/skills/harvest-review/SKILL.md +3 -1
  149. package/skills/operate/SKILL.md +26 -11
  150. package/skills/reconcile/SKILL.md +6 -0
  151. package/skills/spec/SKILL.md +1 -1
  152. package/skills/tickets/SKILL.md +10 -5
  153. package/templates/hosted-service/package.json +2 -2
  154. package/docs/hosted-dispatcher-cutover-validation.md +0 -178
  155. package/docs/hosted-dispatcher.md +0 -278
  156. package/docs/hosted-service.md +0 -304
  157. package/docs/mcp.md +0 -150
@@ -1,6 +1,7 @@
1
1
  # Hosted ticket protocol
2
2
 
3
- The hosted ticket protocol exposes the complete `TicketSource` port without
3
+ A conforming hosted instance implements this normative remote ticket contract
4
+ for the complete `TicketSource` port without
4
5
  exposing backend credentials. It shares the Autobuild and remote protocol
5
6
  version headers with the remote BuildStore. The version must be in the
6
7
  published service window and the protocol must
@@ -10,13 +11,12 @@ A service accepts stable and prerelease clients from its own `major.minor`
10
11
  release line and the two preceding minor lines in the same major. A major starts a new family:
11
12
  X.0 accepts only X.0, X.1 accepts X.0/X.1, and X.2 onward accepts three lines.
12
13
  Patch versions are interchangeable in both directions and must never change
13
- the protocol. Upgrade the service first, then projects independently within
14
- its window. Supported release lines retain their wire handlers and known
14
+ the protocol. Clients must remain within the instance’s published compatibility window. Supported release lines retain their wire handlers and known
15
15
  protocol identities; an unknown protocol is refused independently of version.
16
16
  Stable and prerelease service and client identities share their numeric major/minor
17
17
  line. Malformed or missing identities, build metadata (`+…`), prefixes and
18
18
  whitespace are refused with HTTP 409.
19
- A newer client is told to upgrade the service; a client below the window is
19
+ A newer client receives an instance-upgrade diagnostic; a client below the window is
20
20
  told to upgrade the project's Autobuild. Diagnostics name the service version
21
21
  and supported range.
22
22
 
@@ -39,29 +39,28 @@ Project credentials are opaque `abp_1_<id>_<secret>` bearer values bound to one
39
39
  registered normalized repository. The service stores only a SHA-256 digest of
40
40
  the random secret, plus project, creator, creation time, last use, expiry and
41
41
  revocation metadata. It checks credential status and project registration on
42
- every request. Revocation takes effect on the next request without affecting
42
+ every request. Registry, grant authentication and adapters share one full
43
+ registration/deletion admission per repository within that request; the next
44
+ request admits afresh. Each mutation transaction checks and locks the admitted
45
+ generation before writing. Deletion invalidates that generation with its initial
46
+ purge, so a later transaction in the same request may be refused atomically;
47
+ earlier committed operations remain committed. Reads need no further admission.
48
+ Revocation takes effect on the next request without affecting
43
49
  other credentials. Unknown, expired or revoked credentials receive `401 auth`;
44
- removed projects receive `403 auth` with `project not registered`.
45
-
46
- The deployment owner runs these commands locally with database access:
47
-
48
- ```sh
49
- ab-hosted-store credentials issue https://github.com/acme/app --user owner@example.com
50
- ab-hosted-store credentials list https://github.com/acme/app
51
- ab-hosted-store credentials revoke https://github.com/acme/app --id ID --user owner@example.com
52
- ```
53
-
54
- Issue prints the secret once; list contains metadata only. Issue optionally
55
- accepts `--ttl-seconds N` or `--expires-at ISO-8601`. For administrative/non-interactive issuance, set the returned token as
56
- `AB_TOKEN`. Interactive project onboarding uses `ab connect <service-url>`;
57
- it saves the credential outside the repository and commits no secret. Previous `AB_TOKEN` values and `mint operator` / `mint build` are
58
- retired: the service responds that the credential format changed and points
59
- to `credentials issue`. Supported old protocol shapes still work with a new
60
- credential; protocol compatibility does not restore retired authentication.
61
-
62
- `mint admin --ttl-seconds N` creates an explicit versioned, attributed owner
63
- break-glass credential. It can cross project boundaries. Keep it owner-only:
64
- never give it or `AB_STORE_SECRET` to a dispatcher or build agent.
50
+ removed projects receive `403 auth` with `project not registered` when the
51
+ repository is established independently. Permanent project deletion removes
52
+ credentials, so old credentials receive `401` unknown or revoked credential,
53
+ including on `/connect/v1/status`, and remain invalid after reconnection.
54
+ See [permanent project deletion](operator-api.md#permanent-project-deletion)
55
+ for purge, retry and generation-bound confirmation semantics.
56
+
57
+ Obtain a project credential with `ab connect <instance-url>` or from the
58
+ instance, and use `AB_TOKEN` on non-interactive clients. Interactive connection
59
+ saves the credential outside the repository. Retired credential formats are
60
+ refused with a credential-format-changed diagnostic; supported old protocol
61
+ shapes still require current credentials. Compatibility does not restore retired
62
+ authentication. Versioned, attributed owner-admin credentials are an explicit
63
+ cross-project exception and must never be supplied to build agents.
65
64
 
66
65
  Hosted tickets, comments, blockers, creation-key deduplication and assets belong
67
66
  to exactly one registered project, even when projects use the same team key.
@@ -133,12 +132,6 @@ MCP ticket surfaces refuse with a message naming that project and source: its
133
132
  tickets live in its own source, accessed directly by its dispatcher. This is a
134
133
  409 conflict, not an empty queue. The dispatcher's direct adapters are unchanged.
135
134
 
136
- `AB_TICKET_BACKEND` and `LINEAR_API_KEY` are removed service settings. Their
137
- presence (even blank or unknown values) is ignored and emits one startup removal
138
- message. `AB_TICKET_TRIAGE_STATE`, `AB_TICKET_READY_STATE`,
139
- `AB_TICKET_DOING_STATE` and `AB_TICKET_DONE_STATE` are removed and ignored,
140
- including malformed values. These retired settings do not prevent startup.
141
-
142
135
  ## Operations
143
136
 
144
137
  The operation names and `input` values are:
@@ -173,7 +166,7 @@ lines, or trailing whitespace.
173
166
  New hosted tickets use `<teamKey>-<n>`, for example `ENG-1`. The effective
174
167
  project configuration supplies the literal prefix; the request's `teamKey`
175
168
  does not choose it. Numbers start at 1 in each project, increase atomically
176
- across concurrent creates, and are never reused after deletion. Projects sharing
169
+ across concurrent creates, and are never reused after individual ticket deletion. Permanent project deletion removes the counter; an approved reconnection starts at 1. Projects sharing
177
170
  a team key have independent counters. Changing `teamKey` affects only future
178
171
  ids and continues the same numbering; existing ids retain their captured prefix.
179
172
 
@@ -185,18 +178,6 @@ is `dependency-states`: each result's `id` echoes the requested id for correlati
185
178
  while its `blockedBy` edges are canonical. Raw historical events and artifacts
186
179
  remain unchanged. These rules apply only to hosted tickets, not file or Linear ids.
187
180
 
188
- Upgrade the service with its environment-aware migration command before serving
189
- requests. The transactional migration preserves storage keys and assigns existing
190
- tickets numbers in `(created_at, id)` order within each project. It first resolves
191
- legacy team ownership, then reads each populated project's current independent
192
- ticket policy. Projects without that policy use their selected effective
193
- configuration through the configured blob backend. Independent-policy projects
194
- need no uploaded config or blob access. Missing or invalid fallback config,
195
- missing `teamKey`, or inaccessible required blobs abort the entire migration
196
- unchanged with a project diagnostic. Restore that config/blob access and rerun;
197
- an ownership assignment alone cannot supply a readable prefix. Empty projects
198
- need no config lookup. Re-running a completed migration does not renumber tickets.
199
-
200
181
  ## Errors and conformance
201
182
 
202
183
  Errors are JSON `{ "error": string, "kind": "validation" | "not-found" |
@@ -205,10 +186,9 @@ or backend construction. Responses never include exception causes, stacks,
205
186
  environment values, or credentials. Client 401/403 responses become
206
187
  `AuthError`; other backend messages remain actionable.
207
188
 
208
- The shared `TicketSource` contract is normative for the database adapter and
209
- the hosted client/server pair. PostgreSQL migration and isolation tests prove
210
- project partitions. The direct Linear client retains its separate opt-in
211
- GraphQL contract; no Linear adapter ships through the hosted ticket entry point.
189
+ The shared `TicketSource` contract is normative for protocol implementations.
190
+ Project partitions must be isolated. The direct Linear client retains its
191
+ separate opt-in GraphQL contract; this protocol does not proxy Linear.
212
192
 
213
193
  Every ticket returned by list, get, or create requires a boolean `resolved`,
214
194
  with the same source-native completion semantics as `DependencyState.resolved`.
@@ -47,6 +47,19 @@ actual destination, processing ancestors first. Unrelated siblings stay idle;
47
47
  changes absent from all ancestors cannot trigger a speculative replay. Tickets
48
48
  remain queued until presence is observed in their destination.
49
49
 
50
+ A presence request whose identities are absent from its immediate parent remains
51
+ pending while ancestors restack or reconcile. A durable availability observation
52
+ allows unchanged idle ticks, including after restart, to skip repository preparation
53
+ and native auto-merge cancellation. Exact node/parent heads, contribution base,
54
+ request contents, accepted ancestry, foreign aliases and confirmed landing evidence
55
+ invalidate that observation when they change; polling timestamps do not. Failed
56
+ assessments never establish unavailability. Availability is not proof of destination
57
+ coverage. Moving to another destination branch explicitly settles obsolete requests
58
+ with `destination-changed`; losing identities on the same branch leaves them waiting.
59
+ Native auto-merge is suspended with confirmed, reusable receipts only when replay
60
+ is actionable, and is revalidated during recovery before rewrite effects.
61
+
62
+
50
63
  `ab restack <node>` (operator tool `builds.restack`, input `{repo, slug}`) records
51
64
  a durable request, coalescing pending demand. It refuses leaves, terminal nodes,
52
65
  and unopened nodes. Paused or blocked nodes wait for their normal safety gates.
@@ -154,3 +167,35 @@ publication keeps its workspace through backoff and unresolved exhaustion.
154
167
  Classified rate limits retain repository cooldown and consume no publication
155
168
  retry allowance. Rejected pushes, lease conflicts, dirty trees and unclassified
156
169
  errors retain their existing behavior.
170
+
171
+ ## Ticket preparation before build creation
172
+
173
+ Before claiming, the dispatcher journals a repository-scoped preparation intent;
174
+ a won claim and the exact selected creation slug are durable boundaries. Caught
175
+ asset-copy, spec-authoring, naming, and build-creation failures return the ticket
176
+ to configured Ready; a nonconforming spec goes to configured Triage. Recovery
177
+ checks the exact selected build first: a matching record and atomic
178
+ `build.created` retain ownership even if creation threw after committing.
179
+ Unavailable or conflicting readback never authorizes release or a replacement
180
+ build. Pending attempts retain the original failure, latest recovery error and
181
+ retry deadline in the canonical repository reduced value; resolved attempts
182
+ leave that value. Under repository ownership, each tick admits at most eight
183
+ due recovery attempts, before intake and independently of capacity or intake
184
+ settings, with a 30-second durable retry delay after recovery failure. Unresolved
185
+ ticket identities remain withheld. An uncertain claim outcome or unrelated
186
+ external ticket state, missing ticket/state, or conflicting slug ownership terminates
187
+ automatic recovery with an `abandoned` resolution and diagnostic reason. The
188
+ ticket is left unchanged; an operator can leave it finished or cancelled, or
189
+ inspect ownership and explicitly return it to Ready for another attempt. These
190
+ cases stop provider polling and diagnostic appends. Recovery failures are
191
+ reported without preventing janitor, lease sweep, or other dispatch recovery.
192
+ This is not general process
193
+ crash recovery. Confirmed Ready/Triage transitions settle idempotently, so a
194
+ failed bounce comment does not return an invalid ticket to Ready.
195
+
196
+ Once a build is established, ordinary interrupted-dispatch recovery completes
197
+ its missing boundaries; preparation cleanup cannot release its claim.
198
+
199
+ ## Spec revision during leaf reconcile
200
+
201
+ 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. The retained transaction and restack identity are reused; no abort or destructive reset is needed.
@@ -32,7 +32,7 @@ maintainer before selecting it:
32
32
  - a dispatcher-side push-capable `GITHUB_TOKEN` or `GH_TOKEN`;
33
33
  - for a private repository, a separate read-only clone identity named by
34
34
  `gitUsernameEnv` and `gitPasswordEnv`;
35
- - an HTTPS hosted service reachable from Vercel, configured through `ab connect <url>`;
35
+ - a remote store that speaks the remote BuildStore protocol and is reachable from Vercel, configured through `ab connect <url>`;
36
36
  - each selected role and alternate's runtime/model, its pinned
37
37
  `[workspace.config.runtimeProvisioning.<runtime>]` commands, and the API
38
38
  credential names it needs in `[workspace.config].environmentVariables`.
@@ -67,8 +67,7 @@ preflight = "test \"$(pi --version)\" = \"0.84.4\" && pi update --models"
67
67
  ```
68
68
 
69
69
  Use a `vercel-ai-gateway/...` Pi model with `AI_GATEWAY_API_KEY` in the
70
- dispatcher environment. Do not copy `~/.pi`, OAuth refresh tokens, or any local
71
- runtime auth state, and do not attempt interactive login in a sandbox. Runtime
70
+ dispatcher environment. For Claude Code, configure [accounts](accounts.md) with a manually provisioned `claude setup-token` credential or a Kimi Code membership key; use the unmodified runtime, your own subscription, and ordinary individual usage. ChatGPT subscription accounts use `bun ab accounts login NAME` on your machine with one dispatcher or hosted refresh owner. Pi and ambient Codex login state are not copied, and interactive sandbox login is unsupported. Runtime
72
71
  names are open: a plugin runtime uses the same strict map, for example
73
72
  `[workspace.config.runtimeProvisioning.opencode]`, with its own immutable
74
73
  install and exact-version preflight commands.
@@ -96,7 +95,10 @@ checkout dependencies in every fresh/replacement sandbox and before the
96
95
  readiness probe, writes the marker only after success, and reruns every
97
96
  preflight before each build runner. A failure names the runtime, selecting
98
97
  role/alternate, and field and starts no agent. Runtime provisioning receives
99
- only the API credentials named by `[workspace.config].environmentVariables`.
98
+ allowlisted legacy API credentials named by
99
+ `[workspace.config].environmentVariables` and automatically supplied placeholders
100
+ for every declared account credential variable. Account variables need no
101
+ allowlist entry; their real credentials remain on the dispatcher host.
100
102
 
101
103
  Keep package-level and checkout-level bootstrap in an idempotent
102
104
  `[commands].setup`. It runs after system provisioning and must remain safe to
@@ -156,7 +158,7 @@ to `workspace.config.provisioning` (or a package dependency to setup) while
156
158
  retaining the universal image; add a runtime credential name to
157
159
  `environmentVariables` and its value to the dispatcher environment; correct the
158
160
  Vercel team/project credential set; provide separate private-clone credentials;
159
- use an HTTPS GitHub origin and hosted Store; authorize the Store token; or commit
161
+ use an HTTPS GitHub origin and remote Store; authorize the Store token; or commit
160
162
  and push the selected base branch.
161
163
 
162
164
  ## Keep per-build records in separate fragments
@@ -183,7 +185,7 @@ shared edit surface; the repository owns the release-time assembly tooling.
183
185
  ## Repository identity is the origin, not a checkout path
184
186
 
185
187
  Repository identity in the Store, dispatcher, `ab builds`, `ab build status`,
186
- `ab repository status`, and the web app is the repository's **normalized origin
188
+ `ab repository status` is the repository's **normalized origin
187
189
  URL** (`https://github.com/owner/repository`), not a checkout's absolute path.
188
190
  Two checkouts of the same repository — on different hosts, or a dispatcher and
189
191
  its sandboxes — agree on one identity.
@@ -245,15 +247,14 @@ sources agree with the running system by construction:
245
247
  runs the dispatcher's own code.
246
248
  - **Origin mode** (checkout-less dispatcher): the guest archive is the release
247
249
  asset `autobuild-<version>.tgz` fetched from the canonical repository at the
248
- **running dispatcher's version** (read from the deployed distribution's
250
+ **running dispatcher's version** (read from the installed distribution's
249
251
  `package.json`), so the guest runs the dispatcher's own release.
250
252
 
251
253
  A service accepts stable and prerelease clients from its own `major.minor`
252
254
  release line and the two preceding minor lines in the same major. A major starts a new family:
253
255
  X.0 accepts only X.0, X.1 accepts X.0/X.1, and X.2 onward accepts three lines.
254
256
  Patch versions are interchangeable in both directions and must never change
255
- the protocol. Upgrade the service first, then projects independently within
256
- its window. Supported release lines retain their wire handlers and known
257
+ the protocol. Keep project clients within the instance’s published window. Supported release lines retain their wire handlers and known
257
258
  protocol identities; an unknown protocol is refused independently of version.
258
259
  Stable and prerelease service and client identities share their numeric major/minor
259
260
  line. Malformed or missing identities, build metadata (`+…`), prefixes and
@@ -274,11 +275,12 @@ It warns and continues when the target is outside the range, naming the
274
275
  required service upgrade for a newer target or a compatible project range for
275
276
  an older one. An unavailable or malformed probe warns that connectivity may
276
277
  fail after upgrade. Legacy health without a range means exact-version matching;
277
- upgrade that service to the compatibility-window release first.
278
+ the hosted instance must publish a compatibility window before clients can
279
+ use release-line compatibility.
278
280
 
279
281
  A distribution fix reaches origin-mode guests after a release is cut and the
280
282
  dispatcher is upgraded. Guests continue to run the dispatcher's own version;
281
- the hosted service must support that release line.
283
+ the instance must support that release line.
282
284
 
283
285
  Provisioning records the installed distribution's identity — package version
284
286
  and remote-store protocol version — in the guest's
@@ -305,29 +307,20 @@ perspective:
305
307
  Local `git-worktree` dispatch keeps working from a checkout exactly as before;
306
308
  apart from the identity change, `ab dispatch` behaves as it did.
307
309
 
308
- ## Hosted deployment variables
309
-
310
- A hosted-store deployment configures its web/auth variables once — see the
311
- hosted service README and the complete environment reference in the pinned
312
- distribution checkout: `BETTER_AUTH_URL`, `AB_WEB_SUPER_USER_EMAILS`,
313
- and the optional `AB_WEB_MCP_RESOURCE` — the protected
314
- resource the hosted MCP server (docs/mcp.md) binds its OAuth tokens to,
315
- defaulting to `<BETTER_AUTH_URL>/mcp`. Set it only when a proxy or custom
316
- domain fronts the deployment under a different public URL than
317
- `BETTER_AUTH_URL`; the value must be an absolute http(s) URL (https in
318
- production) or every MCP client's discovery binds tokens to the wrong
319
- resource.
320
-
321
-
322
310
  ## Connect a project
323
311
 
324
312
  From a checkout with an origin remote, run `ab connect https://YOUR_ORIGIN`.
325
313
  The CLI prints a verification URL and short code and attempts to open a browser.
326
- Sign in as an allowed owner, check the full repository identity and code, and
327
- approve or deny. Another device can open the printed URL, or visit `/connect`
328
- and enter the code. Approval requires the web-enabled service origin; a
329
- standalone machine-only listener cannot present browser consent. Requests
330
- expire after ten minutes. Denial and timeout leave local configuration unchanged.
314
+ The code link opens approval directly; if sign-in is needed, it returns there.
315
+ Check the full repository identity and code, and approve or deny. For an
316
+ unassigned project, choose an eligible organization; a sole option is visibly
317
+ selected. Approval requires that destination even for previously registered
318
+ unassigned projects. Assigned projects show their organization as read-only;
319
+ moving them uses project management. With no eligible organization, approval is
320
+ unavailable until a super user creates one. Another device can open the printed
321
+ URL, or visit `/connect` and enter the code. Approval uses the instance’s browser
322
+ consent endpoint. Requests expire after ten minutes. Denial requires no
323
+ organization choice; denial and timeout leave local configuration unchanged.
331
324
 
332
325
  On approval the service registers the project and issues a project credential.
333
326
  The CLI keeps it in `$XDG_CONFIG_HOME/autobuild/credentials` (or
@@ -359,55 +352,6 @@ saved credential for CI and other non-interactive hosts. A service override
359
352
  never borrows another service's credential. Build and harvest sessions keep
360
353
  their explicit scoped authority.
361
354
 
362
- ## Connected projects
363
-
364
- Migrate PostgreSQL from the pinned release before deploying (`bun run
365
- postgres:migrate`). The service keeps an independent, durable project registry;
366
- existing build or ticket data does not register a project. An administrator
367
- with deployment database credentials manages it without redeploying:
368
-
369
- ```sh
370
- ab-hosted-store projects list
371
- ab-hosted-store projects add https://github.com/owner/project --user owner@example.com
372
- ab-hosted-store projects remove https://github.com/owner/project --user owner@example.com
373
- ```
374
-
375
- From a source checkout, substitute `bun packages/hosted-store-service/src/bin.ts`
376
- for `ab-hosted-store`. Configure `AB_POSTGRES_URL` or `DATABASE_URL` in that
377
- process. Database possession grants administration; `--user` is declared audit
378
- attribution, not a verified login. Ordinary project/store tokens cannot manage
379
- registrations. Each entry records the normalized origin URL, addition time,
380
- and adding identity. SSH git spellings normalize to HTTPS; local paths and
381
- credential-bearing HTTPS URLs are rejected. Duplicate adds preserve metadata;
382
- remove is idempotent, and re-adding records a fresh addition.
383
-
384
- Super users can operate every registered project. Organization members can
385
- operate only active projects assigned to their organizations; legacy unassigned
386
- projects are visible only to super users. Membership is granted by normalized
387
- email, including before first sign-in, and is rechecked on every request. The dashboard,
388
- MCP discovery and calls, and every operator API route consult current
389
- registration. Removal hides a project from all these surfaces and subsequent
390
- hosted dispatcher invocations; builds, events, artifacts and tickets remain,
391
- and re-registration restores access. Already-started work is not cancelled.
392
- Project credentials issued by connect authorize only their registered project. Administrative credential issuance remains available for non-interactive hosts.
393
-
394
- Link directly to `/?repo=<URL-encoded normalized origin>`. The page selects the
395
- first registered origin when the requested one is missing or removed, and an
396
- empty registry shows no project data or controls. Registry errors fail closed;
397
- there is no environment fallback on database failure.
398
-
399
- `AB_WEB_REPOSITORIES` is deprecated. A nonempty CSV is imported exactly once per
400
- database, on the first registry initialization with that variable configured,
401
- with actor `system:AB_WEB_REPOSITORIES`. The import and durable marker commit
402
- atomically across concurrent starts. An absent variable does not consume the
403
- marker. Later restarts or edits to the variable never re-add removed projects;
404
- use the owner commands for subsequent administration.
405
-
406
- The hosted dispatcher queries current registrations on every authorized
407
- invocation. With `AB_DISPATCHER_REPOSITORIES` unset, it serves all registered
408
- projects; an explicit list preserves its order and is intersected with current
409
- registration. An empty registry is a successful zero-project invocation.
410
-
411
355
  ## Authoring an agent verifier
412
356
 
413
357
  A repository-owned agent-verify skill is a verifier, not a reviewer: it drives
@@ -480,45 +424,8 @@ cannot select another project. See [local builds with hosted tickets](#local-bui
480
424
 
481
425
  The service never contacts Linear. Projects with external sources (including
482
426
  file and Linear) keep using those sources directly through their dispatcher;
483
- service ticket HTTP, operator and MCP surfaces refuse with project/source
484
- feedback rather than returning an empty queue. Removed `AB_TICKET_BACKEND` and
485
- `LINEAR_API_KEY` values are ignored with one startup removal message, including
486
- blank/unknown values. Removed `AB_TICKET_TRIAGE_STATE`, `AB_TICKET_READY_STATE`,
487
- `AB_TICKET_DOING_STATE` and `AB_TICKET_DONE_STATE` values are ignored even when
488
- malformed. None of these retired settings prevents startup.
489
-
490
- The environment-aware migration imports `AB_WEB_REPOSITORIES` once before
491
- ownership preflight, including released main-v9 deployments without registry
492
- tables. A failed migration rolls back the import, main-schema promotion and
493
- ticket changes together. Owner `projects add` and `tickets assign-team` commands
494
- bootstrap only the registry/recovery journals and work while the main marker
495
- is still v9. Without the retired environment, first register the intended
496
- project with `ab-hosted-store projects add REPOSITORY --user IDENTITY`, then
497
- assign the team and rerun migration. A successful one-time import is never
498
- reapplied from later environment edits.
499
-
500
- Ticket schema v1 migration assigns each whole legacy team to its sole claimant
501
- among registered projects' latest effective configs, reading their actual blob
502
- bytes. Projects with no dispatcher run or no effective-config reference make
503
- no team claim and do not block other projects. Unclaimed teams still fail closed.
504
- When inferring ownership, a selected configuration whose revision/blob is missing,
505
- unreadable or invalid stops unchanged with recovery guidance. Restore the selected
506
- configuration or assign every remaining legacy team explicitly; complete owner
507
- assignments to registered projects bypass unrelated configuration reads. Conflicts
508
- and asset ownership mismatches also stop unchanged. Resolve ownership, then rerun:
509
-
510
- ```sh
511
- ab-hosted-store tickets assign-team TEAM https://github.com/acme/app --user owner@example.com
512
- ab-postgres-store migrate
513
- ```
514
-
515
- The assignment journal works before v2 assertion, retains the actor, and grants
516
- no future cross-project access. Migration preserves ids, states, comments,
517
- blockers, timestamps and assets. Populated-v1 migration and deployment builds
518
- require the running service's blob backend, access mode, credentials and prefix
519
- (`AB_BLOB_PREFIX`), not just PostgreSQL access. `deploy:build` inherits this
520
- environment and migration failure stops Next build. Fresh databases, empty v1
521
- queues and v2 reruns stay SQL-only and do not initialize blob storage.
427
+ service ticket HTTP and operator surfaces refuse with project/source
428
+ feedback rather than returning an empty queue.
522
429
 
523
430
  ## Local builds with hosted tickets
524
431
 
@@ -591,14 +498,12 @@ Follow [ticket migration](ticket-migration.md), keeping the existing BuildStore
591
498
  and recording continuity before resuming build-related ticket writes.
592
499
 
593
500
 
594
- The retired `AB_WEB_ALLOWED_EMAILS` variable is refused at startup, even if empty.
595
- Replace it with `AB_WEB_SUPER_USER_EMAILS`; review the list because these identities
596
- are deployment maintainers. Open Organizations from the account menu to create
597
- the first organization, then Members to add people by email and choose an owner,
598
- and Projects to assign legacy unassigned projects. The
599
- [browser management contract](operator-api.md#organization-management-browser)
600
- also documents the underlying HTTP routes. Super users alone
601
- create orgs, set or clear the single owner, and assign or move projects. Owners
602
- manage their org's members. Removing the last membership or super-user designation
603
- revokes human access on the next request without re-login; existing project
604
- credentials remain valid until revoked.
501
+ Permanent hosted data removal is available on the web app's Projects page to
502
+ super users and owners of the project's organization. `ab disconnect` only
503
+ revokes a credential; admin `projects remove` only unregisters access and retains
504
+ data. Project deletion removes hosted builds, tickets, blobs, secrets and accounts,
505
+ revokes every credential and retains only a minimal deletion audit. It does not
506
+ change local files or configuration. Failed cleanup is retryable with access
507
+ already refused. Reconnecting requires fresh browser approval and starts empty,
508
+ with hosted ticket numbering reset to 1. See
509
+ [permanent project deletion](operator-api.md#permanent-project-deletion).
@@ -131,7 +131,8 @@ The spec is the build's contract artifact (kind `spec`, revision 0).
131
131
  Every downstream reviewer approves conformance to its pinned revision.
132
132
  For leaves, a phase that discovers the spec itself is wrong raises an
133
133
  escalation (`ab escalate`); a human answers, the spec gets revision N+1,
134
- and the leaf restarts from `plan`.
134
+ and the leaf restarts from `plan` after any unfinished reconcile resumes under
135
+ the revised spec and its publication is confirmed.
135
136
 
136
137
  Operators may explicitly revise an opened idle collecting node or a node blocked on failed
137
138
  integration verification without an escalation. Use
@@ -149,4 +150,5 @@ Active verification/reconcile or writer work, restack/reparent work, pause,
149
150
  pending controls, merge intent and ended PRs refuse the no-escalation path.
150
151
  A concurrent state change refuses publication with a retry explanation;
151
152
  uncited artifacts are inert. Leaves still require an open escalation and
152
- restart from `plan`.
153
+ restart from `plan` after any unfinished reconcile resumes under the revised
154
+ spec and its publication is confirmed.
@@ -77,6 +77,14 @@ parent history. An empty completed contribution is satisfied; missing evidence,
77
77
  an open or aborted node, or ambiguous newest build generations remain queued.
78
78
  Older successful generations are never substituted for the newest build.
79
79
 
80
+ Destination observations retain versioned, head-bound Git witnesses (reachable
81
+ commit SHAs and direct build trailers) and a fixed-length evidence digest. Current
82
+ confirmed landings and aliases from only the destination's accepted ancestry are
83
+ reapplied before reuse. Unrelated merged history and ready destinations do not
84
+ invalidate this proof. Head changes require a fresh Git sample; legacy observations
85
+ without witnesses refresh once rather than replaying repository history. Current
86
+ readiness and newest-generation checks still apply before claim.
87
+
80
88
  - Same node: the blocking change merges directly into the target.
81
89
  - Ancestor: the change merges into an ancestor, then presence demand restacks only the required path to the target.
82
90
  - Sibling: the blocking node merges into their common ancestor, then presence demand reaches the target through the minimal ancestor path.
@@ -52,7 +52,9 @@ cluster and author; you never create or move tickets.
52
52
  {"action":"suppress","reason":"...","observations":[...]}
53
53
  ```
54
54
 
55
- Join only an existing unresolved ticket supplied by the ledger. Suppress a
55
+ Ledger lifecycle is scan-time context; filing checks existence and resolution
56
+ again before allowing a join, sharing that fresh lookup with hosted alias
57
+ resolution. Join only an existing unresolved ticket supplied by the ledger. Suppress a
56
58
  duplicate whose ledger ticket is resolved/missing, or a record that cannot
57
59
  support actionable work. Never invent a ticket reference.
58
60
  3. Finish exactly once:
@@ -29,7 +29,9 @@ not author proposals or touch tickets.
29
29
  - every `blockedBy` id is justified by evidence as a hard start gate;
30
30
  contextual citations, related work, and nonbinding preferences such as
31
31
  “do this later” must not become blockers, and ticket ids are never invented;
32
- - joins name only an unresolved ledger proposal and resolved/missing ledger
32
+ - ledger lifecycle is scan-time context; filing refreshes existence and
33
+ resolution before allowing joins and shares that lookup with hosted alias
34
+ resolution. Joins name only an unresolved ledger proposal and resolved/missing ledger
33
35
  tickets are tombstones, not recreated work;
34
36
  - suppression has a concrete evidence-backed reason;
35
37
  - no proposal asks harvest to groom, ready, claim, or dispatch anything.
@@ -95,7 +95,11 @@ restart, abnormal dispatcher stops/loss, ticket-source and forge degradation pas
95
95
  for ticket sources without reset), and five minutes of continuous tick failures. Advertised resets
96
96
  wait for a post-reset tick to finish before requiring action; ordinary recovery
97
97
  on that retry stays silent. Source grace and cooldown-driven failures do not
98
- start the tick-failure clock. Routine outcomes and self-healing failures stay silent.
98
+ start the tick-failure clock. When failure writes are unavailable, dispatch watch
99
+ continues with local warnings and retries at least one second apart (or its
100
+ configured interval, if longer). Recovery records the bounded unreported window;
101
+ local warnings do not start durable attention retroactively. Explicit shutdown
102
+ still stops dispatch without waiting for reporting recovery. Routine outcomes and self-healing failures stay silent.
99
103
 
100
104
  Every record carries a cursor; bounded watches end with a bare `{"cursor": …}`
101
105
  line. Re-arm only with `ab watch --operator --json --since <watch-cursor>`,
@@ -166,7 +170,9 @@ establish loss: a healthy lease can accompany a slow tick.
166
170
  An unscoped watch, or a named watch with `--repository`, reports loss as a
167
171
  read-only observation: `{repo, build:null, state:null, observation:{type:
168
172
  "dispatcher.lost", run, observedAt, leaseExpiresAt, ...identity}, cursor}`.
169
- A validated successor takeover suppresses predecessor loss even while its sessions
173
+ Any persisted stop suppresses loss, including an abnormal stop, which retains its
174
+ own default attention event. Correlation uses persisted per-run values without
175
+ full-log fallback. A validated successor takeover suppresses predecessor loss even while its sessions
170
176
  drain. An unfinished handoff without takeover still reports loss on lease expiry;
171
177
  successor loss and upgrade-failure/rollback attention remain independent.
172
178
  It has no durable event envelope. Keep its cursor just as for event records;
@@ -219,7 +225,8 @@ Read events with a cursor or a small `--events` count; logs are long.
219
225
  Idle collecting or verification-failed nodes need no escalation and recollect
220
226
  for verification on the same head; children and contributions remain intact.
221
227
  Active work, pause, pending controls and merge intent refuse revision. Leaves
222
- require an escalation and restart from plan. Run `ab help answer` for the full menu.
228
+ require an escalation and restart from plan after any unfinished reconcile
229
+ resumes under the revised spec and its publication is confirmed. Run `ab help answer` for the full menu.
223
230
  - `ab pause <slug>` / `ab resume <slug>`; `ab pause --all` / `ab resume --all`
224
231
  hold and release the whole repository. Pause immediately interrupts live agent
225
232
  sessions and acknowledges after they stop. Resume continues the same native
@@ -273,15 +280,13 @@ and concurrency. The service does not load your prompt or operator notes, run
273
280
  a durable agent loop, deliver wake messages, or resume you on a timer.
274
281
  Read notes and current repository facts explicitly before acting. Tool writes
275
282
  use the authenticated binding's operator identity: local MCP uses the local
276
- operator identity, and hosted MCP uses the authenticated user's authority.
283
+ operator identity; Operator API clients use their authenticated authority.
277
284
  Do not assume session-owner delegation or a runner-provided repository scope.
278
285
 
279
286
  ### Human approvals
280
287
 
281
288
  Respect a human denial as a firm no. Any approval or suspension flow in your
282
- external harness belongs to that harness. Hosted session approval answers are
283
- durable records only; the service does not execute approved calls or resume
284
- agents. Do not repeat completed work when your harness resumes.
289
+ external harness belongs to that harness. Protocol session approval answers are durable records only. Do not repeat completed work when your harness resumes.
285
290
 
286
291
  ### The tool surface
287
292
 
@@ -304,8 +309,10 @@ that does the job, and say what you are doing before you do it:
304
309
  review-round ceiling, or a revise-spec resolution. Eligible idle collecting or
305
310
  verification-failed nodes accept body/ticket spec revision without an escalation;
306
311
  the caller supplies the amended body for ticket origin. The node recollects and
307
- verifies; leaves require an escalation and restart from plan.
308
- - `tickets.list`, `tickets.get` — read the ticket queue and one ticket.
312
+ verifies; leaves require an escalation and restart from plan after any unfinished reconcile
313
+ resumes under the revised spec and its publication is confirmed.
314
+ - `tickets.list`, `tickets.get` — read the ticket queue and one ticket. A long
315
+ queue pages with `limit`, `offset` and `order`; `total` counts every match.
309
316
  - `tickets.create` — file a new ticket from a conversation.
310
317
  - `tickets.update`, `tickets.block`, `tickets.unblock` — edit fields and
311
318
  blocker relations.
@@ -433,7 +440,7 @@ for the exceptions above.
433
440
  id you act on came from a tool result or the conversation.
434
441
  - External harnesses own concurrency and incoming-message handling; the
435
442
  service provides no one-turn-at-a-time or queued-message execution guarantee.
436
- - Where operator notes exist (hosted), they are shared ground truth; keep
443
+ - Where your harness provides shared operator notes, keep
437
444
  them current when you learn something durable.
438
445
 
439
446
  ## Drive the tree through one consent queue
@@ -507,7 +514,15 @@ clears it. `policy.janitorBackoffMaxSeconds` sets the positive integer cap.
507
514
 
508
515
  A classified forge rate limit records repository degradation with `resetAt`.
509
516
  Forge work waits during cooldown; passing the deadline permits a recovery
510
- request, and only success clears degradation. A further limit extends cooldown.
517
+ request; a successful probe records automatic recovery. An authorized operator
518
+ may explicitly override erroneous recorded state with
519
+ `ab repository forge-clear --forge <name> --reason <text>` or
520
+ `repository.forge_clear {repo, forge, reason}`. This appends a human-attributed
521
+ `dispatcher.forge-recovered` fact with the reason; it does not prove provider
522
+ success. A subsequent actual limit records a fresh cooldown. Hosted admission
523
+ requires a schema-valid finite ISO `resetAt` no later than server time plus
524
+ 24 hours, inclusive; past deadlines remain valid. Rejection never clamps or
525
+ invents a provider reset, and historical events remain readable.
511
526
  Native merge application failures keep candidate-specific retry eligibility,
512
527
  including automatic decisions without a human command. Retries recheck consent,
513
528
  holds, verification and the exact candidate. Uncertain enables remain pending
@@ -73,6 +73,12 @@ do not repeat `ab done` after success. Post-reconcile verification follows the
73
73
  captured policy and begins a fresh cycle after confirmed publication. A conflict
74
74
  at initial verify entry still requires initial checks regardless of that policy.
75
75
 
76
+ A leaf replay resumed after a spec revision uses the revised spec as its
77
+ contract. Its historical plan and implement notes describe the retained change;
78
+ they cannot override that contract. After confirmed publication the build
79
+ restarts planning, implementation and review before verification, rather than
80
+ entering the ordinary post-reconcile verification cycle directly.
81
+
76
82
  ## When not to resolve
77
83
 
78
84
  Escalate semantic conflicts, incompatible or deleted branch history, or choices
@@ -119,7 +119,7 @@ say you will operate it. The human's explicit instructions override either defau
119
119
  If grooming established prerequisites, follow the complete
120
120
  [safe blocker-filing workflow](../ab-guide/references/ticket-dependencies.md).
121
121
  A single `ab ticket create --blocked-by` invocation does not publish atomically:
122
- Linear (including hosted Linear) exposes the issue before separate blocker writes.
122
+ Linear exposes the issue before separate blocker writes.
123
123
  For a ready destination, create in a known non-ready staging state, pass all
124
124
  blockers at creation, read back and verify them, then move to ready last. The
125
125
  human's requested final placement still wins; temporary staging needs no new