@defrex/autobuild 1.6.0 → 1.8.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 (165) hide show
  1. package/README.md +1 -1
  2. package/SPEC.md +423 -57
  3. package/docs/agent-runtimes.md +1 -1
  4. package/docs/answering-blocked-builds.md +44 -3
  5. package/docs/architecture.md +124 -29
  6. package/docs/cli.md +1 -0
  7. package/docs/configuration-overview.md +11 -1
  8. package/docs/configuration.md +334 -14
  9. package/docs/dispatcher.md +1 -1
  10. package/docs/forges.md +1 -0
  11. package/docs/integration-overview.md +2 -2
  12. package/docs/integration-tree.md +7 -4
  13. package/docs/merge-policy.md +78 -6
  14. package/docs/migration-1.0.md +4 -2
  15. package/docs/operating.md +3 -2
  16. package/docs/operator-api.md +45 -13
  17. package/docs/operator-surfaces.md +16 -3
  18. package/docs/plugin-authoring.md +45 -7
  19. package/docs/remote-store-protocol.md +28 -7
  20. package/docs/restacking.md +35 -11
  21. package/docs/ticket-dependencies.md +9 -4
  22. package/docs/ticket-sources.md +34 -6
  23. package/docs/tickets.md +7 -1
  24. package/docs/troubleshooting.md +1 -1
  25. package/docs/workspaces.md +1 -1
  26. package/package.json +3 -3
  27. package/packages/core/src/cli/attention.ts +2 -0
  28. package/packages/core/src/cli/binary-direct.ts +1 -0
  29. package/packages/core/src/cli/build-control.ts +65 -7
  30. package/packages/core/src/cli/context.ts +55 -14
  31. package/packages/core/src/cli/dashboard/actions.ts +13 -4
  32. package/packages/core/src/cli/dashboard/landing-display.ts +32 -8
  33. package/packages/core/src/cli/dashboard/model.ts +61 -8
  34. package/packages/core/src/cli/dashboard/render.ts +28 -3
  35. package/packages/core/src/cli/dashboard/tree.ts +9 -1
  36. package/packages/core/src/cli/dispatch-frontend.ts +10 -14
  37. package/packages/core/src/cli/dispatch-preflight.ts +1 -0
  38. package/packages/core/src/cli/dispatch-repository-feed.ts +145 -109
  39. package/packages/core/src/cli/dispatch.ts +9 -3
  40. package/packages/core/src/cli/help.ts +80 -11
  41. package/packages/core/src/cli/init-validation.ts +14 -1
  42. package/packages/core/src/cli/landings.ts +1 -1
  43. package/packages/core/src/cli/main.ts +60 -9
  44. package/packages/core/src/cli/publication-settlement.ts +10 -0
  45. package/packages/core/src/cli/repository-status.ts +37 -2
  46. package/packages/core/src/cli/status.ts +186 -12
  47. package/packages/core/src/cli/terminals.ts +197 -4
  48. package/packages/core/src/cli/ticket.ts +22 -4
  49. package/packages/core/src/cli/wait.ts +1 -0
  50. package/packages/core/src/cli/watch.ts +73 -0
  51. package/packages/core/src/config/landing.ts +12 -0
  52. package/packages/core/src/config/live.ts +4 -0
  53. package/packages/core/src/config/path-selectors.ts +68 -0
  54. package/packages/core/src/config/profiles.ts +96 -0
  55. package/packages/core/src/config/ready-assignee.ts +43 -11
  56. package/packages/core/src/config/roles.ts +33 -10
  57. package/packages/core/src/config/schema.ts +205 -81
  58. package/packages/core/src/events/catalog.ts +17 -3
  59. package/packages/core/src/events/compatibility.ts +4 -1
  60. package/packages/core/src/events/forge-degradation-policy.ts +16 -2
  61. package/packages/core/src/events/head-paths-limits.ts +25 -0
  62. package/packages/core/src/events/payloads.ts +323 -20
  63. package/packages/core/src/events/policy.ts +22 -0
  64. package/packages/core/src/events/repository.ts +47 -1
  65. package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +320 -130
  66. package/packages/core/src/kernel/build-creation.ts +29 -0
  67. package/packages/core/src/kernel/consent-revocation.ts +72 -0
  68. package/packages/core/src/kernel/dispatch-capacity.ts +19 -8
  69. package/packages/core/src/kernel/engine.ts +48 -8
  70. package/packages/core/src/kernel/forge-health.ts +47 -0
  71. package/packages/core/src/kernel/guarded-forge.ts +76 -18
  72. package/packages/core/src/kernel/head-paths-state.ts +63 -0
  73. package/packages/core/src/kernel/head-paths.ts +401 -0
  74. package/packages/core/src/kernel/landing-policy-identity.ts +20 -0
  75. package/packages/core/src/kernel/landing-policy.ts +55 -2
  76. package/packages/core/src/kernel/landing-readiness.ts +104 -9
  77. package/packages/core/src/kernel/landing-state.ts +44 -4
  78. package/packages/core/src/kernel/leaf-restack-state.ts +50 -2
  79. package/packages/core/src/kernel/log-index.ts +27 -1
  80. package/packages/core/src/kernel/node-parent.ts +2 -0
  81. package/packages/core/src/kernel/node-polling.ts +13 -3
  82. package/packages/core/src/kernel/node-restack-state.ts +8 -1
  83. package/packages/core/src/kernel/node-restack-transaction.ts +45 -0
  84. package/packages/core/src/kernel/read-deferrals.ts +3 -1
  85. package/packages/core/src/kernel/read-facts.ts +37 -2
  86. package/packages/core/src/kernel/reducer-registry.ts +22 -1
  87. package/packages/core/src/kernel/reducer.ts +332 -16
  88. package/packages/core/src/kernel/target-observation.ts +2 -5
  89. package/packages/core/src/kernel/terminal-guard.ts +52 -3
  90. package/packages/core/src/kernel/ticket-handbacks.ts +40 -0
  91. package/packages/core/src/kernel/ticket-preparation.ts +15 -1
  92. package/packages/core/src/kernel/ticket-wait.ts +345 -0
  93. package/packages/core/src/kernel/verify-applicability.ts +9 -19
  94. package/packages/core/src/ontology.ts +1 -0
  95. package/packages/core/src/operator/annotations.ts +6 -0
  96. package/packages/core/src/operator/index.ts +3 -0
  97. package/packages/core/src/operator/protocol.ts +25 -2
  98. package/packages/core/src/operator/query.ts +1 -1
  99. package/packages/core/src/operator/registry.ts +122 -10
  100. package/packages/core/src/operator/repository-events.ts +67 -0
  101. package/packages/core/src/operator/sandbox-host.ts +3 -0
  102. package/packages/core/src/operator/tickets.ts +15 -3
  103. package/packages/core/src/plugin-sdk/index.ts +4 -0
  104. package/packages/core/src/ports/forge/create.ts +6 -0
  105. package/packages/core/src/ports/forge/github-transport.ts +40 -3
  106. package/packages/core/src/ports/forge/github.ts +12 -1
  107. package/packages/core/src/ports/forge/workspace-ancestry.ts +60 -0
  108. package/packages/core/src/ports/forge-failure.ts +31 -2
  109. package/packages/core/src/ports/runner/routing.ts +66 -5
  110. package/packages/core/src/ports/tickets/assignees.ts +54 -0
  111. package/packages/core/src/ports/tickets/contract.ts +164 -4
  112. package/packages/core/src/ports/tickets/create.ts +17 -3
  113. package/packages/core/src/ports/tickets/fake.ts +5 -0
  114. package/packages/core/src/ports/tickets/github-fake.ts +18 -2
  115. package/packages/core/src/ports/tickets/github.ts +247 -29
  116. package/packages/core/src/ports/tickets/hosted-index.ts +1 -0
  117. package/packages/core/src/ports/tickets/operations.ts +6 -1
  118. package/packages/core/src/ports/tickets/tree.ts +12 -2
  119. package/packages/core/src/ports/tickets/update.ts +6 -2
  120. package/packages/core/src/ports/types.ts +36 -5
  121. package/packages/core/src/ports/workspace/vercel-sandbox.ts +9 -0
  122. package/packages/core/src/processes/build-child.ts +28 -7
  123. package/packages/core/src/processes/build-execution-state.ts +34 -2
  124. package/packages/core/src/processes/build-runner.ts +165 -19
  125. package/packages/core/src/processes/dispatcher.ts +837 -115
  126. package/packages/core/src/processes/execution-no-progress.ts +22 -2
  127. package/packages/core/src/processes/harvest-child.ts +4 -0
  128. package/packages/core/src/processes/harvest-runner.ts +5 -0
  129. package/packages/core/src/processes/phase-failure-budget.ts +1 -0
  130. package/packages/core/src/processes/publication-state.ts +6 -1
  131. package/packages/core/src/processes/repo-view.ts +2 -0
  132. package/packages/core/src/scenarios/harness.ts +15 -1
  133. package/packages/core/src/store/digest.ts +41 -2
  134. package/packages/core/src/store/reduced-reads.ts +4 -1
  135. package/packages/core/src/store/reducer-value-shapes.json +10310 -8441
  136. package/packages/core/src/store/remote/client.ts +49 -10
  137. package/packages/core/src/store/remote/index.ts +4 -0
  138. package/packages/core/src/store/remote/protocol.ts +18 -1
  139. package/packages/core/src/store/remote/released-clients.json +22 -0
  140. package/packages/core/src/store/remote/released-reducer-values/1.7.0.json +27366 -0
  141. package/packages/core/src/store/remote/released-reducer-values/1.8.0.json +29043 -0
  142. package/packages/core/src/store/remote/released-reducer-values/index.ts +4 -0
  143. package/packages/core/src/store/repo-state-events.ts +3 -0
  144. package/packages/core/src/store/types.ts +27 -0
  145. package/packages/core/src/testing/dispatch-read-budget.ts +84 -58
  146. package/packages/core/src/testing/index.ts +2 -0
  147. package/packages/core/src/testing/reduced-read-budget.ts +419 -9
  148. package/skills/code-review/SKILL.md +8 -0
  149. package/skills/finalize/SKILL.md +4 -0
  150. package/skills/guide/SKILL.md +241 -47
  151. package/skills/guide/references/integration-tree.md +7 -4
  152. package/skills/guide/references/merge-policy.md +78 -6
  153. package/skills/guide/references/migration-1.0.md +4 -2
  154. package/skills/guide/references/operator-api.md +45 -13
  155. package/skills/guide/references/plugin-authoring.md +45 -7
  156. package/skills/guide/references/remote-store-protocol.md +28 -7
  157. package/skills/guide/references/restacking.md +35 -11
  158. package/skills/guide/references/ticket-dependencies.md +9 -4
  159. package/skills/implement/SKILL.md +15 -1
  160. package/skills/operate/SKILL.md +133 -16
  161. package/skills/plan/SKILL.md +17 -2
  162. package/skills/plan-review/SKILL.md +8 -0
  163. package/skills/reconcile/SKILL.md +21 -5
  164. package/skills/tickets/SKILL.md +23 -6
  165. package/templates/hosted-service/package.json +2 -2
@@ -88,7 +88,7 @@ raw session-event append. External operator harnesses own agent execution.
88
88
  | `GET …/status` | Repository intake, pause, and default-auto-merge projection. Its `operator` is `{presence: "unavailable", reason}`: this route does not load presence registrations, so it is not evidence that no operator is present. |
89
89
  | `GET …/harvest/status` | Harvest gate, runs, steps, recovery, and attention projection. |
90
90
  | `GET …/builds/{slug}/artifacts/{kind}?rev=N` | Raw bytes (`application/octet-stream`) plus content-disposition and `X-Autobuild-Artifact-*` metadata headers. Omit `rev` for latest. |
91
- | `GET …/tickets?state=S&label=L&limit=N&offset=K&order=O` | `{states,tickets,diagnostics,criteria,triageState,readyState,doneState,total}`. The three lifecycle names come from effective repository configuration (including provider fallback). With no `state`, `criteria.state` is `triageState`; repeated `label` parameters narrow that state with AND filters. An explicit `state` selects that exact backend workflow state. `limit` (0–200) returns one page, after skipping `offset`, in `order` `oldest` (the default: dispatch order, urgent tickets first, then the source order) or `newest` (newest filed first); `total` counts every match before paging. |
91
+ | `GET …/tickets?state=S&label=L&limit=N&offset=K&order=O` | `{states,tickets,diagnostics,criteria,triageState,readyState,doneState,total}`. The three lifecycle names come from effective repository configuration (including provider fallback). With no `state`, `criteria.state` is `triageState`; repeated `label` parameters narrow that state with AND filters. An explicit `state` selects that exact backend workflow state. `limit` (0–200) returns one page, after skipping `offset`, in `order` `oldest` (the default: dispatch order, urgent tickets first, then the source order) or `newest` (newest filed first, regardless of urgency; see paging below); `total` counts every match before paging. |
92
92
  | `GET …/tickets/states` | Full state metadata `{name,tickets,about?}[]`, including empty states (`tickets.states` in MCP). |
93
93
  | `GET …/tickets/{id}` | `{ticket,blockers,build}`. Blockers include native `exists`/`resolved` status; `build` prefers an active matching repository build, otherwise the most recently updated one. |
94
94
 
@@ -124,7 +124,7 @@ JSON bodies are strict: unknown fields are rejected.
124
124
 
125
125
  | Method and path | Body |
126
126
  |---|---|
127
- | `POST …/builds/{slug}/control` | `{"action":"pause"\|"cancel-pause"\|"resume"\|"abort"\|"discard"\|"land"\|"hold"}` |
127
+ | `POST …/builds/{slug}/control` | `{"action":"pause"\|"cancel-pause"\|"resume"\|"abort"\|"discard"\|"land"\|"hold"}`; `land` alone accepts an optional `"head":"<sha>"` (full or at least seven characters) that binds consent to that candidate head. Abort alone also accepts `"to":"triage"\|"ready"` (default triage) and a `"reason"` of 1–2000 characters after trimming, as `ab abort --to/--reason` does. Ready requires the current ticket to meet the spec standard; otherwise cleanup returns it to triage and the hand-back comment and `ticket.handed-back` event carry the `requested` role and `missing` parts. Repeating an identical pending abort is idempotent; a repeat with a different destination or reason is refused. |
128
128
  | `POST …/builds/{slug}/restack` | Empty body; durable node restack demand. |
129
129
  | `POST …/builds/{slug}/answer` | One answer variant described below. |
130
130
  | `PUT …/settings/intake` | `{"enabled":boolean}` |
@@ -132,8 +132,8 @@ JSON bodies are strict: unknown fields are rejected.
132
132
  | `POST …/bulk-control` | `{"action":"pause"\|"resume"}`. The hold fact, intake fact, then eligible build events are written in that order. |
133
133
  | `POST …/harvest/control` | `{"action":"toggle-gate"}` or `{"action":"run","run":"…"}`. A run action is bound to that concrete projected run. |
134
134
  | `POST …/tickets/states` | `{name,about?}` → `{state,created}`; requires attributed operator identity (`tickets.state.create` in MCP). Hosted duplicate names are refused case-insensitively. |
135
- | `POST …/tickets` | `{"title":"…","body":"…","labels"?:[],"state"?:"…","blockedBy"?:[],"issueLinks"?:[{"issue":N,"intent"?:"closes"|"refs"}],"priority"?:"urgent"|"normal","kind"?:"work"|"node","target"?:"id"|null}`; omitted state preserves the backend default, omitted intent is `closes`, and omitted priority is normal. A backend that cannot store issue links refuses with `code: "issue-links-unsupported"`; one that cannot store priority refuses `urgent` with `code: "priority-unsupported"` and accepts `normal` as a no-op. |
136
- | `PATCH …/tickets/{id}` | Any nonempty subset of `title`, `body`, complete-replacement `labels`, complete-replacement `issueLinks` (`[]` clears), `priority` (`urgent` or `normal`; refusals as for create), `kind` (`work` or `node`), and nullable `target` (null clears). Body bytes are not normalized. |
135
+ | `POST …/tickets` | `{"title":"…","body":"…","labels"?:[],"state"?:"…","blockedBy"?:[],"issueLinks"?:[{"issue":N,"intent"?:"closes"|"refs"}],"priority"?:"urgent"|"normal","assignees"?:["login"|"me"],"kind"?:"work"|"node","target"?:"id"|null}`; omitted state preserves the backend default, omitted intent is `closes`, omitted priority is normal, and omitted assignees apply `[tickets].createAssignee` (`[]` creates an unassigned ticket). `assignees` takes at most ten entries, counted before duplicates collapse, and more is a validation error. A backend that cannot store issue links refuses with `code: "issue-links-unsupported"`; one that cannot store priority refuses `urgent` with `code: "priority-unsupported"` and accepts `normal` as a no-op; one that cannot store assignees refuses any `assignees` with `code: "assignees-unsupported"`. |
136
+ | `PATCH …/tickets/{id}` | Any nonempty subset of `title`, `body`, complete-replacement `labels`, complete-replacement `issueLinks` (`[]` clears), `priority` (`urgent` or `normal`; refusals as for create), complete-replacement `assignees` (`[]` clears; refusals as for create), `kind` (`work` or `node`), and nullable `target` (null clears). Body bytes are not normalized. |
137
137
  | `POST …/tickets/{id}/move` | Exactly one of `{"state":"backend state name"}` or `{"role":"triage"\|"ready"\|"backlog"\|"rejected"}`; both or neither is `400 validation` (`tickets.move` in MCP takes the same target). A role resolves to the configured `triageState`, `readyState`, `backlogState`, or `rejectedState`. An unset `backlogState` or `rejectedState` refuses with a message naming the key to set, and never guesses a native state. A source that can create states creates a missing role state before moving. |
138
138
  | `POST …/tickets/{id}/block` | `{"blockerIds":["…"]}`. |
139
139
  | `POST …/tickets/{id}/unblock` | `{"blockerIds":["…"]}`. |
@@ -225,7 +225,9 @@ refusal` and preserve the shared `BuildControlError` code and exact reason text.
225
225
  A `land` control whose merge candidate is not ready is refused with code
226
226
  `merge-not-ready`, and its reason names the unmet condition; a node that fails
227
227
  the live completeness check is refused with code `node-incomplete`, naming any
228
- open children. Neither records consent or starts a merge, so refresh the
228
+ open children. A `land` whose `head` is not the current candidate head is
229
+ refused with code `head-mismatch`, and its reason names the current head.
230
+ None of these records consent or starts a merge, so refresh the
229
231
  build's status and retry once the reason is resolved.
230
232
  A partial bulk failure uses code `bulk-partial` and includes the durable write
231
233
  progress and unattempted builds. Unexpected failures are `500 internal`.
@@ -288,8 +290,10 @@ The default watch reports actionable conditions only:
288
290
  - `build.janitor-escalated`: a build's janitor failure episode outlasted `policy.janitorFailureEscalationSeconds` and raised one escalation naming the operation, last error, attempt count and episode start. The janitor keeps retrying; a successful attempt closes the escalation, and a bare retry answer attempts on the next tick.
289
291
  - `dispatcher.forge-persistent`: forge degradation remains after a completed post-reset retry opportunity; successful recovery clears it.
290
292
 
291
- - Build `escalation.raised`, `integration.landed`, `node.item-conflicted`, `target.rewritten`, or
292
- conflicted `restack.replayed` events. `build.consent-ready` is the single
293
+ - Build `escalation.raised`, `integration.landed`, `node.item-conflicted`, `target.rewritten`,
294
+ `landing.consent-revoked` (protected merge consent revoked by a reconcile's
295
+ edits, naming the matched files and both heads), or conflicted
296
+ `restack.replayed` events. `build.consent-ready` is the single
293
297
  signal for a ready consent or held merge, including first repository-wide
294
298
  discovery. Its target has the queue entry shape `{kind, branch, ticket?, build?}`.
295
299
  Unready and stale candidates stay silent. `build.merge-decision` remains for
@@ -298,7 +302,11 @@ The default watch reports actionable conditions only:
298
302
  - Repository `harvest.escalated`, `harvest.recovery-exhausted`,
299
303
  `dispatcher.config-rejected`, `dispatcher.config-reloaded` with nonempty
300
304
  `restartRequired`, `dispatcher.upgrade-failed`, `dispatcher.runtime-rolled-back`,
301
- `dispatcher.kernel-git-unavailable`, abnormal `dispatcher.run-stopped`, and `dispatcher.lost`.
305
+ `dispatcher.kernel-git-unavailable`, `forge.credential-limited`, abnormal
306
+ `dispatcher.run-stopped`, and `dispatcher.lost`. A `forge.credential-limited`
307
+ line names the process whose GitHub request was rate-limited outside the
308
+ dispatcher's credential (unauthenticated, with why, or on that process's own
309
+ credential) and its reset; dispatcher forge work continues.
302
310
  - Repository `ticket-preparation.resolved` with outcome `abandoned`: automatic
303
311
  preparation recovery stopped and left the ticket unchanged. The line names the
304
312
  ticket, attempt and recorded reason; the payload's `claimed` says whether the
@@ -306,6 +314,12 @@ The default watch reports actionable conditions only:
306
314
  events written before `claimed` existed report the certainty as not recorded.
307
315
  Each abandonment reports once as it lands; a fresh watch does not replay
308
316
  historical ones, and nothing clears or acknowledges it.
317
+ - Repository `ticket.handed-back`: a claimed or ready ticket was returned other
318
+ than as completion (`cause` `abort`, `spec-bounce`, `preparation-failed`,
319
+ `pr-closed` or `discard`), with its destination `state` and `role`, the build
320
+ or preparation attempt, and any `requested` role, `missing` spec parts and
321
+ `reason`. It is appended once, only after the move is committed, so moving
322
+ the ticket on receipt is never overridden.
309
323
  - `dispatcher.ticket-source-persistent`: degradation past its advertised
310
324
  reset time, once a tick started at or after reset has completed or failed
311
325
  with the episode still open; crossing reset alone is silent. Without a reset,
@@ -367,6 +381,15 @@ complete history without omission. Waiting remains bounded and applies only
367
381
  when no events are available. Repository event reads have a 1,000-position
368
382
  window; build history itself remains available through explicit pages.
369
383
 
384
+ The MCP `repository.events` tool delivers the same repository attention to a
385
+ connected agent. It takes `{repo, cursor?, waitSeconds?, filter?}` and returns
386
+ `{events, cursor, hasMore}`: one bounded read of at most 256 journal positions
387
+ after `cursor`, filtered by default (`filter: "attention"`) to exactly the
388
+ repository records the CLI default watch reports, or every event with
389
+ `filter: "all"`. The returned cursor is the last scanned position, so it
390
+ advances past filtered events. Omitting `cursor` returns no events and a
391
+ baseline cursor; an expired cursor fails with `code: "cursor-too-old"`.
392
+
370
393
 
371
394
  Hosted ticket tools resolve independent project ticket policy, including its
372
395
  backlog and rejected roles for role moves, before legacy uploaded configuration. Queue, detail, state discovery and mutations work before any build
@@ -385,7 +408,9 @@ to CLI, HTTP and MCP alike; unsupported sources refuse even explicit defaults
385
408
  or clears before changing other fields. Dispatch routing is unchanged.
386
409
 
387
410
  HTTP merge controls retain the wire actions `land` and `hold` with acknowledged durable state. Merge
388
- requires readiness and survives restacks; hold persists until merge. Repository
411
+ requires readiness and survives clean restacks, except that a reconcile editing
412
+ files protected by the consent rule's `paths` or `within` predicates revokes it;
413
+ hold persists until merge. Repository
389
414
  auto-merge settings are retired; configure ordered `[[merge]]` rules.
390
415
 
391
416
  Default attention includes `build.janitor-failing`, `build.janitor-escalated` and
@@ -395,6 +420,10 @@ Active janitor attention and an open janitor escalation clear on a successful
395
420
  attempt. Repository status
396
421
  includes forge degradation/reset and available request counts; `dispatcher.forge-persistent` requires a completed retry opportunity past
397
422
  the original reset, which later rate limits cannot postpone indefinitely.
423
+ Only the dispatcher's own classified limits record that degradation. Status
424
+ also lists active `forgeCredentialLimits`: limits on unauthenticated requests or
425
+ seen by build runners and phase sessions, each naming the process, which never
426
+ pause repository forge work.
398
427
 
399
428
  ### Node restack request
400
429
 
@@ -580,20 +609,23 @@ permission or retention failures leave deletion pending. Vercel Blob cleanup use
580
609
  the same store identity, token and prefixed pathname as uploads. Missing objects
581
610
  are successful cleanup; provider errors never count as completed deletion.
582
611
 
583
- Paged ticket listings use the source's optional native `listPage(criteria, page)` capability when present, otherwise read the full listing, order it, and slice it: by default urgent tickets first, then normal ones, each in source order; for `newest`, the reversed source order. Native errors propagate. PostgreSQL counts matches without bodies and reads only the requested window. Zero limits and offsets past the end still report the full matching total. Unpaged listings remain exhaustive; the wire payload is the same for both paths.
612
+ Paged ticket listings use the source's optional native `listPage(criteria, page)` capability when present, otherwise read the full listing, order it, and slice it: by default urgent tickets first, then normal ones, each in source order; for `newest`, the reversed listing. `newest` means newest filed first, regardless of urgency, with a stable tie-break; it is not the reverse of dispatch order. A source that lists in filing order (file, GitHub, Linear) gets exactly that from the reversed listing. The remote `HostedTicketSource` is the exception: the hosted list-ready protocol returns urgent tickets first and carries no filing time, so its fallback `newest` pages are reversed dispatch order whenever urgent tickets exist. Native errors propagate. PostgreSQL counts matches without bodies and reads only the requested window. Zero limits and offsets past the end still report the full matching total. Unpaged listings remain exhaustive; the wire payload is the same for both paths.
584
613
 
585
614
 
586
615
  ### Forge cooldown admission and explicit recovery
587
616
 
588
617
  Hosted repository event appends and atomic artifact deposits validate
589
- `dispatcher.forge-degraded` before any durable mutation. The payload must match
590
- its event schema, with a finite ISO `resetAt` at most 24 hours after server time
618
+ `dispatcher.forge-degraded` and `forge.credential-limited` before any durable
619
+ mutation. The payload must match its event schema, with a finite ISO `resetAt` at most 24 hours after server time
591
620
  (inclusive). Already-expired deadlines are accepted. Invalid or out-of-horizon
592
621
  writes return `400 validation` (the remote adapter exposes `EventValidationError`);
593
622
  the server never clamps or invents a provider reset. Historical decoding has no clock-relative restriction.
594
623
 
595
624
  Build-runner and build-phase grants may POST only the kernel-authored
596
- `dispatcher.forge-degraded` repository fact through the events route. The
625
+ `forge.credential-limited` and `dispatcher.forge-degraded` repository facts
626
+ through the events route. Current runners and phase sessions record only
627
+ `forge.credential-limited` attention; the `dispatcher.forge-degraded` exception
628
+ remains for runners pinned to older releases. The
597
629
  preceding `requireProject` check binds this exception to the exact repository
598
630
  in the delegated claim. A hosted project identifies one repository. Delegates
599
631
  cannot write recovery, deposits or other repository facts, regardless of the
@@ -38,6 +38,16 @@ bun ab build status example-build --json
38
38
  - Presence is advisory and allows multiple registrations. MCP repository status marks it `unavailable`, which is not evidence of absence. Termination attempts withdrawal; routine timeout/count re-arms keep the five-minute grace. SIGKILL and failed withdrawal rely on TTL expiry.
39
39
  - Dashboard and API share one lifecycle vocabulary.
40
40
 
41
+ When a leaf with an open pull request waits on the PR but has no landing decision for its current candidate, `ab build status <slug>` prints a `landing: undecided — <reason>` line, and `--json` includes an optional `landingUndecided` string. The reason names what is holding the decision back:
42
+
43
+ - an open session, a pause, a terminal state, an open escalation, or a pending pause or abort request;
44
+ - a compatibility deferral;
45
+ - a failed dispatcher janitor attempt, with its message and next attempt time;
46
+ - a latest build pipeline configuration the dispatcher cannot read, even when the build's verification pin is still readable;
47
+ - no recorded base for the merge candidate.
48
+
49
+ If none of these apply, the line says no refusal is recorded and the dispatcher decides at its next janitor poll. Repository-wide forge deferrals appear in `ab repository status`. When a decision is recorded for the current candidate, the line and the field are no longer shown.
50
+
41
51
  A local CLI can use a remote Store:
42
52
 
43
53
  <!-- seam-config:start -->
@@ -80,14 +90,17 @@ There's no operator-surface plugin map. Build a client of the versioned, authent
80
90
  ### Forge cooldown admission and explicit recovery
81
91
 
82
92
  Hosted repository event appends and atomic artifact deposits validate
83
- `dispatcher.forge-degraded` before any durable mutation. The payload must match
84
- its event schema, with a finite ISO `resetAt` at most 24 hours after server time
93
+ `dispatcher.forge-degraded` and `forge.credential-limited` before any durable
94
+ mutation. The payload must match its event schema, with a finite ISO `resetAt` at most 24 hours after server time
85
95
  (inclusive). Already-expired deadlines are accepted. Invalid or out-of-horizon
86
96
  writes return `400 validation` (the remote adapter exposes `EventValidationError`);
87
97
  the server never clamps or invents a provider reset. Historical decoding has no clock-relative restriction.
88
98
 
89
99
  Build-runner and build-phase grants may POST only the kernel-authored
90
- `dispatcher.forge-degraded` repository fact through the events route. The
100
+ `forge.credential-limited` and `dispatcher.forge-degraded` repository facts
101
+ through the events route. Current runners and phase sessions record only
102
+ `forge.credential-limited` attention; the `dispatcher.forge-degraded` exception
103
+ remains for runners pinned to older releases. The
91
104
  preceding `requireProject` check binds this exception to the exact repository
92
105
  in the delegated claim. A hosted project identifies one repository. Delegates
93
106
  cannot write recovery, deposits or other repository facts, regardless of the
@@ -31,7 +31,7 @@ All four manifest maps have production selectors. Omitted forge and workspace se
31
31
 
32
32
  ### `ticket-source`
33
33
 
34
- Lists, gets and claims tickets to start builds; receives comments, transitions, creates and updates. Owns lifecycle names, dependency completion, idempotent creation with a stable external creation-key projection, and partial-list diagnostics. Never consulted mid-build; not artifact storage.
34
+ Lists, gets and claims tickets to start builds; receives comments, transitions, creates and updates. Owns lifecycle names, dependency completion, idempotent creation with a stable external creation-key projection, and partial-list diagnostics. A build never consults it mid-build. The dispatcher reads tickets and adds blockers to validate a declared ticket wait, and while any ticket wait is open it makes one batched `dependencyStates` read per tick to release waits whose tickets completed and escalate waits on rejected or deleted tickets. Not artifact storage.
35
35
 
36
36
  ### `agent-runtime`
37
37
 
@@ -158,6 +158,9 @@ API 1.8 adds optional forge failure classification. Import `ForgeFailure` and `i
158
158
  ```ts
159
159
  // Rate limit, with a valid ISO reset timestamp:
160
160
  throw new ForgeFailure(message, { kind: 'rate-limited', resetAt })
161
+ // The limited request carried no credential: say why, so the limit stays local
162
+ // to the caller instead of pausing the repository:
163
+ throw new ForgeFailure(message, { kind: 'rate-limited', resetAt, unauthenticated: reason })
161
164
  // Retryable transport error:
162
165
  throw new ForgeFailure(message, { kind: 'transient', retry: 'retryable' })
163
166
  ```
@@ -537,10 +540,12 @@ refuse a configured `readyAssignee` with an error naming the source and plugin.
537
540
  Three optional methods support it:
538
541
 
539
542
  - `prepareReadyAssignee(): Promise<void>` is called once at dispatcher startup,
540
- before the loop and never in a tick, whether or not `readyAssignee` is set.
543
+ before the loop and never in a tick, whether or not `readyAssignee` or
544
+ `createAssignee` is set.
541
545
  Resolve whatever `"me"` needs and memoize it. A credential with no user is a
542
546
  recorded result, not a throw; throw only for infrastructure failures, which
543
- fail startup when `readyAssignee` is set and are otherwise a warning.
547
+ fail startup when `readyAssignee` or `createAssignee` is set and are
548
+ otherwise a warning.
544
549
  - `readyAssigneeRefusal(value): string | undefined` is synchronous and makes no
545
550
  request. Return why the value can't be honoured from what was prepared, or
546
551
  `undefined`. Startup and every reload call it, so a refused reload keeps the
@@ -549,6 +554,29 @@ Three optional methods support it:
549
554
  return a one-line summary of who the value names, such as `me → @octocat`,
550
555
  or throw an error that says how to fix a value that names nobody.
551
556
 
557
+ ## Optional assignees capability
558
+
559
+ An adapter opts in with `assignees: true` and must then accept
560
+ `assignees?: string[]` on create, update and revision-checked update, where
561
+ each entry is a username or `me` (the owner of the source's credential) and an
562
+ update replaces the whole set, `[]` clearing it. Return `assignees` on every
563
+ read, `[]` when unassigned, and leave it out of revisions. Check each user
564
+ before any write and refuse, writing nothing, when one can't be assigned. A
565
+ write the provider accepts without the requested assignees must fail rather
566
+ than report success, and a retried keyed create that adopts an existing ticket
567
+ must leave it with the requested assignees. Without the flag, the
568
+ compatibility facade refuses any write naming assignees, including `[]`, with
569
+ `TicketAssigneesUnsupported` before your methods run, strips them from reads,
570
+ and dispatcher startup, `ab init --validate` and live reloads refuse a
571
+ configured `[tickets].createAssignee`, naming the source and plugin.
572
+
573
+ Callers apply `createAssignee` themselves, so a draft's assignees are always
574
+ exact. To support it, implement `createAssigneeRefusal(value)`, synchronous
575
+ and request-free like `readyAssigneeRefusal`, and
576
+ `describeCreateAssignee(value)` for `ab init --validate`. `"me"` should reuse
577
+ what `prepareReadyAssignee` resolved, so a dispatcher never resolves it in a
578
+ tick.
579
+
552
580
  ## Optional ticket paging capability
553
581
 
554
582
  Native paging is an optional API 1.9 ticket-source capability:
@@ -556,8 +584,11 @@ Native paging is an optional API 1.9 ticket-source capability:
556
584
  The SDK exports these types; the result is `TicketListing & { total: number }`.
557
585
  Criteria retain state, labels (AND), and assignee semantics. The page has a
558
586
  nonnegative integer `limit`, optional nonnegative integer `offset` (default 0),
559
- and optional `order: 'oldest' | 'newest'` (default oldest). Newest reverses the
560
- entire source order before offset and limit. Total counts all matches, even
587
+ and optional `order: 'oldest' | 'newest'` (default oldest). Oldest is the
588
+ source's dispatch order: with `priority`, urgent tickets first, then normal
589
+ ones, each in listing order. Newest is newest filed first: creation time
590
+ descending, regardless of urgency, with a stable tie-break. It is not the
591
+ reverse of dispatch order. Offset and limit apply after ordering. Total counts all matches, even
561
592
  with limit zero or an offset past the end. Records, diagnostics and errors
562
593
  match the exhaustive listing. The shared `describeTicketSourceContract` suite
563
594
  automatically compares declared native paging with full-read windows.
@@ -565,7 +596,12 @@ automatically compares declared native paging with full-read windows.
565
596
  Only paged operator listings select this capability. Sources without it retain
566
597
  the full-read fallback, which orders the listing before offset and limit: by
567
598
  default a stable urgent-first partition (urgent, then normal, each in source
568
- order), or for newest the reversed source order. Native errors propagate. Unpaged operator
599
+ order), or for newest the reversed listing, which is newest filed first for
600
+ sources that list in filing order (file, GitHub, Linear). The remote
601
+ `HostedTicketSource` is the exception: the hosted list-ready protocol returns
602
+ urgent tickets first and carries no filing time, so the client cannot see
603
+ filing order, and its newest pages are reversed dispatch order whenever urgent
604
+ tickets exist. Native errors propagate. Unpaged operator
569
605
  listings, CLI ticket lists and dispatcher ready scans remain exhaustive through
570
606
  `listReady`/`listAll`. The hosted PostgreSQL source counts matches without
571
607
  bodies and reads only the SQL-bounded window. File, Linear, GitHub and the remote
@@ -574,4 +610,6 @@ bodies and reads only the SQL-bounded window. File, Linear, GitHub and the remot
574
610
  Hosted cooldown recording rejects observed reset deadlines beyond the 24-hour
575
611
  admission horizon explicitly; adapters must not shorten or invent a provider
576
612
  reset to evade this validation. Operator forge-clear is an audited override,
577
- not a successful provider observation.
613
+ not a successful provider observation. Only limits the dispatcher's own forge
614
+ classifies, without `unauthenticated`, record repository cooldown; others are
615
+ local to the process and reported as `forge.credential-limited` attention.
@@ -35,6 +35,12 @@ service publishes `>=1.2.0 <1.4.0` until later publication facts permit retireme
35
35
  The service reads the clock for each decision, so retirement needs no redeploy. Health needs no credentials, version
36
36
  headers, or available backend. On the service’s own line, both its runtime protocol and its published ledger protocol are admitted. Health advertises a fully validated same-line request’s admitted protocol. Otherwise it advertises the service line’s published protocol, or its runtime protocol when that line is unpublished. Thus default 1.3 health advertises 6 anonymously and to published clients, and 7 to admitted source clients; explicit 1.4/7 services default to 7. The package version and support range remain truthful. Health performs no store reads.
37
37
 
38
+ Every current service advertises `build-creation-key-v1` in health `capabilities`:
39
+ keyed project creation lands at the derived slug described under `POST /builds`.
40
+ Clients send a creation key only after seeing it. A client treats a service without
41
+ it as allocating, so an unkeyed creation whose response was lost there is reported
42
+ as an unknown outcome rather than as absence.
43
+
38
44
 
39
45
  ## Hosted dispatch placement
40
46
 
@@ -372,7 +378,7 @@ it to exist. An unknown build returns `404 not-found`.
372
378
 
373
379
  | BuildStore operation | HTTP route | Request | Success |
374
380
  |---|---|---|---|
375
- | `createBuild` | `POST /builds` | `{slug: string, repo: string, repoOrigin?: string, ticket?: TicketRef, branch?: string, created?: event write}`; `slug`, `repo`, and a supplied `branch` are nonempty. `created`, when present, must be a valid `build.created` write; the server appends it as seq 1 atomically with the record (both exist or neither), and an invalid one is `422` with nothing created | `201` + authoritative `BuildRecord`; project credentials receive a fresh random-suffixed slug and a branch in the build kind's namespace (`ab/<slug>`, or `ab-node/<slug>` for a node); a supplied `branch` must be `ab/<requested slug>` or `ab-node/<requested slug>` agreeing with the `build.created` kind, otherwise `400 validation`. Owner admin/open mode keeps exact-slug semantics with `409 conflict` for duplicates |
381
+ | `createBuild` | `POST /builds` | `{slug: string, repo: string, repoOrigin?: string, ticket?: TicketRef, branch?: string, created?: event write, creationKey?: string}`; `slug`, `repo`, and a supplied `branch` are nonempty; a supplied `creationKey` matches `^[A-Za-z0-9_-]{1,128}$`. `created`, when present, must be a valid `build.created` write; the server appends it as seq 1 atomically with the record (both exist or neither), and an invalid one is `422` with nothing created | `201` + authoritative `BuildRecord`; project credentials receive a fresh random-suffixed slug, or with `creationKey` the slug that key derives (a repeated key is `409 conflict`), and a branch in the build kind's namespace (`ab/<slug>`, or `ab-node/<slug>` for a node); a supplied `branch` must be `ab/<requested slug>` or `ab-node/<requested slug>` agreeing with the `build.created` kind, otherwise `400 validation`. Owner admin/open mode keeps exact-slug semantics with `409 conflict` for duplicates |
376
382
  | `listBuilds` | `GET /builds` | none | `200` + `BuildRecord[]`, filtered by the server to the credential project; owner admin may list all projects. List order is unspecified |
377
383
  | `getBuild` | `GET /builds/{slug}` | none | `200` + `BuildRecord`; absent is `404` (the shipped client maps this to `null`) |
378
384
  | `append` | `POST /builds/{slug}/events` | event write | `201` + build event envelope |
@@ -715,7 +721,7 @@ without a journal record, or a repository without builds.
715
721
  | `ensureRepo` | `POST /repos` | `{"repo": string}` with a nonempty id | `200` + `RepositoryRecord`; idempotently returns the existing record |
716
722
  | `getRepo` | `GET /repos/{repo}` | none | `200` + `RepositoryRecord`; absent is `404` (the shipped client maps this to `null`) |
717
723
  | `appendRepo` | `POST /repos/{repo}/events` | event write | `201` + repository event envelope |
718
- | `getRepoEvents` | `GET /repos/{repo}/events?since={n}&wait={s}` | optional `since` query value, parsed as in section 3; absence defaults to `0`. Optional `wait` in whole seconds, per the event-wait rules of section 3 | `200` + envelopes with `seq > since`, up to the frozen head; `409 cursor-too-old` below `max(0, head - 1000)` |
724
+ | `getRepoEvents` / `getRepositoryTail` | `GET /repos/{repo}/events?since={n}&through={n}&wait={s}` | optional `since` query value, parsed as in section 3; absence defaults to `0`. Optional `wait` in whole seconds, per the event-wait rules of section 3 | `200` + envelopes with `seq > since`, up to the frozen head; optional `through` caps the response at `seq <= through`; `409 cursor-too-old` below `max(0, head - 1000)` |
719
725
  | `getRepoStateEvents` | `GET /repos/{repo}/state-events` | none | `200` + the bounded repository-journal subset (AUT-489): every durable event type (`ticket-preparation.*`, `harvest.*`, `orchestrator.sandbox.*`, the three dispatcher setting types, and cross-generation handoff correlation facts: target-prepared, yield-requested, upgrade-failed, handoff-started, terminal-released, takeover, drain-deadline, drain-settled and handoff-completed) plus the latest-only `dispatcher.ticket-scan-completed` and `dispatcher.placement-set` facts and, when the journal has one, the tail from the latest `dispatcher.run-started`, in increasing sequence order; served inside the repository-existence gate like `GET events`, so an unknown repository is `404` |
720
726
  | `getReducerSnapshot` (repo scope) | `GET /repos/{repo}/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, ahead of the journal's tail, or the repository has no journal record; an unknown repository is `404`, which the shipped client also maps to `null` |
721
727
  | `putReducerSnapshot` (repo scope) | `PUT /repos/{repo}/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 journal's tail answer `written: false` |
@@ -775,6 +781,14 @@ protocol version: older clients ignore it. A client that needs it and gets an
775
781
  answer without it, from an older service, fails with a typed error instead of
776
782
  reading each build's facts.
777
783
 
784
+ `waitPending` (`true` while a declared ticket wait awaits the dispatcher's
785
+ check) and `ticketWait` (`{id, escalation, tickets}` while an entered ticket
786
+ wait is open) let a hosted dispatcher service ticket waits from digests alone.
787
+ Both are additive and keep the protocol version; older clients ignore them. An
788
+ older service that omits `ticketWait` yields no automatic release: open waits
789
+ then end only when an operator answers them, and the client never rebuilds the
790
+ field from events.
791
+
778
792
  The digest is derived from the event log on every call — the server persists
779
793
  nothing and there is no refresh step. Protocol version `3` reshaped the
780
794
  digest's `observations` from bare sequence numbers to `{seq, ts}` pairs and
@@ -1190,8 +1204,12 @@ Remote clients continue mapping addressed GET 404 responses to null. Nested
1190
1204
  streams must also belong to the addressed parent.
1191
1205
 
1192
1206
  `GET /builds` is filtered by the server to the credential's project. Project
1193
- `POST /builds` always allocates a fresh random-suffixed slug from the requested
1194
- base, even when the base is unused, and a matching branch in the build kind's
1207
+ `POST /builds` without `creationKey` allocates a fresh random-suffixed slug from
1208
+ the requested base, even when the base is unused. With `creationKey` it creates at
1209
+ most once at `<base>-<first 24 hex of sha256("autobuild-build-creation\0" + repo +
1210
+ "\0" + requested slug + "\0" + creationKey)>` and answers a repeated key with
1211
+ `409 conflict`, never a second identity; `creationBuildSlug` in the client package
1212
+ computes it. Either way it creates a matching branch in the build kind's
1195
1213
  namespace: `ab-node/<slug>` when the `build.created` payload has `kind: "node"`,
1196
1214
  otherwise `ab/<slug>`. Without `created`, a supplied `branch` prefix decides the
1197
1215
  kind. A supplied `branch` must be exactly `ab/<requested slug>` or
@@ -1776,14 +1794,17 @@ The commands use the saved owner credential, even if an ambient build token exis
1776
1794
  ### Forge cooldown admission and explicit recovery
1777
1795
 
1778
1796
  Hosted repository event appends and atomic artifact deposits validate
1779
- `dispatcher.forge-degraded` before any durable mutation. The payload must match
1780
- its event schema, with a finite ISO `resetAt` at most 24 hours after server time
1797
+ `dispatcher.forge-degraded` and `forge.credential-limited` before any durable
1798
+ mutation. The payload must match its event schema, with a finite ISO `resetAt` at most 24 hours after server time
1781
1799
  (inclusive). Already-expired deadlines are accepted. Invalid or out-of-horizon
1782
1800
  writes return `400 validation` (the remote adapter exposes `EventValidationError`);
1783
1801
  the server never clamps or invents a provider reset. Historical decoding has no clock-relative restriction.
1784
1802
 
1785
1803
  Build-runner and build-phase grants may POST only the kernel-authored
1786
- `dispatcher.forge-degraded` repository fact through the events route. The
1804
+ `forge.credential-limited` and `dispatcher.forge-degraded` repository facts
1805
+ through the events route. Current runners and phase sessions record only
1806
+ `forge.credential-limited` attention; the `dispatcher.forge-degraded` exception
1807
+ remains for runners pinned to older releases. The
1787
1808
  preceding `requireProject` check binds this exception to the exact repository
1788
1809
  in the delegated claim. A hosted project identifies one repository. Delegates
1789
1810
  cannot write recovery, deposits or other repository facts, regardless of the
@@ -3,7 +3,12 @@
3
3
  A leaf contributes one net change, independent of its WIP commit count. Before
4
4
  verification the kernel collapses its contribution relative to the effective
5
5
  diff base and replays it onto the sampled destination. Implementation and review
6
- do not rewrite history. Verification failures return to implementation; later
6
+ do not rewrite history; the one exception is a build resuming from a ticket
7
+ wait, which the kernel restacks between phases so the resumed phase sees the
8
+ merged blockers. A build with nothing published fast-forwards to the
9
+ destination only when its local branch has no commits the destination lacks and
10
+ its workspace has no uncommitted tracked changes; otherwise the restack fails
11
+ and that local work is never discarded. Verification failures return to implementation; later
7
12
  commits append until the next approved cycle. Later reviews use the effective
8
13
  base from the preceding successful restack; the original cut remains provenance.
9
14
 
@@ -17,7 +22,7 @@ node fast-forwards preserve ordered contributing identities.
17
22
 
18
23
  Destination heads come only from the authoritative forge branch; dispatcher-host
19
24
  refs are never a fallback. Failed remote reads retain the accepted observation;
20
- classified rate limits use repository forge degradation and cooldown. Changed
25
+ dispatcher-classified rate limits use repository forge degradation and cooldown. Changed
21
26
  heads require immutable commit ancestry proof against the accepted target and
22
27
  the destination base already used by replay. Missing capability or failed proof
23
28
  defers new replay. A non-descendant without kernel lineage records
@@ -49,7 +54,18 @@ polls read no receipts or event rows.
49
54
 
50
55
  Accepted destination observations are durable `target.moved` facts, including while an
51
56
  agent runs. Verify-entry restack freezes a current base before verification;
52
- path selection excludes upstream-only paths. After finalize and post-steps,
57
+ path selection excludes upstream-only paths. A build leaving a ticket wait
58
+ restacks with trigger `wait-resume` before its declaring phase resumes, when the
59
+ target moved from the base its work sits on; an unchanged target resumes
60
+ without a restack. Published work replays through the guarded restack, and a
61
+ conflict runs reconcile before the declaring phase resumes. With nothing
62
+ published, the local branch fast-forwards to the target (`restack.advanced`)
63
+ only when it has no commits the target lacks and the workspace has no
64
+ uncommitted tracked changes; unpublished local commits or uncommitted tracked
65
+ changes prevent the advance and are never discarded. A wait declared by a
66
+ reconcile session whose replay recorded no publish intent supersedes that
67
+ replay when the target moved, discarding its undeposited resolution, and
68
+ replays the published head onto the current target instead. After finalize and post-steps,
53
69
  waiting leaves restack when the target moves. Node-target finalize contributions
54
70
  are canonicalized before guarded merge even when the target SHA is unchanged.
55
71
  Clean replay starts no agent. A clean waiting leaf rewrite preserves completed
@@ -68,7 +84,7 @@ dependency presence requires an ancestor change; on `ab restack <node>`; or on
68
84
  accepted re-parenting. There is no eager mode or cadence option. Nested nodes
69
85
  need their own demand. Existing frozen transactions, including ones reserved
70
86
  before upgrade, finish first; later demand coalesces onto the latest parent.
71
- Leaves keep verify-entry and awaiting-merge restacks for every target.
87
+ Leaves keep verify-entry, wait-resume and awaiting-merge restacks for every target.
72
88
 
73
89
  For observation cadence, durable wakes and last-check evidence, see
74
90
  [node polling and status](integration-tree.md#polling-and-status).
@@ -221,7 +237,7 @@ not consume `maxPhaseAttempts`. A seventh transient failure records
221
237
  error and six retries. Answering that escalation opens a fresh publication episode
222
238
  for the same retained intent without resetting agent phase failures. Pending
223
239
  publication keeps its workspace through backoff and unresolved exhaustion.
224
- Classified rate limits retain repository cooldown and consume no publication
240
+ Dispatcher-classified rate limits retain repository cooldown and consume no publication
225
241
  retry allowance. Rejected pushes, lease conflicts, dirty trees and unclassified
226
242
  errors retain their existing behavior.
227
243
 
@@ -237,11 +253,17 @@ sessions do not inherit obsolete reconstruction instructions.
237
253
  ## Ticket preparation before build creation
238
254
 
239
255
  Before claiming, the dispatcher journals a repository-scoped preparation intent;
240
- a won claim and the exact selected creation slug are durable boundaries. Caught
256
+ a won claim, the selected creation slug and, when the build store attests keyed
257
+ creation, the attempt's creation key are durable boundaries. Caught
241
258
  asset-copy, spec-authoring, naming, and build-creation failures return the ticket
242
- to configured Ready; a nonconforming spec goes to configured Triage. Recovery
243
- checks the exact selected build first: a matching record and atomic
244
- `build.created` retain ownership even if creation threw after committing.
259
+ to configured Ready; a nonconforming spec goes to configured Triage. Once a
260
+ confirmed claim's ticket is back, one repository `ticket.handed-back` reports it
261
+ (cause `preparation-failed` or `spec-bounce`, with the missing spec parts) before
262
+ the attempt resolves; an attempt reports at most once. Recovery
263
+ point-reads the selected slug and, for a keyed attempt, the canonical slug derived
264
+ from the repository, selected slug and key: one matching record and atomic
265
+ `build.created` retain ownership even if creation threw after committing or its
266
+ response was lost.
245
267
  Unavailable or conflicting readback never authorizes release or a replacement
246
268
  build. Pending attempts retain the original failure, latest recovery error and
247
269
  retry deadline in the canonical repository reduced value; resolved attempts
@@ -249,8 +271,10 @@ leave that value. Under repository ownership, each tick admits at most eight
249
271
  due recovery attempts, before intake and independently of capacity or intake
250
272
  settings, with a 30-second durable retry delay after recovery failure. Unresolved
251
273
  ticket identities remain withheld. An uncertain claim outcome or unrelated
252
- external ticket state, missing ticket/state, or conflicting slug ownership terminates
253
- automatic recovery with an `abandoned` resolution and diagnostic reason. The
274
+ external ticket state, missing ticket/state, conflicting slug ownership, builds at
275
+ both identities, or an unknown creation outcome (an unkeyed attempt on a store
276
+ that allocates slugs, where absence is not evidence) terminates automatic
277
+ recovery with an `abandoned` resolution and diagnostic reason. The
254
278
  ticket is left unchanged; an operator can leave it finished or cancelled, or
255
279
  inspect ownership and explicitly return it to Ready for another attempt. These
256
280
  cases stop provider polling and further durable diagnostic appends. The tick
@@ -58,10 +58,15 @@ the ticket ready.
58
58
  ## Already-claimed work
59
59
 
60
60
  Adding blockers does not stop a build already claimed from an earlier listing.
61
- When the human authorizes restarting premature work: request `ab abort <slug>`,
62
- wait for dispatcher cleanup to finish and return the ticket to triage, verify
63
- or repair the blocker set, and only then move the ticket back to ready. Moving
64
- the ticket before cleanup finishes can be overwritten by cleanup. Ready with
61
+ When the human authorizes restarting premature work and the blocker set is
62
+ already right, request `ab abort <slug> --to ready`: cleanup moves the ticket
63
+ straight back to ready with its blockers kept, so no second move is needed.
64
+ If the ticket no longer meets the spec standard, cleanup returns it to triage
65
+ instead and the hand-back names the missing parts; groom it before moving it
66
+ to ready.
67
+ If the blockers need changing first, verify or repair them once the
68
+ `ticket.handed-back` repository event for that build arrives; the dispatcher
69
+ writes nothing to the ticket for that hand-back afterwards. Ready with
65
70
  unresolved blockers is the normal waiting state: dispatch rechecks dependencies
66
71
  and claims the ticket only after they resolve and other readiness gates pass.
67
72
 
@@ -113,7 +113,7 @@ rejectedState = "rejected"
113
113
 
114
114
  ### GitHub (`github`)
115
115
 
116
- Tickets are the issues of the forge repository, the GitHub repository that `origin` names, so a team grooms and tracks work where it already looks. The source authenticates as the `github` forge does: `GITHUB_TOKEN`, then `GH_TOKEN`, then the gh CLI's `gh auth login`. A fine-grained token needs Issues read and write, and Metadata read, on the repository, and a user token's user needs triage or write access: GitHub silently drops label changes from anyone below that, so a label write that doesn't come back fails with a permission error instead of reporting success. `ab init --validate` names a missing token, a token that can't read and write issues, a user who can't set labels, disabled issues, an `origin` that isn't a GitHub repository, a state that can't be a label, and a `readyAssignee` that names no user who can be assigned issues in the repository.
116
+ Tickets are the issues of the forge repository, the GitHub repository that `origin` names, so a team grooms and tracks work where it already looks. The source authenticates as the `github` forge does: `GITHUB_TOKEN`, then `GH_TOKEN`, then the gh CLI's `gh auth login`. A fine-grained token needs Issues read and write, and Metadata read, on the repository, and a user token's user needs triage or write access: GitHub silently drops label changes from anyone below that, so a label write that doesn't come back fails with a permission error instead of reporting success. `ab init --validate` names a missing token, a token that can't read and write issues, a user who can't set labels, disabled issues, an `origin` that isn't a GitHub repository, a state that can't be a label, and a `readyAssignee` or `createAssignee` that names no user who can be assigned issues in the repository, or `"me"` with a credential that has no user.
117
117
 
118
118
  <!-- seam-config:start -->
119
119
  ```toml
@@ -138,17 +138,35 @@ rejectedState = "rejected"
138
138
  - **Closing reasons.** Closed as completed, or closed before GitHub recorded reasons, is done. Closed as not planned or duplicate is in the `rejectedState` state; without `rejectedState` it reads as a fixed `not-planned` state that is never ready, never resolves a blocker and can't be moved into. Moving to done or rejected closes the issue with that reason (an issue already closed with the other reason is reopened and closed again, because GitHub changes a reason only with the state); moving to any other state opens it with exactly that state's label.
139
139
  - **Reopen goes to triage.** If a state label survived the close, the adapter strips that stale label the first time it reads the reopened issue. It tells stale from fresh by the issue's last 100 label and reopen events; an issue whose deciding event is older than that is left out of listings with a diagnostic until its state label is removed and re-added.
140
140
  - **Labels.** `readyLabels` defaults to `["autobuild"]`; `[]` removes the gate. Missing labels are created on demand. State and link labels are never part of a ticket's labels, and a write that names one is refused. The `autobuild:proposal` and `autobuild:aborted` labels that harvest and abort apply are ordinary labels, so `proposal` and `aborted` can't be states.
141
- - **Assignee.** `readyAssignee = "me"` keeps only issues assigned to the login that owns the GitHub credential; a username, including an Enterprise Managed User login such as `mona_acme`, names a specific user. The ready read itself is narrowed by assignee, an unassigned issue is never ready, and any one of several assignees matches. `"me"` costs one `GET /user` per dispatcher start, never during a tick, so a reload that enables it needs no restart unless startup couldn't resolve the credential's owner.
141
+ - **Assignee.** `readyAssignee = "me"` keeps only issues assigned to the login that owns the GitHub credential; a username, including an Enterprise Managed User login such as `mona_acme`, names a specific user. The ready read itself is narrowed by assignee, an unassigned issue is never ready, and any one of several assignees matches. While `readyAssignee` is set, each scan reports open ready issues that carry every `readyLabels` entry but have no assignee in the ticket diagnostics, which `ab repository status` and the dashboards show, naming the ten lowest-numbered and counting the rest. The report never claims or assigns them; assigning one makes it claimable. `"me"` costs one `GET /user` per dispatcher start, never during a tick, so a reload that enables it needs no restart unless startup couldn't resolve the credential's owner.
142
+ - **Assignees.** Tickets carry the issue's assignees as an `assignees` array of usernames in JSON reads, whether they were set on GitHub or through `ab`, and `ab ticket show` prints them. They aren't part of the ticket's `revision`. `--assignees` on `ab ticket create` and `ab ticket update`, and the `assignees` field of the operator `tickets.create` and `tickets.update` tools, set them: each entry is a username or `me`, at most ten entries counted before duplicates collapse, and an update replaces the whole set. `createAssignee = "me"` (or a username) assigns every ticket Autobuild creates, through `ab ticket create`, operator `tickets.create` and harvest proposals, unless the create names its own assignees; a harvest proposal goes to the owner of the filing dispatcher's credential. That pairs with `readyAssignee = "me"`, so each person's dispatcher picks up the tickets they file. A create or update fails, naming the cause and writing nothing, when `me` has no user behind the credential (a GitHub App installation token has none) or a user can't be assigned issues in the repository. GitHub silently drops assignees a token without push access sets, so a write whose assignees don't come back fails, naming the issue and saying it is unassigned; a retried harvest create adopts that issue and assigns it. A write naming assignees costs one check per user per process, `me` reuses the `readyAssignee` `GET /user`, and reads cost nothing extra.
142
143
  - **Blockers** are native issue dependencies ("blocked by"), visible on both issues, including ones added on GitHub. A blocker resolves when its issue is done. One in another repository never resolves and is named in the dependency diagnostics. An issue transferred to another repository is no longer a ticket here: its old number reads as missing, so it is never written and never resolves a blocker.
143
144
  - **Issue links.** The ticket's own issue is always a `closes` link that can't be removed. Links to other issues are labels named `autobuild-link:<intent> #<n>`, such as `autobuild-link:refs #820`, so they show on the issue and survive edits on GitHub. Each linked issue and intent adds one repository label, which appears in GitHub's label picker; unused link labels are never deleted.
144
145
  - **Comments and assets.** Dispatcher notices post as issue comments, but tickets carry no comment history, so `ab ticket show` lists none; export and import read comment history explicitly. Assets live in the BuildStore, with the usual note left as an issue comment.
145
146
  - **Nodes and targets.** A node is an issue with the exact `node` label. A ticket targets a node by being a sub-issue of the node's issue, so the node's sub-issue list on GitHub shows its children. A parent without the `node` label, or in another repository, is ordinary grouping: it gives no target, never blocks dispatch and is left untouched, so `--target` on such an issue is refused and `--no-target` doesn't remove it. Sub-issues and `node` labels added or removed on GitHub read the same as `ab ticket` writes. GitHub allows 100 direct sub-issues per issue and 8 levels of nesting. A repository label named `Node` or another casing must be renamed to `node` first.
146
147
  - **Export and import.** `ab ticket export` covers every issue, closed ones included. `ab ticket import` remaps every id to a new issue number and resumes by creation key, as the ticket migration procedure's GitHub section describes.
147
148
  - **Not supported:** guarded writes (`--expected-revision` is refused, as with Linear).
148
- - **Cost.** Dispatcher reads are conditional requests. Their validators live under the local state root, in `github-tickets/<owner>/<repo>/validators/`, and are evicted after 7 days unused, so a tick on an unchanged repository spends no primary rate-limit budget. A process without them, such as a cold hosted instance, pays one read sized by the ready candidates. A ready candidate whose parent issue isn't in the listing adds one conditional read of that parent, at most one per distinct parent. A node's completeness check reads the node issue and its sub-issues, conditionally, whatever the repository's size. Rate limits surface as the ticket-source rate-limit error, with GitHub's reset time.
149
+ - **Cost.** Dispatcher reads are conditional requests. Their validators live under the local state root, in `github-tickets/<owner>/<repo>/validators/`, and are evicted after 7 days unused, so a tick on an unchanged repository spends no primary rate-limit budget. A process without them, such as a cold hosted instance, pays one read sized by the ready candidates. A ready candidate whose parent issue isn't in the listing adds one conditional read of that parent, at most one per distinct parent. A node's completeness check reads the node issue and its sub-issues, conditionally, whatever the repository's size. With `readyAssignee` set, the unassigned-issue report adds one conditional read per scan, plus one per further page, which is free on an unchanged repository; its failure, a rate limit included, is a diagnostic that never stops assigned tickets from being listed and claimed. Rate limits surface as the ticket-source rate-limit error, with GitHub's reset time.
149
150
  - **State counts** are display-only: one fresh GraphQL request per call, plus one more for each further page of 100 `autobuild:` labels, never cached and never reading issue history, with done and rejected subject to GitHub's search-index lag. Three cases approximate. A stale reopen label counts in its label's state until the first read strips it. An issue with two or more state labels counts once in each until its labels are fixed; the first read reports it. A closure that predates GitHub's close reasons reads as done but may count as rejected or `not-planned`, and never heals.
150
151
  - **Creation keys** live in a hidden marker in the issue body. A keyed create needs `idempotencyKeyReservedAt`; harvest supplies it.
151
152
 
153
+ Issues filed directly on GitHub aren't assigned by Autobuild, so under `readyAssignee` they never become ready until someone assigns them. A small Actions workflow can assign each opened issue to its author:
154
+
155
+ ```yaml
156
+ on: { issues: { types: [opened] } }
157
+ permissions: { issues: write }
158
+ jobs:
159
+ assign:
160
+ runs-on: ubuntu-latest
161
+ steps:
162
+ - run: gh issue edit "$NUMBER" --repo "$REPO" --add-assignee "$AUTHOR"
163
+ env:
164
+ GH_TOKEN: ${{ github.token }}
165
+ NUMBER: ${{ github.event.issue.number }}
166
+ REPO: ${{ github.repository }}
167
+ AUTHOR: ${{ github.event.issue.user.login }}
168
+ ```
169
+
152
170
  ### Optional issue links
153
171
 
154
172
  The `file`, `hosted` and `github` sources store [forge issue links](tickets.md#groom-a-buildable-spec): as `issueLinks` frontmatter (`file`), transactional project data (`hosted`), or `autobuild-link:<intent> #<n>` labels (`github`), where the ticket's own issue is a `closes` link with no label. `linear` doesn't, because Linear links GitHub issues natively through its own integration; a create or update that names issue links is refused with an error naming the source, and nothing is written.
@@ -188,6 +206,8 @@ bun ab plugin test ticket-source acme
188
206
 
189
207
  Declare `readyAssignee` only if `listReady` filters by `criteria.assignee`; without it, a configured `readyAssignee` is refused, naming your source. See the [optional ready assignee capability](plugin-authoring.md#optional-ready-assignee-capability).
190
208
 
209
+ Declare `assignees` only if you store, return and verify ticket assignees; without it, a write naming assignees and a configured `createAssignee` are refused, naming your source. See the [optional assignees capability](plugin-authoring.md#optional-assignees-capability).
210
+
191
211
  Declare tree support only if you keep the [optional tree contract](plugin-authoring.md#optional-ticket-tree-capability) on the same port and harness: exhaustive pagination, canonical targets, revision coverage and atomic rejection.
192
212
 
193
213
  Native paging is an optional API 1.9 ticket-source capability:
@@ -195,8 +215,11 @@ Native paging is an optional API 1.9 ticket-source capability:
195
215
  The SDK exports these types; the result is `TicketListing & { total: number }`.
196
216
  Criteria retain state, labels (AND), and assignee semantics. The page has a
197
217
  nonnegative integer `limit`, optional nonnegative integer `offset` (default 0),
198
- and optional `order: 'oldest' | 'newest'` (default oldest). Newest reverses the
199
- entire source order before offset and limit. Total counts all matches, even
218
+ and optional `order: 'oldest' | 'newest'` (default oldest). Oldest is the
219
+ source's dispatch order: with `priority`, urgent tickets first, then normal
220
+ ones, each in listing order. Newest is newest filed first: creation time
221
+ descending, regardless of urgency, with a stable tie-break. It is not the
222
+ reverse of dispatch order. Offset and limit apply after ordering. Total counts all matches, even
200
223
  with limit zero or an offset past the end. Records, diagnostics and errors
201
224
  match the exhaustive listing. The shared `describeTicketSourceContract` suite
202
225
  automatically compares declared native paging with full-read windows.
@@ -204,7 +227,12 @@ automatically compares declared native paging with full-read windows.
204
227
  Only paged operator listings select this capability. Sources without it retain
205
228
  the full-read fallback, which orders the listing before offset and limit: by
206
229
  default a stable urgent-first partition (urgent, then normal, each in source
207
- order), or for newest the reversed source order. Native errors propagate. Unpaged operator
230
+ order), or for newest the reversed listing, which is newest filed first for
231
+ sources that list in filing order (file, GitHub, Linear). The remote
232
+ `HostedTicketSource` is the exception: the hosted list-ready protocol returns
233
+ urgent tickets first and carries no filing time, so the client cannot see
234
+ filing order, and its newest pages are reversed dispatch order whenever urgent
235
+ tickets exist. Native errors propagate. Unpaged operator
208
236
  listings, CLI ticket lists and dispatcher ready scans remain exhaustive through
209
237
  `listReady`/`listAll`. The hosted PostgreSQL source counts matches without
210
238
  bodies and reads only the SQL-bounded window. File, Linear, GitHub and the remote