@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
package/docs/setup.md CHANGED
@@ -126,7 +126,9 @@ exits nonzero on failure. Then:
126
126
  alternate. The runtime that launched setup and the temporary fresh-skeleton
127
127
  default do not constrain the final arrangement.
128
128
  3. Choose the ticket source and workflow states. Confirm account/team facts and
129
- required environment credentials. Author a repository-owned acceptance-check skill and select it from an agent
129
+ required environment credentials. The `github` source needs no new secret:
130
+ it uses the forge's `GITHUB_TOKEN`, `GH_TOKEN` or `gh auth login`, which must
131
+ read and write the repository's issues. Author a repository-owned acceptance-check skill and select it from an agent
130
132
  verify step in every repository. An **acceptance check** is a repository-owned agent verify step that runs the built software, exercises each acceptance criterion in the spec, attaches evidence, and returns a typed verdict. Every repository must configure one. It is not a test suite and leaves no test files behind.
131
133
  Wire an existing maintained end-to-end or browser test suite into an ordinary `check` step. If none exists, do not create one during setup. The acceptance check neither substitutes for nor seeds a suite.
132
134
  4. Preserve an existing `autobuild.toml` and unrelated repository choices on a
@@ -391,14 +393,10 @@ manifest-directed artifact paths remain authoritative. Never commit scratch.
391
393
  1. Run `ab context` and read `"$AB_CONTEXT_DIR/context.json"`. The verifier receives
392
394
  `$AB_CONTEXT_DIR/spec.md`, the configured step,
393
395
  the commit range, and, after escalation is answered, `$AB_CONTEXT_DIR/guidance.json`.
394
- Node verify sessions also receive `nodeVerification` in the context manifest:
395
- contribution specs and a provenance index mapping commits to the builds that
396
- introduced them. Read those specs through the manifest's allocated paths.
397
- Also read `handPushedCommits: [{sha, originalSha, message}]` from the manifest
398
- and index. These hand-pushed node commit messages express maintainer-authorized
399
- intent; judge quality and consistency, and never fail them solely for lacking
400
- a covering spec. Other node changes are authorized when the node spec or the introducing
401
- contribution's spec covers it; use the commit index to find that spec.
396
+ Node verify sessions also receive `nodeVerification`: contribution specs,
397
+ a commit provenance index and owned `handPushedCommits`, read through the
398
+ manifest's allocated paths. Judge them as described in
399
+ [node verification context](integration-tree.md#node-verification-context).
402
400
  2. Exercise each applicable acceptance criterion through the repository's real
403
401
  application lifecycle. Prefer the narrowest honest flow that catches a
404
402
  regression.
@@ -434,7 +432,7 @@ Owner admin requests require an explicit registered context.repo; project creden
434
432
  cannot select another project. See [local builds with hosted tickets](#local-builds-with-hosted-tickets).
435
433
 
436
434
  The service never contacts Linear. Projects with external sources (including
437
- file and Linear) keep using those sources directly through their dispatcher;
435
+ file, Linear and GitHub) keep using those sources directly through their dispatcher;
438
436
  service ticket HTTP and operator surfaces refuse with project/source
439
437
  feedback rather than returning an empty queue.
440
438
 
@@ -463,6 +461,9 @@ To retain earlier names configure `triageState = "Backlog"`,
463
461
  `claimedState = "Doing"`, `doneState = "Done"`, and the desired `readyState`.
464
462
  Existing ticket rows are never renamed. Older combined-service clients continue
465
463
  using the uploaded dispatcher configuration until independent policy is published.
464
+ Also set the recommended `backlogState` and `rejectedState` so agents can defer
465
+ and decline work by role; role moves create a missing state on first use.
466
+ Published policy carries both roles, and publishes from older clients keep them.
466
467
 
467
468
  ## Forge readiness
468
469
 
@@ -522,9 +523,11 @@ with hosted ticket numbering reset to 1. See
522
523
  ## Hosted dispatch and local viewing
523
524
 
524
525
  A plain `ab dispatch` reads dispatch placement once before starting local execution.
525
- For a hosted project it opens the Store-only viewer automatically, displaying
526
+ For a hosted project it opens the viewer automatically, displaying
526
527
  `viewer · dispatched by <host>` from the placement origin (including a nondefault
527
528
  port). `--once`, `--plain`, and `--interval` retain their viewer meanings.
529
+ The viewer reads its dashboard from the Store; its one ticket-source read is
530
+ the header's triage count, through the source's optional `countStates`.
528
531
  `--takeover` explicitly dispatches locally, with a warning that it can displace
529
532
  the hosted dispatcher; it cannot be combined with `--viewer`. Startup intake
530
533
  flags require `--takeover` when placement selects viewer.
@@ -533,6 +536,9 @@ An unreadable placement fails closed with a typed error naming the cause:
533
536
  use `--viewer` to watch or `--takeover` to dispatch locally. Both explicit modes
534
537
  skip placement discovery. Older services without the capability and projects
535
538
  with unknown or nonhosted placement retain local dispatch behavior. Local stores
536
- need no placement request. Origin mode (`--repository` or `AB_REPOSITORY`) and
537
- hosted cron dispatch bypass this check. Placement is a startup snapshot, not a
539
+ need no placement request. Failing to resolve the checkout's store selection
540
+ (for example, a malformed `autobuild.toml`) is not a placement failure: default
541
+ startup reports it as a repository resolution error naming its cause, and
542
+ neither explicit mode bypasses it. Origin mode (`--repository` or
543
+ `AB_REPOSITORY`) and hosted cron dispatch bypass this check. Placement is a startup snapshot, not a
538
544
  liveness probe or a polling input.
@@ -164,7 +164,8 @@ order.
164
164
  The spec is the build's contract artifact (kind `spec`, revision 0).
165
165
  Every downstream reviewer approves conformance to its pinned revision.
166
166
  For leaves, a phase that discovers the spec itself is wrong raises an
167
- escalation (`ab escalate`); a human answers, the spec gets revision N+1,
167
+ escalation (`ab escalate`); your operator agent, within your instructions and
168
+ authority, or you answer it with a revised spec. The spec gets revision N+1,
168
169
  and the leaf restarts from `plan` after any unfinished reconcile resumes under
169
170
  the revised spec and its publication is confirmed.
170
171
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  `ab ticket create --blocked-by` validates prerequisite ids and records blocking
4
4
  relationships, but a single CLI command is **not an atomic publication guarantee**.
5
- In particular, direct Linear creates the issue first and adds
5
+ In particular, direct Linear and GitHub create the issue first and add
6
6
  its blocker relationships in separate requests. If the issue is already in the
7
7
  ready state, a dispatcher can see it before those relationships exist. A
8
8
  successful create response containing every blocker does not prove that no build
@@ -19,6 +19,8 @@ before publishing it. Use the repository's triage state when it differs from its
19
19
  ready state. This temporary staging does not require another placement approval.
20
20
  If no non-ready state can be established, resolve that before creating the
21
21
  dependent; never guess that a name such as "Backlog" is safe in every repository.
22
+ A configured backlog role is a known non-ready state: `ab ticket move <id>
23
+ --role backlog` reaches it without knowing its native name.
22
24
 
23
25
  1. Create prerequisites in dependency order and extract each new `.ref.id` from
24
26
  the complete `--json` response, never the human confirmation line.
@@ -28,7 +30,12 @@ dependent; never guess that a name such as "Backlog" is safe in every repository
28
30
  non-ready and every expected blocker is present. Repair missing relationships
29
31
  through `ab ticket block`, then read back again.
30
32
  4. Only after verification, move it to the intended final state with
31
- `ab ticket move <id> <state> --json`. Verify the final state and blockers.
33
+ `ab ticket move <id> <state> --json`, or by role with
34
+ `ab ticket move <id> --role ready --json`. Verify the final state and blockers.
35
+
36
+ A blocker in the configured rejected state never resolves: its dependents stay
37
+ unclaimed until the blocker leaves that state or is removed with
38
+ `ab ticket unblock`.
32
39
 
33
40
  For a repository whose configured triage and ready states are `Triage` and
34
41
  `Ready`, respectively, and whose human requested ready placement:
@@ -77,13 +84,24 @@ parent history. An empty completed contribution is satisfied; missing evidence,
77
84
  an open or aborted node, or ambiguous newest build generations remain queued.
78
85
  Older successful generations are never substituted for the newest build.
79
86
 
80
- Destination observations retain versioned, head-bound Git witnesses (reachable
81
- commit SHAs and direct build trailers) and a fixed-length evidence digest. Current
87
+ Destination observations record a head-bound, query-scoped probe rather than
88
+ the destination's history: only the commit SHAs and direct build trailers in the
89
+ proof closure of the identities being decided (blocker identities, plus the
90
+ landings and confirmed foreign aliases that could transport them), which of those
91
+ are reachable from the sampled head, presence answers for only those identities,
92
+ and a fixed-length evidence digest. Observation size is bounded by that closure,
93
+ independent of the destination's reachable commit count and of repository history.
94
+ While the head is unchanged and the probe covers the current questions, current
82
95
  confirmed landings and aliases from only the destination's accepted ancestry are
83
- reapplied before reuse. Unrelated merged history and ready destinations do not
84
- invalidate this proof. Head changes require a fresh Git sample; legacy observations
85
- without witnesses refresh once rather than replaying repository history. Current
86
- readiness and newest-generation checks still apply before claim.
96
+ reapplied without Git; unrelated merged history and ready-set changes neither
97
+ invalidate it nor append events. A moved head requires a fresh Git sample. A
98
+ newly relevant landing or a new question needs only a new probe: a dispatcher
99
+ still holding the full in-memory witness for that branch and head compacts one
100
+ without Git, and otherwise samples Git once. Observations without a probe,
101
+ including older full-history witnesses, are never trusted for admission: they
102
+ are re-derived once the same way, and an unavailable sample leaves the dependent
103
+ queued; neither replays repository history. Current readiness and
104
+ newest-generation checks still apply before claim.
87
105
 
88
106
  - Same node: the blocking change merges directly into the target.
89
107
  - Ancestor: the change merges into an ancestor, then presence demand restacks only the required path to the target.
@@ -2,7 +2,9 @@
2
2
 
3
3
  Export and import use the ordinary file ticket layout. They operate on tickets
4
4
  and current attachments through the ticket source; neither command contacts the
5
- forge. File and hosted sources support import. Linear supports export only.
5
+ forge, except that a GitHub source reads and writes the repository's issues.
6
+ File, hosted and GitHub sources support import. Every built-in source supports
7
+ export.
6
8
 
7
9
  1. Pause intake and quiesce build-related ticket writes and other ticket writers
8
10
  for the cutover. In-flight builds need not be aborted. Import preflight does
@@ -13,8 +15,8 @@ forge. File and hosted sources support import. Linear supports export only.
13
15
  directory only after all reads succeed. Back up the target tracker too.
14
16
  3. Configure the new `[tickets]` source, or use `ab connect --tickets URL` for a
15
17
  hosted ticket service. Keep the export directory intact.
16
- 4. Run `ab ticket import /path/to/export`. Inspect its printed ticket and state
17
- mappings and `/path/to/export/.ab-import-map.json`.
18
+ 4. Run `ab ticket import /path/to/export [--states <state,…>]`. Inspect its
19
+ printed ticket and state mappings and `/path/to/export/.ab-import-map.json`.
18
20
  5. Import records a durable source/ID mapping in the same BuildStore and repository
19
21
  that hold the existing builds, after tickets, metadata and assets finish.
20
22
  Keep that BuildStore/repository identity through the cutover.
@@ -37,13 +39,40 @@ through export when file or Linear tickets have attachments there.
37
39
  State directory names use lowercase letters, digits and hyphens, start with a
38
40
  letter and contain at most forty characters. Export maps `In Progress` to
39
41
  `in-progress`, `Backlog` to `backlog`, and `Done` to `done`. It retains each ticket's
40
- state rather than assigning lifecycle roles. Distinct names that collapse to the
42
+ state, and the manifest records which lifecycle roles each state held under the
43
+ exporting configuration: triage, ready, claimed, done, backlog, rejected, and the
44
+ create and proposal placements. Distinct names that collapse to the
41
45
  same directory fail before publication. The hidden `.ab-migration.json` records
42
46
  original display names and the state map. Import also accepts ordinary legacy
43
47
  file layouts: it reuses exact or unique case-insensitive target states before
44
48
  normalizing new names. A seeded `done` satisfies `Done`; absent `In Progress`
45
49
  creates `in-progress`. Ambiguous matches and colliding state maps fail preflight.
46
50
 
51
+ A state that held a role lands in the destination's state for the same role,
52
+ whatever either source calls it. For example, an `icebox` backlog lands in a
53
+ `later` backlog, and Linear's `Backlog` triage lands in `triage`. A state holding
54
+ several roles takes the first of done, rejected, claimed, ready, backlog, triage,
55
+ proposal and create. If the destination configures no backlog or rejected state
56
+ for such a state, import refuses and names the `[tickets]` key to set. States
57
+ without a role, and exports made before roles were recorded, map by name as above.
58
+
59
+ ## Importing selected states
60
+
61
+ `ab ticket import <dir> --states triage,ready,icebox` imports only the tickets in
62
+ the named states and creates only those states. Teams moving to a new tracker
63
+ often take their open work and leave closed history behind. A name matches an
64
+ export directory exactly, then by unique case-insensitive match, then by the
65
+ original display name the manifest recorded (`In Progress` for `in-progress`).
66
+ An unknown name is refused, and the refusal lists the export's states.
67
+
68
+ A blocker on a left-out ticket in the done role is dropped as resolved. Any other
69
+ reference to a left-out ticket is reported before any write, and nothing is
70
+ imported. That covers a blocker in another state, an integration-tree target, and
71
+ an issue link to a left-out issue in an export from GitHub. Import also refuses a
72
+ selection that leaves out a ticket an unfinished build is working on or targets.
73
+ The refusal names the build and the ticket, so in-flight work keeps its continuity.
74
+ Without `--states`, every ticket is imported.
75
+
47
76
  File targets retain source ids. Hosted targets keep canonical own-team ids:
48
77
  `AUT-706` imported into team `AUT` stays `AUT-706`. Other ids receive numbers above
49
78
  all existing and preserved incoming numbers. Known clashes with unrelated tickets
@@ -52,7 +81,8 @@ Content similarity and stale mapping files never establish identity.
52
81
 
53
82
  Creation keys establish identity. Exports retain existing keys and assign keys to
54
83
  legacy tickets. Importing an ordinary file layout first saves a hidden migration
55
- identity and keys in that input directory. Preserve this file and the input across
84
+ identity and keys in that input directory. The identity also records when it was
85
+ first saved, and that time is passed as the creation keys' reservation time. Preserve this file and the input across
56
86
  retries. After interruption, rerun the same command: committed creates are adopted
57
87
  by key even if their mapping write failed. Adopted bodies and other fields are not
58
88
  overwritten. Missing blockers and comments are replayed, and unchanged attachments
@@ -62,7 +92,7 @@ timestamps remain in the export; imported comments use the target's metadata.
62
92
 
63
93
  Portable records use TOML frontmatter between `+++` fences and an unchanged
64
94
  Markdown body. Alongside `id`, `title`, `labels`, `blockedBy` and `idempotencyKey`,
65
- optional `comments` contain `body`, `createdAt` and optional `author`. Optional
95
+ optional `issueLinks` contain `issue` and `intent` (`closes` or `refs`), optional `priority` is `"urgent"` (absent means normal), optional `comments` contain `body`, `createdAt` and optional `author`. Optional
66
96
  `attachments` contain `kind`, `name`, `layout` (`file` or `tree`) and `entries`:
67
97
  `{ type = "dir", path = "empty" }` or
68
98
  `{ type = "file", path = "image.png", base64 = "…" }`. Common asset limits and
@@ -78,12 +108,45 @@ no continuous sync, assignee migration, state history or build-history migration
78
108
 
79
109
  Integration-tree `kind` and `target` are preserved in portable frontmatter.
80
110
  Import validates the complete target graph before changing the destination and
81
- refuses a destination that cannot preserve metadata. It creates or adopts every
111
+ refuses a destination that cannot preserve metadata. Issue links and urgent
112
+ priority are preserved the same way, and a destination that cannot store them is refused before any write. It creates or adopts every
82
113
  identity, establishes node kinds, then applies targets using the durable id map,
83
114
  just like blockers. Input order does not matter. Resuming also restores edges on
84
115
  adopted tickets; normal destination validation still guards existing graphs and
85
116
  node demotion. Older work-only exports remain valid.
86
117
 
118
+ ## GitHub
119
+
120
+ GitHub chooses issue numbers, so import into a `github` source remaps every
121
+ ticket. Check the printed mapping and `.ab-import-map.json`, which list each
122
+ original id with its new issue number. Blockers are rewritten through that
123
+ mapping and become native issue dependencies. Comments become issue comments,
124
+ and attachments go to the BuildStore under the new number. States become
125
+ `autobuild:<state>` labels. The done role closes the issue as completed, the
126
+ rejected role closes it as not planned, and triage leaves it open without a state
127
+ label. Each issue carries a creation key in a hidden marker, so an interrupted
128
+ import resumes with the same command and adopts the issues it already opened.
129
+ Resuming never duplicates an issue, and it replays missing blockers, comments and
130
+ assets.
131
+
132
+ Before any write, import reports every problem together: states that cannot be
133
+ `autobuild:` labels (for example `proposal`, or names that are not lowercase),
134
+ a rejected state when `[tickets].rejectedState` is unset, and ticket labels that
135
+ would collide with a state label (`autobuild:<state>`) or an issue-link label
136
+ (`autobuild-link:…`). The `autobuild:proposal` and `autobuild:aborted` marker
137
+ labels are ordinary labels and import as-is. Node kinds become the exact `node`
138
+ label, and targets become sub-issue relationships to the remapped node issues.
139
+ Issue links are kept. They are rewritten through the mapping only when the export
140
+ came from GitHub, because only then do they name the exported tickets.
141
+
142
+ Export from a `github` source covers every issue, closed ones included. It records
143
+ comment history with authors and timestamps, kinds, targets, blockers and issue links, and skips
144
+ pull requests. An issue it cannot read as a ticket, such as one with two state
145
+ labels, fails the export. Issues closed as not planned export in the rejected
146
+ role even when `[tickets].rejectedState` is unset. Export and import read comment
147
+ history explicitly. The GitHub source still lists no comment history in
148
+ `ab ticket show`, and dispatcher ticks never read it.
149
+
87
150
  ## In-flight builds
88
151
 
89
152
  A recorded migration resolves old source-qualified ticket references through the
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  title: "Tickets"
3
3
  group: "reference"
4
- description: "Configure file, Linear, or hosted tickets and implement a ticket-source adapter."
4
+ description: "Configure file, Linear, hosted, or GitHub tickets and implement a ticket-source adapter."
5
5
  label: "Ticket sources"
6
6
  order: 13
7
7
  ---
@@ -21,6 +21,7 @@ Install with `bun add -d --exact @defrex/autobuild`. Examples are complete minim
21
21
  | `file` | tickets you edit as plain files | none |
22
22
  | `linear` | a team already grooming in Linear | `LINEAR_API_KEY` |
23
23
  | `hosted` | a project tracker shared by agents and clients | saved `ab connect` credential |
24
+ | `github` | a team already working in the repository's GitHub issues | `GITHUB_TOKEN`, `GH_TOKEN` or `gh auth login` |
24
25
 
25
26
  ### Local files (`file`)
26
27
 
@@ -37,11 +38,14 @@ createState = "triage"
37
38
  triageState = "triage"
38
39
  proposalState = "triage"
39
40
  doneState = "done"
41
+ backlogState = "backlog"
42
+ rejectedState = "rejected"
40
43
  ```
41
44
  <!-- seam-config:end -->
42
45
 
43
46
  - **States are directories** (`.tickets/ready/`, `.tickets/doing/`). Claims move to `doing`; `claimedState` isn't configurable.
44
47
  - **Claiming** needs `readyState`, every `readyLabels` entry and resolved blockers; `[]` adds no label gate.
48
+ - **Backlog and rejected** directories are created on the first role move into them.
45
49
 
46
50
  Initialize with `bun ab init`; manage with `bun ab ticket states` and the other ticket commands.
47
51
 
@@ -61,6 +65,7 @@ createState = "Backlog"
61
65
  triageState = "Backlog"
62
66
  proposalState = "Backlog"
63
67
  doneState = "Done"
68
+ rejectedState = "Canceled"
64
69
  ```
65
70
  <!-- seam-config:end -->
66
71
 
@@ -69,7 +74,9 @@ Replace `ENG` and the case-sensitive workflow names with your team's.
69
74
  - **Admission.** `teamKey` selects the team; `readyState`, every `readyLabels` entry and optional `readyAssignee` filter it.
70
75
  - **Labels.** `readyLabels` defaults to `["autobuild"]`; `[]` removes the gate.
71
76
  - **No `project` key.** Scope the queue through team access, states and labels.
77
+ - **Priority.** Linear's Urgent priority reads as `urgent`; every other priority, including none, reads as `normal`. `--priority urgent` sets Urgent. `--priority normal` clears Urgent to No priority and leaves High, Medium or Low untouched.
72
78
  - **Rate limits** are shared with your other API callers.
79
+ - **Backlog and rejected.** Neither role has a default, and neither may share a state with triage. Here `Backlog` is the triage state, so a deferred-work state needs its own name, such as `backlogState = "Icebox"`. Linear counts `Canceled` as complete; mapped to `rejectedState`, it no longer resolves blockers.
73
80
 
74
81
  ### Hosted (`hosted`)
75
82
 
@@ -94,21 +101,70 @@ createState = "triage"
94
101
  triageState = "triage"
95
102
  proposalState = "triage"
96
103
  doneState = "done"
104
+ backlogState = "backlog"
105
+ rejectedState = "rejected"
97
106
  ```
98
107
  <!-- seam-config:end -->
99
108
 
100
109
  - `teamKey` identifies the registered project's team.
101
110
  - **URL.** `tickets.url` defaults to the remote BuildStore service (`AB_STORE` or `[store].url`); it's required with a local Store, as here.
102
111
  - **Authority.** A separate ticket service needs its own project credential; a Store connection grants nothing there. Delegated child sessions are read-only and can't redefine policy.
112
+ - **Backlog and rejected.** `ab connect` and every policy publication carry both roles, so operator and MCP role moves use them too. Mapping a role onto an existing state, such as `backlogState = "icebox"`, keeps that state and its tickets; a missing role state is created. Blocker facts carry each blocker's state, so a rejected blocker is named in diagnostics.
113
+
114
+ ### GitHub (`github`)
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.
117
+
118
+ <!-- seam-config:start -->
119
+ ```toml
120
+ [tickets]
121
+ source = "github"
122
+ readyState = "ready"
123
+ readyLabels = ["autobuild"]
124
+ claimedState = "doing"
125
+ createState = "triage"
126
+ triageState = "triage"
127
+ proposalState = "triage"
128
+ doneState = "done"
129
+ backlogState = "backlog"
130
+ rejectedState = "rejected"
131
+ ```
132
+ <!-- seam-config:end -->
133
+
134
+ `source = "github"` alone is enough: every other key shown is its default, except the two roles, which `ab init` writes. `teamKey`, `dir` and `url` are refused.
135
+
136
+ - **Ids** are issue numbers; commands accept `123` and `#123`. Title, body and labels are the issue's. Pull requests are never tickets.
137
+ - **States are `autobuild:` labels.** An open issue with one `autobuild:<state>` label is in that state, and an open issue with none is in triage, so issues filed on GitHub arrive there. An issue with two or more state labels is left out of listings with a diagnostic naming it and its labels. `ab ticket state create icebox --about "…"` creates the `autobuild:icebox` label, with the purpose as its description. A name is one to forty lowercase letters, digits or hyphens, starting with a letter.
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
+ - **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
+ - **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.
142
+ - **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
+ - **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
+ - **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
+ - **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
+ - **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
+ - **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
+ - **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
+ - **Creation keys** live in a hidden marker in the issue body. A keyed create needs `idempotencyKeyReservedAt`; harvest supplies it.
151
+
152
+ ### Optional issue links
153
+
154
+ 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.
155
+
156
+ ### Optional priority
157
+
158
+ A ticket is `urgent` or `normal` (the default); the dispatcher claims urgent ready work first. The `file` and `hosted` sources store priority: as `priority = "urgent"` frontmatter with no key for normal (`file`), or transactional project data covered by the ticket revision (`hosted`, whose ready listing returns urgent tickets first). `linear` uses its native Urgent priority, described in its section above.
103
159
 
104
160
  ### Optional ticket tree
105
161
 
106
- All three sources declare `integrationTree: true`, storing kind and target as frontmatter (`file`), transactional project data (`hosted`), or the exact `node` label plus the parent relationship (`linear`).
162
+ The `file`, `hosted`, `linear` and `github` sources declare `integrationTree: true`, storing kind and target as frontmatter (`file`), transactional project data (`hosted`), the exact `node` label plus the parent relationship (`linear`), or the exact `node` label plus sub-issues (`github`).
107
163
 
108
164
  - **Targets** resolve to canonical ids in the same source and pick the integration destination, not execution order; blockers are a separate graph. See [integration](integration-overview.md).
109
165
  - **Updates.** Omitted `kind` or `target` keeps the value. New tickets default to work; `kind = "work"` resets kind; `target = null` clears a target in the typed API (not TOML syntax).
110
166
  - **Validation.** Target existence, node kind, self/ancestor cycles, corrupt ancestor chains and demoting a node with children are checked before any write; invalid metadata rejects the whole patch.
111
- - **Enumeration.** `listAll` lists every state, ignoring ready filters.
167
+ - **Enumeration.** `listAll` lists every state, ignoring ready filters. `listTargeting`, when provided, lists the tickets targeting one node and is what integration observation uses; `github` and `hosted` provide it.
112
168
  - **Without the capability**, a source keeps CRUD but must refuse kind/target writes, not drop them.
113
169
 
114
170
  ## Writing your own
@@ -119,6 +175,7 @@ An adapter must:
119
175
 
120
176
  - preserve lifecycle, claim and blocker-completion semantics
121
177
  - create idempotently under retries, with stable visible creation keys
178
+ - if its key lookup is bounded by time, require `idempotencyKeyReservedAt`, the earliest time the key could first have been used, and refuse a keyed create without it
122
179
  - return valid records from `listReady` with diagnostics for malformed ones, but propagate infrastructure failures
123
180
  - declare revision support honestly: guarded writes reject stale revisions; unsupported guards fail explicitly
124
181
  - never report success for a partial mixed update
@@ -129,6 +186,8 @@ Test with a `TicketSourceContractFactory` returning a `TicketSourceContractHarne
129
186
  bun ab plugin test ticket-source acme
130
187
  ```
131
188
 
189
+ 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
+
132
191
  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.
133
192
 
134
193
  Native paging is an optional API 1.9 ticket-source capability:
@@ -143,8 +202,26 @@ match the exhaustive listing. The shared `describeTicketSourceContract` suite
143
202
  automatically compares declared native paging with full-read windows.
144
203
 
145
204
  Only paged operator listings select this capability. Sources without it retain
146
- the full-read/reverse/slice fallback; native errors propagate. Unpaged operator
205
+ the full-read fallback, which orders the listing before offset and limit: by
206
+ 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
147
208
  listings, CLI ticket lists and dispatcher ready scans remain exhaustive through
148
209
  `listReady`/`listAll`. The hosted PostgreSQL source counts matches without
149
- bodies and reads only the SQL-bounded window. File, Linear and the remote
210
+ bodies and reads only the SQL-bounded window. File, Linear, GitHub and the remote
150
211
  `HostedTicketSource` retain fallback; the POST list-ready protocol stays exhaustive.
212
+
213
+ Bounded state counts are another optional capability:
214
+ `countStates?(names: readonly string[]): Promise<TicketStateCount[]>`. It returns
215
+ `{name, tickets}` for each requested name that resolves (exactly, else by one
216
+ case-insensitive match) and never returns ticket rows. Only interactive
217
+ dashboards and viewers read it, for the header's triage count: a dashboard
218
+ viewer, or a dispatcher driving an interactive dashboard or feeding a viewer,
219
+ samples it in the background at most once per 60 s, never inside a dispatcher
220
+ tick. Without it, the header shows `–`, and nothing falls back to a listing. A store-backed source should answer from maintained
221
+ totals so the cost does not grow with the number of tickets: the hosted
222
+ PostgreSQL source reads trigger-maintained totals, and the remote
223
+ `HostedTicketSource` forwards the read to the server. The file source counts
224
+ each matched state's directory entries without parsing a ticket, so its local
225
+ cost grows with the files in that state. The GitHub source sends one GraphQL request per call, plus one per further page of 100 `autobuild:` labels, so its cost grows with matching labels rather than tickets, and keeps no count between calls. Linear does not implement it. When a source declares
226
+ both `countStates` and `listStates`, the shared contract suite checks that they
227
+ agree.
package/docs/tickets.md CHANGED
@@ -13,11 +13,12 @@ A ticket says what change to make and why. The tracker is the input; the build's
13
13
 
14
14
  ## Choose a source
15
15
 
16
- Autobuild ships three ticket sources; plugins can register more through the same port:
16
+ Autobuild ships four ticket sources; plugins can register more through the same port:
17
17
 
18
18
  - **File** stores tickets in lifecycle directories.
19
19
  - **Linear** (direct) uses your team's workflow.
20
20
  - **Hosted** is its own project-scoped service, not a Linear proxy.
21
+ - **GitHub** uses the repository's own issues, with states as labels.
21
22
 
22
23
  The source supplies content, workflow states, labels, and blockers; configuration picks the source and ready gate. Everything else is source-agnostic.
23
24
 
@@ -40,13 +41,44 @@ The spec standard asks for:
40
41
 
41
42
  Your operator agent grooms the ticket with you using `ab-spec`, then moves it to the ready state with any required labels. Dispatch's spec gate returns ready tickets that can't become conforming specs to Triage with an explanation.
42
43
 
44
+ When the work comes from a forge issue, record it on the ticket: `--issues 824` when the ticket fully resolves issue #824 (`closes`, the default), or `--issues 820:refs` when it only partly addresses it. `ab ticket update --issues` replaces the set and `--issues ''` clears it. Sources that can't store issue links refuse the write and name the source.
45
+
46
+ A build freezes the links when it claims the ticket. On GitHub, a leaf build that targets the default branch writes `Closes #824` or `Refs #820` lines at the end of its PR body and before the trailers of its landed commit, so merging closes each fully resolved issue and back-links the rest. A leaf that targets a node branch writes only `Refs` lines into its PR body, which never close anything, and none into its landed commit; its links ride up to the root node's PR into the default branch, together with the node's own links, so they close when the node lands. A build that turns out to only partly resolve an issue downgrades it to `refs` with a recorded reason.
47
+
48
+ ```sh
49
+ bun ab ticket create "Close stale sandboxes" --body spec.md --issues 824,820:refs
50
+ ```
51
+
52
+ When a ticket must go next, such as a fix for a stuck build, mark it urgent instead of moving other tickets out of ready: `--priority urgent` on `ab ticket create` or `ab ticket update`. `--priority normal` removes it. The `file`, `hosted` and `linear` sources store priority. See [Ticket sources](ticket-sources.md#shipped-adapters).
53
+
54
+ ```sh
55
+ bun ab ticket update AUT-12 --priority urgent
56
+ ```
57
+
58
+
59
+ ## Backlog and rejected
60
+
61
+ Two optional lifecycle roles sit beside triage, ready, claimed and done:
62
+
63
+ - **Backlog** holds work you deferred on purpose. Nothing dispatches from it.
64
+ - **Rejected** holds work you considered and declined. A rejected ticket never unblocks the tickets it blocks, and a rejected child no longer holds its node open.
65
+
66
+ Both roles are recommended. Map each to a native state with `[tickets].backlogState` and `[tickets].rejectedState`; `ab init` writes `backlog` and `rejected` for the file, hosted and GitHub sources, and a Linear team might use `Icebox` and `Canceled`. With a key unset, that role doesn't exist. Your operator agent moves tickets by role, so it never needs your native names:
67
+
68
+ ```sh
69
+ bun ab ticket move AUT-12 --role backlog
70
+ ```
71
+
72
+ Moving a ticket back to triage, backlog or ready restores ordinary behavior. "Building" isn't a role you move work into: it's the claimed state (`doing` for the file source), which the dispatcher sets.
43
73
 
44
74
  ## Ready is a gate, not a guarantee
45
75
 
46
76
  The dispatcher claims only tickets in the ready state with the required labels and any source-specific filter. A ready ticket still waits on:
47
77
 
48
78
  - **Blockers.** Unresolved prerequisite tickets keep it queued; they don't create a blocked build. With nodes, prerequisites with builds must be present at the sampled destination; see [integration and blocker presence](integration-overview.md).
49
- - **Destination and capacity.** Its target must accept new work, and a capacity slot must be free.
79
+ - **Destination and capacity.** Its target must accept new work, and a capacity slot must be free and not reserved for an integration node awaiting verification or a finished build waiting to re-verify or reconcile.
80
+
81
+ When a slot is free, the dispatcher takes urgent ready tickets first, then normal ones, each in the source's order. Priority changes only that order: a blocked urgent ticket waits like any other while normal work proceeds, and an urgent ticket never stops or pauses a running build. The web dashboard's Queue tab lists tickets in the same order and marks urgent ones `URGENT`; the mark shows priority, not that the ticket will dispatch next.
50
82
 
51
83
  Before ready filing, the agent checks `ab repository status --json`. With live
52
84
  `operator.registrations`, it records intent, rejected alternatives and out-of-scope
@@ -55,9 +55,9 @@ bun ab harvest status
55
55
 
56
56
  - **Intake and pause:** intake on, repository not paused. Resume a deliberately paused repository only when work should proceed.
57
57
  - **Ready state:** ticket in the exact ready state with every required label.
58
- - **Blockers and destination:** blockers done, target node open, required changes in the destination.
58
+ - **Blockers and destination:** blockers done, target node open, required changes in the destination. A target node built by another dispatcher's store never opens here; see [several dispatchers](build-store.md#several-dispatchers-on-one-repository). `ab repository status` lists the queue diagnostics.
59
59
  - **Claims:** claimed tickets aren't reclaimed.
60
- - **Capacity:** paused or blocked work keeps its slot; idle collecting nodes take none. Node verification and reconciliation account specially for descendants' slots.
60
+ - **Capacity:** paused or blocked unfinished work keeps its slot; builds waiting for a merge decision and idle collecting nodes take none. A finished build that must re-verify or reconcile reserves a slot ahead of new claims. Node verification and reconciliation account specially for descendants' slots.
61
61
  - **Harvest:** check the acknowledged harvest gate and unclaimed observations. Harvest triggers at `policy.harvestThreshold` observations, or `policy.harvestMaxDrift` other merged builds since the oldest observation (zero disables drift), and uses no build slot.
62
62
 
63
63
  ## Authentication failures
@@ -67,7 +67,7 @@ bun ab harvest status
67
67
  | Component | Check |
68
68
  |---|---|
69
69
  | Linear | `LINEAR_API_KEY`, team and workflow states, in the actual process environment or supported `.env` |
70
- | GitHub | `gh auth status` and repository permissions; test Git fetch and push separately |
70
+ | GitHub | `gh auth status` and repository permissions; test Git fetch and push separately. With `source = "github"` tickets, the same token needs Issues read and write |
71
71
  | Agent providers | The effective role's runtime: `codex login` when the Codex diagnostic asks; for Pi, provider login and the provider-qualified model |
72
72
  | Hosted store | `bun ab connect` for service, project and credential status |
73
73
 
@@ -59,7 +59,7 @@ For example: `steps = ["types", ["unit", "integration"], ["acceptance", "docs"]]
59
59
  | `agent` | the exact `skill` you configure ([repository-local](skills.md#add-a-repository-local-skill), no prefix inferred) | `ab verdict` records pass, fail or skip |
60
60
 
61
61
  - **Pass** satisfies the member; the next stage waits for its siblings.
62
- - **Fail**, after its stage settles, sends all failed reports back through implement and code review, then verification, up to `[policy].maxVerifyAttempts`; then the build escalates.
62
+ - **Fail**, after its stage settles, sends all failed reports back through implement and code review, then verification, up to `[policy].maxVerifyAttempts`; then the build escalates. That budget is build-wide, so the escalation lists every counted failed attempt and its failed steps, and says a step failed in every counted cycle only when it did.
63
63
  - **Skip** satisfies its member without counting as a pass or spending retries. Plan exclusions and path misses skip deterministically. An agent may skip only when the whole step doesn't apply, with a reason; an applicable behavior it can't exercise is a failure.
64
64
 
65
65
  ## Select what a build needs
@@ -167,17 +167,17 @@ Autobuild's own chain: this repository's choices, not defaults.
167
167
  |---|---|---|---|
168
168
  | 1 | lint | check | formatting and lint; mandatory |
169
169
  | 2 | types | check | TypeScript type checking |
170
- | 3 | unit | check | the test suite, minus database-backed integration tests |
170
+ | 3 | unit | check | the in-memory test suite; a guard fails any test that does IO |
171
171
  | 4 | build | check | packs every publishable package and checks its contents, imports and bins; mandatory |
172
- | 5 | integration | check | database-backed store, service and migration suites, plus a packed hosted-service deploy rehearsal |
172
+ | 5 | integration | check | every IO test (filesystem, processes, network, real time) plus database-backed suites and a packed hosted-service deploy rehearsal; runs concurrently with unit and build |
173
173
  | 6 | ui-tui | agent | captures terminal-dashboard frames and judges them |
174
174
  | 7 | ui-app | agent | captures operator web-app frames and judges them against the design |
175
175
  | 8 | ui-website | agent | captures site and docs frames at desktop and phone widths, compared with approved references |
176
176
  | 9 | docs | agent | fails when a `docs/` passage no longer matches the build's user-facing changes |
177
177
 
178
- Steps 5 to 9 are optional and path-scoped. Integration covers core, the Postgres store and the hosted packages; the others run through repository skills `verify-ui-tui`, `verify-ui-app`, `verify-ui-website` and `verify-docs`. The docs step applies to product source, skills, templates, `SPEC.md`, `README.md` and `docs/`.
178
+ Steps 5 to 9 are optional. Integration covers every package plus `tools/`, `scripts/` and `bin/`, and applies to every build because many of its tests check skills, docs and configuration. Steps 6 to 9 are path-scoped and run through repository skills `verify-ui-tui`, `verify-ui-app`, `verify-ui-website` and `verify-docs`. The docs step applies to product source, skills, templates, `SPEC.md`, `README.md` and `docs/`.
179
179
 
180
- A plan for a docs change like this page selects lint, types, unit, build, ui-website and docs; both of the last two pass their path checks because they cover `docs/`. The untouched ui-tui and ui-app steps aren't selected.
180
+ A plan for a docs change like this page selects lint, types, unit, build, integration, ui-website and docs; both of the last two pass their path checks because they cover `docs/`. The untouched ui-tui and ui-app steps aren't selected.
181
181
 
182
182
  Grouped failures retain the legacy `feedback.verify` object for the first report
183
183
  in configured order. A decisive `verify.stage-failed` receipt carries the full
package/docs/website.md CHANGED
@@ -41,6 +41,14 @@ registry edit. `bun run capture:website` captures every generated docs page at
41
41
  `.ab/website-frames/`. Static hosts must serve directory index files. The dev
42
42
  server redirects slashless docs URLs to canonical trailing-slash paths.
43
43
 
44
+ Each published page has a snapshot of its text hash, headings, code and
45
+ metadata in `packages/website/src/docs-baseline/<source stem>.json`, and the
46
+ website docs integration test fails when one is stale. After changing,
47
+ adding or removing a published page, or when a reconcile meets a conflict in
48
+ that directory, run `bun run docs:baseline` and commit its output instead of
49
+ hand-editing or hand-merging it. The command is idempotent and removes files
50
+ for pages that are no longer published.
51
+
44
52
  `bun run check` enforces complete-byte parity for same-named files shared by
45
53
  `docs/` and `skills/guide/references/`, including their live and pristine installed
46
54
  copies. Edit docs first and synchronize all three guide copies in the same
@@ -112,7 +112,7 @@ Sandbox preparation order:
112
112
 
113
113
  - **Runtimes.** Every primary and alternate runtime needs a pinned install and exact-version preflight, and gets only the credentials named in `environmentVariables`, except declared [accounts](configuration-overview.md#accounts), whose credentials remain on the host and are brokered by egress policy using guest placeholders.
114
114
  - **Repetition.** New sandboxes repeat provisioning and preflights rerun before each build-runner; keep setup idempotent.
115
- - **Validation.** `bun ab init --validate` runs named provisioning, setup, runtime and Store checks in a disposable environment, deletes it even on failure, and starts no build. For every declared account, including unused accounts, it runs a tool-free model probe through the account's runtime (Claude Code for Claude/Kimi, Codex for ChatGPT); these probes create no ordinary build phase or persistent agent session. Hosted ChatGPT project secrets report readiness from write-only status metadata instead; the first hosted build is the live check.
115
+ - **Validation.** `bun ab init --validate` runs named provisioning, setup, runtime and Store checks in a disposable environment, deletes it even on failure, and starts no build. For every declared account, including unused accounts, it runs a tool-free model probe through the account's runtime (Claude Code for Claude/Kimi, Codex for ChatGPT); these probes create no ordinary build phase or persistent agent session. Hosted ChatGPT, Claude and Kimi project secrets report readiness from write-only status metadata instead; the first hosted build is the live check.
116
116
  - **Lifetime.** `timeoutSeconds` bounds a sandbox; provider operations have their own timeouts. An intact sandbox resumes. Before replacement, the dispatcher fences it, preserves reachable unpublished commits to build-private refs, and records a receipt; the next workspace restores those commits. Loss is limited to already absent or unrecoverable work and uncommitted files; known loss appears in the next session's recovery context. See the [workspace recovery contract](architecture.md#key-boundaries).
117
117
 
118
118
  ### Private repositories