@defrex/autobuild 1.4.2 → 1.6.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 (218) hide show
  1. package/README.md +1 -1
  2. package/SPEC.md +512 -101
  3. package/bin/ab-dispatch-kernel.ts +1 -0
  4. package/docs/accounts.md +9 -0
  5. package/docs/agent-runtimes.md +1 -0
  6. package/docs/answering-blocked-builds.md +7 -3
  7. package/docs/architecture.md +313 -130
  8. package/docs/assets/headline-wide.png +0 -0
  9. package/docs/build-store.md +33 -3
  10. package/docs/cli.md +2 -1
  11. package/docs/configuration-overview.md +9 -0
  12. package/docs/configuration.md +217 -106
  13. package/docs/dispatcher-hosting.md +19 -3
  14. package/docs/dispatcher.md +11 -6
  15. package/docs/glossary.md +1 -1
  16. package/docs/integration-overview.md +2 -2
  17. package/docs/integration-tree.md +91 -28
  18. package/docs/merge-policy.md +28 -9
  19. package/docs/operating.md +1 -1
  20. package/docs/operator-api.md +57 -20
  21. package/docs/operator-surfaces.md +1 -1
  22. package/docs/plugin-authoring.md +89 -8
  23. package/docs/remote-store-protocol.md +39 -11
  24. package/docs/remote-ticket-protocol.md +126 -12
  25. package/docs/restacking.md +24 -6
  26. package/docs/seams.md +2 -2
  27. package/docs/setup.md +19 -13
  28. package/docs/spec-standard.md +2 -1
  29. package/docs/ticket-dependencies.md +26 -8
  30. package/docs/ticket-migration.md +70 -7
  31. package/docs/ticket-sources.md +82 -5
  32. package/docs/tickets.md +34 -2
  33. package/docs/troubleshooting.md +3 -3
  34. package/docs/verification.md +5 -5
  35. package/docs/website.md +8 -0
  36. package/docs/workspaces.md +1 -1
  37. package/package.json +4 -3
  38. package/packages/core/src/accounts/hosted-readiness.ts +21 -0
  39. package/packages/core/src/cli/attention.ts +3 -0
  40. package/packages/core/src/cli/build-control.ts +36 -12
  41. package/packages/core/src/cli/connect.ts +9 -18
  42. package/packages/core/src/cli/context.ts +44 -0
  43. package/packages/core/src/cli/dashboard/configuration.ts +11 -0
  44. package/packages/core/src/cli/dashboard/model.ts +51 -11
  45. package/packages/core/src/cli/dashboard/poll.ts +14 -0
  46. package/packages/core/src/cli/dashboard/queue.ts +21 -0
  47. package/packages/core/src/cli/dashboard/render.ts +43 -22
  48. package/packages/core/src/cli/dispatch-frontend.ts +63 -30
  49. package/packages/core/src/cli/dispatch-mode.ts +35 -16
  50. package/packages/core/src/cli/dispatch-preflight.ts +4 -1
  51. package/packages/core/src/cli/dispatch-repository-feed.ts +40 -11
  52. package/packages/core/src/cli/dispatch-tickets.ts +47 -0
  53. package/packages/core/src/cli/dispatch-upgrade-controller.ts +3 -0
  54. package/packages/core/src/cli/dispatch.ts +522 -145
  55. package/packages/core/src/cli/help.ts +63 -24
  56. package/packages/core/src/cli/init-hosted-accounts.ts +54 -0
  57. package/packages/core/src/cli/init-readiness-remote.ts +16 -3
  58. package/packages/core/src/cli/init-validation.ts +144 -42
  59. package/packages/core/src/cli/issue-links.ts +67 -0
  60. package/packages/core/src/cli/main.ts +32 -15
  61. package/packages/core/src/cli/pr-summary-publication.ts +38 -7
  62. package/packages/core/src/cli/publication-settlement.ts +36 -24
  63. package/packages/core/src/cli/repo-lease.ts +225 -0
  64. package/packages/core/src/cli/repository-status.ts +203 -49
  65. package/packages/core/src/cli/status.ts +42 -4
  66. package/packages/core/src/cli/terminals.ts +37 -2
  67. package/packages/core/src/cli/ticket-editor.ts +20 -6
  68. package/packages/core/src/cli/ticket.ts +264 -46
  69. package/packages/core/src/cli/triage-count-sampler.ts +59 -0
  70. package/packages/core/src/cli/wait.ts +4 -1
  71. package/packages/core/src/cli/watch.ts +19 -4
  72. package/packages/core/src/config/live.ts +45 -4
  73. package/packages/core/src/config/load.ts +9 -0
  74. package/packages/core/src/config/pipeline-source.ts +6 -2
  75. package/packages/core/src/config/ready-assignee.ts +86 -0
  76. package/packages/core/src/config/schema.ts +202 -38
  77. package/packages/core/src/distribution-packaging.ts +1 -1
  78. package/packages/core/src/events/catalog.ts +7 -0
  79. package/packages/core/src/events/compatibility.ts +2 -1
  80. package/packages/core/src/events/payloads.ts +85 -0
  81. package/packages/core/src/events/policy.ts +10 -0
  82. package/packages/core/src/events/repository.ts +93 -28
  83. package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +237 -230
  84. package/packages/core/src/kernel/build-identity.ts +12 -0
  85. package/packages/core/src/kernel/change-presence.ts +139 -6
  86. package/packages/core/src/kernel/dispatch-capacity.ts +189 -19
  87. package/packages/core/src/kernel/dispatch-status.ts +10 -1
  88. package/packages/core/src/kernel/dispatch-upgrade.ts +104 -5
  89. package/packages/core/src/kernel/engine.ts +17 -8
  90. package/packages/core/src/kernel/finalize-pr-rejection.ts +95 -0
  91. package/packages/core/src/kernel/generators/build-log.ts +9 -0
  92. package/packages/core/src/kernel/generators/repository-journals.ts +15 -1
  93. package/packages/core/src/kernel/harvest.ts +4 -1
  94. package/packages/core/src/kernel/incremental-fixtures.ts +1 -0
  95. package/packages/core/src/kernel/integration-completeness.ts +104 -17
  96. package/packages/core/src/kernel/integration-landing.ts +17 -0
  97. package/packages/core/src/kernel/integration-state.ts +17 -0
  98. package/packages/core/src/kernel/issue-keywords.ts +202 -0
  99. package/packages/core/src/kernel/janitor-failure.ts +96 -5
  100. package/packages/core/src/kernel/kernel-git.ts +87 -0
  101. package/packages/core/src/kernel/landing-readiness.ts +25 -17
  102. package/packages/core/src/kernel/leaf-restack-state.ts +4 -2
  103. package/packages/core/src/kernel/log-index.ts +1 -1
  104. package/packages/core/src/kernel/node-issue-links.ts +142 -0
  105. package/packages/core/src/kernel/node-landing.ts +2 -1
  106. package/packages/core/src/kernel/node-parent.ts +6 -0
  107. package/packages/core/src/kernel/node-restack-transaction.ts +2 -0
  108. package/packages/core/src/kernel/pr-summary.ts +24 -0
  109. package/packages/core/src/kernel/read-deferrals.ts +75 -12
  110. package/packages/core/src/kernel/read-facts.ts +32 -1
  111. package/packages/core/src/kernel/reconcile-restack.ts +1 -1
  112. package/packages/core/src/kernel/reducer-registry.ts +37 -2
  113. package/packages/core/src/kernel/reducer.ts +147 -5
  114. package/packages/core/src/kernel/ticket-preparation.ts +16 -0
  115. package/packages/core/src/kernel/verify-budget.ts +43 -0
  116. package/packages/core/src/operator/index.ts +3 -1
  117. package/packages/core/src/operator/presentation.ts +3 -0
  118. package/packages/core/src/operator/protocol.ts +38 -2
  119. package/packages/core/src/operator/query.ts +69 -29
  120. package/packages/core/src/operator/registry.ts +47 -26
  121. package/packages/core/src/operator/tickets.ts +77 -10
  122. package/packages/core/src/plugin-sdk/index.ts +13 -0
  123. package/packages/core/src/plugins/manifest.ts +1 -1
  124. package/packages/core/src/plugins/registry.ts +1 -0
  125. package/packages/core/src/ports/forge/contract.ts +69 -0
  126. package/packages/core/src/ports/forge/create.ts +5 -0
  127. package/packages/core/src/ports/forge/fake.ts +184 -3
  128. package/packages/core/src/ports/forge/git-rewrite.ts +4 -2
  129. package/packages/core/src/ports/forge/github.ts +175 -38
  130. package/packages/core/src/ports/forge/local-git.ts +14 -0
  131. package/packages/core/src/ports/forge/readiness.ts +10 -0
  132. package/packages/core/src/ports/forge-failure.ts +43 -0
  133. package/packages/core/src/ports/runner/claude.ts +7 -1
  134. package/packages/core/src/ports/runner/codex.ts +7 -2
  135. package/packages/core/src/ports/runner/native-cli-fixture.ts +2 -1
  136. package/packages/core/src/ports/runner/pi.ts +7 -1
  137. package/packages/core/src/ports/runner/runtime.ts +3 -0
  138. package/packages/core/src/ports/runner/start-prompt.ts +37 -0
  139. package/packages/core/src/ports/tickets/contract.ts +320 -7
  140. package/packages/core/src/ports/tickets/create.ts +89 -20
  141. package/packages/core/src/ports/tickets/fake.ts +18 -0
  142. package/packages/core/src/ports/tickets/file-codec.ts +20 -0
  143. package/packages/core/src/ports/tickets/file.ts +43 -1
  144. package/packages/core/src/ports/tickets/github-fake.ts +1123 -0
  145. package/packages/core/src/ports/tickets/github-issues.ts +431 -0
  146. package/packages/core/src/ports/tickets/github-validators.ts +194 -0
  147. package/packages/core/src/ports/tickets/github.ts +2029 -0
  148. package/packages/core/src/ports/tickets/hosted-index.ts +34 -3
  149. package/packages/core/src/ports/tickets/issue-links.ts +86 -0
  150. package/packages/core/src/ports/tickets/lifecycle.ts +60 -4
  151. package/packages/core/src/ports/tickets/linear.ts +66 -6
  152. package/packages/core/src/ports/tickets/migration.ts +290 -68
  153. package/packages/core/src/ports/tickets/operations.ts +98 -12
  154. package/packages/core/src/ports/tickets/priority.ts +55 -0
  155. package/packages/core/src/ports/tickets/remote-protocol.ts +195 -29
  156. package/packages/core/src/ports/tickets/remote.ts +188 -13
  157. package/packages/core/src/ports/tickets/revision.ts +22 -1
  158. package/packages/core/src/ports/tickets/states.ts +43 -0
  159. package/packages/core/src/ports/tickets/tree.ts +58 -12
  160. package/packages/core/src/ports/tickets/update.ts +12 -2
  161. package/packages/core/src/ports/types.ts +194 -9
  162. package/packages/core/src/ports/workspace/commit-preservation.ts +163 -25
  163. package/packages/core/src/ports/workspace/git-worktree.ts +6 -2
  164. package/packages/core/src/ports/workspace/harvest-execution.ts +4 -2
  165. package/packages/core/src/ports/workspace/vercel-sandbox.ts +121 -27
  166. package/packages/core/src/processes/build-runner.ts +101 -22
  167. package/packages/core/src/processes/dispatcher.ts +1046 -372
  168. package/packages/core/src/processes/execution-no-progress.ts +7 -0
  169. package/packages/core/src/processes/harvest-child.ts +4 -2
  170. package/packages/core/src/processes/harvest-execution-state.ts +104 -0
  171. package/packages/core/src/processes/harvest-runner.ts +263 -25
  172. package/packages/core/src/processes/harvest.ts +5 -8
  173. package/packages/core/src/processes/tick-publication.ts +12 -2
  174. package/packages/core/src/processes/ticket-scan-schedule.ts +78 -0
  175. package/packages/core/src/processes/workspace-preservation.ts +36 -1
  176. package/packages/core/src/runtime-identity.ts +10 -2
  177. package/packages/core/src/scenarios/harness.ts +149 -35
  178. package/packages/core/src/store/adapter.ts +7 -1
  179. package/packages/core/src/store/contract.ts +83 -2
  180. package/packages/core/src/store/digest.ts +32 -1
  181. package/packages/core/src/store/reduced-reads.ts +10 -0
  182. package/packages/core/src/store/reducer-value-shapes.json +4471 -3427
  183. package/packages/core/src/store/remote/protocol.ts +2 -0
  184. package/packages/core/src/store/remote/released-clients.json +22 -0
  185. package/packages/core/src/store/remote/released-reducer-values/1.5.0.json +26924 -0
  186. package/packages/core/src/store/remote/released-reducer-values/1.6.0.json +27173 -0
  187. package/packages/core/src/store/remote/released-reducer-values/index.ts +4 -0
  188. package/packages/core/src/store/repo-state-events.ts +2 -0
  189. package/packages/core/src/store/types.ts +5 -0
  190. package/packages/core/src/testing/dispatch-read-budget.ts +729 -123
  191. package/packages/core/src/testing/index.ts +18 -1
  192. package/packages/core/src/testing/presence-history.ts +79 -0
  193. package/packages/core/src/testing/reduced-read-budget.ts +1424 -33
  194. package/packages/core/src/testing/upgrade-generations.ts +77 -0
  195. package/skills/code-review/SKILL.md +4 -3
  196. package/skills/finalize/SKILL.md +18 -2
  197. package/skills/guide/SKILL.md +417 -143
  198. package/skills/guide/references/accounts.md +9 -0
  199. package/skills/guide/references/integration-tree.md +91 -28
  200. package/skills/guide/references/merge-policy.md +28 -9
  201. package/skills/guide/references/operator-api.md +57 -20
  202. package/skills/guide/references/plugin-authoring.md +89 -8
  203. package/skills/guide/references/remote-store-protocol.md +39 -11
  204. package/skills/guide/references/remote-ticket-protocol.md +126 -12
  205. package/skills/guide/references/restacking.md +24 -6
  206. package/skills/guide/references/setup.md +19 -13
  207. package/skills/guide/references/spec-standard.md +2 -1
  208. package/skills/guide/references/ticket-dependencies.md +26 -8
  209. package/skills/guide/references/ticket-migration.md +70 -7
  210. package/skills/harvest-review/SKILL.md +4 -3
  211. package/skills/implement/SKILL.md +20 -1
  212. package/skills/operate/SKILL.md +149 -35
  213. package/skills/plan/SKILL.md +1 -1
  214. package/skills/reconcile/SKILL.md +5 -4
  215. package/skills/spec/SKILL.md +15 -2
  216. package/skills/tickets/SKILL.md +116 -37
  217. package/templates/autobuild.toml +5 -0
  218. package/templates/hosted-service/package.json +2 -2
@@ -42,7 +42,7 @@ Wrap an `AgentRunner` that supports:
42
42
  - typed failures: verbatim message, retry-compatible `permanent` bit, optional `cause: availability | exhaustion | credentials | configuration` routing evidence
43
43
  - the distribution-managed `ab` launcher
44
44
 
45
- Declare served model prefixes and a default. Optional tool-free `oneShot` sits beside the runner interface.
45
+ Declare served model prefixes and a default. Optional tool-free `oneShot` sits beside the runner interface. An optional `startPrompt(opts)` returns the exact first message `start` sends, which the kernel records on `session.started`.
46
46
 
47
47
  ### `workspace-provider`
48
48
 
@@ -55,6 +55,7 @@ Declare served model prefixes and a default. Optional tool-free `oneShot` sits b
55
55
  - Kernel-owned regular pushes, idempotent PR opening, PR-state projection, gated and ungated auto-merge, head-guarded squash merge, and comments. Agents never receive forge credentials or push.
56
56
  - API 1.2: optional idempotent `closePr` and `deleteBranch` for abort cleanup. `closePr` must preserve a racing merge. Without them, cleanup stays visibly pending.
57
57
  - Optional `prAttachments` hosts images; the text-only path must work without it.
58
+ - Optional `closesIssues: true` declares that closing keywords reaching the default branch close issues. Only then does the kernel pass `issueLinks` (`{ issue, intent }[]`). For a leaf aimed at the default branch it passes the build's sealed links to `openPr` and in `BuildLandingOptions` to `setAutoMerge` and `squashMerge`. Compose them with the SDK helpers: `neutralizeClosingReferences(title, links, { repository })` for the PR title and squash headline, `withIssueKeywords(body, links, { repository, trailers: false })` for the PR body so it ends with the `Closes #N` / `Refs #N` lines, and `landingMessage(message, buildSlug, links, { repository })` for the landed message, which puts the keyword paragraph before the trailer block. `repository` is `owner/name`, so qualified references to other repositories are left alone. Compare an already-applied landing request against the same composition, or auto-merge churns. The kernel calls `setAutoMerge(…, true, options)` on every eligible poll while a request is armed: return `applied` without mutating when the armed method and message match, and call `options.canApply()` before any mutation that repairs them. Without the flag no links are passed and none are written. A leaf aimed at a node passes its links to `openPr` with every intent `refs` (and none to the landing calls), a root node's PR receives the node's own links merged with its landed children's union, and a nested node's PR receives that set with every intent `refs`. When `openPr` adopts an existing open PR for the head and links are present, converge it: neutralize the existing title, recompose the existing body with `withIssueKeywords`, write only the fields that changed, and confirm by readback, without replacing the title, prose or merge message. To keep a node's PR current, implement the optional `updatePrIssueLinks(workspacePath, number, issueLinks)`: read the PR, neutralize its title and compose its body with `withIssueKeywords(body, links, { repository, trailers: false })`, write only when either changed, re-read and throw when the readback disagrees or the PR is not open. Without the method a node's set is recorded but never written.
58
59
 
59
60
  ### Reconcile rewrites
60
61
 
@@ -65,8 +66,10 @@ Reconcile requires the optional grouped `Forge.rewrite` capability:
65
66
  archives also publish commits present only on the remote: GitHub uses create-only
66
67
  Git-reference REST creation when the workspace lacks the commit, retaining guarded
67
68
  Git pushes for local objects. Exact remote readback confirms publication, then a
68
- depth-one fetch by the archive ref (without tags or configured refmap expansion)
69
- restores missing commits and verifies them locally before returning.
69
+ non-shallow fetch of only that exact archive ref (without tags, configured refmap
70
+ expansion or a depth limit) restores missing commits and their missing ancestry,
71
+ writes no shallow boundary, leaves an already-shallow repository's existing
72
+ boundaries unchanged, and verifies the commits locally before returning.
70
73
  3. Replace the explicit branch, leased on an explicit expected remote head.
71
74
 
72
75
  - Return `lease-mismatch` separately from transport, auth and policy failures.
@@ -86,6 +89,15 @@ authentication, malformed responses or rate limits. Missing capability withholds
86
89
  new replay requiring proof. GitHub uses exact-SHA comparison; local-git requires
87
90
  an explicit served `repoRoot`. Unknown ancestry never authorizes replay.
88
91
 
92
+ The optional `remoteBranchExists(branch)` returns false only for proven absence
93
+ and throws on failure. Dispatch uses it at claim time to skip slugs whose build
94
+ branch another store already published, and to recognize a target node branch
95
+ another store opened. A throw during slug selection fails that claim: no build
96
+ is created and the ticket is handed back to retry on a later tick, never named
97
+ without the check. A throw while diagnosing a target node leaves the plain
98
+ pending diagnostic. Without the capability, slugs are deduplicated against the
99
+ local store only and the dispatcher records a startup warning.
100
+
89
101
  Stores may expose `getNodeRewrite(node, previousHead, beforePrevious)` as a bounded point
90
102
  lookup of a durable `node.rewritten` receipt. Built-in adapters index these
91
103
  validated publication facts atomically with append, including transactional
@@ -108,6 +120,20 @@ confirmed, absent, or unknown without deleting an environment or its snapshots.
108
120
  Only dispatcher-authorized reap follows the durable fence and preservation/loss
109
121
  receipt. `provision` accepts exact `restoration` heads; branch ancestry must be
110
122
  verified, and detached producer objects must never overwrite the named branch.
123
+ `provision` also receives `restorationArchives`: `local` for the local-git
124
+ forge, whose repository already holds the archive refs and must not be fetched
125
+ from, and `remote` otherwise, in which case a provider sharing the repository
126
+ must fetch each exact archive ref from origin before verifying it.
127
+ `preserve` receives `replaced`, and `provision` receives `restorationReplaced`:
128
+ the build's bounded record of the latest 64 shas recorded rewrites replaced.
129
+ A branch head equal to or contained in one of them is superseded. Preserve
130
+ archives it only as a producer; provision skips it before any branch mutation
131
+ and reports each skipped head, as `contained` or `superseded`, in the result's
132
+ `restorationSkipped`. The dispatcher demotes exact matches itself, so a
133
+ provider that ignores these fields stays safe. `preserve` also receives
134
+ `neverExecuted` when no execution ever started in the environment: a missing
135
+ base, `HEAD`, branch, or candidate object then means nothing to preserve rather
136
+ than an error. A provider that ignores it stays strict, and cleanup fails safely.
111
137
  Provision/start failures signal `WorkspaceCleanupRequired` rather than deleting
112
138
  or implicitly recreating an existing checkout. A confirmed `snapshot_not_found`
113
139
  lookup establishes filesystem absence, while retaining the stale name for
@@ -184,6 +210,7 @@ A plugin relying on a capability declares an `apiVersion` range containing its v
184
210
  - **1.7** Workspace factory seams.
185
211
  - **1.8** Forge failure classification and request observers.
186
212
  - **1.9** Optional native ticket-source paging (`listPage`); older sources retain operator slicing.
213
+ - **1.10** Optional ticket-source ready-assignee capability (`readyAssignee`, with `prepareReadyAssignee`, `readyAssigneeRefusal` and `describeReadyAssignee`); sources without it refuse `[tickets].readyAssignee`. Also optional targeted ticket listing (`listTargeting`); older tree sources are observed through `listAll`.
187
214
 
188
215
  ## 2. Create a repository-local module
189
216
 
@@ -412,8 +439,9 @@ acme-autobuild-plugin/
412
439
  └── bun.lock
413
440
  ```
414
441
 
415
- This manifest declares only the tested host release (`1.0.0-beta.2`); widen it only after the unchanged contracts pass on each added host.
442
+ Replace `<tested-version>` with the exact Autobuild release your contracts passed against: the version `bun add -d --exact @defrex/autobuild` recorded, also the first line of `ab --version`. That output's plugin API line is the version your `apiVersion` range must contain. Keep the peer at that tested release; widen it to a range only after the unchanged contracts pass on each added host.
416
443
 
444
+ <!-- plugin-authoring-package-manifest:start -->
417
445
  ```json
418
446
  {
419
447
  "name": "@acme/autobuild-plugin",
@@ -426,11 +454,12 @@ This manifest declares only the tested host release (`1.0.0-beta.2`); widen it o
426
454
  "test": "bun test",
427
455
  "prepublishOnly": "bun run typecheck && bun test"
428
456
  },
429
- "devDependencies": { "@defrex/autobuild": "1.0.0-beta.2", "typescript": "5.9.3" },
430
- "peerDependencies": { "@defrex/autobuild": "1.0.0-beta.2" },
457
+ "devDependencies": { "@defrex/autobuild": "<tested-version>", "typescript": "5.9.3" },
458
+ "peerDependencies": { "@defrex/autobuild": "<tested-version>" },
431
459
  "peerDependenciesMeta": { "@defrex/autobuild": { "optional": true } }
432
460
  }
433
461
  ```
462
+ <!-- plugin-authoring-package-manifest:end -->
434
463
 
435
464
  - **Dependencies.** Type-only SDK imports erase, so Autobuild is a dev dependency, not a runtime `dependencies` entry. The optional peer names the tested host without loading a second Autobuild copy. Runtime imports, such as the reference fake, need a runtime dependency; never ship the fake as a production adapter.
436
465
  - **Versions.** Package semver is independent of the host range and `apiVersion`. On an incompatible host plugin API, update adapter and contracts, change the range once they pass, and version the package by the user-visible compatibility change.
@@ -468,8 +497,58 @@ An adapter opts in with `integrationTree: true` and must:
468
497
  - before writing any mixed patch, including revision-checked writes, validate same-source existence, node kind, self and ancestor cycles, corrupt chains, and demotion of a node with children
469
498
  - expose kind and target in revisions
470
499
 
500
+ Optionally (API 1.10), implement `listTargeting(nodeId: string): Promise<TicketListing>`: every ticket in every state whose target is `nodeId`, exhausting pagination and propagating infrastructure failures. It must equal `listAll()` filtered by `target === nodeId`, with diagnostics only for excluded records it read. Integration observation prefers it, so a node's completeness read can cost what its children cost instead of a full scan; a failure never falls back to `listAll`. The shared `describeTicketSourceContract` suite checks the equality for any source that declares it.
501
+
471
502
  Don't opt in unless the source preserves these semantics. Legacy sources get ordinary CRUD; the compatibility facade refuses metadata writes before legacy methods run, and unsupported sources should also refuse metadata at their own write boundary.
472
503
 
504
+ ## Optional issue links capability
505
+
506
+ An adapter opts in with `issueLinks: true` and must persist
507
+ `issueLinks?: IssueLink[]` (`{ issue: number, intent: 'closes' | 'refs' }`) on
508
+ create, update and revision-checked update, return them on every read sorted by
509
+ issue number (absent means none), treat an update's set as a complete replacement
510
+ where `[]` clears, and include nonempty links in revisions. `normalizeIssueLinks`
511
+ validates, defaults intent to `closes` and sorts. Without the flag, the
512
+ compatibility facade refuses any write naming links with
513
+ `TicketIssueLinksUnsupported` before your methods run, and strips links from reads.
514
+
515
+ ## Optional priority capability
516
+
517
+ An adapter opts in with `priority: true` and must persist
518
+ `priority?: 'urgent' | 'normal'` on create, update and revision-checked update,
519
+ return `priority: 'urgent'` on every read of an urgent ticket and omit the field
520
+ otherwise, treat `normal` as clearing urgency, and include urgent priority in
521
+ revisions. The dispatcher claims urgent ready tickets before normal ones, each in
522
+ your listing order. Without the flag, every ticket reads as normal: the
523
+ compatibility facade refuses a write naming `urgent` with
524
+ `TicketPriorityUnsupported` before your methods run, drops a `normal` no-op
525
+ (skipping the call when nothing else remains), and strips priority from reads.
526
+
527
+ ## Optional ready assignee capability
528
+
529
+ An adapter opts in to `[tickets].readyAssignee` with `readyAssignee: true` and
530
+ must then honour `criteria.assignee` in `listReady` (and `listPage`, if
531
+ implemented): only tickets assigned to that user are ready, and an unassigned
532
+ ticket is never ready while it is set. `"me"` means the owner of the source's
533
+ credential; any other value's forms are the source's to define and enforce.
534
+ Without the flag, dispatcher startup, `ab init --validate` and live reloads
535
+ refuse a configured `readyAssignee` with an error naming the source and plugin.
536
+
537
+ Three optional methods support it:
538
+
539
+ - `prepareReadyAssignee(): Promise<void>` is called once at dispatcher startup,
540
+ before the loop and never in a tick, whether or not `readyAssignee` is set.
541
+ Resolve whatever `"me"` needs and memoize it. A credential with no user is a
542
+ recorded result, not a throw; throw only for infrastructure failures, which
543
+ fail startup when `readyAssignee` is set and are otherwise a warning.
544
+ - `readyAssigneeRefusal(value): string | undefined` is synchronous and makes no
545
+ request. Return why the value can't be honoured from what was prepared, or
546
+ `undefined`. Startup and every reload call it, so a refused reload keeps the
547
+ previous configuration.
548
+ - `describeReadyAssignee(value): Promise<string>` serves `ab init --validate`:
549
+ return a one-line summary of who the value names, such as `me → @octocat`,
550
+ or throw an error that says how to fix a value that names nobody.
551
+
473
552
  ## Optional ticket paging capability
474
553
 
475
554
  Native paging is an optional API 1.9 ticket-source capability:
@@ -484,10 +563,12 @@ match the exhaustive listing. The shared `describeTicketSourceContract` suite
484
563
  automatically compares declared native paging with full-read windows.
485
564
 
486
565
  Only paged operator listings select this capability. Sources without it retain
487
- the full-read/reverse/slice fallback; native errors propagate. Unpaged operator
566
+ the full-read fallback, which orders the listing before offset and limit: by
567
+ 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
488
569
  listings, CLI ticket lists and dispatcher ready scans remain exhaustive through
489
570
  `listReady`/`listAll`. The hosted PostgreSQL source counts matches without
490
- bodies and reads only the SQL-bounded window. File, Linear and the remote
571
+ bodies and reads only the SQL-bounded window. File, Linear, GitHub and the remote
491
572
  `HostedTicketSource` retain fallback; the POST list-ready protocol stays exhaustive.
492
573
 
493
574
  Hosted cooldown recording rejects observed reset deadlines beyond the 24-hour
@@ -372,7 +372,7 @@ it to exist. An unknown build returns `404 not-found`.
372
372
 
373
373
  | BuildStore operation | HTTP route | Request | Success |
374
374
  |---|---|---|---|
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 matching branch. Owner admin/open mode keeps exact-slug semantics with `409 conflict` for duplicates |
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 |
376
376
  | `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
377
  | `getBuild` | `GET /builds/{slug}` | none | `200` + `BuildRecord`; absent is `404` (the shipped client maps this to `null`) |
378
378
  | `append` | `POST /builds/{slug}/events` | event write | `201` + build event envelope |
@@ -529,7 +529,7 @@ client version window are unchanged.
529
529
  | Scope | Reducers with no arguments |
530
530
  | --- | --- |
531
531
  | Build | `executionNoProgress`, `summaryRequests`, `build`, `buildDigest`, `currentPrAttachments`, `pendingPrAttachmentReclaims`, `openExecution`, `lastExecutionOutcome`, `infrastructureFailureReset`, `openWorkspace`, `setupStreak`, `openBuildWorkspace`, `currentDeferralObservation`, `dashboardFacts`, `pinnedAssets`, `buildDelegation` |
532
- | Repository | `dispatchPlacement`, `ticketPreparation`, `harvest`, `dispatchSettings`, `sandboxStates`, `openHarvestExecutions`, `autoMergeDefault`, `effectiveConfig`, `harvestDelegation` |
532
+ | Repository | `dispatchPlacement`, `ticketPreparation`, `harvest`, `dispatchSettings`, `sandboxStates`, `openHarvestExecutions`, `hostedHarvestAuthority`, `autoMergeDefault`, `effectiveConfig`, `harvestDelegation` |
533
533
 
534
534
  | Reducer | Scope | Required arguments |
535
535
  | --- | --- | --- |
@@ -542,7 +542,12 @@ another's accumulator. `effectiveConfig` returns an object with optional `run`
542
542
  and `reference: {kind, rev}`. Absence is distinct from an unreadable referenced
543
543
  artifact. Delegation values contain semantic lifecycle facts indexed by prefixed
544
544
  identifiers, not authorization decisions; request time and grace expiry are
545
- always evaluated against those facts on the service.
545
+ always evaluated against those facts on the service. `hostedHarvestAuthority`
546
+ returns `{current?: {execution, run, leaseHolder, released}}`: the latest
547
+ `harvest.execution.authorized` and whether that execution has since ended or
548
+ been released. Its size does not grow with harvest history; a hosted harvest
549
+ guest re-reads it at durable boundaries to decide whether it still holds
550
+ authority, and a server that does not serve it stops the guest.
546
551
 
547
552
  Each remaining registered reducer is explicitly excluded:
548
553
 
@@ -687,7 +692,7 @@ seconds (the stream/session wait ceiling) and 25 seconds. A held request's authe
687
692
  are identical to the immediate form: a `401`, `403`, or `409` identity failure
688
693
  is answered immediately, never held.
689
694
 
690
- The parameter is purely additive in the version it merged in (protocol `2`,
695
+ The parameter is purely additive in the protocol version that introduced it (protocol `2`,
691
696
  where the event-wait rules were introduced): a server
692
697
  that ignores `wait` remains conforming — its immediate empty answers only raise
693
698
  the client's request rate — and a client that sends `wait` to such a server
@@ -748,7 +753,8 @@ from one build's log:
748
753
  "head": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
749
754
  "base": "cccccccccccccccccccccccccccccccccccccccc",
750
755
  "identities": ["build:child"]
751
- }
756
+ },
757
+ "nodeTargets": ["ab-node-auth"] // node builds the build's target or parent moves ever named, sorted; [] when none
752
758
  }
753
759
  ```
754
760
 
@@ -759,6 +765,16 @@ recording or recovering a contribution advances `readinessChangeSeq`. These
759
765
  members are additive: older peers can omit them, leaving presence unproven rather
760
766
  than substituting source completion. They do not change the protocol version.
761
767
 
768
+ `nodeTargets` lists every node build named by the build's `build.created`
769
+ target or by either side of a `node.parent-requested` or
770
+ `node.parent-accepted` move. The set only grows, so it is a superset of the
771
+ nodes the build relates to, and a dispatcher finds a node's child builds from
772
+ digests, reading full facts only for builds that name that node. Current
773
+ services always send it, possibly empty. The field is additive and keeps the
774
+ protocol version: older clients ignore it. A client that needs it and gets an
775
+ answer without it, from an older service, fails with a typed error instead of
776
+ reading each build's facts.
777
+
762
778
  The digest is derived from the event log on every call — the server persists
763
779
  nothing and there is no refresh step. Protocol version `3` reshaped the
764
780
  digest's `observations` from bare sequence numbers to `{seq, ts}` pairs and
@@ -1110,7 +1126,7 @@ by this rule (their retention belongs to the open archival thread), and open
1110
1126
  streams are never pruned. A read of a stream whose chunks were pruned returns
1111
1127
  no chunks, `status: "closed"`, and the artifact reference.
1112
1128
 
1113
- These additions were purely additive in the version they merged in (protocol
1129
+ These additions were purely additive in the protocol version that introduced them (protocol
1114
1130
  `2`, where the stream routes were introduced), and a
1115
1131
  conforming server implements the stream routes together with this document's
1116
1132
  rules exactly as it does for the event and artifact routes.
@@ -1175,7 +1191,14 @@ streams must also belong to the addressed parent.
1175
1191
 
1176
1192
  `GET /builds` is filtered by the server to the credential's project. Project
1177
1193
  `POST /builds` always allocates a fresh random-suffixed slug from the requested
1178
- base and a matching `ab/<slug>` branch, even when the base is unused. The
1194
+ base, even when the base is unused, and a matching branch in the build kind's
1195
+ namespace: `ab-node/<slug>` when the `build.created` payload has `kind: "node"`,
1196
+ otherwise `ab/<slug>`. Without `created`, a supplied `branch` prefix decides the
1197
+ kind. A supplied `branch` must be exactly `ab/<requested slug>` or
1198
+ `ab-node/<requested slug>` and agree with the `build.created` kind; only its
1199
+ namespace is used. The base (the requested slug's first 60 characters, trailing
1200
+ hyphens removed) must be a kebab build slug. A malformed or conflicting branch,
1201
+ or an invalid base, is `400 validation` with nothing created. The
1179
1202
  returned BuildRecord slug and branch are authoritative for all subsequent
1180
1203
  work. A foreign or missing base returns null on GET; it neither reveals
1181
1204
  collisions nor blocks creation. Owner admin retains exact-slug creation and
@@ -1248,12 +1271,17 @@ or invoke operator APIs. Harvest writes require the exact run in event payloads
1248
1271
  and artifact metadata; artifacts use the harvest kinds. Every artifact in an
1249
1272
  atomic deposit is checked before writing. Harvest streams have an immutable
1250
1273
  `harvest:<run>:<execution>:` label namespace. Addressed streams resolve their actual owner;
1251
- a guessed ID cannot bypass the boundary. Only the runner can heartbeat or re-acquire its exact
1252
- adopted repository lease holder; another current holder still fences it. Recovery acknowledgements remain dispatcher-side.
1274
+ a guessed ID cannot bypass the boundary. A harvest-runner grant may heartbeat or re-acquire
1275
+ only its exact adopted repository lease holder, and another current holder fences those lease
1276
+ calls. That lease permission is not the prepared guest's execution authority: the guest neither
1277
+ heartbeats, reclaims nor releases the invocation lease, so routine `--once` teardown or a
1278
+ successor invocation's lease acquisition alone does not fence it. The guest instead reads
1279
+ `hostedHarvestAuthority` at durable boundaries and stops when its execution authorization is
1280
+ released or replaced, or when that verification fails. Recovery acknowledgements remain dispatcher-side.
1253
1281
 
1254
1282
  Hosted ticket access is gated by grant kind. Build-runner and build-phase grants
1255
- cannot call ticket routes. Harvest-phase grants may call only list-ready, get
1256
- and dependency-states; harvest-runner grants may additionally create proposals.
1283
+ cannot call ticket routes. Harvest-phase grants may call only list-ready,
1284
+ list-targeting, get and dependency-states; harvest-runner grants may additionally create proposals.
1257
1285
  Other ticket mutations require project or admin authority. A denied operation
1258
1286
  returns 403 naming the grant kind and operation before parsing or source construction.
1259
1287
  Ticket admission and repository-keyed assets use the authenticated project;
@@ -99,8 +99,9 @@ The strict request envelope is:
99
99
  loads the project's durable independent ticket policy. Project authority publishes
100
100
  version 1 policy through `POST /tickets/policy`, using the usual context/input
101
101
  envelope. The input contains only `version` and `tickets`: source, teamKey,
102
- readyState, triageState, claimedState, doneState, createState, proposalState and
103
- optional readyLabels. URL, secrets, and pipeline configuration are rejected.
102
+ readyState, triageState, claimedState, doneState, createState, proposalState,
103
+ optional readyLabels, and the optional backlogState and rejectedState roles. URL,
104
+ secrets, and pipeline configuration are rejected.
104
105
  Only project or owner authority can publish. This does not append BuildStore
105
106
  history. Registration removal invalidates policy and grants from that registration.
106
107
 
@@ -114,6 +115,28 @@ State lookup prefers an exact match, then a unique case-insensitive match;
114
115
  unknown or ambiguous names are refused. Lists order configured triage, ready,
115
116
  doing, done first (deduplicated), then other names alphabetically.
116
117
 
118
+ `backlogState` and `rejectedState` have no defaults: an unset role holds no state,
119
+ and a policy that names neither behaves exactly as before. Each must differ,
120
+ case-insensitively, from the ready, claimed, done, triage and proposal states and
121
+ from the other; a publish that overlaps is refused with `400` naming the keys.
122
+ A named role's state is created when missing. Role names match existing states
123
+ case-insensitively, so `backlogState = "icebox"` next to an existing `icebox` (or
124
+ `Icebox`) state creates nothing: that state and its tickets now hold the role.
125
+ Removing a role leaves its state in place as a custom state. Operator and MCP
126
+ ticket tools resolve role moves through these policy names.
127
+
128
+ Clients that understand the roles send `x-autobuild-ticket-policy-roles: 1`. With
129
+ it, a publish is the complete policy, and omitting a role clears it. Without it,
130
+ as from released 1.2–1.4 clients, each omitted role keeps its saved value for the
131
+ same registration, so an older client never erases a newer client's mapping. If
132
+ a kept role would then name the same state as a lifecycle name that publish
133
+ sets, the service keeps the whole saved policy unchanged, answers
134
+ `200 { "ok": true }`, and records a diagnostic naming the colliding keys. A
135
+ policy read (`input: null`) includes the roles only with the header. Every
136
+ `/tickets/*` response, including errors, carries
137
+ `x-autobuild-ticket-policy-roles: 1`; a client publishing a role that receives
138
+ `400` without it reports that the service predates policy roles.
139
+
117
140
  `[tickets] url` selects the ticket service independently of the build store;
118
141
  otherwise the selected remote build store is used. A local build store requires
119
142
  an explicit ticket URL. Credentials are resolved for that selected service.
@@ -129,10 +152,14 @@ AB_TOKEN. Revocation, expiry, parent revocation and registration changes invalid
129
152
  grants. Existing combined-service BuildStore delegation remains supported.
130
153
 
131
154
  The service never contacts Linear or relays external trackers. If the project's
132
- source is Linear, file or another non-hosted source, machine HTTP, operator and
155
+ source is Linear, GitHub, file or another non-hosted source, machine HTTP, operator and
133
156
  MCP ticket surfaces refuse with a message naming that project and source: its
134
157
  tickets live in its own source, accessed directly by its dispatcher. This is a
135
158
  409 conflict, not an empty queue. The dispatcher's direct adapters are unchanged.
159
+ Configuration refusals carry a `code`: `external-ticket-source` for a non-hosted
160
+ source, `no-dispatcher-run` when a project has neither a published ticket policy
161
+ nor any recorded dispatcher run, and `effective-config-unavailable` for other
162
+ missing or unreadable configuration.
136
163
 
137
164
  ## Operations
138
165
 
@@ -142,7 +169,9 @@ The operation names and `input` values are:
142
169
  |---|---|---|
143
170
  | `states` | `{}` | `{name, tickets, about?}[]`, including empty states |
144
171
  | `add-state` | `{name, about?: string}` | `{state: {name,tickets,about?}, created: boolean}` |
172
+ | `state-counts` | `{names: string[]}` (1–16) | `{name, tickets}[]` for the names that resolve |
145
173
  | `list-ready` | `{labels?: string[], state?: string}` | `TicketListing` |
174
+ | `list-targeting` | `{nodeId: string}` | `TicketListing` of every state |
146
175
  | `get` | `{id}` | `Ticket \| null` |
147
176
  | `claim` | `{id}` | `{claimed: boolean}` |
148
177
  | `comment` | `{id, body}` | `{ok: true}` |
@@ -207,8 +236,8 @@ current required resolution fields; domain and storage types are unchanged.
207
236
  Build and harvest runners exchange project authority for signed, project-bound
208
237
  execution and phase credentials through `/credentials/delegate` (see the remote
209
238
  store protocol). Build-runner and build-phase credentials cannot call any ticket
210
- operation. Harvest-phase credentials permit only list-ready, get and
211
- dependency-states. Harvest-runner credentials permit those reads plus create
239
+ operation. Harvest-phase credentials permit only list-ready, list-targeting, get
240
+ and dependency-states. Harvest-runner credentials permit those reads plus create
212
241
  for filing proposals. Claim, comment, transition, update, add-blocker and
213
242
  remove-blocker require project or admin authority; their access is unchanged.
214
243
  Denied delegated calls return 403 with an error naming the grant kind and
@@ -222,6 +251,10 @@ Custom state creation uses `/^[a-z][a-z0-9-]{0,39}$/`; an optional purpose must
222
251
  be one nonblank line. A duplicate in any letter case is refused without
223
252
  changing purpose. `add-state` requires project or owner machine authority;
224
253
  ticket grants and harvest delegations can read states but cannot create them.
254
+ `state-counts` returns bounded per-state totals only, never ticket rows, with
255
+ each name resolved exactly or by one case-insensitive match. It requires project
256
+ or owner authority, not ticket grants or harvest delegations. A source without
257
+ state counts answers 409 conflict, with no listing fallback.
225
258
  Request context cannot supply lifecycle policy or insert another project's
226
259
  states. These operations use the existing wire version and strict envelopes.
227
260
 
@@ -232,13 +265,15 @@ Every ticket read includes an opaque `revision`. Pass it as `expectedRevision`
232
265
  `move`, `block` and `unblock`. A stale write fails without changing anything and
233
266
  reports the current revision. Omission preserves unguarded behavior. Blocker
234
267
  checks cover the entire batch. Dispatcher moves remain unguarded and change the
235
- revision. Sources without guarded writes, including Linear, refuse supplied
236
- revisions rather than ignoring them.
268
+ revision. Sources without guarded writes, including Linear and GitHub, refuse
269
+ supplied revisions rather than ignoring them.
237
270
 
238
271
  `ab ticket edit <id>` opens `$VISUAL`, falling back to `$EDITOR`, using TOML
239
272
  frontmatter and a Markdown body. Only title, body and labels are editable;
240
273
  id, blockers, creation key and reference comments are read-only. It saves only
241
- changed fields with the opening revision. Unchanged or formatting-only edits
274
+ changed fields with the opening revision. Sources without guarded writes,
275
+ including Linear and GitHub, re-read the ticket immediately before an
276
+ unguarded write and refuse a changed revision, with the no-lock race window of file checks. Unchanged or formatting-only edits
242
277
  write nothing. On conflict, invalid input or editor failure, the error names an
243
278
  absolute file path containing the edited text. Read the current ticket and
244
279
  reapply the intended changes before retrying; conflicts are never merged.
@@ -258,7 +293,8 @@ snapshot of fields, blockers and revision.
258
293
 
259
294
  `POST /tickets/mutate-if-revision` accepts the usual authenticated context and
260
295
  `input: { id, expectedRevision, mutation }`. Mutation is one of
261
- `{ kind: "update", patch: { title?, body?, labels?, kind?, target? } }`,
296
+ `{ kind: "update", patch: { title?, body?, labels?, kind?, target?,
297
+ priority?: "urgent" | "normal" } }`,
262
298
  `{ kind: "transition", state }`, or
263
299
  `{ kind: "blockers", operation: "block" | "unblock", ids: string[] }`.
264
300
  Unknown keys and empty patches are refused. Success returns `{ ok: true }`.
@@ -280,8 +316,11 @@ BuildStore protocol version.
280
316
 
281
317
  Create options accept optional `requestedId: string` alongside `state` and
282
318
  `idempotencyKey`. Older clients omit it and responses are unchanged. Unsupported
283
- sources reject supplied ids; Linear is not an import target. File sources keep
284
- filesystem-safe ids exactly and never overwrite an occupied id.
319
+ sources reject supplied ids. Linear is not an import target. GitHub rejects
320
+ supplied ids but is an import target: it allocates every issue number itself and
321
+ import remaps each ticket to the number GitHub returns, as described in the
322
+ migration procedure's GitHub section. File sources keep filesystem-safe ids
323
+ exactly and never overwrite an occupied id.
285
324
 
286
325
  Hosted sources preserve only literal own-team `<teamKey>-<n>` ids, where `n` is a
287
326
  positive canonical decimal within PostgreSQL bigint bounds. For example,
@@ -312,11 +351,86 @@ Effective metadata changes increment the revision; equivalent aliases are no-ops
312
351
  Ticket responses include these fields only with `x-autobuild-ticket-tree: 1`.
313
352
  This capability is independent of revision and comment capabilities and of the
314
353
  client version. Without it, both fields are projected away, preserving historical
315
- strict decoders. Current hosted clients send all three capability headers and
354
+ strict decoders. Current hosted clients send every capability header and
316
355
  default absent kind to `work`. Unfiltered listing includes all ticket states and
317
356
  empty nodes for `ab ticket tree`; dispatch and merge behavior are unchanged.
318
357
 
358
+ ### Targeted listing
359
+
360
+ `list-targeting` returns every ticket in every state whose `target` is exactly
361
+ `nodeId`, equal to unfiltered `list-ready` filtered by target, read through the
362
+ project's target index so its cost follows the node's children rather than the
363
+ project's ticket count. An unknown id returns an empty listing. A backing source
364
+ without targeted listing answers `409` with `code: "targeting-unsupported"`; the
365
+ service never filters a full listing instead. Ticket grants and harvest
366
+ delegations may call it wherever they may call `list-ready`.
367
+
368
+ Every `/tickets/*` response, including errors, carries
369
+ `x-autobuild-ticket-targeting: 1`. A current client declares `listTargeting`
370
+ only after a response from the service has carried that header, and settles the
371
+ decision before use: from the policy sync, or else from one `list-targeting`
372
+ probe for the reserved id `~negotiate`, which never names a ticket. An ok
373
+ response without the header, or a `404` or `400` refusal of `list-targeting`
374
+ without it, means the service predates the operation. Against such a service
375
+ the client never declares it, and integration observation uses the exhaustive
376
+ listing by that explicit decision. An inconclusive probe (a network failure or
377
+ an unmarked gateway error) fails source construction. A targeted read the
378
+ service later refuses fails closed, with no fallback within the pass.
379
+
380
+ ## Issue links
381
+
382
+ Hosted tickets store forge issue links as `issueLinks`, an array of
383
+ `{ "issue": N, "intent": "closes" | "refs" }` with unique positive issue numbers.
384
+ Create, update and guarded update accept the field; intent is required on the
385
+ wire. Update replaces the whole set and `[]` clears it. The service stores links
386
+ sorted by issue number. Effective changes increment the revision, and rewriting
387
+ an identical set is a no-op.
388
+
389
+ Ticket responses include nonempty `issueLinks` only with
390
+ `x-autobuild-ticket-issue-links: 1`, independently of the other capabilities and
391
+ of the client version. Without it, links are projected away for historical strict
392
+ decoders, and stored links survive their writes. Every `/tickets/*` response,
393
+ including errors, carries `x-autobuild-ticket-issue-links: 1`.
394
+
395
+ `dependency-states` entries for existing tickets include `state`, the blocker's
396
+ native state name, only with `x-autobuild-ticket-dependency-state: 1`. Without
397
+ it the field is projected away for historical strict decoders. A service that
398
+ predates the capability ignores the header and omits the field, which is
399
+ optional. Clients apply the configured rejected role to it; the service never
400
+ interprets it.
401
+
402
+ A service whose backing source cannot store links refuses a write naming them,
403
+ including `[]`, with `409 { "kind": "conflict", "code": "issue-links-unsupported" }`
404
+ before anything is written. A service predating issue links refuses the unknown
405
+ field with a `400` validation error and no capability header. Clients report both
406
+ as `TicketIssueLinksUnsupported`.
407
+
319
408
  Completed ticket imports record `tickets.migration-recorded` in the selected
320
409
  BuildStore repository journal, with export identity, origin/destination adapter
321
410
  names and the actual complete ID mapping. Requested-ID preservation alone does
322
411
  not establish continuity for in-flight builds; see the migration procedure.
412
+
413
+ ## Priority
414
+
415
+ Hosted tickets store `priority`, either `"urgent"` or `"normal"`. Create,
416
+ update and guarded update accept it as an optional field. A create that omits it
417
+ files a normal ticket, and an update that omits it never changes it. Tickets that
418
+ existed before the field read as normal. A priority change increments the
419
+ revision, and rewriting the same value is a no-op.
420
+
421
+ Ticket responses include `priority` on every ticket, `normal` included, only with
422
+ `x-autobuild-ticket-priority: 1`, independently of the other capabilities and of
423
+ the client version. Without it, priority is projected away for historical strict
424
+ decoders, whose writes never name it and so never clear it. Every `/tickets/*`
425
+ response, including errors, carries `x-autobuild-ticket-priority: 1`.
426
+
427
+ `list-ready` returns urgent tickets first, then normal ones, each class in filing
428
+ order, for every client. Ordering happens within the existing listing; it adds no
429
+ per-ticket reads.
430
+
431
+ A service whose backing source cannot store priority refuses a write naming
432
+ `urgent` with `409 { "kind": "conflict", "code": "priority-unsupported" }` before
433
+ anything is written. A service predating priority refuses the unknown field with a
434
+ `400` validation error and no capability header. Clients report both as
435
+ `TicketPriorityUnsupported`. Current clients omit `normal` on create, so a plain
436
+ create still works against such a service.
@@ -84,8 +84,11 @@ pending while ancestors restack or reconcile. A durable availability observation
84
84
  allows unchanged idle ticks, including after restart, to skip repository preparation
85
85
  and native auto-merge cancellation. Exact node/parent heads, contribution base,
86
86
  request contents, accepted ancestry, foreign aliases and confirmed landing evidence
87
- invalidate that observation when they change; polling timestamps do not. Failed
88
- assessments never establish unavailability. Availability is not proof of destination
87
+ invalidate that observation when they change; polling timestamps do not. Confirmed
88
+ landing evidence comes from every repository build, including mixed-version deferred
89
+ builds whose own decisions stay withheld, so the dispatcher check and the node
90
+ transaction assess the same fingerprint. Failed assessments never establish
91
+ unavailability. Availability is not proof of destination
89
92
  coverage. Moving to another destination branch explicitly settles obsolete requests
90
93
  with `destination-changed`; losing identities on the same branch leaves them waiting.
91
94
  Native auto-merge is suspended with confirmed, reusable receipts only when replay
@@ -126,8 +129,10 @@ Before replacement the kernel publishes retained tips, displaced heads and the
126
129
  temporary change under immutable exact archive refs. Remote archives also publish
127
130
  commits present only on the remote: GitHub uses create-only Git-reference REST creation
128
131
  when the workspace lacks the commit, retaining guarded Git pushes for local objects.
129
- Exact remote readback confirms publication, then a depth-one fetch by the archive ref
130
- (without tags or configured refmap expansion) restores missing commits and verifies them
132
+ Exact remote readback confirms publication, then a non-shallow fetch of only that exact
133
+ archive ref (without tags, configured refmap expansion or a depth limit) restores
134
+ missing commits and their missing ancestry, writes no shallow boundary, leaves an
135
+ already-shallow repository's existing boundaries unchanged, and verifies the commits
131
136
  locally before returning. `restack.*` facts record
132
137
  preparation, replay, intent, archived replacement, contention and completion.
133
138
  Unpublished request/loss records alone cannot preserve objects from a released
@@ -221,7 +226,11 @@ retry allowance. Rejected pushes, lease conflicts, dirty trees and unclassified
221
226
  errors retain their existing behavior.
222
227
 
223
228
  Preserved restoration checkpoints survive repeated replacement; a published
224
- reconcile or restack rewrite retires the old checkpoint.
229
+ reconcile or restack rewrite retires the old checkpoint. Node, restack and
230
+ reconcile rewrites also supersede a branch checkpoint that the build's bounded
231
+ record of its latest 64 replaced heads covers: provisioning keeps its archived
232
+ objects but never restores it over the branch. Coverage older than that bound
233
+ falls back to refusing divergent branch work.
225
234
  Recovery context applies to the following session and its repeated hydration; later
226
235
  sessions do not inherit obsolete reconstruction instructions.
227
236
 
@@ -244,7 +253,16 @@ external ticket state, missing ticket/state, or conflicting slug ownership termi
244
253
  automatic recovery with an `abandoned` resolution and diagnostic reason. The
245
254
  ticket is left unchanged; an operator can leave it finished or cancelled, or
246
255
  inspect ownership and explicitly return it to Ready for another attempt. These
247
- cases stop provider polling and diagnostic appends. Recovery failures are
256
+ cases stop provider polling and further durable diagnostic appends. The tick
257
+ that records the abandonment reports one dispatcher diagnostic naming the
258
+ ticket and attempt, whether the claim was confirmed or its provider outcome is
259
+ unknown, and the recorded reason. If that tick fails for any reason, its
260
+ failure error carries the diagnostics instead. Later ticks do not repeat it.
261
+ The `abandoned` resolution event records whether the claim was confirmed, and
262
+ default `ab watch` repository attention reports the same line once as it lands,
263
+ whether or not its tick failed; a fresh watch does not replay historical
264
+ abandonments.
265
+ Recovery failures are
248
266
  reported without preventing janitor, lease sweep, or other dispatch recovery.
249
267
  This is not general process
250
268
  crash recovery. Confirmed Ready/Triage transitions settle idempotently, so a
package/docs/seams.md CHANGED
@@ -14,7 +14,7 @@ Adapters supply storage, agent execution, code publication, workspaces and ticke
14
14
  ## Storage and tickets
15
15
 
16
16
  - **BuildStore.** Local SQLite with filesystem artifacts by default; a remote store implementing the remote BuildStore protocol.
17
- - **Tickets.** Local files, Linear, or hosted tickets. A hosted Store doesn't require hosted tickets.
17
+ - **Tickets.** Local files, Linear, hosted tickets, or GitHub issues. A hosted Store doesn't require hosted tickets.
18
18
 
19
19
  See [Build store](build-store.md) and [Tickets](ticket-sources.md).
20
20
 
@@ -56,7 +56,7 @@ See [Dispatcher hosting](dispatcher-hosting.md).
56
56
 
57
57
  ## Seam guides
58
58
 
59
- - [Tickets](ticket-sources.md): file, Linear, hosted, ticket trees.
59
+ - [Tickets](ticket-sources.md): file, Linear, hosted, GitHub, ticket trees.
60
60
  - [Agent runtimes](agent-runtimes.md): Claude Code, Codex, Pi, models.
61
61
  - [Workspaces](workspaces.md): git worktree, Vercel Sandbox, provisioning.
62
62
  - [Forges](forges.md): GitHub, local git, publication adapters.