@defrex/autobuild 1.12.0 → 1.13.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 (159) hide show
  1. package/README.md +1 -1
  2. package/SPEC.md +435 -160
  3. package/bin/ab-build-runner.ts +8 -0
  4. package/docs/answering-blocked-builds.md +25 -3
  5. package/docs/architecture.md +124 -53
  6. package/docs/cli.md +1 -1
  7. package/docs/configuration.md +110 -15
  8. package/docs/dispatcher.md +19 -8
  9. package/docs/integration-overview.md +1 -1
  10. package/docs/integration-tree.md +12 -9
  11. package/docs/merge-policy.md +7 -2
  12. package/docs/operating.md +5 -3
  13. package/docs/operator-api.md +46 -23
  14. package/docs/operator-surfaces.md +7 -6
  15. package/docs/optimization-nodes.md +7 -6
  16. package/docs/plugin-authoring.md +46 -18
  17. package/docs/remote-store-protocol.md +51 -12
  18. package/docs/remote-ticket-protocol.md +85 -38
  19. package/docs/restacking.md +48 -3
  20. package/docs/setup.md +2 -1
  21. package/docs/ticket-migration.md +2 -2
  22. package/docs/ticket-sources.md +23 -8
  23. package/docs/tickets.md +4 -4
  24. package/docs/troubleshooting.md +17 -2
  25. package/docs/verification.md +3 -1
  26. package/package.json +3 -3
  27. package/packages/core/src/cli/build-control.ts +72 -6
  28. package/packages/core/src/cli/dashboard/actions.ts +4 -0
  29. package/packages/core/src/cli/dashboard/integration-row.ts +43 -19
  30. package/packages/core/src/cli/dashboard/model.ts +14 -8
  31. package/packages/core/src/cli/dashboard/poll.ts +218 -10
  32. package/packages/core/src/cli/dashboard/queue.ts +21 -10
  33. package/packages/core/src/cli/dashboard/row-text.ts +2 -1
  34. package/packages/core/src/cli/dashboard/vocabulary.ts +5 -1
  35. package/packages/core/src/cli/dispatch-frontend.ts +2 -1
  36. package/packages/core/src/cli/dispatch-tickets.ts +33 -12
  37. package/packages/core/src/cli/dispatch.ts +527 -144
  38. package/packages/core/src/cli/help.ts +38 -24
  39. package/packages/core/src/cli/main.ts +7 -5
  40. package/packages/core/src/cli/publication-settlement.ts +4 -0
  41. package/packages/core/src/cli/remote-poll.ts +22 -5
  42. package/packages/core/src/cli/repository-status.ts +19 -9
  43. package/packages/core/src/cli/status.ts +23 -11
  44. package/packages/core/src/cli/store-opening.ts +12 -0
  45. package/packages/core/src/cli/ticket-start.ts +3 -3
  46. package/packages/core/src/cli/ticket.ts +12 -11
  47. package/packages/core/src/cli/wait.ts +8 -28
  48. package/packages/core/src/cli/watch.ts +113 -50
  49. package/packages/core/src/config/reference-metadata.ts +7 -1
  50. package/packages/core/src/config/reference.ts +5 -2
  51. package/packages/core/src/config/schema.ts +51 -16
  52. package/packages/core/src/events/payloads.ts +74 -14
  53. package/packages/core/src/events/repository.ts +14 -3
  54. package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +27 -0
  55. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/0a10010ee5cf2e47.json +577 -0
  56. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/227701361be6d1e0.json +490 -0
  57. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/76e5043bae7a80ab.json +86 -0
  58. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/87a917802870bbed.json +87 -0
  59. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/9d85616e5b9e24c1.json +500 -0
  60. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/c7c94fbe7f63cf07.json +84 -0
  61. package/packages/core/src/kernel/clean-restack-policy.ts +40 -0
  62. package/packages/core/src/kernel/dispatch-capacity.ts +243 -107
  63. package/packages/core/src/kernel/done-escalations.ts +269 -0
  64. package/packages/core/src/kernel/engine.ts +28 -9
  65. package/packages/core/src/kernel/integration-landing.ts +24 -4
  66. package/packages/core/src/kernel/integration-stack.ts +39 -0
  67. package/packages/core/src/kernel/janitor-failure.ts +20 -1
  68. package/packages/core/src/kernel/log-index-value.ts +3 -0
  69. package/packages/core/src/kernel/log-index.ts +41 -2
  70. package/packages/core/src/kernel/open-pr-backpressure.ts +3 -3
  71. package/packages/core/src/kernel/reducer-registry.ts +3 -0
  72. package/packages/core/src/kernel/reducer-revisions.ts +15 -0
  73. package/packages/core/src/kernel/reducer.ts +27 -7
  74. package/packages/core/src/kernel/repository-attention.ts +14 -5
  75. package/packages/core/src/kernel/ticket-starts.ts +15 -4
  76. package/packages/core/src/kernel/verify-stages.ts +46 -7
  77. package/packages/core/src/operator/attention.ts +28 -3
  78. package/packages/core/src/operator/done-escalations.ts +38 -0
  79. package/packages/core/src/operator/presentation.ts +1 -1
  80. package/packages/core/src/operator/protocol.ts +8 -5
  81. package/packages/core/src/operator/query.ts +33 -19
  82. package/packages/core/src/operator/registry.ts +17 -13
  83. package/packages/core/src/operator/ticket-start.ts +8 -7
  84. package/packages/core/src/operator/tickets.ts +28 -9
  85. package/packages/core/src/plugin-sdk/index.ts +10 -0
  86. package/packages/core/src/plugins/manifest.ts +14 -1
  87. package/packages/core/src/ports/forge/create.ts +8 -0
  88. package/packages/core/src/ports/forge/github-transport.ts +5 -1
  89. package/packages/core/src/ports/forge/github.ts +3 -0
  90. package/packages/core/src/ports/tickets/contract.ts +147 -76
  91. package/packages/core/src/ports/tickets/create.ts +47 -7
  92. package/packages/core/src/ports/tickets/fake.ts +8 -4
  93. package/packages/core/src/ports/tickets/file-codec.ts +4 -3
  94. package/packages/core/src/ports/tickets/file.ts +7 -3
  95. package/packages/core/src/ports/tickets/github.ts +1 -0
  96. package/packages/core/src/ports/tickets/grants.ts +11 -3
  97. package/packages/core/src/ports/tickets/hosted-index.ts +5 -0
  98. package/packages/core/src/ports/tickets/linear.ts +28 -9
  99. package/packages/core/src/ports/tickets/migration.ts +4 -4
  100. package/packages/core/src/ports/tickets/operations.ts +4 -2
  101. package/packages/core/src/ports/tickets/priority-labels.ts +213 -0
  102. package/packages/core/src/ports/tickets/priority.ts +127 -21
  103. package/packages/core/src/ports/tickets/remote-protocol.ts +10 -0
  104. package/packages/core/src/ports/tickets/remote.ts +104 -11
  105. package/packages/core/src/ports/tickets/revision.ts +5 -3
  106. package/packages/core/src/ports/tickets/search.ts +9 -0
  107. package/packages/core/src/ports/tickets/tree.ts +8 -6
  108. package/packages/core/src/ports/types.ts +30 -15
  109. package/packages/core/src/ports/workspace/build-execution.ts +4 -0
  110. package/packages/core/src/ports/workspace/builtin-capabilities.ts +4 -0
  111. package/packages/core/src/ports/workspace/create.ts +16 -3
  112. package/packages/core/src/ports/workspace/execution-exit-marker.ts +41 -0
  113. package/packages/core/src/ports/workspace/recovery-step.ts +101 -0
  114. package/packages/core/src/ports/workspace/vercel-sandbox.ts +510 -145
  115. package/packages/core/src/processes/build-execution-state.ts +4 -0
  116. package/packages/core/src/processes/build-runner.ts +14 -1
  117. package/packages/core/src/processes/dispatcher.ts +544 -212
  118. package/packages/core/src/processes/execution-settlement.ts +1 -0
  119. package/packages/core/src/processes/harvest-runner.ts +12 -7
  120. package/packages/core/src/processes/infrastructure-failure-budget.ts +7 -2
  121. package/packages/core/src/processes/invocation-budget.ts +176 -0
  122. package/packages/core/src/processes/publication-loss.ts +38 -3
  123. package/packages/core/src/processes/workspace-preservation.ts +86 -15
  124. package/packages/core/src/store/contract.ts +81 -3
  125. package/packages/core/src/store/event-reads.ts +30 -1
  126. package/packages/core/src/store/reduced-reads.ts +23 -0
  127. package/packages/core/src/store/reducer-value-shapes.json +6628 -6469
  128. package/packages/core/src/store/reducer-value-validation.ts +181 -33
  129. package/packages/core/src/store/remote/client.ts +169 -29
  130. package/packages/core/src/store/remote/compatibility.ts +113 -56
  131. package/packages/core/src/store/remote/credentials.ts +4 -1
  132. package/packages/core/src/store/remote/protocol.ts +3 -0
  133. package/packages/core/src/store/remote/released-clients.json +11 -0
  134. package/packages/core/src/store/remote/released-reducer-values/1.13.0.json +35966 -0
  135. package/packages/core/src/store/remote/released-reducer-values/index.ts +18 -16
  136. package/packages/core/src/store/remote/released-value-policy.ts +144 -0
  137. package/packages/core/src/store/remote/retry.ts +406 -0
  138. package/packages/core/src/testing/dispatch-read-budget.ts +144 -10
  139. package/packages/core/src/testing/index.ts +2 -0
  140. package/packages/core/src/testing/invocation-budget.ts +42 -0
  141. package/packages/core/src/testing/reduced-read-budget.ts +381 -18
  142. package/packages/core/src/testing/released-value-coverage.ts +423 -0
  143. package/packages/core/src/web/overview-source.ts +19 -6
  144. package/skills/guide/SKILL.md +138 -67
  145. package/skills/guide/references/integration-tree.md +12 -9
  146. package/skills/guide/references/merge-policy.md +7 -2
  147. package/skills/guide/references/operator-api.md +46 -23
  148. package/skills/guide/references/optimization-nodes.md +7 -6
  149. package/skills/guide/references/plugin-authoring.md +46 -18
  150. package/skills/guide/references/remote-store-protocol.md +51 -12
  151. package/skills/guide/references/remote-ticket-protocol.md +85 -38
  152. package/skills/guide/references/restacking.md +48 -3
  153. package/skills/guide/references/setup.md +2 -1
  154. package/skills/guide/references/ticket-migration.md +2 -2
  155. package/skills/operate/SKILL.md +82 -51
  156. package/skills/plan/SKILL.md +4 -3
  157. package/skills/spec/SKILL.md +9 -5
  158. package/skills/tickets/SKILL.md +25 -17
  159. package/templates/hosted-service/package.json +2 -2
@@ -51,23 +51,34 @@ A ticket is claimed when it passes every gate:
51
51
  - **Blockers.** Every dependency is done.
52
52
  - **Destination.** Its target (`main` or an integration node) accepts new work.
53
53
 
54
- Others stay queued. Urgent tickets are claimed before normal ones, each in the source's order; priority never preempts a running build. With `[policy].maxOpenPrs` set, open-PR backpressure pauses new normal-priority claims while that many root PRs are open and unmerged, until the count drains to `resumeOpenPrs` (below `maxOpenPrs` when the two are equal); urgent claims and in-flight work continue. See [`[policy]`](configuration.md#policy). See [Tickets and specs](tickets.md) for grooming and [Intake and harvest](intake.md) for proposed work.
54
+ Others stay queued. Ready tickets are claimed by level, `urgent`, `high`, `normal`, then `low`, each level in the source's order; priority never preempts a running build. With `[policy].maxOpenPrs` set, open-PR backpressure pauses new claims of every ticket but urgent ones while that many root PRs are open and unmerged, until the count drains to `resumeOpenPrs` (below `maxOpenPrs` when the two are equal); urgent claims and in-flight work continue. See [`[policy]`](configuration.md#policy). See [Tickets and specs](tickets.md) for grooming and [Intake and harvest](intake.md) for proposed work.
55
55
 
56
- To start one ticket without turning intake on for the whole ready queue, run `ab start <ticket-id> [--priority manual|urgent|normal]` (or the `tickets.start` operator tool). The running dispatcher, local or hosted, claims just that ticket on its next tick with a free slot in the request's tier and records the outcome as a `ticket.start-settled` event shown by `ab watch` and `ab repository status`. The default `manual` tier goes ahead of all waiting work; `urgent` and `normal` wait their turn as described below. The ticket must still be in the ready state, meet the spec standard, have no unresolved blockers and a destination that accepts work, and is deduplicated against existing builds; capacity and repository pause still apply. Listing labels and the ready assignee are not applied, because the ticket is named. Every tier bypasses intake off and open-PR backpressure for that ticket only. See `ab help start`.
56
+ To start one ticket without turning intake on for the whole ready queue, run `ab start <ticket-id> [--priority manual|urgent|high|normal|low]` (or the `tickets.start` operator tool). The running dispatcher, local or hosted, claims just that ticket on its next tick with a free slot in the request's tier and records the outcome as a `ticket.start-settled` event shown by `ab watch` and `ab repository status`. The default `manual` tier goes ahead of all waiting work; the four level tiers wait their turn as described below. The ticket must still be in the ready state, meet the spec standard, have no unresolved blockers and a destination that accepts work, and is deduplicated against existing builds; capacity and repository pause still apply. Listing labels and the ready assignee are not applied, because the ticket is named. Every tier bypasses intake off and open-PR backpressure for that ticket only. See `ab help start`.
57
57
 
58
- Each build gets its own workspace (local git worktree or remote sandbox) and a build-runner that owns its pipeline. Capacity is the repository's number of slots. A build takes a slot only by admission (a ticket claim, a start request or an admitted slot request) and holds it while Autobuild owes its next move, runner or not: between phases, while provisioning, across a crashed runner or expired lease, while a requested pause or abort winds down, and while work it started outlasts a question: other steps of a verify stage, or a recorded launch and its execution. The dispatcher records `slot.admitted` before every such launch. It releases the slot as soon as it waits on the outside world: an open question nothing is still working past, an acknowledged pause, a merge decision or merge gates, or other tickets (`ab wait-on`). When that wait ends (an answer, a resume, a moved target, a conflicted PR, an ended ticket wait) the build holds no slot until it is admitted again, ahead of normal ticket claims. Occupancy never exceeds `capacity`. Builds without a slot keep their workspaces, so retained workspaces can exceed `capacity`. An integration node takes a slot only when admitted to verify, reconcile or propose, and holds it until that work is done; it holds none while collecting children, waiting for a repair child, or blocked. See [the integration tree](integration-overview.md). `ab builds`, `ab build status` and `ab repository status` report each build's slot state; see [Operator surfaces](operator-surfaces.md).
58
+ Each build gets its own workspace (local git worktree or remote sandbox) and a build-runner that owns its pipeline. Capacity is the repository's number of slots. A build takes a slot only by admission (a ticket claim, a start request or an admitted slot request) and holds it while Autobuild owes its next move, runner or not: between phases, while provisioning, across a crashed runner or expired lease, while a requested pause or abort winds down, and while work it started outlasts a question: other steps of a verify stage, or a recorded launch and its execution. The dispatcher records `slot.admitted` before every such launch. It releases the slot as soon as it waits on the outside world: an open question nothing is still working past, an acknowledged pause, a merge decision or merge gates, or other tickets (`ab wait-on`). When that wait ends (an answer, a resume, a moved target, a conflicted PR, an ended ticket wait) the build holds no slot until it is admitted again, ahead of ticket claims at its level. Occupancy never exceeds `capacity`. Builds without a slot keep their workspaces, so retained workspaces can exceed `capacity`. An integration node takes a slot only when admitted to verify, reconcile or propose, and holds it until that work is done; it holds none while collecting children, waiting for a repair child, or blocked. See [the integration tree](integration-overview.md). `ab builds`, `ab build status` and `ab repository status` report each build's slot state; see [Operator surfaces](operator-surfaces.md).
59
59
 
60
60
  ## Slot admission order
61
61
 
62
62
  A free slot goes, in order, to:
63
63
 
64
64
  1. `manual` start requests (`ab start`'s default);
65
- 2. urgent parked work: nodes and finished or waiting builds that must verify, reconcile, resume or propose;
66
- 3. urgent ticket claims: `ab start --priority urgent` requests, then urgent ready tickets;
67
- 4. normal parked work;
68
- 5. normal ticket claims: `ab start --priority normal` requests, then normal ready tickets.
65
+ 2. urgent waiting work, then urgent ticket claims;
66
+ 3. high waiting work, then high ticket claims;
67
+ 4. normal waiting work, then normal ticket claims;
68
+ 5. low waiting work, then low ticket claims.
69
69
 
70
- Each tier keeps its usual order, start requests oldest first. A pending start request reserves its slot ahead of the tiers below it until it settles or is cancelled. An ordinary build takes its ticket's priority when it is claimed; a build started by an `urgent` request is urgent, and `manual` never becomes a build priority. An [optimization node's attempts](optimization-nodes.md#attempts) claim at the node's current priority instead: a later `ab priority` on the node affects attempts claimed afterwards, while an already claimed attempt keeps its build priority. `ab priority <slug> urgent|normal` (or the `builds.control` action `priority`) changes an active build's priority, for example to expedite a waiting reconcile that now blocks other work; it never changes the ticket. While urgent tickets are ready, normal parked work waits for a slot until the dispatcher has offered urgent tickets the free slots that tick. An urgent ticket blocked on a dependency reserves nothing. Priority orders free slots only: it never interrupts a running build. `ab repository status`, `ab builds` and both dashboards mark urgent waiters, pending start requests by tier and urgent ticket claims waiting ahead of normal parked work.
70
+ | Term | Means |
71
+ | --- | --- |
72
+ | Waiting work | nodes and finished or waiting builds that must verify, reconcile, resume, reopen or propose |
73
+ | A level's ticket claims | `ab start --priority <level>` requests, oldest first, then that level's ready tickets in the source's order |
74
+
75
+ - **Build level.** A build takes its ticket's level. A build started by a non-`manual` request takes the request's level; `manual` never becomes a build level. A ticket with a pending non-`manual` request is claimed only by that request, at its tier, ahead of that level's ready tickets.
76
+ - **Optimization attempts.** [Attempts](optimization-nodes.md#attempts) claim at the node's current level, any of the four. A later `ab priority` on the node affects attempts claimed afterwards; an already claimed attempt keeps its level.
77
+ - **Changing a build.** `ab priority <slug> urgent|high|normal|low` (or the `builds.control` action `priority`) changes an active build's level, for example to expedite a waiting reconcile that now blocks other work, or to defer one with `low`. It never changes the ticket.
78
+ - **Reservations.** A pending start request reserves its slot ahead of the tiers below it until it settles or is cancelled. Lower-level waiting work waits while gate-passing higher-level tickets are ready, until the dispatcher has offered them the free slots that tick. A ticket blocked on a dependency reserves nothing at any level.
79
+ - **Unread start requests.** A tick reads at most eight `manual` and `urgent` requests and eight `high`, `normal` and `low` requests. While a request at a level is left unread, nothing below that level is admitted that tick, and that level's ready tickets wait too. That level's waiting work still goes first. A later tick reads the request once the requests ahead of it settle.
80
+ - **No preemption.** Priority orders free slots only: it never interrupts a running build.
81
+ - **Status.** `ab repository status`, `ab builds` and both dashboards show each waiter's level, pending start requests by tier, and higher-level ticket claims waiting ahead of lower-level waiting work.
71
82
 
72
83
 
73
84
  ## The log is the source of truth
@@ -42,7 +42,7 @@ A leaf contributes one canonical net change, however many commits it took.
42
42
 
43
43
  - **Identity.** The `Autobuild-Build: <slug>` trailer carries it across SHA rewrites. Root squash merges keep it; node integration keeps each contributing identity, in order, alongside the node's verified hand-pushed tweaks, rather than one node commit.
44
44
  - **Restacks.** When a destination moves, a leaf restacks onto it at its usual restack points; a node restacks only on demand, and each descendant node needs its own demand. Clean replay is automatic, and so is a conflict confined to files the repository declares as generated, which their declared command rebuilds. Any other conflict attaches a reconcile runner with the source change's context, then verification as required.
45
- - **Reverification.** Node verification covers the exact node head and parent; a change to either voids merge eligibility until reverified, even after a clean restack. A cleanly restacked waiting leaf can keep its prior verification; reports cite their actual head and base.
45
+ - **Reverification.** Node verification covers the exact node head and parent; a change to either voids merge eligibility until reverified, even after a clean restack. A cleanly restacked waiting leaf keeps its prior verification unless `afterCleanRestack` opts steps in for a root-targeting leaf, which re-run before it lands; reports cite their actual head and base.
46
46
 
47
47
 
48
48
  ## Blockers are a separate graph
@@ -13,7 +13,9 @@ See [restacking](restacking.md) for change identity and replay.
13
13
  Presence is checked only at claim, never to interrupt existing work. The newest
14
14
  build generation supplies evidence; ambiguous or unavailable evidence leaves the
15
15
  dependent queued. Confirmed merge SHA reachability can prove presence without
16
- a trailer, and a merged node transports its whole owned contribution. Empty
16
+ a trailer, and a merged node transports its whole owned contribution. A child
17
+ whose commit became empty and was dropped by a forge rebase merge still counts as
18
+ landed through that contribution. Empty
17
19
  completed nodes contribute nothing. Sibling work waits for merge into the common
18
20
  ancestor and demand the minimal restack path; same-node merges satisfy presence directly.
19
21
 
@@ -101,11 +103,12 @@ has commits its current parent lacks; parent-only advancement remains empty.
101
103
  A node takes a slot only by admission for runner work: `reconcile` for a
102
104
  restack conflict, `verification` for an integration cycle or a measurement, and
103
105
  `propose` for an optimization node's open proposal request. The request is
104
- durable and is admitted before normal ticket claims, urgent work first. Until
105
- the node holds its slot, intake reserves one slot for it, and the dispatcher
106
- checks its admission every tick regardless of idle node polling, so a slot
107
- freed in any tick goes to the node, not to a new normal claim. Admission counts
108
- every build that holds a slot, as every admission does.
106
+ durable and is admitted before ticket claims at its level, higher levels first. Until
107
+ the node holds its slot, intake reserves one slot for it ahead of claims at its
108
+ own level and below, and the dispatcher checks its admission every tick
109
+ regardless of idle node polling. A slot freed in any tick goes to the node, not
110
+ to a new claim at its level or below; higher-level demand can take it first.
111
+ Admission counts every build that holds a slot, as every admission does.
109
112
 
110
113
  - **Recorded before provisioning.** Admission is a durable `slot.admitted`
111
114
  fact naming the work it admitted.
@@ -122,8 +125,8 @@ every build that holds a slot, as every admission does.
122
125
  slot it needs to unblock them.
123
126
 
124
127
  Status and both dashboards report occupancy against configured capacity, and
125
- each node waiting for a slot ahead of normal ticket claims, marking urgent
126
- ones.
128
+ each node waiting for a slot ahead of ticket claims at its level, marking
129
+ urgent, high and low ones.
127
130
  Status also reports every build's slot state (`slot`, `capacity.slots`):
128
131
  an admitted node reports `held`; a node awaiting admission reports its request.
129
132
 
@@ -263,7 +266,7 @@ An optimization node follows `branch opening → starting measurement →
263
266
  (propose → collecting)*`, then completes, verifies and merges like any node.
264
267
  Once the starting value is measured, the dispatcher requests a `propose`
265
268
  session whenever the node has room within its concurrency and attempts budget.
266
- The request takes a slot ahead of normal ticket claims, like node reconcile and
269
+ The request takes a slot ahead of ticket claims at the node's level, like node reconcile and
267
270
  verification. The session runs the `ab-propose` skill on the node head, reads
268
271
  the attempt ledger and deposits proposals with `ab propose`; it never creates
269
272
  tickets. The dispatcher files each proposal as a work ticket targeting the
@@ -188,7 +188,10 @@ Node-to-GitHub-root merge uses PR rebase merge guarded on verified head after
188
188
  a final parent freshness read. Enforced up-to-date protection provides a fenced
189
189
  merge; uncertainty is recorded as unfenced and requires immutable merged-tree
190
190
  audit. A mismatch raises operator attention without rewriting the shared parent.
191
- Pending audits survive completion and retry until settled.
191
+ A verified empty child commit that the rebase merge dropped is accounted for when
192
+ the merged tree matches; a missing non-empty commit or a duplicate identity still
193
+ raises attention. Answer it with `ab answer`, which acknowledges it without
194
+ reopening the build. Pending audits survive completion and retry until settled.
192
195
 
193
196
  Root leaves land by one of three routes. Behind a real merge-blocking gate,
194
197
  Autobuild arms GitHub-native auto-merge. An authoritatively ungated root
@@ -259,7 +262,9 @@ displaced history under immutable exact archive refs
259
262
  them. Where it refuses, they keep a BuildStore copy (`history-objects-<sha>`),
260
263
  or record one `history-unretained` warning and proceed.
261
264
  - **Workspace preservation** keeps unpublished workspace commits under archive
262
- refs, else as BuildStore copies. When neither holds them, release is refused.
265
+ refs, else as BuildStore copies. When neither holds them, release is refused,
266
+ except under abort cleanup, which records `workspace.commits-lost` and
267
+ releases.
263
268
  - There is never a branch or tag fallback. When an environment refuses non-branch
264
269
  Git pushes, as Claude Code on the web's GitHub proxy does, the GitHub adapter
265
270
  creates the same archive ref through REST ref creation and confirms it by exact
package/docs/operating.md CHANGED
@@ -63,7 +63,9 @@ Re-arm with `bun ab watch --operator --json --since <watch-cursor>` using only
63
63
  the standing watch's own cursor. This preserves one ID and original start time
64
64
  across a presence re-arm gap of up to five minutes. This presence TTL is separate
65
65
  from hosted event-window eligibility. After termination withdraws presence,
66
- the same cursor re-registers the same ID and start time. Reconcile current and
66
+ the same cursor re-registers the same ID and start time. Settled builds drop out
67
+ of the cursor once their events are delivered, so re-arms stay proportional to
68
+ active builds. Reconcile current and
67
69
  newly dispatched builds after arming and on timeout. Keep operating after the initial work ends,
68
70
  until you end or hand off the role. `wait` does not heartbeat or carry registration
69
71
  identity: a separate unflagged diagnostic wait/watch must never replace the
@@ -140,14 +142,14 @@ Intake off only stops new ticket claims; a repository pause also holds queued bu
140
142
  bun ab priority my-build urgent
141
143
  ```
142
144
 
143
- - **`priority`** sets an active build's slot-admission priority to `urgent` or `normal` without touching its ticket. An urgent build waiting to re-verify, reconcile or resume takes the next free slot ahead of normal work; see [slot admission order](dispatcher.md#slot-admission-order). It never interrupts running work.
145
+ - **`priority`** sets an active build's slot-admission level to `urgent`, `high`, `normal` or `low` without touching its ticket. A build waiting to re-verify, reconcile or resume takes the next free slot ahead of its own level's ticket claims and all lower-level work; see [slot admission order](dispatcher.md#slot-admission-order). It never interrupts running work.
144
146
 
145
147
  ```
146
148
  bun ab start AUT-12
147
149
  bun ab start AUT-13 --priority urgent
148
150
  ```
149
151
 
150
- - **`start`** asks the running dispatcher to claim one ticket on its next tick with a free slot, even while intake is off or open-PR backpressure is engaged, and nothing else. By default (`--priority manual`) the request goes ahead of all waiting work; `--priority urgent` waits for urgent parked work and makes the build urgent, and `--priority normal` waits for normal parked work and urgent claims. Repeating the command with another priority updates the pending request. The ticket must still be ready, meet the spec standard and have no unresolved blockers; a request that cannot start settles once with its reason. `ab watch` reports the outcome and `ab repository status` lists pending requests with their priority. `--cancel` withdraws a pending request.
152
+ - **`start`** asks the running dispatcher to claim one ticket on its next tick with a free slot, even while intake is off or open-PR backpressure is engaged, and nothing else. By default (`--priority manual`) the request goes ahead of all waiting work and the build takes its ticket's level. `--priority urgent|high|normal|low` waits for waiting work at that level or above and for higher-level claims, goes ahead of that level's ready tickets, and sets the build's level. Repeating the command with another priority updates the pending request. The ticket must still be ready, meet the spec standard and have no unresolved blockers; a request that cannot start settles once with its reason. `ab watch` reports the outcome and `ab repository status` lists pending requests with their priority. `--cancel` withdraws a pending request.
151
153
 
152
154
  ## Authorize merge
153
155
 
@@ -16,8 +16,10 @@ other credentials. Unknown, expired or revoked credentials receive `401 auth`;
16
16
  removed projects receive `403 auth` with `project not registered`.
17
17
 
18
18
  The hosted cron dispatcher issues a dispatcher-purpose credential per repository
19
- tick, then deletes that exact row on completion or failure. Its crash-safety
20
- expiry is capped at the invocation deadline plus 60 seconds and the configured
19
+ tick, then attempts to delete that exact row on completion or failure, within a
20
+ bounded cleanup window of at least 5 seconds. Issuance or deletion that does not
21
+ settle in that window is reported as a tick failure, and the row relies on its
22
+ expiry, capped at the invocation deadline plus 60 seconds and the configured
21
23
  `AB_DISPATCHER_TOKEN_TTL_SECONDS` upper bound. Each served tick removes at most
22
24
  100 expired or revoked dispatcher rows through indexed probes. Legacy unexpired
23
25
  rows keep their recorded expiry and are pruned afterward. Owner lifetimes are
@@ -82,13 +84,13 @@ raw session-event append. External operator harnesses own agent execution.
82
84
 
83
85
  | Method and path | Result |
84
86
  |---|---|
85
- | `GET …/builds?scope=active\|queued\|all` | Build summaries, newest update first. `queued` means active plus queued, matching `ab builds --queued`. Each nonterminal summary's `slot` is `{state: "held"}`, `{state: "requested", request, priority?: "urgent"}` or `{state: "none"}`; absent means unknown (an older server), never `none`. Its `statusWord` is `{word, tone, note?}`, the status word every surface shows; `status` stays the reducer's lifecycle status. |
86
- | `GET …/builds/{slug}` | `{detail, dashboardRow}`; `detail.slot` and `dashboardRow.slot` carry the build's slot state, shaped as in `GET …/builds`; `detail.runnerAttaches` records chronological attach boundaries and their runtime identity (version, commit, source kind/location), with null runtime for unrecorded historical attaches; `dashboardRow` remains a `CLEANING` row after `build.aborted` and becomes `null` only when the dashboard stops listing it (after cleanup's `build.completed`). |
87
+ | `GET …/builds?scope=active\|queued\|all` | Build summaries, newest update first. `queued` means active plus queued, matching `ab builds --queued`. Each nonterminal summary's `slot` is `{state: "held"}`, `{state: "requested", request, priority?: "urgent" \| "high" \| "low"}` or `{state: "none"}`; absent means unknown (an older server), never `none`. Its `statusWord` is `{word, tone, note?}`, the status word every surface shows; `status` stays the reducer's lifecycle status. |
88
+ | `GET …/builds/{slug}` | `{detail, dashboardRow}`; `detail.slot` and `dashboardRow.slot` carry the build's slot state, shaped as in `GET …/builds`; `detail.runnerAttaches` records chronological attach boundaries and their runtime identity (version, commit, source kind/location), with null runtime for unrecorded historical attaches; `dashboardRow` remains a `CLEANING` row after `build.aborted` and becomes `null` only when the dashboard stops listing it: at `build.completed` when no escalation is open. A completed build with an open escalation keeps, or regains, a `BLOCKED` row (note `done`), including after abort cleanup, and the row becomes `null` once the escalation is acknowledged; neither step reopens its lifecycle state. |
87
89
  | `GET …/dashboard` | `{generatedAt, model, settingsHeader}`. `model` is the dashboard's rows, steps, elapsed timing inputs, harvest row, triage (when the dispatcher published one)/queue/capacity and settings projection. `model.capacity.slots` maps each build to its slot state, and each `model.builds[].slot` repeats it; absent means unknown. `model.configuration` is `"no-dispatcher-run"` when the repository records no dispatcher run, and absent otherwise. Optional `rollback` contains `correlation`, `lineage`, full `failed` and `restored` runtime identities and rollback event `ts` for the authoritative dispatcher lineage’s unresolved hold. Both dashboards name failed, restored and held runtime plus timestamp. Matching durable different-target hold clearance removes it; a fresh operator lineage hides it only after a committed operational tick or accepted takeover. Run-started and yielded ticks alone cannot replace authority; same-lineage generations retain the notice. Historical rollback records are not fallback notices. Optional `handoffs` lists all accepted unfinished handoffs with predecessor `run`, optional `successor`, `correlation`, full `from`/`to` runtimes, `mode` and optional `deadline`. Outstanding drain-mode builds carry `draining: true`, also on build-detail `dashboardRow`; matching settlement removes it. Accepted completion removes the handoff; neither takeover nor the clock does. Missing historical mode means cutover and missing deadline displays unknown. |
88
90
  | `GET …/status` | Repository intake, pause, and default-auto-merge projection, plus `ticketStarts` (`{pending, recent}`, each entry with its `priority`) when single-ticket start requests are pending or recently settled. `capacity.slots`, when the held configuration is readable, maps each nonterminal build to its slot state; `capacity.occupied` counts its `held` entries. Its `operator` is `{presence: "unavailable", reason}`: this route does not load presence registrations, so it is not evidence that no operator is present. |
89
91
  | `GET …/harvest/status` | Harvest gate, runs, steps, recovery, and attention projection. |
90
92
  | `GET …/builds/{slug}/artifacts/{kind}?rev=N` | Raw bytes (`application/octet-stream`) plus content-disposition and `X-Autobuild-Artifact-*` metadata headers. Omit `rev` for latest. |
91
- | `GET …/tickets?state=S&label=L&limit=N&offset=K&order=O` | `{states,tickets,diagnostics,criteria,triageState,readyState,doneState,total}`. The three lifecycle names come from effective repository configuration (including provider fallback). With no `state`, `criteria.state` is `triageState`; repeated `label` parameters narrow that state with AND filters. An explicit `state` selects that exact backend workflow state. `limit` (0–200) returns one page, after skipping `offset`, in `order` `oldest` (the default: dispatch order, urgent tickets first, then the source order) or `newest` (newest filed first, regardless of urgency; see paging below); `total` counts every match before paging. |
93
+ | `GET …/tickets?state=S&label=L&limit=N&offset=K&order=O` | `{states,tickets,diagnostics,criteria,triageState,readyState,doneState,total}`. The three lifecycle names come from effective repository configuration (including provider fallback). With no `state`, `criteria.state` is `triageState`; repeated `label` parameters narrow that state with AND filters. An explicit `state` selects that exact backend workflow state. `limit` (0–200) returns one page, after skipping `offset`, in `order` `oldest` (the default: priority order, urgent, high, normal, then low tickets, each in the source order) or `newest` (newest filed first, regardless of priority; see paging below); `total` counts every match before paging. |
92
94
  | `GET …/tickets/states` | Full state metadata `{name,tickets,about?}[]`, including empty states (`tickets.states` in MCP). |
93
95
  | `GET …/tickets/{id}` | `{ticket,blockers,build,assets}`. Blockers include native `exists`/`resolved` status; `build` prefers an active matching repository build, otherwise the most recently updated one. `assets` lists the current ticket assets as `{kind,name,revision,size,layout,fileCount}`, as `ab ticket show --json` does. |
94
96
 
@@ -124,7 +126,7 @@ JSON bodies are strict: unknown fields are rejected.
124
126
 
125
127
  | Method and path | Body |
126
128
  |---|---|
127
- | `POST …/builds/{slug}/control` | `{"action":"pause"\|"cancel-pause"\|"resume"\|"abort"\|"discard"\|"land"\|"hold"\|"priority"}`; `priority` requires `"priority":"urgent"\|"normal"` and records `build.priority-set`, the build's slot-admission priority, as `ab priority` does. Build priority stays `urgent` or `normal`; free slots go to `manual` start requests, then urgent waiting work, then urgent start requests and ordinary urgent claims, then normal waiting work, then normal start requests and ordinary normal claims. `land` alone accepts an optional `"head":"<sha>"` (full or at least seven characters) that binds consent to that candidate head. Abort alone also accepts `"to":"triage"\|"ready"` (default triage) and a `"reason"` of 1–2000 characters after trimming, as `ab abort --to/--reason` does. `hold` also accepts an optional `"reason"` of 1–2000 characters after trimming, as `ab hold --reason` does; a blank reason is refused with `invalid-argument` and nothing is recorded. `"reason"` with any other action is a validation error. Ready requires the current ticket to meet the spec standard; otherwise cleanup returns it to triage and the hand-back comment and `ticket.handed-back` event carry the `requested` role and `missing` parts. Repeating an identical pending abort is idempotent; a repeat with a different destination or reason is refused. Aborting an [optimization attempt](optimization-nodes.md#landing-and-settlement) ignores `to`: it settles `aborted`, the node moves the ticket to rejected, and no hand-back is reported. |
129
+ | `POST …/builds/{slug}/control` | `{"action":"pause"\|"cancel-pause"\|"resume"\|"abort"\|"discard"\|"land"\|"hold"\|"priority"}`; `priority` requires `"priority":"urgent"\|"high"\|"normal"\|"low"` and records `build.priority-set`, the build's slot-admission level, as `ab priority` does. Free slots go to `manual` start requests, then, for each level from urgent to low, that level's waiting work, then its start requests and ordinary claims. `land` alone accepts an optional `"head":"<sha>"` (full or at least seven characters) that binds consent to that candidate head. Abort alone also accepts `"to":"triage"\|"ready"` (default triage) and a `"reason"` of 1–2000 characters after trimming, as `ab abort --to/--reason` does. `hold` also accepts an optional `"reason"` of 1–2000 characters after trimming, as `ab hold --reason` does; a blank reason is refused with `invalid-argument` and nothing is recorded. `"reason"` with any other action is a validation error. Ready requires the current ticket to meet the spec standard; otherwise cleanup returns it to triage and the hand-back comment and `ticket.handed-back` event carry the `requested` role and `missing` parts. Repeating an identical pending abort is idempotent; a repeat with a different destination or reason is refused. Aborting an [optimization attempt](optimization-nodes.md#landing-and-settlement) ignores `to`: it settles `aborted`, the node moves the ticket to rejected, and no hand-back is reported. |
128
130
  | `POST …/builds/{slug}/restack` | Empty body; durable node restack demand. |
129
131
  | `POST …/builds/{slug}/answer` | One answer variant described below. |
130
132
  | `PUT …/settings/intake` | `{"enabled":boolean}` |
@@ -132,10 +134,10 @@ JSON bodies are strict: unknown fields are rejected.
132
134
  | `POST …/bulk-control` | `{"action":"pause"\|"resume"}`. The hold fact, intake fact, then eligible build events are written in that order. |
133
135
  | `POST …/harvest/control` | `{"action":"toggle-gate"}` or `{"action":"run","run":"…"}`. A run action is bound to that concrete projected run. |
134
136
  | `POST …/tickets/states` | `{name,about?}` → `{state,created}`; requires attributed operator identity (`tickets.state.create` in MCP). Hosted duplicate names are refused case-insensitively. |
135
- | `POST …/tickets` | `{"title":"…","body":"…","labels"?:[],"state"?:"…","blockedBy"?:[],"issueLinks"?:[{"issue":N,"intent"?:"closes"|"refs"}],"priority"?:"urgent"|"normal","assignees"?:["login"|"me"],"kind"?:"work"|"node","target"?:"id"|null}`; omitted state preserves the backend default, omitted intent is `closes`, omitted priority is normal, and omitted assignees apply `[tickets].createAssignee` (`[]` creates an unassigned ticket), and `labels` are unioned with `[tickets].createLabels`. `assignees` takes at most ten entries, counted before duplicates collapse, and more is a validation error. A backend that cannot store issue links refuses with `code: "issue-links-unsupported"`; one that cannot store priority refuses `urgent` with `code: "priority-unsupported"` and accepts `normal` as a no-op; one that cannot store assignees refuses any `assignees` with `code: "assignees-unsupported"`. |
136
- | `PATCH …/tickets/{id}` | Any nonempty subset of `title`, `body`, complete-replacement `labels`, complete-replacement `issueLinks` (`[]` clears), `priority` (`urgent` or `normal`; refusals as for create), complete-replacement `assignees` (`[]` clears; refusals as for create), `kind` (`work` or `node`), and nullable `target` (null clears). Body bytes are not normalized. |
137
+ | `POST …/tickets` | `{"title":"…","body":"…","labels"?:[],"state"?:"…","blockedBy"?:[],"issueLinks"?:[{"issue":N,"intent"?:"closes"|"refs"}],"priority"?:"urgent"|"high"|"normal"|"low","assignees"?:["login"|"me"],"kind"?:"work"|"node","target"?:"id"|null}`; omitted state preserves the backend default, omitted intent is `closes`, omitted priority is normal, and omitted assignees apply `[tickets].createAssignee` (`[]` creates an unassigned ticket), and `labels` are unioned with `[tickets].createLabels`. `assignees` takes at most ten entries, counted before duplicates collapse, and more is a validation error. A backend that cannot store issue links refuses with `code: "issue-links-unsupported"`; any other `priority` value is a validation error naming the four levels; a hosted service that cannot store the level refuses it with `code: "priority-unsupported"` (sources without native priority store it as a `priority:<level>` label instead); one that cannot store assignees refuses any `assignees` with `code: "assignees-unsupported"`. |
138
+ | `PATCH …/tickets/{id}` | Any nonempty subset of `title`, `body`, complete-replacement `labels`, complete-replacement `issueLinks` (`[]` clears), `priority` (`urgent`, `high`, `normal` or `low`; omitted never changes it; refusals as for create), complete-replacement `assignees` (`[]` clears; refusals as for create), `kind` (`work` or `node`), and nullable `target` (null clears). Body bytes are not normalized. |
137
139
  | `POST …/tickets/{id}/move` | Exactly one of `{"state":"backend state name"}` or `{"role":"triage"\|"ready"\|"backlog"\|"rejected"}`; both or neither is `400 validation` (`tickets.move` in MCP takes the same target). A role resolves to the configured `triageState`, `readyState`, `backlogState`, or `rejectedState`. An unset `backlogState` or `rejectedState` refuses with a message naming the key to set, and never guesses a native state. A source that can create states creates a missing role state before moving. |
138
- | `POST …/tickets/{id}/start` | Empty body, or `{"priority":"manual"\|"urgent"\|"normal"}` (default `manual`; anything else is `400 validation`). Records a durable request that the running dispatcher start this ticket on its next tick with a free slot in the priority's admission tier, even while intake is off (`tickets.start` in MCP). The id resolves through the configured source; an unknown ticket is `404 not-found`. Returns `{status:"pending",existing,updated,request,priority,requestedAt,ticket}`; `existing` is true when a request for the ticket was already pending, and `updated` is true when that request's priority was changed to this one. Nothing is written when `updated` is false for an existing request. The outcome arrives later as `ticket.start-settled`. |
140
+ | `POST …/tickets/{id}/start` | Empty body, or `{"priority":"manual"\|"urgent"\|"high"\|"normal"\|"low"}` (default `manual`; anything else is `400 validation`). Records a durable request that the running dispatcher start this ticket on its next tick with a free slot in the priority's admission tier, even while intake is off (`tickets.start` in MCP). The id resolves through the configured source; an unknown ticket is `404 not-found`. Returns `{status:"pending",existing,updated,request,priority,requestedAt,ticket}`; `existing` is true when a request for the ticket was already pending, and `updated` is true when that request's priority was changed to this one. Nothing is written when `updated` is false for an existing request. The outcome arrives later as `ticket.start-settled`. |
139
141
  | `POST …/tickets/{id}/start/cancel` | Empty body. Cancels the pending start request: `{cancelled:true,request,ticket}`, or `{cancelled:false,id}` when none is pending (`tickets.start` with `cancel: true` in MCP). |
140
142
  | `POST …/tickets/{id}/block` | `{"blockerIds":["…"]}`. |
141
143
  | `POST …/tickets/{id}/unblock` | `{"blockerIds":["…"]}`. |
@@ -156,6 +158,10 @@ The retry object is deliberately bare: adding `text` is a `400 validation`
156
158
  rather than silently changing the resolution to guidance. A revision object may
157
159
  also carry `ceiling` only to receive the shared `incompatible-answer-options`
158
160
  refusal; a ceiling and spec revision cannot be performed together.
161
+ On a `done` build only `guidance` and `retry` are accepted: they acknowledge its
162
+ open escalations, such as a post-landing integration audit, and return
163
+ `acknowledged: true` while the build stays done. Other variants get
164
+ `409 refusal` with code `inactive`, as does a done build with nothing open.
159
165
  The protocol does not supply ticket-provider credentials. For ticket-origin
160
166
  revision, a trusted caller fetches the current ticket body and supplies it; the
161
167
  build must still have a recorded ticket. Revision conformance, lazy retry,
@@ -368,7 +374,7 @@ The default watch reports actionable conditions only:
368
374
  - `dispatcher.forge-degraded`: the dispatcher's own rate-limit cooldown opened, with its reset; once per episode. Extensions marked `continued` are silent.
369
375
  - `dispatcher.forge-persistent`: forge degradation remains after a completed post-reset retry opportunity; successful recovery clears it.
370
376
 
371
- - Build `escalation.raised`, `integration.landed`, `node.item-conflicted`,
377
+ - Build `escalation.raised`, `integration.landed`,
372
378
  `target.rewritten` (a node's, once per rejected base; a leaf recovers or escalates),
373
379
  `landing.consent-revoked` (protected merge consent revoked by a reconcile's
374
380
  edits, naming the matched files and both heads),
@@ -376,20 +382,27 @@ The default watch reports actionable conditions only:
376
382
  per head and failing set; build summaries, details and merge-queue entries
377
383
  carry it as `ciFailure` until a CI read finds no failing checks on that
378
384
  head, pending ones included, or the PR moves to another head),
379
- `optimization.noise-exceeded` (an optimization node's ε is below its
380
- measured noise, naming both), or conflicted
381
- `restack.replayed` events. `build.consent-ready` is the single
385
+ or `optimization.noise-exceeded` (an optimization node's ε is below its
386
+ measured noise, naming both). `build.consent-ready` is the single
382
387
  signal for a ready consent or held merge, including first repository-wide
383
388
  discovery. Its target has the queue entry shape `{kind, branch, ticket?, build?}`.
384
389
  Unready and stale candidates stay silent. `build.merge-decision` remains for
385
390
  current actionable merge-gate deferrals, landings awaiting a human merge, and
386
391
  unsafe forge outcomes, once per build/PR; it does not duplicate consent or
387
392
  hold attention.
393
+ - Conflicted `restack.replayed` and `node.item-conflicted` are routine
394
+ (reconcile or generated-file regeneration resolves them). They stay out of
395
+ the default, matching `repository.attention`. Follow them with `--event`.
396
+ An unresolvable conflict arrives as `escalation.raised` (reconcile
397
+ escalation, exhausted `maxReconcileAttempts`, no progress) or
398
+ `landing.consent-revoked`.
388
399
  - Repository `harvest.escalated`, `harvest.recovery-exhausted`,
389
400
  `dispatcher.config-rejected`, `dispatcher.config-reloaded` with nonempty
390
401
  `restartRequired`, `dispatcher.upgrade-failed`, `dispatcher.runtime-rolled-back`,
391
402
  `dispatcher.kernel-git-unavailable`, `forge.credential-limited`, abnormal
392
- `dispatcher.run-stopped`, and `dispatcher.lost`. A `forge.credential-limited`
403
+ `dispatcher.run-stopped`, and `dispatcher.lost`. A one-tick run whose tick
404
+ failed and was reported stops normally, with exit code 1 and the error, so a
405
+ single blip is not attention. A `forge.credential-limited`
393
406
  line names the process whose GitHub request was rate-limited outside the
394
407
  dispatcher's credential (unauthenticated, with why, or on that process's own
395
408
  credential) and its reset; dispatcher forge work continues.
@@ -427,9 +440,12 @@ The default watch reports actionable conditions only:
427
440
  with the episode still open; crossing reset alone is silent. Without a reset,
428
441
  the deadline is 15 minutes after onset. Repeated evidence never postpones
429
442
  the deadline; recovery ends the episode.
430
- - `dispatcher.tick-failure-persistent`: continuously failing completed ticks
431
- for five minutes in one run. A successful tick, new run, or matching stop
432
- ends the episode. Source grace and cooldown-driven failures do not start
443
+ - `dispatcher.tick-failure-persistent`: continuously failing ticks for five
444
+ minutes, across consecutive runs, including one-tick hosted runs. Any
445
+ completed tick ends the episode, as does a clean, abnormal or forced stop of
446
+ the run that last failed. A new run does not, nor does a one-tick run's normal
447
+ stop after its failed tick. The observation keeps the first failure's time and
448
+ names the latest failing run and error. Source grace and cooldown-driven failures do not start
433
449
  this clock; after grace, the first qualifying failure starts a new five-minute
434
450
  interval. Each persistence episode is reported once. Unavailable failure writes delay durable visibility:
435
451
  watch keeps running, warns locally and reports one bounded unreported window
@@ -461,14 +477,19 @@ silently baselines historical direct events and merge decisions, but retains
461
477
  active repository timers. A no-slug watch follows each build announced in the
462
478
  journal after its position from the build's first event; cursors carry
463
479
  creations still in preparation, and a cursor from an earlier release, which
464
- carries none, baselines a build whose creation was selected before it. Reconcile existing conditions through status after
480
+ carries none, baselines a build whose creation was selected before it. A watch retires a terminal, settled build (no pending cleanup, reclaim, open
481
+ execution or integration audit) once its events through settlement are
482
+ delivered: it leaves tracking and every later cursor, so a re-armed cursor
483
+ stays proportional to active builds. Named builds are never retired. Following
484
+ a build reads only events after its position, with no per-poll reduced read. Reconcile existing conditions through status after
465
485
  arming the watch. Named watches still end when every named build is terminal;
466
486
  learn their outcomes from status reconciliation at exit.
467
487
 
468
488
  `ab wait --for attention` is build-only and uses the same build conditions:
469
489
  current failed node verification, an open escalation other than a ticket wait's
470
490
  own, janitor failure attention, a current forge CI failure,
471
- consent readiness, merge/conflict attention or a merge decision. Current failed
491
+ consent readiness, merge attention or a merge decision; `--for
492
+ restack-conflicted` opts into restack conflicts. Current failed
472
493
  verification satisfies attention even before its notification is written. Existing conditions return immediately,
473
494
  even with `--since`; live and backlog matches ignore routine outcomes and
474
495
  self-healing failures. A merge match uses the watch observation with
@@ -504,7 +525,7 @@ waiting on the operator:
504
525
 
505
526
  | Section | Contents |
506
527
  |---|---|
507
- | `escalations` | Open builds with open escalations, as `builds.get` reports them; wait-only builds are excluded |
528
+ | `escalations` | Open builds with open escalations, as `builds.get` reports them; wait-only builds are excluded. Also each `done` build with an open escalation (status `done`), which `builds.answer` acknowledges while the build stays done |
508
529
  | `merges` | The `merges.list` entries, each with its build's PR |
509
530
  | `events` | The `repository.events` attention page after `cursor`: `{items, cursor, hasMore}` |
510
531
  | `waiting` | Builds `paused`, `stalled`, failing node verification (`verification-failed`) or failing forge CI (`ci-failing`), each with a `detail` |
@@ -516,8 +537,10 @@ fixes; the named tool reads the evidence to report. Cursor rules match
516
537
  `repository.events`: an omitted cursor returns no events and a baseline cursor
517
538
  beside every current-state section, and an expired cursor fails with
518
539
  `code: "cursor-too-old"`. The call never waits. Its cost is bounded: one open-build
519
- listing pass, the `repository.status` reads and at most 256 journal positions,
520
- with zero event rows when nothing changed.
540
+ listing pass, the `repository.status` reads, one `doneEscalations` rollup read
541
+ plus a record and saved-facts read per done build with an open escalation, and
542
+ at most 256 journal positions. It grows with open escalations, never with
543
+ history, and reads zero event rows when nothing changed.
521
544
 
522
545
 
523
546
  Hosted ticket tools resolve independent project ticket policy, including its
@@ -839,7 +862,7 @@ permission or retention failures leave deletion pending. Vercel Blob cleanup use
839
862
  the same store identity, token and prefixed pathname as uploads. Missing objects
840
863
  are successful cleanup; provider errors never count as completed deletion.
841
864
 
842
- Paged ticket listings use the source's optional native `listPage(criteria, page)` capability when present, otherwise read the full listing, order it, and slice it: by default urgent tickets first, then normal ones, each in source order; for `newest`, the reversed listing. `newest` means newest filed first, regardless of urgency, with a stable tie-break; it is not the reverse of dispatch order. A source that lists in filing order (file, GitHub, Linear) gets exactly that from the reversed listing. The remote `HostedTicketSource` pages natively through the service's `list-page` operation, and uses the fallback only against a service predating it. Native errors propagate. PostgreSQL counts matches without bodies and reads only the requested window. Zero limits and offsets past the end still report the full matching total. Unpaged listings remain exhaustive; the wire payload is the same for both paths.
865
+ Paged ticket listings use the source's optional native `listPage(criteria, page)` capability when present, otherwise read the full listing, order it, and slice it: by default priority order (urgent, high, normal, then low tickets, each in source order); for `newest`, the reversed listing. `newest` means newest filed first, regardless of priority, with a stable tie-break; it is not the reverse of priority order. A source that lists in filing order (file, GitHub, Linear) gets exactly that from the reversed listing. The remote `HostedTicketSource` pages natively through the service's `list-page` operation, and uses the fallback only against a service predating it. Native errors propagate. PostgreSQL counts matches without bodies and reads only the requested window. Zero limits and offsets past the end still report the full matching total. Unpaged listings remain exhaustive; the wire payload is the same for both paths.
843
866
 
844
867
 
845
868
  ### Forge cooldown admission and explicit recovery
@@ -35,6 +35,7 @@ bun ab build status example-build --json
35
35
  - Interactive `dispatch` shows the terminal dashboard.
36
36
  - A shell-capable agent follows progress and acts through the CLI, including `bun ab watch` and `bun ab wait`.
37
37
  - A standing CLI operator uses `bun ab watch --operator --json` after checking `bun ab repository status --json` for existing presence. It operates the builds the repository's dispatcher dispatches and adopts new ones.
38
+ - `bun ab watch` and `bun ab wait` exit 1 on a reducer incompatibility (`incompatible reducer …`) instead of retrying it; the operator aligns the CLI with the service (service first), then re-arms.
38
39
  - Presence is advisory and allows multiple registrations. MCP repository status marks it `unavailable`, which is not evidence of absence. Termination attempts withdrawal; routine timeout/count re-arms keep the five-minute grace. SIGKILL and failed withdrawal rely on TTL expiry.
39
40
  - Dashboard and API share one lifecycle vocabulary.
40
41
 
@@ -55,7 +56,7 @@ Status output reports each nonterminal build's slot state, by the rules the disp
55
56
  | `ab builds`, `ab build status` | `SLOT` column, `slot:` line | `slot` |
56
57
  | `ab repository status` | `slots:` line after `capacity:` | `capacity.slots`, by slug |
57
58
 
58
- - Values: `{"state":"held"}`, `{"state":"requested","request":…,"priority":"urgent"}` (`request` is `resume`, `reconcile`, `verification`, `reopen` or `propose`; `priority` only when urgent), or `{"state":"none"}`.
59
+ - Values: `{"state":"held"}`, `{"state":"requested","request":…,"priority":"high"}` (`request` is `resume`, `reconcile`, `verification`, `reopen` or `propose`; `priority` is `urgent`, `high` or `low`, omitted for normal), or `{"state":"none"}`.
59
60
  - `capacity.occupied` counts exactly the `held` entries. A requested build is a slot waiter.
60
61
  - A missing value is unknown, from a server older than this field. It is never `none`, and text prints `unknown`. A `done` build reports no slot state.
61
62
 
@@ -69,12 +70,12 @@ Every nonterminal build row on both dashboards, `ab builds` and `ab build status
69
70
  | `STARTING` | green | held | No runner works yet: a newly claimed build provisioning, a relaunch, spec publication, an upgrade drain, a suspended session. |
70
71
  | `PAUSING` | green | held | A pause was requested and the runner is still stopping. |
71
72
  | `ABORTING` | green | held | An abort was requested and the runner is still stopping. |
72
- | `QUEUED` | teal | requested | Parked work waiting for admission. The note names the request (`resume`, `reconcile`, `verification`, `reopen`, `propose`) and marks urgent waiters. |
73
+ | `QUEUED` | teal | requested | Parked work waiting for admission. The note names the request (`resume`, `reconcile`, `verification`, `reopen`, `propose`) and marks urgent, high and low waiters. |
73
74
  | `WAITING` | amber | none | A finished pipeline waiting for a merge decision (`merge decision`) or on hold (`on hold`), a ticket wait (`on <ids>`), or a `revise-spec` answer waiting for its revision (`spec revision`). |
74
75
  | `MERGING` | amber | none | A finished pipeline with merge consent, waiting for merge gates or the forge. |
75
76
  | `PAUSED` | amber | none | An acknowledged pause. |
76
77
  | `COLLECTING` | amber | none | An integration build collecting child work. |
77
- | `BLOCKED` | red | none | An open escalation, or a failed node verification waiting for a repair child. |
78
+ | `BLOCKED` | red | none | An open escalation, or a failed node verification waiting for a repair child. The note `done` marks a completed build with an open escalation, such as a post-landing audit or a question still open when abort cleanup completed; the row stays until `ab answer` acknowledges it. |
78
79
  | `CLEANING` | dim | none | Abort cleanup. |
79
80
 
80
81
  - Green means held: the active counter `<occupied>/<capacity>` counts the green rows.
@@ -110,12 +111,12 @@ bun ab web
110
111
  - `--json` prints one line, `{"url":"http://127.0.0.1:<port>/"}`, for agents that open or hand off the page.
111
112
  - Reads nothing from the store while no browser is connected; open tabs share one refresh loop.
112
113
  - While idle, each poll reads only the repository change position.
113
- - A fresh process starts the overview from the build roster. It reads each live build plus each aborted build among the roster's 10 newest finished builds, to show aborts still cleaning up. An older abort still cleaning up appears at its next change. Startup never scans history.
114
+ - A fresh process starts the overview from the build roster and the `doneEscalations` rollup. It reads each live build, each aborted build among the roster's 10 newest finished builds (to show aborts still cleaning up), and every done build with an open escalation, whatever its age. An older abort still cleaning up appears at its next change. Startup never scans history.
114
115
  - A build change reads that build only, plus one roster read when a build starts, finishes or aborts. The overview never lists builds, and nothing reads event history.
115
- - A remote store server too old to serve the roster, the changed-builds feed or the filtered listing fails the read with a typed error instead of falling back.
116
+ - A remote store server too old to serve the roster, a compatible `doneEscalations` rollup, the changed-builds feed or the filtered listing fails the read with a typed error instead of falling back.
116
117
  - Pages:
117
118
  - The overview (`/`) shows the dispatcher's mode, capacity, what needs attention, and active, queued and recently finished builds. Each row links to its build page.
118
- - A build page (`/builds/<slug>`) shows an active or queued build's ticket, phase, steps and attention. A recently finished build's page shows only its outcome, kind and completion time, because the roster keeps no finished tickets. Every build page ends with that build's timeline, including builds the overview does not list.
119
+ - A build page (`/builds/<slug>`) shows an active or queued build's ticket, phase, steps and attention. A done build with an open escalation keeps a full attention row and page, outside the newest-finished cap, until the question is answered. Any other recently finished build's page shows only its outcome, kind and completion time, because the roster keeps no finished tickets. Every build page ends with that build's timeline, including builds the overview does not list.
119
120
  - Analytics (`/analytics`) shows the Gantt of builds and the step-duration table; see [Timeline and analytics](#timeline-and-analytics).
120
121
  - Pages update live and offer no actions.
121
122
  - Analytics and timelines are explicit reads from `/api/analytics` and `/api/builds/<slug>/timeline`, never polled:
@@ -742,7 +742,7 @@ because a request is open. A node that is paused, blocked, has a pending command
742
742
  conflicted node restack, a landing intent or a merged or closed PR, or is
743
743
  deferred for runtime compatibility gets `optimization.proposal-deferred` with
744
744
  that reason instead, and is reconsidered once a fact that can clear it lands.
745
- The request takes a slot ahead of normal ticket claims, like node reconcile and
745
+ The request takes a slot ahead of ticket claims at the node's level, like node reconcile and
746
746
  verification. Before the session starts, the dispatcher re-checks the request:
747
747
  when the node stopped, the active-hours budget is spent, or room fell below the
748
748
  recorded room, it records `optimization.proposal-withdrawn`, which clears the
@@ -832,11 +832,12 @@ build as an ordinary child.
832
832
  An attempt keeps the ordinary work grammar: plan, plan review, implement, code
833
833
  review, verify and finalize.
834
834
 
835
- An attempt claims at its node's priority. `ab priority <node> urgent` puts
836
- the node's attempts claimed afterwards in the urgent tier; an attempt already
837
- claimed keeps its build's priority. Nothing is reserved: an attempt waits for
838
- a free slot like any ready ticket, preempts nothing, and follows the source's
839
- order within its tier.
835
+ An attempt claims at its node's level, any of `urgent`, `high`, `normal` or
836
+ `low`, whether or not the ticket source stores priority. `ab priority <node>
837
+ high` puts the node's attempts claimed afterwards in the high tier; an attempt
838
+ already claimed keeps its build's level. Nothing is reserved: an attempt waits
839
+ for a free slot like any ready ticket, preempts nothing, and follows the
840
+ source's order within its tier.
840
841
 
841
842
  ### Attempt context
842
843
 
@@ -157,7 +157,9 @@ archive transport refuses a head's archive ref, call it with your trusted Git
157
157
  transport. It keeps the head as a BuildStore copy and resolves to the copy's
158
158
  exclusion base; record the head with that `storeBase` in place of `remoteRef`.
159
159
  It throws when the head cannot be kept; rethrow so release is refused. A
160
- provider that ignores it preserves strictly. A `restoration` head may name
160
+ provider that ignores it preserves strictly. Abort cleanup is the exception:
161
+ when preservation fails, the dispatcher records the commits as lost
162
+ (`workspace.commits-lost`) and releases anyway. A `restoration` head may name
161
163
  `storeBase` instead of `remoteRef`. Then `provision` receives
162
164
  `restoreStored({ exec, workspacePath, sha })`: when the commit is absent, call
163
165
  it with your trusted transport, and fail provisioning when it resolves false.
@@ -248,6 +250,7 @@ A plugin relying on a capability declares an `apiVersion` range containing its v
248
250
  - **1.9** Optional native ticket-source paging (`listPage`); older sources retain operator slicing.
249
251
  - **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`.
250
252
  - **1.11** Optional ticket-source search (`search`); callers refuse sources without it and never fall back to a listing.
253
+ - **1.12** Host-provided factory-context `fetch` and `invocationSignal` for bounded-invocation cancellation.
251
254
 
252
255
  ## 2. Create a repository-local module
253
256
 
@@ -293,6 +296,12 @@ Every module default-exports one strict `AutobuildPluginManifest`:
293
296
 
294
297
  Every adapter and contract factory receives `{ config, env, repoRoot }`: read-only `config`, the process `env`, and `repoRoot`, the absolute consuming-repository root.
295
298
 
299
+ Ticket-source, forge and workspace-provider factories also receive `fetch` and `invocationSignal` from a host that provides API 1.12. A bounded dispatcher invocation (the hosted cron) cancels requests at its deadline through them:
300
+
301
+ - **`fetch`** Use it for provider HTTP. Every request is cancelled at the current invocation phase's deadline, together with any `init.signal` you pass; outside a bounded invocation it is plain `fetch`.
302
+ - **`invocationSignal()`** Call it at request time, not at construction, for other transports (SQL clients, subprocesses, SDKs with their own HTTP). It returns `undefined` outside a bounded invocation.
303
+ - An adapter that ignores both still works, but at the deadline its requests are abandoned rather than cancelled.
304
+
296
305
  | Port | `config` |
297
306
  |---|---|
298
307
  | ticket-source | the existing strict `[tickets]` fields; no untyped plugin-options table |
@@ -301,7 +310,7 @@ Every adapter and contract factory receives `{ config, env, repoRoot }`: read-on
301
310
 
302
311
  Workspace-provider factories also receive optional host-derived seams (API 1.7), absent when the call site has none; ignoring them changes nothing.
303
312
 
304
- - **`storeRef`, `delegateCredential`** Store URL and credential-exchange callback; guaranteed when the registration declares `capabilities.storeRequirements`.
313
+ - **`storeRef`, `delegateCredential`** Store URL and credential-exchange callback; guaranteed when the registration declares `capabilities.storeRequirements`. In a bounded invocation the exchange goes through the host `fetch`, so it is cancelled at the deadline too.
305
314
  - **`runtimeReferences`** The host's effective runtime routes.
306
315
  - **`origin`, `remoteBranchHead`** Checkout-less readers; when absent, fall back to host `git` from `repoRoot`.
307
316
 
@@ -551,15 +560,33 @@ compatibility facade refuses any write naming links with
551
560
 
552
561
  ## Optional priority capability
553
562
 
554
- An adapter opts in with `priority: true` and must persist
555
- `priority?: 'urgent' | 'normal'` on create, update and revision-checked update,
556
- return `priority: 'urgent'` on every read of an urgent ticket and omit the field
557
- otherwise, treat `normal` as clearing urgency, and include urgent priority in
558
- revisions. The dispatcher claims urgent ready tickets before normal ones, each in
559
- your listing order, and ahead of normal builds waiting for a slot. Without the
560
- flag, every ticket reads as normal: the compatibility facade refuses a write naming `urgent` with
561
- `TicketPriorityUnsupported` before your methods run, drops a `normal` no-op
562
- (skipping the call when nothing else remains), and strips priority from reads.
563
+ Ticket priority has four levels, highest first: `urgent`, `high`, `normal`
564
+ (the default) and `low`. Declare `priority: true` only if you store all four
565
+ natively. Then you must:
566
+
567
+ - persist `priority?: TicketPriority` on create, update and revision-checked
568
+ update; an update that omits it never changes it
569
+ - return the level on every read, omitting the field for normal
570
+ - include any level other than normal in revisions
571
+
572
+ Without the flag, the compatibility facade stores priority as labels for you:
573
+ `priority:urgent`, `priority:high` or `priority:low`, none for normal. It reads
574
+ them case-insensitively (the highest wins when several are present), reports
575
+ them as `priority` and never in `labels`, keeps them across labels
576
+ replacements, never touches any other label, and refuses label writes,
577
+ criteria and `readyLabels` or `createLabels` entries that name one. If your
578
+ source records the `node` kind as a label rather than natively, declare
579
+ `kindLabel` with that label's name: a kind change written beside a priority
580
+ then adds or removes it. A raw source used outside the facade
581
+ without the flag refuses any level but `normal` with
582
+ `TicketPriorityUnsupported`.
583
+
584
+ The dispatcher claims ready tickets by level, urgent first and low last, each
585
+ level in your listing order and ahead of lower-level builds waiting for a
586
+ slot. The SDK exports `TICKET_PRIORITIES`, `ticketPriority` (absent reads as
587
+ normal), `dispatchPriority` (the level a ticket is claimed at), `byPriority`
588
+ (a stable four-level sort), and, for the label fallback, `priorityLabelSource`,
589
+ `PRIORITY_LABEL_PREFIX` and `priorityLabel`.
563
590
 
564
591
  ## Optional ready assignee capability
565
592
 
@@ -627,18 +654,17 @@ Native paging is an optional API 1.9 ticket-source capability:
627
654
  The SDK exports these types; the result is `TicketListing & { total: number }`.
628
655
  Criteria retain state, labels (AND), and assignee semantics. The page has a
629
656
  nonnegative integer `limit`, optional nonnegative integer `offset` (default 0),
630
- and optional `order: 'oldest' | 'newest'` (default oldest). Oldest is the
631
- source's dispatch order: with `priority`, urgent tickets first, then normal
632
- ones, each in listing order. Newest is newest filed first: creation time
633
- descending, regardless of urgency, with a stable tie-break. It is not the
634
- reverse of dispatch order. Offset and limit apply after ordering. Total counts all matches, even
657
+ and optional `order: 'oldest' | 'newest'` (default oldest). Oldest is
658
+ priority order: urgent, high, normal, then low tickets, each in listing order.
659
+ Newest is newest filed first: creation time descending, regardless of
660
+ priority, with a stable tie-break. It is not the reverse of priority order. Offset and limit apply after ordering. Total counts all matches, even
635
661
  with limit zero or an offset past the end. Records, diagnostics and errors
636
662
  match the exhaustive listing. The shared `describeTicketSourceContract` suite
637
663
  automatically compares declared native paging with full-read windows.
638
664
 
639
665
  Only paged operator listings select this capability. Sources without it retain
640
666
  the full-read fallback, which orders the listing before offset and limit: by
641
- default a stable urgent-first partition (urgent, then normal, each in source
667
+ default a stable priority sort (urgent, high, normal, then low, each in source
642
668
  order), or for newest the reversed listing, which is newest filed first for
643
669
  sources that list in filing order (file, GitHub, Linear). Native errors
644
670
  propagate. Unpaged operator listings, CLI ticket lists and dispatcher ready
@@ -658,7 +684,7 @@ errors.
658
684
  | Type | Fields |
659
685
  | --- | --- |
660
686
  | `TicketSearchQuery` | `text`, optional `state`, optional `labels`, `limit`, optional `cursor` |
661
- | `TicketSearchHit` | `id`, `title`, optional `state`, `labels`, `kind`, optional `target` |
687
+ | `TicketSearchHit` | `id`, `title`, optional `state`, `labels`, `kind`, optional `target`, optional `priority` (`TicketPriority`) |
662
688
  | `TicketSearchPage` | `tickets: TicketSearchHit[]`, optional `cursor`, `diagnostics` |
663
689
 
664
690
  - **Matching.** A ticket matches when every whitespace-separated term of
@@ -672,6 +698,8 @@ errors.
672
698
  is source-defined and stable across pages. Reject a malformed or foreign
673
699
  cursor with the SDK's `TicketSearchCursorInvalid(sourceName, cursor)`;
674
700
  callers map it to the `search-cursor-invalid` refusal.
701
+ - **Priority.** Set `priority` on a hit whose ticket is `urgent`, `high` or
702
+ `low`, taken from the search read itself; `normal` may be omitted.
675
703
  - **Cost.** Build each hit from the search read itself, never from a follow-up
676
704
  read per result. A failure rejects; it never falls back to `listAll`.
677
705