@defrex/autobuild 1.12.0 → 1.14.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 (167) hide show
  1. package/README.md +1 -1
  2. package/SPEC.md +465 -163
  3. package/bin/ab-build-runner.ts +8 -0
  4. package/docs/answering-blocked-builds.md +28 -4
  5. package/docs/architecture.md +136 -53
  6. package/docs/cli.md +1 -1
  7. package/docs/configuration.md +120 -17
  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 +13 -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 +52 -13
  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 +32 -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 +547 -145
  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/policy.ts +1 -0
  54. package/packages/core/src/events/repository.ts +33 -3
  55. package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +31 -0
  56. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/be211f0e31a65006.json.gz +0 -0
  57. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/0a10010ee5cf2e47.json +577 -0
  58. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/227701361be6d1e0.json +490 -0
  59. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/312cc4090820a612.json +1078 -0
  60. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/76e5043bae7a80ab.json +86 -0
  61. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/87a917802870bbed.json +87 -0
  62. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/9d85616e5b9e24c1.json +500 -0
  63. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/a2780567b4989fb6.json +105 -0
  64. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/c7c94fbe7f63cf07.json +84 -0
  65. package/packages/core/src/kernel/clean-restack-policy.ts +40 -0
  66. package/packages/core/src/kernel/dispatch-capacity.ts +243 -107
  67. package/packages/core/src/kernel/done-escalations.ts +273 -0
  68. package/packages/core/src/kernel/engine.ts +28 -9
  69. package/packages/core/src/kernel/integration-landing.ts +24 -4
  70. package/packages/core/src/kernel/integration-stack.ts +39 -0
  71. package/packages/core/src/kernel/janitor-failure.ts +20 -1
  72. package/packages/core/src/kernel/log-index-value.ts +3 -0
  73. package/packages/core/src/kernel/log-index.ts +41 -2
  74. package/packages/core/src/kernel/open-pr-backpressure.ts +3 -3
  75. package/packages/core/src/kernel/reducer-registry.ts +3 -0
  76. package/packages/core/src/kernel/reducer-revisions.ts +19 -0
  77. package/packages/core/src/kernel/reducer.ts +42 -8
  78. package/packages/core/src/kernel/repository-attention.ts +14 -5
  79. package/packages/core/src/kernel/repository-read-facts.ts +9 -0
  80. package/packages/core/src/kernel/ticket-starts.ts +15 -4
  81. package/packages/core/src/kernel/verify-stages.ts +46 -7
  82. package/packages/core/src/operator/attention.ts +28 -3
  83. package/packages/core/src/operator/done-escalations.ts +38 -0
  84. package/packages/core/src/operator/presentation.ts +1 -1
  85. package/packages/core/src/operator/protocol.ts +8 -5
  86. package/packages/core/src/operator/query.ts +33 -19
  87. package/packages/core/src/operator/registry.ts +17 -13
  88. package/packages/core/src/operator/ticket-start.ts +8 -7
  89. package/packages/core/src/operator/tickets.ts +28 -9
  90. package/packages/core/src/plugin-sdk/index.ts +10 -0
  91. package/packages/core/src/plugins/manifest.ts +14 -1
  92. package/packages/core/src/ports/forge/create.ts +8 -0
  93. package/packages/core/src/ports/forge/github-transport.ts +5 -1
  94. package/packages/core/src/ports/forge/github.ts +3 -0
  95. package/packages/core/src/ports/tickets/contract.ts +147 -76
  96. package/packages/core/src/ports/tickets/create.ts +47 -7
  97. package/packages/core/src/ports/tickets/fake.ts +8 -4
  98. package/packages/core/src/ports/tickets/file-codec.ts +4 -3
  99. package/packages/core/src/ports/tickets/file.ts +7 -3
  100. package/packages/core/src/ports/tickets/github.ts +1 -0
  101. package/packages/core/src/ports/tickets/grants.ts +11 -3
  102. package/packages/core/src/ports/tickets/hosted-index.ts +5 -0
  103. package/packages/core/src/ports/tickets/linear.ts +28 -9
  104. package/packages/core/src/ports/tickets/migration.ts +4 -4
  105. package/packages/core/src/ports/tickets/operations.ts +4 -2
  106. package/packages/core/src/ports/tickets/priority-labels.ts +213 -0
  107. package/packages/core/src/ports/tickets/priority.ts +127 -21
  108. package/packages/core/src/ports/tickets/remote-protocol.ts +10 -0
  109. package/packages/core/src/ports/tickets/remote.ts +104 -11
  110. package/packages/core/src/ports/tickets/revision.ts +5 -3
  111. package/packages/core/src/ports/tickets/search.ts +9 -0
  112. package/packages/core/src/ports/tickets/tree.ts +8 -6
  113. package/packages/core/src/ports/types.ts +30 -15
  114. package/packages/core/src/ports/workspace/build-execution.ts +13 -1
  115. package/packages/core/src/ports/workspace/builtin-capabilities.ts +4 -0
  116. package/packages/core/src/ports/workspace/create.ts +16 -3
  117. package/packages/core/src/ports/workspace/execution-exit-marker.ts +41 -0
  118. package/packages/core/src/ports/workspace/recovery-step.ts +101 -0
  119. package/packages/core/src/ports/workspace/vercel-sandbox.ts +596 -144
  120. package/packages/core/src/processes/build-execution-state.ts +4 -0
  121. package/packages/core/src/processes/build-runner.ts +14 -1
  122. package/packages/core/src/processes/dispatcher.ts +841 -230
  123. package/packages/core/src/processes/execution-settlement.ts +25 -3
  124. package/packages/core/src/processes/harvest-runner.ts +12 -7
  125. package/packages/core/src/processes/infrastructure-failure-budget.ts +7 -2
  126. package/packages/core/src/processes/invocation-budget.ts +176 -0
  127. package/packages/core/src/processes/publication-loss.ts +38 -3
  128. package/packages/core/src/processes/tick-publication.ts +1 -0
  129. package/packages/core/src/processes/workspace-preservation.ts +86 -15
  130. package/packages/core/src/store/contract.ts +88 -3
  131. package/packages/core/src/store/event-reads.ts +30 -1
  132. package/packages/core/src/store/reduced-reads.ts +23 -0
  133. package/packages/core/src/store/reducer-value-shapes.json +6759 -6490
  134. package/packages/core/src/store/reducer-value-validation.ts +188 -33
  135. package/packages/core/src/store/remote/client.ts +169 -29
  136. package/packages/core/src/store/remote/compatibility.ts +113 -56
  137. package/packages/core/src/store/remote/credentials.ts +4 -1
  138. package/packages/core/src/store/remote/protocol.ts +3 -0
  139. package/packages/core/src/store/remote/released-clients.json +22 -0
  140. package/packages/core/src/store/remote/released-reducer-values/1.13.0.json +35966 -0
  141. package/packages/core/src/store/remote/released-reducer-values/1.14.0.json +36076 -0
  142. package/packages/core/src/store/remote/released-reducer-values/index.ts +20 -16
  143. package/packages/core/src/store/remote/released-value-policy.ts +144 -0
  144. package/packages/core/src/store/remote/retry.ts +406 -0
  145. package/packages/core/src/store/repo-state-events.ts +1 -0
  146. package/packages/core/src/testing/dispatch-read-budget.ts +155 -11
  147. package/packages/core/src/testing/index.ts +2 -0
  148. package/packages/core/src/testing/invocation-budget.ts +42 -0
  149. package/packages/core/src/testing/reduced-read-budget.ts +589 -19
  150. package/packages/core/src/testing/released-value-coverage.ts +423 -0
  151. package/packages/core/src/web/overview-source.ts +19 -6
  152. package/skills/guide/SKILL.md +147 -67
  153. package/skills/guide/references/integration-tree.md +12 -9
  154. package/skills/guide/references/merge-policy.md +7 -2
  155. package/skills/guide/references/operator-api.md +46 -23
  156. package/skills/guide/references/optimization-nodes.md +7 -6
  157. package/skills/guide/references/plugin-authoring.md +46 -18
  158. package/skills/guide/references/remote-store-protocol.md +52 -13
  159. package/skills/guide/references/remote-ticket-protocol.md +85 -38
  160. package/skills/guide/references/restacking.md +48 -3
  161. package/skills/guide/references/setup.md +2 -1
  162. package/skills/guide/references/ticket-migration.md +2 -2
  163. package/skills/operate/SKILL.md +136 -55
  164. package/skills/plan/SKILL.md +4 -3
  165. package/skills/spec/SKILL.md +9 -5
  166. package/skills/tickets/SKILL.md +25 -17
  167. package/templates/hosted-service/package.json +2 -2
package/SPEC.md CHANGED
@@ -196,7 +196,8 @@ linear history and root freshness as recommendations. Archive refs are optional
196
196
  forge-side backup of displaced leaf and node history and of unpublished
197
197
  workspace commits: where the forge refuses them, rewrites and node writes keep a
198
198
  BuildStore copy or warn and proceed, and workspace preservation keeps a
199
- BuildStore copy or refuses the release (§15.7). Results are pass, fail, or unknown; incomplete
199
+ BuildStore copy or refuses the release, except under abort cleanup, which
200
+ records the commits lost and releases (§15.7). Results are pass, fail, or unknown; incomplete
200
201
  inspection never proves permission. Local Git passes trivially; legacy plugins
201
202
  report unknown. Known hard failures fail init validation and produce one durable
202
203
  `dispatcher.forge-readiness-failed` repository fact per run/check; historical
@@ -570,13 +571,16 @@ clock rollback, rescans, and resets the cache to the current clock.
570
571
 
571
572
  **Single-ticket start requests.** An operator can ask the running dispatcher,
572
573
  local or hosted, to start one named ticket whether or not intake is on:
573
- `ab start <ticket-id> [--priority manual|urgent|normal]`, the operator tool
574
+ `ab start <ticket-id> [--priority manual|urgent|high|normal|low]`, the operator tool
574
575
  `tickets.start {priority?}`, or HTTP `POST …/tickets/{id}/start` with an
575
576
  optional `{priority}` body. The priority is the request's slot-admission tier
576
577
  (§12 "Slot admission order") and defaults to `manual`. The request
577
578
  canonicalizes the id through the configured source's `get` (refusing an
578
579
  unknown ticket) and appends one human-attributed repository
579
- `ticket.start-requested {ticket, priority}` naming the canonical ref. A pending
580
+ `ticket.start-requested {ticket, priority, level?}` naming the canonical ref.
581
+ `priority` keeps its persisted `manual | urgent | normal` domain; a `high` or
582
+ `low` request writes `priority: normal` refined by `level`, which an older
583
+ reader drops and reads as a normal request. A pending
580
584
  request with the same priority makes it a no-op; one with another priority is
581
585
  updated by the new event, keeping the first request's sequence, so settlement
582
586
  and cancellation still name one request. `ab start --cancel`
@@ -587,12 +591,25 @@ pending. A reduced `ticketStarts` part of the repository read facts holds the
587
591
  pending requests and the eight most recent settlements; a settlement or
588
592
  cancellation applies only to the request sequence it names.
589
593
 
590
- Each tick evaluates pending requests in two passes, at most eight per pass,
591
- each in tier order and then oldest first, and claims nothing else for them:
594
+ Each tick reads at most eight pending `manual` and `urgent` requests, and at
595
+ most eight `high`, `normal` and `low` requests shared by their passes, each in
596
+ tier order and then oldest first, and claims nothing else for them:
592
597
  `manual` and `urgent` requests after node admission and before ordinary
593
- intake, and `normal` requests after ordinary intake and the deferred normal
594
- parked admissions, so that urgent claims and normal parked work found in the
595
- same tick go first. Each request belongs to one pass. With none pending a pass
598
+ intake. Each of `high`, `normal` and `low` runs inside ordinary intake just
599
+ before intake's first ready ticket at that level or below. A level that intake
600
+ does not reach runs after intake and the deferred parked admissions. So the
601
+ higher-level claims and the waiting work reserved in the same tick go first,
602
+ and each level's requests are claimed, oldest first, before its ready tickets.
603
+ A request a tick leaves unread is a barrier for that tick, set from the
604
+ pending requests when the tick starts: while one at level L is unread, nothing
605
+ below L is admitted (no ready-ticket claim, optimization attempt, parked leaf,
606
+ node or proposer), and L's own ready tickets wait too. L's waiting work keeps
607
+ its place ahead of L's claims, and higher levels are unaffected. The barrier
608
+ adds no reads; a later tick reads the request once the requests ahead of it
609
+ settle.
610
+ Ordinary intake leaves a ticket with a pending non-`manual` request to the
611
+ start pass. A request settled without starting frees the slot that intake had
612
+ reserved for it. Each request belongs to one pass. With none pending a pass
596
613
  reads nothing; otherwise it makes one targeted `get` per request. Every tier
597
614
  bypasses intake off, and open-PR backpressure, without enabling intake for any
598
615
  other ticket. A request whose ticket has an active build settles
@@ -606,9 +623,9 @@ skips the ready listing, the scan checkpoint and the standing queue report but
606
623
  keeps every gate: creation holds, profile conflicts, node targets, dependency
607
624
  verdicts, the spec-standard quality gate and its bounce, the claim and its
608
625
  preparation journal, capacity, repository pause, accounts and forge health.
609
- A claimed build's priority (§13) is `urgent` when the request's priority was
610
- `urgent`, even on a source without the priority capability, and otherwise its
611
- ticket's own; `manual` is admission-only and never a build priority.
626
+ A claimed build's level (§13) is the request's level for a non-`manual`
627
+ request and its ticket's level for a `manual` one; `manual` is admission-only
628
+ and never a build priority.
612
629
  Outcomes are `started` with the slug, `invalid` for a bounce (with the missing
613
630
  parts) or a profile conflict, `blocked` for unresolved blockers or an
614
631
  unavailable target, and `claim-refused` for a refused claim. A pause, no free
@@ -747,8 +764,8 @@ two consecutive empty proposals, and when its room is positive. Room is the
747
764
  smaller of the free concurrency slots (`proposer.concurrency` minus attempts
748
765
  queued or running) and the remaining attempts budget, and is zero once the
749
766
  attempts or hours budget is spent. A paused, blocked or otherwise held node
750
- is deferred instead. The request takes a slot ahead of normal ticket claims,
751
- like node reconcile and verification (§12 "Slot admission order"), and is re-checked against current state
767
+ is deferred instead. The request takes a slot ahead of ticket claims at the
768
+ node's level, like node reconcile and verification (§12 "Slot admission order"), and is re-checked against current state
752
769
  before it is admitted. The session runs the `ab-propose` skill on the node
753
770
  head's tree and ends with `ab propose <file>`, `ab propose --none <reason>` or
754
771
  `ab escalate`; `ab done` and `ab verdict` are refused. The proposer only
@@ -761,7 +778,7 @@ spec → plan ⇄ plan-review → implement ⇄ code-review → verify:* → fin
761
778
  Verification uses ordered stages. A string in `[verify].steps` is a singleton
762
779
  stage; a nonempty array groups members that start together. Empty stages and
763
780
  repeated names are errors. Plain string lists retain serial event sequences.
764
- Every member resolves post-reconcile policy, approved selection/`always`, then
781
+ Every member resolves post-reconcile and clean-restack policy, approved selection/`always`, then
765
782
  path applicability at stage entry. Only pass or skip satisfies a member. The
766
783
  next stage, or finalize after the last, waits for every member to pass or skip.
767
784
  On a normal stage transition the runner drains agent turns before stage-local
@@ -845,7 +862,10 @@ For a node-targeted leaf, published finalize-step commits also schedule one
845
862
  waiting restack, even when the target SHA is unchanged, so guarded merge
846
863
  preserves one canonical build identity.
847
864
  Clean awaiting-merge restacks retain existing verification when build-owned config is
848
- unchanged (§16.1), including when replay replaces the pin commit's ancestry.
865
+ unchanged (§16.1), including when replay replaces the pin commit's ancestry,
866
+ unless the clean-restack policy (§16.2) opts steps in for a root-targeting
867
+ leaf. Then the completion opens a fresh cycle: opted-in steps re-run on the
868
+ restacked head and the rest record policy skips.
849
869
  Conflicts use reconcile and its captured post-reconcile policy. A conflict before initial verification,
850
870
  including one at a wait resume, cannot skip initial checks through that policy.
851
871
 
@@ -1474,8 +1494,9 @@ The base-selection invariants make this safe with Git:
1474
1494
  fast-forward (`restack.advanced`). Every new verify start and
1475
1495
  result, including skips, cites the cycle's base and head. Those citations stay
1476
1496
  frozen throughout the cycle and survive clean awaiting-merge restacks; a clean
1477
- wait-resume restack after a `verify:*` or `finalize` wait starts a fresh cycle
1478
- that cites the restacked base and head. Historical facts without citations
1497
+ wait-resume restack after a `verify:*` or `finalize` wait, or a clean
1498
+ awaiting-merge restack that froze an opted-in clean-restack policy (§16.2),
1499
+ starts a fresh cycle that cites the restacked base and head. Historical facts without citations
1479
1500
  remain readable. Upstream-only paths are excluded.
1480
1501
  - **Work distance is advisory durable telemetry.** Each admitted work target poll
1481
1502
  samples destination-only commits (`BUILD..TARGET`), even when only the build
@@ -1665,10 +1686,52 @@ and cannot re-admit themselves. Missing/corrupt checkpoint coverage fails with
1665
1686
  a typed integrity error. Appends never depend on checkpoint availability.
1666
1687
  Expired resume cursors terminate watch/wait with fresh-attachment instructions:
1667
1688
  re-arm without `--since`, reconcile status, and acknowledge the unavailable gap.
1689
+ Live following reads only the events after each stream's position, with no
1690
+ per-poll seed read. Watch retires a terminal, settled build that was not named
1691
+ once its events through settlement are delivered: it leaves tracking and every
1692
+ emitted cursor, so recurring watch cost and cursor size follow active builds.
1668
1693
  Explicit harvest history uses reverse indexed filtered pages rather than a
1669
1694
  journal replay. See `docs/remote-store-protocol.md` for the wire contract,
1670
1695
  initial migration bootstrap and generation-retirement recovery.
1671
1696
 
1697
+ ### Transient remote retries
1698
+
1699
+ The remote build store client and the hosted ticket client retry a request that
1700
+ failed transiently, and only then. The happy path is exactly one request: no
1701
+ timer, buffering, probe or extra read.
1702
+
1703
+ - **Transient** means `429`, `502`, `503`, `504`, a `500` whose body is not a
1704
+ protocol error or has `kind: "internal"`, or a transport failure. Other `4xx`
1705
+ statuses, `501`, authentication failures, `checkpoint-integrity`, a caller's
1706
+ abort and reducer incompatibility (raised after a successful response) are
1707
+ never retried.
1708
+ - **Safety classes.** Idempotent requests retry any transient failure: every
1709
+ `GET`, `PUT` and `DELETE`; the reducer and rollup value reads; the
1710
+ expected-sequence appends; the holder-checked lease and node-writer claims,
1711
+ renewals and releases; repository, scan-cadence and operator-presence upserts;
1712
+ a keyed build creation when the server advertises the creation key; and the
1713
+ hosted ticket reads, `transition`, `update`, `add-blocker`, `remove-blocker`,
1714
+ `mutate-if-revision`, policy publication and keyed `create`. Every other write
1715
+ retries only a `429` or a transport failure that provably preceded delivery
1716
+ (connection refused, unresolvable host, connect timeout).
1717
+ - **A retried keyed build creation** that the server answers with a conflict
1718
+ found an earlier attempt's build: that attempt landed and lost its response.
1719
+ The client point-reads the key's derived slug within the same retry bound
1720
+ and returns that build. A conflict on a first attempt is still a conflict.
1721
+ - **Limits.** At most three attempts, with equal-jitter backoff of 250–500 ms
1722
+ then 500–1000 ms. `Retry-After` (seconds or an HTTP date) lengthens a delay;
1723
+ one over 5 s is not retried.
1724
+ - **The retry bound.** The first retryable failure fixes a bound: 10 s later, or
1725
+ the invocation deadline when sooner. Retry sleeps, retry requests and the
1726
+ buffered reading of every response body after that failure end at the bound;
1727
+ no retry starts at or after it. First attempts are never bounded, so a held
1728
+ read still waits its full window, but a retried long-poll read is cut to the
1729
+ bound. The caller's own cancellation ends retry work with the caller's abort.
1730
+ - **Exhausted failures are typed.** A final transient status, a transport
1731
+ failure, or retry work cut off by the bound surfaces as
1732
+ `RemoteUnavailableError`, keeping the server's message. Typed protocol errors
1733
+ are unchanged.
1734
+
1672
1735
  ### 7.7 Derived reducers
1673
1736
 
1674
1737
  A derived reducer answers a question across builds, such as P90 plan time over
@@ -1801,6 +1864,25 @@ repository's live builds and its most recently finished ones.
1801
1864
  saved row is O(live builds + 50) bytes however many builds the repository
1802
1865
  has ever had.
1803
1866
 
1867
+ #### `doneEscalations`
1868
+
1869
+ Folds every build's `doneEscalationEntry` (§15.5) into the repository's `done`
1870
+ builds that still have an open escalation, such as a post-landing integration
1871
+ audit raised after the node merged. Operator surfaces list them beside the
1872
+ open builds until an operator acknowledges them (§14).
1873
+
1874
+ - **Contribution:** a build whose status is `done` and which has at least one
1875
+ open escalation contributes `{slug, kind}`. Any other build contributes
1876
+ nothing. Completion closes no escalation, but the first `build.aborted`
1877
+ closes every escalation open then, so an aborted build is listed only for an
1878
+ escalation raised after its abort, such as a cleanup failure that escalates,
1879
+ until it is answered or the janitor recovers.
1880
+ - **Arguments:** none, so each repository has one key. Nothing expires.
1881
+ - **Answer:** `{position, builds: [{slug, kind}]}` by slug, with `cursor: 0`.
1882
+ Readers confirm each listed build against its build-reducer state.
1883
+ - **Cost:** a read with nothing changed is the two constant reads, and the
1884
+ saved row is O(escalated done builds) however many builds have finished.
1885
+
1804
1886
  ## 8. The `ab` CLI
1805
1887
 
1806
1888
  The **only** channel between agents and the store — and the enforcement
@@ -1907,7 +1989,30 @@ owner delegation is short-lived, repository-bound and operator-only. The hosted
1907
1989
  dispatcher issues stored credentials with immutable dispatcher purpose (raw
1908
1990
  store and tickets only) per repository invocation. It deletes each credential on
1909
1991
  completion, including failures. Crash-safety expiry is the earlier of the configured
1910
- TTL upper bound and the invocation deadline plus 60 seconds. Each served tick
1992
+ TTL upper bound and the invocation deadline plus 60 seconds. Each invocation's
1993
+ budget is a wall-time bound: work stops, and in-flight store, ticket, forge and
1994
+ workspace requests are cancelled, at the work deadline, which is the budget minus
1995
+ a teardown reserve of `min(30 s, budget/4)`. Teardown (provisioning abandonment,
1996
+ repository-lease release, `dispatcher.run-stopped`) is bounded by the budget end;
1997
+ a write storage cannot finish by then is abandoned and the lease left to expire.
1998
+ Deadline-gated work starts only when it fits before the work deadline: a remote
1999
+ provision needs the provider's estimate (about 150 s), and a stopped-sandbox
2000
+ recovery needs a realistic resume (about 45 s) plus the cleanup reserve, with
2001
+ `recoveryTimeoutMs` as its ceiling. A recovery the deadline cuts short stops the
2002
+ sandbox, or leaves it uncertain for a later fence, and consumes no infrastructure
2003
+ attempt. A tick that defers such work counts it as `provisioningDeferred` or
2004
+ `recoveryDeferred`, logs one line per build naming the step, and is never
2005
+ reported idle. It records those builds in the latest-only, advisory
2006
+ `dispatcher.work-deferred` fact (a deferral noted after the work deadline is
2007
+ written in teardown, under the cleanup deadline, while the repository lease is
2008
+ still held), and the next invocation sweeps them before its
2009
+ other stages, re-deriving every decision from build state. The fact is a
2010
+ scheduling hint, never authority; an entry leaves it only after its own pass
2011
+ finishes without deferring again. Several carried recoveries can use most of
2012
+ that invocation's window before the janitor runs.
2013
+ A budget stop is a normal run stop. Credential deletion then gets the remaining
2014
+ budget and at least 5 seconds; issuance or deletion unsettled by then is
2015
+ reported and left to the capped expiry. Each served tick
1911
2016
  prunes at most 100 expired or revoked dispatcher rows using indexed probes;
1912
2017
  unexpired legacy rows retain their recorded expiry before eventual pruning.
1913
2018
  Already issued delegated grants do not depend on the parent row or its expiry.
@@ -2334,7 +2439,7 @@ handoff naming a draining predecessor, even with an empty drain map. It uses
2334
2439
  existing projections and adds no reads; only durable retirement clears evidence.
2335
2440
  The controls include: ticket intake, the
2336
2441
  repository-wide pause, and the harvest gate, plus pending and recently settled
2337
- single-ticket start requests with their priority (`ticketStarts`, present when either is nonempty). It uses the same
2442
+ single-ticket start requests with their tier, `manual`, `urgent`, `high`, `normal` or `low` (`ticketStarts`, present when either is nonempty). It uses the same
2338
2443
  dispatch-settings reducer as dispatcher decisions and the dashboard. An absent
2339
2444
  repository stream reduces as an empty journal and reports intake on, repository
2340
2445
  pause off; the query does not create that stream,
@@ -2415,8 +2520,11 @@ call — the open escalations `builds.get` reports, the `merges.list` consent
2415
2520
  queue, the attention page of `repository.events` and the `repository.status`
2416
2521
  projection — adds the builds waiting on operator action (paused, stalled,
2417
2522
  failing node verification or forge CI), and names a resolving registry tool per
2418
- item. It takes the `repository.events` cursor, never waits, reads only open
2419
- builds, and reads zero event rows when nothing changed since the cursor.
2523
+ item. Its escalations also include each `done` build with an open escalation,
2524
+ found through the `doneEscalations` rollup (§7.7), with status `done` and
2525
+ `builds.answer` as its acknowledgement. It takes the `repository.events`
2526
+ cursor, never waits, reads only open builds and those escalated done builds,
2527
+ and reads zero event rows when nothing changed since the cursor.
2420
2528
 
2421
2529
  Each registered project also has a per-repository binding at
2422
2530
  `<resource>/<host><path>`, derived from its identity. It serves the same table
@@ -2985,8 +3093,8 @@ nothing, reports a diagnostic and is retried on the next tick. Hosted clients
2985
3093
  read `ticketWait` from the digest wire answer; an older service that omits it
2986
3094
  yields no automatic release, and operators still end waits by answering.
2987
3095
 
2988
- An ended wait requests a `resume` slot and is admitted before normal ticket
2989
- claims, as a parked finished build is (§12 "Slot admission order"); a `revise-spec` answer instead waits for
3096
+ An ended wait requests a `resume` slot and is admitted before ticket claims at
3097
+ its level, as a parked finished build is (§12 "Slot admission order"); a `revise-spec` answer instead waits for
2990
3098
  the revision. The dispatcher observes the leaf's target when it launches the
2991
3099
  resume. Before the declaring phase resumes, and ahead of the plan and code
2992
3100
  loops, the engine decides a `restack` with trigger `wait-resume` and cycle
@@ -3070,69 +3178,86 @@ signals (telemetry, observations)
3070
3178
  → build → PR → merge
3071
3179
  ```
3072
3180
 
3073
- **Intake order.** When a slot is free, dispatch takes ready candidates urgent
3074
- first, then normal, each class in the source's listing order (see Ticket
3075
- priority in §13). Every admission gate is unchanged — blockers, labels,
3076
- creation holds, capacity, intake off and repository pause — so a blocked urgent
3077
- ticket never holds back normal work. Priority never preempts: an urgent ticket
3078
- does not stop, pause or displace a running build.
3181
+ **Intake order.** When a slot is free, dispatch claims ready candidates by
3182
+ level, `urgent`, `high`, `normal` and then `low`, each level in the source's
3183
+ listing order (see Ticket priority in §13). Every admission gate is unchanged
3184
+ — blockers, labels, creation holds, capacity, intake off and repository pause
3185
+ — so a blocked ticket never holds back lower-level work. Priority never
3186
+ preempts: no level stops, pauses or displaces a running build.
3079
3187
 
3080
- **Slot admission order.** Free slots are admitted in five tiers:
3188
+ **Slot admission order.** Free slots are admitted in this order:
3081
3189
 
3082
3190
  1. `manual` single-ticket start requests (the `ab start` default, §11);
3083
- 2. urgent parked work (nodes and leaves that hold no slot and request one:
3084
- `resume`, `reconcile`, `verification`, `reopen` or `propose`, "What holds
3085
- a slot" below);
3086
- 3. urgent ticket claims: `urgent` start requests, then ordinary urgent ready
3087
- tickets while intake is on;
3088
- 4. normal parked work;
3089
- 5. normal ticket claims: `normal` start requests, then ordinary normal ready
3090
- tickets while intake is on.
3091
-
3092
- An optimization attempt's ready ticket claims in its node's tier: the node's
3093
- current build priority, decided at claim. Nothing is reserved for attempts,
3094
- and they never jump ahead of other work in their tier.
3191
+ 2. urgent waiting work, then urgent ticket claims;
3192
+ 3. high waiting work, then high ticket claims;
3193
+ 4. normal waiting work, then normal ticket claims;
3194
+ 5. low waiting work, then low ticket claims.
3195
+
3196
+ Waiting work is parked nodes and leaves that hold no slot and request one:
3197
+ `resume`, `reconcile`, `verification`, `reopen` or `propose` ("What holds a
3198
+ slot" below). A level's ticket claims are that level's start requests, oldest
3199
+ first, then its ordinary ready tickets while intake is on, in the source's
3200
+ listing order. Within each level, waiting work goes ahead of claims, and both
3201
+ go ahead of every lower level. Ordinary intake never claims a ticket with a
3202
+ pending start request at a non-`manual` tier: that request's start pass claims
3203
+ it at its tier. An
3204
+ optimization attempt's ready ticket claims at its node's level: the node's
3205
+ current build priority, any of the four, decided at claim. Nothing is
3206
+ reserved for attempts, and they never jump ahead of other work at their level.
3095
3207
 
3096
3208
  Each tier keeps its own order: start requests oldest first, parked leaves in
3097
3209
  the tick's visit order, nodes in slug order, tickets in the source's listing
3098
3210
  order. Start requests bypass intake off and open-PR backpressure; ordinary
3099
- ready tickets do not. A build's
3100
- priority is frozen from its claimed ticket on `build.created` (`priority:
3101
- urgent`; omitted for normal and in historical logs) and changed by the
3102
- human-authored advisory `build.priority-set {priority: urgent | normal}`
3103
- (`ab priority <slug> urgent|normal`, the operator `builds.control` action
3104
- `priority`); a later ticket priority edit does not reach an existing build.
3105
- Absent priority reads as normal. Admission is arithmetic over reduced facts: a
3106
- waiter is admitted when the slots occupied by every other build plus the
3107
- slots reserved ahead of it are below `capacity`. Pending start requests are
3108
- durable demand: the reduced `ticketStarts` counts them by tier, whatever
3109
- intake says, and nothing while the repository is paused. Each reserves one slot
3110
- ahead of the tiers below it until it settles or is cancelled, and never
3111
- preempts. Only `manual` requests are reserved ahead of urgent parked work.
3112
- Ahead of normal parked work are the `manual` and `urgent` requests, the urgent
3113
- waiters' slot reservations and the urgent claim demand of the latest admission
3114
- scan:
3115
- `dispatcher.ticket-scan-completed` records `urgentWaiting`, the urgent non-node
3116
- ready tickets that passed every intake gate except capacity (omitted when
3117
- none; counted only while intake is on and the repository unpaused). An
3118
- `urgent` start request waits for urgent reservations and `manual` requests; an
3119
- ordinary urgent claim also for `urgent` requests. A `normal` start request
3120
- waits for every waiter, the `manual` and `urgent` requests and the urgent claim
3121
- demand; an ordinary normal claim waits for every waiter and every pending start
3122
- request. Because demand discovered by an earlier scan can be stale,
3123
- the dispatcher also defers, within a tick, any normal parked admission into a
3124
- free slot while ticket claims can run (the source supports priority, intake is
3125
- on, the repository is unpaused, accounts are present and the forge is not
3126
- cooling down). A deferral writes nothing and keeps the build's reservation
3127
- against normal claims; it makes that tick's admission scan due, and the
3128
- deferred admissions are retried after the tick's dispatch only when that scan
3129
- completed its urgent decision (its claim loop ran to the end, or it proved no
3130
- urgent ticket ready). Otherwise they are decided again on a later tick. A
3131
- forced scan is bounded per deferral state: an unchanged set of deferred builds
3132
- and occupancy lists again only when a scan is due on its own. Only gate-passing
3133
- urgent tickets count, so an urgent ticket blocked on a dependency never holds
3134
- back normal parked work. Free slots only: priority never interrupts a running
3135
- build or session.
3211
+ ready tickets do not. A build's level is frozen at claim on `build.created`:
3212
+ the request's level for a build started by a non-`manual` start request, and
3213
+ its ticket's level otherwise. It is changed by the human-authored advisory
3214
+ `build.priority-set` (`ab priority <slug> urgent|high|normal|low`, the operator
3215
+ `builds.control` action `priority`); a later ticket priority edit does not
3216
+ reach an existing build. Both facts encode the level compatibly:
3217
+ `build.created` carries `priority: urgent` for an urgent build and `level:
3218
+ high | low` for a high or low one, both omitted for normal;
3219
+ `build.priority-set` carries `{priority: urgent | normal, level?: high |
3220
+ low}`, with `priority: normal` for high and low. A reader takes `level` over
3221
+ `priority`. A reader older than this encoding drops the `level` key and reads a
3222
+ high or low build as normal, and every log written before it reads as urgent
3223
+ or normal, exactly as before.
3224
+
3225
+ Admission is arithmetic over reduced facts: a waiter is admitted when the
3226
+ slots occupied by every other build plus the slots reserved ahead of it are
3227
+ below `capacity`. Pending start requests are durable demand: the reduced
3228
+ `ticketStarts` counts them by tier, whatever intake says, and nothing while
3229
+ the repository is paused. Each reserves one slot ahead of the tiers below it
3230
+ until it settles or is cancelled, and never preempts. Reserved ahead of a
3231
+ waiter at level L are the `manual` requests and, for every level above L,
3232
+ that level's other waiters, its start requests and its ticket claim demand
3233
+ from the latest admission scan: `dispatcher.ticket-scan-completed` records
3234
+ `urgentWaiting`, `highWaiting` and `normalWaiting`, the non-node ready tickets
3235
+ at that level that passed every intake gate except capacity (each omitted when
3236
+ none; counted only while intake is on and the repository unpaused). Urgent
3237
+ demand is always counted; high and normal demand only while work of a lower
3238
+ level waits (a parked waiter or a start request), and low demand never, since
3239
+ nothing ranks below it. A start request at level L waits for waiters at L or
3240
+ above, every start request of a higher tier and the claim demand of every
3241
+ higher level. An ordinary claim at level L waits for waiters at L or above and
3242
+ every pending start request at L or above; a claim spends a slot of every
3243
+ level, and ready tickets are visited highest level first. Because demand
3244
+ discovered by an earlier scan can be stale, the dispatcher also defers, within
3245
+ a tick, any non-urgent parked admission into a free slot while a higher-level
3246
+ claim can exist and ticket claims can run (intake is on, the repository is
3247
+ unpaused, accounts are present and the forge is not cooling down). A
3248
+ higher-level claim can exist at every level when the source supports
3249
+ priority, and always for low work, since normal tickets exist in every
3250
+ source; without the capability, a high or normal waiter defers only while an
3251
+ open optimization node of a higher level can claim attempts. A deferral writes
3252
+ nothing and keeps the build's reservation against claims at its level; it
3253
+ makes that tick's admission scan due, and the deferred admissions are retried
3254
+ after the tick's dispatch only when that scan decided claims at every level
3255
+ (its claim loop ran to the end, or it proved no ticket could claim or count as
3256
+ demand). Otherwise they are decided again on a later tick. A forced scan is
3257
+ bounded per deferral state: an unchanged set of deferred builds and occupancy
3258
+ lists again only when a scan is due on its own. Only gate-passing tickets
3259
+ count, so a ticket blocked on a dependency reserves nothing at any level. Free
3260
+ slots only: priority never interrupts a running build or session.
3136
3261
 
3137
3262
  **Open-PR backpressure.** An optional intake throttle, off by default and
3138
3263
  independent of slots. When `[policy].maxOpenPrs` is set, the dispatcher
@@ -3144,7 +3269,7 @@ engages when the count reaches `maxOpenPrs` and stays engaged until the count
3144
3269
  drops to or below `resumeOpenPrs` (default `maxOpenPrs - 1`). Reaching
3145
3270
  `maxOpenPrs` takes precedence, so with `resumeOpenPrs = maxOpenPrs` intake
3146
3271
  stays paused at that count and resumes once it falls below. While engaged,
3147
- the dispatcher claims no new `normal`-priority ticket; `urgent` claims,
3272
+ the dispatcher claims no new `high`, `normal` or `low` ready ticket; `urgent` claims,
3148
3273
  in-flight builds, parked-build admission, reconciles, verification and
3149
3274
  landings continue, and capacity accounting is unchanged. The count is derived
3150
3275
  from the reduced build facts each tick already holds. The dispatcher records
@@ -3153,7 +3278,7 @@ from the reduced build facts each tick already holds. The dispatcher records
3153
3278
  transitions (a cleared fact names `drained`, or `disabled` when the key is
3154
3279
  removed while engaged); the engaged fact is the hysteresis memory a fresh
3155
3280
  process reads. Repository status and both dashboards report the count,
3156
- watermarks and whether normal intake is paused. `maxOpenPrs` is unset by
3281
+ watermarks and whether high, normal and low intake is paused. `maxOpenPrs` is unset by
3157
3282
  default, which disables backpressure entirely.
3158
3283
 
3159
3284
  **What holds a slot.** `capacity` is the repository's number of slots. A
@@ -3196,8 +3321,8 @@ the current spec has passed. The dispatcher records the finish as an advisory
3196
3321
  Release follows state; acquisition never does. An answer that lands while the
3197
3322
  build is still carried releases nothing: the build keeps its slot and requests
3198
3323
  none. A build whose outside wait ends holds no slot until it is admitted. It is then **parked work**: it requests a
3199
- slot, and intake reserves one for it ahead of normal ticket claims (urgent work
3200
- first, "Slot admission order"). The requests are:
3324
+ slot, and intake reserves one for it ahead of ticket claims at its level
3325
+ (higher levels first, "Slot admission order"). The requests are:
3201
3326
 
3202
3327
  | Request | Raised by |
3203
3328
  |---|---|
@@ -3522,33 +3647,76 @@ anything is written; it never drops them. Writes that name no links are
3522
3647
  unaffected. `ab ticket create` and `update` take `--issues N[:refs],...`;
3523
3648
  operator and MCP ticket requests take `issueLinks`.
3524
3649
 
3525
- **Ticket priority.** A ticket's priority is `urgent` or `normal`; absent means
3526
- normal. Urgent ready work is claimed before normal ready work, and ahead of
3527
- normal parked work (§12 "Slot admission order"); a claimed ticket's priority
3528
- becomes its build's priority, and nothing else changes. A single-ticket start
3529
- request has its own admission tier (§11); an `urgent` request also makes its
3530
- build urgent. An optimization attempt (§13.1.1) is the exception: an in-flight
3531
- attempt of an open, unstopped optimization node claims at the node's current
3532
- build priority, whatever its ticket says and whether or not its source stores
3533
- priority. `ab priority <node> urgent|normal` therefore reaches the node's
3534
- attempts claimed afterwards; an attempt already claimed keeps its build's
3535
- priority, as any build does. No slot is reserved for attempts, they preempt
3536
- nothing, and within a tier the source's order applies. Sources declare
3537
- support. The file source stores
3538
- `priority = "urgent"` in its frontmatter, writes no key for normal, and covers
3539
- urgent priority in its revisions; the in-memory fake behaves the same way.
3540
- The hosted source stores priority in the hosted ticket store, covers it in its
3541
- revision, and lists urgent ready tickets first; an update that omits priority
3542
- never changes it. The Linear source maps its native Urgent priority (1) to
3543
- `urgent` and reads every other value as normal; it writes Urgent for `urgent`,
3544
- clears only a current Urgent to No priority for `normal`, and covers urgent
3545
- priority in its revisions. Plugins without the capability read every ticket
3546
- as normal and refuse a create or
3547
- update naming `urgent` with a typed error naming the source, before anything is
3548
- written. Naming `normal` on such a source is a successful no-op. `ab ticket
3549
- create` and `update` take `--priority urgent|normal`; operator and MCP ticket
3550
- requests take `priority`; JSON ticket output always names it. Harvest files
3551
- every proposal normal; grooming marks one urgent.
3650
+ **Ticket priority.** A ticket's priority is one of four levels, highest
3651
+ first: `urgent`, `high`, `normal`, `low`. Absent means `normal`, the default.
3652
+ Normalized tickets omit the field for normal; JSON ticket output (`ab ticket
3653
+ show --json`, listings, operator `tickets.get` and `tickets.search`) always
3654
+ names exactly one level.
3655
+
3656
+ - **Dispatch.** Ready work is claimed by level, `urgent`, `high`, `normal`
3657
+ then `low`, each level in the source's listing order, and each level's
3658
+ claims go after that level's parked work and ahead of every lower level's
3659
+ (§12 "Slot admission order"). A ticket's build takes its level, and among
3660
+ ready tickets only urgent claims bypass open-PR backpressure. A claim
3661
+ freezes the build's level and nothing else changes; `ab priority` changes
3662
+ the build's level and never the ticket. A single-ticket start request has
3663
+ its own admission tier (§11), and a non-`manual` request sets its build's
3664
+ level.
3665
+ - **Optimization attempts** (§13.1.1) are the exception: an in-flight attempt
3666
+ of an open, unstopped optimization node claims at the node's current build
3667
+ level, any of the four, whatever its ticket says or whether its source
3668
+ stores priority. `ab priority <node> urgent|high|normal|low` therefore
3669
+ reaches the node's attempts claimed afterwards; an attempt already claimed
3670
+ keeps its build's level, as any build does. No slot is reserved for
3671
+ attempts, they preempt nothing, and within a level the source's order
3672
+ applies.
3673
+ - **Writes.** `ab ticket create` and `update` take `--priority
3674
+ urgent|high|normal|low`; operator and MCP `tickets.create` and
3675
+ `tickets.update` take the same `priority` values. Any other value is refused
3676
+ before anything is written, with an error naming the four levels. An update
3677
+ that omits priority never changes it. Harvest files every proposal normal;
3678
+ grooming sets another level.
3679
+ - **Native storage.** Sources that store all four levels declare the
3680
+ `priority` capability. The file source stores `priority = "<level>"` in its
3681
+ frontmatter for `urgent`, `high` and `low` and writes no key for normal; the
3682
+ in-memory fake behaves the same way. The hosted source stores all four in
3683
+ the hosted ticket store and lists ready tickets urgent, then high, then
3684
+ normal, then low, each in filing order. The Linear source maps Urgent (1),
3685
+ High (2) and Low (4) to `urgent`, `high` and `low`, and Medium (3) or No
3686
+ priority (0) to `normal`; writing `urgent`, `high` or `low` sets the
3687
+ matching Linear priority, and writing `normal` sets No priority only when the
3688
+ issue is Urgent, High or Low, leaving Medium untouched. File, hosted and
3689
+ Linear revisions cover priority.
3690
+ - **Label fallback.** A source without the capability (the GitHub source, and
3691
+ any plugin that does not declare it) gets priority through the ticket-source
3692
+ compatibility facade, which stores a level other than normal as exactly one
3693
+ label: `priority:urgent`, `priority:high` or `priority:low`; normal is none
3694
+ of them. Priority labels are matched case-insensitively, including
3695
+ hand-added ones; when several are present the highest wins, and the next
3696
+ priority write leaves exactly one (none for normal). They are reported as
3697
+ the ticket's `priority`, never in its `labels`. A labels replacement neither
3698
+ adds nor removes them, and a priority write never touches other labels,
3699
+ except that a source declaring `kindLabel` (GitHub's `node`) keeps that
3700
+ label in step with a kind change written beside the priority.
3701
+ Label writes, listing and search criteria, and `[tickets].readyLabels` or
3702
+ `createLabels` entries naming a priority label are refused (writes point to
3703
+ `--priority`; configuration fails at startup), so priority labels never
3704
+ satisfy or block `readyLabels`. Reading priority costs no extra request, and
3705
+ the revision changes with priority because labels are in it.
3706
+ - **Refusal.** Outside the facade, a raw source without the capability
3707
+ refuses a create or update naming any level but `normal` with a typed
3708
+ `TicketPriorityUnsupported` error naming the source, before anything is
3709
+ written; naming `normal` is a successful no-op. Through Autobuild this
3710
+ arises only from a hosted service that cannot store the level.
3711
+ - **Hosted version skew.** Current clients send, and current servers echo on
3712
+ every ticket response, the capability header
3713
+ `x-autobuild-ticket-priority-levels: 1`. A server answering a client that
3714
+ sends only the older `x-autobuild-ticket-priority: 1` keeps `urgent` and
3715
+ reports `high` and `low` as `normal`; without either header it names no
3716
+ priority. A current client refuses to write `high` or `low` to a server that
3717
+ does not echo the levels header, with `TicketPriorityUnsupported` naming the
3718
+ `hosted` source, before anything is written. Search hits carry an optional
3719
+ `priority`, projected the same way.
3552
3720
 
3553
3721
  **Ticket assignees.** A ticket may carry the usernames it is assigned to.
3554
3722
  Sources declare support with the `assignees` capability; only the GitHub source
@@ -3718,21 +3886,22 @@ the branch is open to targeting tickets immediately, without a PR. Idle integrat
3718
3886
  builds use no provisioned workspace, runner, execution lease, or dispatch capacity.
3719
3887
 
3720
3888
  A node requesting reconcile, verification or, for an optimization node,
3721
- propose is admitted before normal ticket claims (urgent work first, §12 "Slot
3722
- admission order"). The request is durable: a
3889
+ propose is admitted before ticket claims at its level (higher levels first,
3890
+ §12 "Slot admission order"). The request is durable: a
3723
3891
  prepared verification cycle, a restack conflict or an open proposal request,
3724
3892
  with no runner yet. Until the node holds its slot, intake reserves one
3725
3893
  slot for it, and the dispatcher checks its admission every tick regardless of
3726
3894
  idle node polling, so a slot freed in any tick goes to the node, not to a new
3727
- normal claim. A node's admission counts every build that holds a slot, as every
3895
+ claim at its level or below. A node's admission counts every build that holds a slot, as every
3728
3896
  admission does. Blocked and paused descendants hold none (§12 "What holds a
3729
3897
  slot"), so they never stand between a node and the slot it needs to unblock
3730
3898
  them, and no node uses a descendant's slot. Admission is durable and precedes
3731
3899
  provisioning; a node's workspace never counts toward occupancy. Status and both dashboards report
3732
3900
  occupancy against configured capacity. Status, `ab builds` and both dashboards
3733
- report each node waiting for a slot ahead of normal ticket claims, marking
3734
- urgent waiters, the pending start requests of each tier and the urgent ticket
3735
- claims waiting ahead of normal parked work, and report every other parked
3901
+ report each node waiting for a slot ahead of ticket claims at its level,
3902
+ marking urgent, high and low waiters, the pending start requests of each tier
3903
+ and the urgent, high and normal ticket claims waiting ahead of lower-level
3904
+ parked work, and report every other parked
3736
3905
  build waiting to run again the same way. Idle collecting nodes remain free.
3737
3906
 
3738
3907
  An empty node has no PR and reports `integration`, `target`, and `empty`.
@@ -3775,7 +3944,13 @@ children's, and is refreshed before landing, so merging it closes them (see
3775
3944
  Forge issue links).
3776
3945
  Authoritative enforced up-to-date protection records fenced merge; uncertainty
3777
3946
  records unfenced merge and triggers immutable merged-tree comparison. A mismatch
3778
- raises operator attention and never rewrites the shared parent.
3947
+ raises operator attention and never rewrites the shared parent. A verified commit
3948
+ that is empty (its tree equals its parent's) and whose identity is missing from
3949
+ an otherwise tree-identical merge is accounted for, since forge rebase merges
3950
+ drop empty commits; duplicates, non-empty omissions and tree mismatches still
3951
+ raise attention. That attention, like any escalation raised after completion,
3952
+ stays on the dashboards and `repository.attention` until it is closed with
3953
+ `ab answer`, which does not change the build's done status.
3779
3954
  The repository build digest carries an additive optional pending-audit signal from
3780
3955
  `integration.landed` with an operation until `integration.audited` settles it.
3781
3956
  Settled nodes without that signal require no full build reads; completion does
@@ -4395,8 +4570,8 @@ runtime compatibility is not requested; the dispatcher instead records
4395
4570
  `optimization.proposal-deferred {reason}` (`paused`, `blocked`, `command`,
4396
4571
  `restack`, `integration`, `landing` or `compatibility`), and reconsiders the
4397
4572
  node only after a fact that can clear the blocker lands on its log. The
4398
- request is the node's `propose` slot request, admitted ahead of normal ticket
4399
- claims (§13.1, §12 "Slot admission order"). Before admission the dispatcher re-checks it against current
4573
+ request is the node's `propose` slot request, admitted ahead of ticket claims
4574
+ at the node's level (§13.1, §12 "Slot admission order"). Before admission the dispatcher re-checks it against current
4400
4575
  state: a request whose node has stopped, whose active-hours budget is spent,
4401
4576
  whose room fell to zero or below the recorded room, or whose node has no free
4402
4577
  concurrency slot, and for which no session has started, records
@@ -4717,8 +4892,9 @@ over one server-sent event stream. It appends nothing, takes no lease and
4717
4892
  registers no presence.
4718
4893
 
4719
4894
  Its frame is the repository header and notice plus the overview. A fresh
4720
- process starts the overview from the `buildRoster` rollup (§7.7) and targeted
4721
- reads of its live builds, then advances it by the changed-builds feed. Its
4895
+ process starts the overview from the `buildRoster` and `doneEscalations`
4896
+ rollups (§7.7) and targeted reads of its live and escalated done builds, then
4897
+ advances it by the changed-builds feed. Its
4722
4898
  recurring reads, made only while a browser is subscribed:
4723
4899
 
4724
4900
  | Occurrence | Reads | Cost |
@@ -4728,13 +4904,14 @@ recurring reads, made only while a browser is subscribed:
4728
4904
  | Per changed build | `getBuild`, `buildReadFacts`, and while the build is visible `listStreams` and its pinned effective-config artifact | 4 calls, that build's new rows |
4729
4905
  | A changed build started, finished, aborted or is done | `buildRoster` | 1 call per poll |
4730
4906
  | New effective-config ref | `getRepoArtifact` | 1 call per ref |
4731
- | Cold start: first read, repository reset | `buildRoster`, the per-build reads for each live build and each aborted entry among the roster's newest finished builds | O(live builds), independent of history |
4907
+ | Cold start: first read, repository reset | `buildRoster`, `doneEscalations`, the per-build reads for each live build, each aborted entry among the roster's newest finished builds and each done build with an open escalation | O(live builds + escalated done builds), independent of history |
4732
4908
 
4733
4909
  No read grows with history, build count or tab count, and nothing is read
4734
4910
  while no browser is connected. The overview never lists builds, analytics
4735
4911
  requests read one listing page, and nothing reads events. A
4736
- remote store that lacks the roster or the feed fails the read with its typed
4737
- error and never falls back to either. Until the dispatcher records an
4912
+ remote store that lacks the roster, `doneEscalations` or the feed, or serves a
4913
+ different rollup version, fails the read with its typed error and never falls
4914
+ back to either. Until the dispatcher records an
4738
4915
  effective configuration the frame has no `overview` and makes no build read.
4739
4916
  The web protocol's overview and rows carry the shared dashboard projection's
4740
4917
  terms: status, phase, attention, waits, step timers, finished outcomes, the
@@ -4878,10 +5055,15 @@ compared numerically. Build creation and every build event also record the new
4878
5055
  position as that build's latest change position, in the same transaction, which
4879
5056
  the changed-builds feed (§7.2) reads.
4880
5057
  Unchanged positions reuse the complete presentation snapshot; an ordinary refresh, focused or unfocused,
4881
- then makes exactly one store request. Discovery uses required exact-repo
4882
- `listBuildsForRepo(repo)`, never a global listing. Initial hydration, position or
4883
- configuration changes, and at most ten seconds between full reads refresh the
4884
- snapshot, including mutable lease/stream/artifact/ticket enrichment. Failed or
5058
+ then makes exactly one store request. Discovery never lists builds: a cold
5059
+ start (initial hydration or a feed reset) samples the change position, then
5060
+ reads `listOpenBuilds(repo)` and the `doneEscalations` rollup (§7.7); every
5061
+ later refresh reads only `listBuildsChangedSince` from that watermark and
5062
+ re-reads the builds it reports. Position or configuration changes, and at most
5063
+ ten seconds between full reads, refresh the snapshot, including the visible
5064
+ builds' stream and artifact enrichment. A remote store on a different
5065
+ `doneEscalations` version, or without the open-builds or feed routes, fails the
5066
+ refresh with its typed error and never falls back to a listing. Failed or
4885
5067
  cancelled reads do not acknowledge the sampled position. Open session feeds poll
4886
5068
  independently; kernel ticks and watch/wait retain their existing reads.
4887
5069
 
@@ -4988,8 +5170,20 @@ standalone `dispatcher.tick-failed` diagnostic before the next operational tick.
4988
5170
  An unacknowledged diagnostic remains pending and may be duplicated after a lost
4989
5171
  response. Reporting never closes a later tick boundary or gates committed
4990
5172
  handoff acceptance. Explicit shutdown, supersession and fatal forge publication
4991
- still stop the loop; once mode rethrows the original tick error even if reporting
4992
- fails. Stopping before recovery leaves only local warnings for unreported failures.
5173
+ still stop the loop. Once mode ends its run after its single tick: a failed tick
5174
+ whose `dispatcher.tick-failed` is durable records a normal `dispatcher.run-stopped`
5175
+ with exit code 1 and the error, then rethrows the original error; an unreported
5176
+ failure, a fatal forge publication or a fatal ticket preparation stops abnormally.
5177
+ Stopping before recovery leaves only local warnings for unreported failures.
5178
+
5179
+ A dispatcher with a hosted ticket source publishes its ticket policy and settles
5180
+ targeted listing at its first tick boundary, as ticket preparation, not while it
5181
+ is constructed. A transient preparation failure is a tick failure retried on the
5182
+ next tick; a permanent one (authentication, a service predating the policy, a
5183
+ validation error) is fatal. A tick-failure episode spans runs, so consecutive
5184
+ one-tick runs accumulate one: any completed tick ends it, as does a clean,
5185
+ abnormal or forced stop of the run that last failed, but a new run or a one-tick
5186
+ run's normal stop after its failed tick does not.
4993
5187
 
4994
5188
  Repository tick telemetry is bounded mutable operational metadata, like leases.
4995
5189
  `beginRepoTick` persists the open boundary before unsafe work; `finishRepoTick`
@@ -5041,7 +5235,11 @@ setup failures, and blockers. Dashboard rows derive from build and repository ev
5041
5235
  effective configuration only, so heartbeat or lease renewal without an event
5042
5236
  does not alter them. Every nonterminal build, including `queued`, has a
5043
5237
  dashboard row; a pre-run row names its pending dispatch boundary or latest
5044
- durable failure. A human may discard only such a queued build. Discard is
5238
+ durable failure. A `done` build with an open escalation, such as a
5239
+ post-landing integration audit raised after it completed or an escalation
5240
+ raised during abort cleanup, also has a row, `BLOCKED` with the note
5241
+ `done` and its question, until an operator acknowledges it with `ab answer`;
5242
+ it holds no slot and offers no other control. A human may discard only such a queued build. Discard is
5045
5243
  dispatcher cleanup, returns the ticket to its
5046
5244
  configured Ready state, and completes with
5047
5245
  `discarded`; it is deliberately distinct from abort, which returns work to
@@ -5068,12 +5266,12 @@ using a slot and the word tells why.
5068
5266
  | | held | `STARTING` | no runner is working yet: provisioning, a relaunch, spec publication, a publication retry, a pending ticket-wait decision, an upgrade drain, a suspended session |
5069
5267
  | | held | `PAUSING` | a pause was requested and the runner is still stopping |
5070
5268
  | | held | `ABORTING` | an abort was requested and the runner is still stopping |
5071
- | teal (`live`) | requested | `QUEUED` | parked work waiting for admission; the note names the request (`resume`, `reconcile`, `verification`, `reopen`, `propose`) and marks urgent waiters |
5269
+ | teal (`live`) | requested | `QUEUED` | parked work waiting for admission; the note names the request (`resume`, `reconcile`, `verification`, `reopen`, `propose`) and marks urgent, high and low waiters |
5072
5270
  | amber (`held`) | none | `WAITING` | a finished pipeline waiting for a merge decision or on hold, an entered ticket wait, or a `revise-spec` answer waiting for its revision; the note says which (`merge decision`, `on hold`, `on <tickets>`, `spec revision`) |
5073
5271
  | | none | `MERGING` | a finished pipeline with merge consent, waiting for merge gates or for the forge to merge |
5074
5272
  | | none | `PAUSED` | an acknowledged pause |
5075
5273
  | | none | `COLLECTING` | an integration build collecting child work |
5076
- | red (`alert`) | none | `BLOCKED` | an open escalation, other than a ticket wait's own, or a failed node verification waiting for a repair child |
5274
+ | red (`alert`) | none | `BLOCKED` | an open escalation, other than a ticket wait's own, or a failed node verification waiting for a repair child; the note `done` marks a completed build whose escalation awaits acknowledgement |
5077
5275
  | dim (`pending`) | none | `CLEANING` | abort cleanup |
5078
5276
 
5079
5277
  A build's slot state picks its tone first, then the word within that tone.
@@ -5180,7 +5378,10 @@ rejection is `EventValidationError`.
5180
5378
  require a boundary. The store is the *only* coordination surface — no side
5181
5379
  channel — and polling covers commands exactly the way it covers
5182
5380
  `subscribe`. A runner that is dead still receives pause/resume/abort
5183
- commands and escalation answers on resume. While a turn is live, the runner
5381
+ commands and escalation answers on resume. Abort is the exception: the
5382
+ dispatcher acknowledges it itself for any node, and for a queued, paused
5383
+ or blocked leaf with no live execution lease. It never provisions a
5384
+ workspace or starts a runner to do so. While a turn is live, the runner
5184
5385
  subscribes from its session boundary and forwards pause or abort as caller-owned
5185
5386
  cancellation to the AgentRunner; it closes the session transcript without
5186
5387
  recording `phase.failed`, records suspension for pause, and acknowledges the
@@ -5198,16 +5399,16 @@ with illustrative members:
5198
5399
  | Family | Examples |
5199
5400
  |---|---|
5200
5401
  | Build lifecycle | `build.created` (carrying `assets`, the claim-time pin, §6.3), `workspace.provisioned`, `workspace.cleanup-required`, `workspace.fenced`, `workspace.commits-preserved`, decisive `workspace.commits-retained` (the same receipt when some head is a BuildStore copy, §15.7), `workspace.commits-lost`, `workspace.released`, `execution.started`, `execution.ended`, `infrastructure.failed`, `infrastructure.cleanup-attempted`, `dispatch.comment-posted`, `dispatch.failed`, `runner.attached`, `runner.runtime-recorded`, `runner.setup-failed`, `abort.remote-branch-deleted`, `abort.local-branch-deleted`, `abort.ticket-returned`, `build.ticket-returned`, advisory `slot.admitted {request?, need?}` (§12), `build.completed` |
5201
- | Operator commands [D2] | `build.abort-requested {reason?, to?, origin?: {kind: optimization-stop, node}}` → `build.aborted` (a human, or the dispatcher for an attempt of a stopped optimization node, §13.1.1); `build.pause-requested` → `build.paused`; `build.discard-requested`; `build.hold-requested {reason?}`; `build.priority-set {priority}` (advisory slot-admission priority, §12); `build.land-requested` → `landing.command-acknowledged`; decisive human `build.reopened {feedback?, spec?: {artifact, assets?}}` (§15.7); `escalation.answered` (optionally carrying a validated `reviewRoundCeiling`, or the `assets` sampled with a revise-from-ticket authorization) |
5402
+ | Operator commands [D2] | `build.abort-requested {reason?, to?, origin?: {kind: optimization-stop, node}}` → `build.aborted` (a human, or the dispatcher for an attempt of a stopped optimization node, §13.1.1); `build.pause-requested` → `build.paused`; `build.discard-requested`; `build.hold-requested {reason?}`; `build.priority-set {priority, level?}` (advisory slot-admission level, §12); `build.land-requested` → `landing.command-acknowledged`; decisive human `build.reopened {feedback?, spec?: {artifact, assets?}}` (§15.7); `escalation.answered` (optionally carrying a validated `reviewRoundCeiling`, or the `assets` sampled with a revise-from-ticket authorization) |
5202
5403
  | Merge policy | `landing.decided` (candidate, matched rule/default, labels, target, mode, matched `paths?` summary); advisory `landing.deferred` (candidate, reason, rule, policy); kernel `landing.consent-revoked {commandSeq, source, rule, previousHead, head, consentedHead?, paths}`; `landing.native-enable-started`; `landing.native-applied`; advisory dispatcher `landing.polling-selected {candidate, decisionSeq, commandSeq?, detail}` and `landing.human-merge-required {candidate, decisionSeq, commandSeq?, cause: merge-queue-rule \| merge-queue-activity \| merge-refused, detail}` |
5203
5404
  | Spec | `spec.imported`, `spec.authored`, `spec.revised` (either positive `escalation` sequence or exclusive `operator: {user, via?}` provenance for an idle node or a settled leaf's reopen, §15.7; optionally carrying `assets`, a re-pin of the ticket's assets, §6.3) |
5204
5405
  | Sessions | `session.started` (including optional write-ahead continuation intent, budget ceiling, and the effective first `prompt` the bracket sent: the start prompt, the live continuation message, or the interruption notice); `session.suspended` with partial transcript and active duration; `session.resumed` acceptance (stale reports are inert); reasoned `session.resume-fallback`; kernel-only `session.native-handle-recorded` with bracket and native execution identity; `session.ended` with transcript ref and usage (ordinary completion — the analysis corpus), or `session.ended {outcome: reclaimed, reclaimedBy: {instance, resumedFromSeq}}` (explicit transcriptless takeover) |
5205
5406
  | Plan/code loops | `plan.started` … `plan-review.verdict`; `implement.started` … `code-review.verdict`; agent `implement.declined {round, reason, artifact?}` (decisive), an optimization attempt's alternative implement terminal: the build completes `closed-unmerged` and the dispatcher writes `attempt.settled {outcome: declined, note}` on the node (§13.1.1) |
5206
- | Verify/finalize | `verify.started {step, attempt, feedback?, baseSha?, headSha?, restackId?}`, `verify.completed {step, outcome, skipCause?, baseSha?, headSha?, restackId?}`, `verify.cancelled {step, attempt, cause: {step}, baseSha?, headSha?, restackId?}`, `verify.stage-failed {attempt, cycle, stage, failed, cancelled, baseSha?, headSha?, restackId?}`, `verify.reconcile-policy-captured {reconcileSeq, steps}`, `finalize.completed {pr}`, `finalize.step-started {step}`, `finalize.step-completed {step, ok, headSha?}` |
5407
+ | Verify/finalize | `verify.started {step, attempt, feedback?, baseSha?, headSha?, restackId?}`, `verify.completed {step, outcome, skipCause?: post-reconcile-policy \| clean-restack-policy, baseSha?, headSha?, restackId?}`, `verify.cancelled {step, attempt, cause: {step}, baseSha?, headSha?, restackId?}`, `verify.stage-failed {attempt, cycle, stage, failed, cancelled, baseSha?, headSha?, restackId?}`, `verify.reconcile-policy-captured {reconcileSeq, steps}`, `finalize.completed {pr}`, `finalize.step-started {step}`, `finalize.step-completed {step, ok, headSha?}` |
5207
5408
  | Integration attention | Kernel/dispatcher `integration.verification-failed {id, head, parent, steps, guidance}`: one durable failed-cycle notification, recovered from exact verification receipts |
5208
5409
  | PR summary | Kernel-authored `pr-summary.requested {occurrence, boundary}`, `pr-summary.attempted {occurrence, boundary, pr}`, `pr-summary.result {attempt, outcome, eligibleAfter?}`, `pr-summary.settled {request, disposition}`; sequence identities correlate durable starts, completed boundaries, attempts, and handoffs (§7.5) |
5209
5410
  | PR attachments | `pr-attachment.designated`, `pr-attachment.hosted`, `pr-attachment.reclaimed`, `pr-attachment.reclaim-failed` |
5210
- | Leaf restacking | `target.moved {branch, sha, lineage?}`, `target.rewritten {branch, previousSha, sha}`, `target.rewrite-cleared {branch, sha, lineage?}`, kernel `target.rewrite-reprovision-prepared {branch, previousSha, base, from, sha}` and `target.rewrite-recovered {branch, previousSha, sha, base, recovery: reprovisioned \| accepted, escalation?, pendingLocal?}`, advisory `target.distance {branch, sha, head, count}`, `restack.prepared`, `restack.replayed`, `restack.publish-intended`, `restack.rewritten`, `restack.contended`, `restack.completed` (trigger `verify-entry`, `wait-resume` or `awaiting-landing`), `restack.advanced {trigger: wait-resume, cycle, observation, branch, from, to}`, kernel `restack.regenerated {id, files, commands, outcome, head?, reason?}`, kernel or dispatcher decisive `history.retained {operation: restack \| reconcile, id, base, store, target, unretained}` (leaf restacks and reconciles, §15.7) |
5411
+ | Leaf restacking | `target.moved {branch, sha, lineage?}`, `target.rewritten {branch, previousSha, sha}`, `target.rewrite-cleared {branch, sha, lineage?}`, kernel `target.rewrite-reprovision-prepared {branch, previousSha, base, from, sha}` and `target.rewrite-recovered {branch, previousSha, sha, base, recovery: reprovisioned \| accepted, escalation?, pendingLocal?}`, advisory `target.distance {branch, sha, head, count}`, `restack.prepared`, `restack.replayed`, `restack.publish-intended`, `restack.rewritten`, `restack.contended`, `restack.completed` (trigger `verify-entry`, `wait-resume` or `awaiting-landing`; an awaiting-landing intent, rewrite and completion may carry a frozen `cleanRestackPolicy {steps}`), `restack.advanced {trigger: wait-resume, cycle, observation, branch, from, to}`, kernel `restack.regenerated {id, files, commands, outcome, head?, reason?}`, kernel or dispatcher decisive `history.retained {operation: restack \| reconcile, id, base, store, target, unretained}` (leaf restacks and reconciles, §15.7) |
5211
5412
  | Head path facts | advisory `head.paths-recorded {source, head, destination, mergeBase, total, preview, resolution?, artifact}` |
5212
5413
  | Propose (§5, §13.1.1) | Kernel `propose.started {round, request}`; agent `propose.completed {round, request, proposals, artifact}` (the deposited proposal ids and the `attempts` artifact) |
5213
5414
  | Post-PR [D1] | `pr.merged`, `pr.conflicted`, advisory dispatcher `pr.checks-failed {pr, head, buildHead, checks, total, digest}` and `pr.checks-cleared {pr, head, cause}` (forge CI on finished leaves, §15.7), `reconcile.progress-checked`, `reconcile.started`, `reconcile.prepared`, `reconcile.replayed`, `reconcile.publish-intended`, `reconcile.rewritten`, `reconcile.contended`, `reconcile.completed`, kernel `reconcile.superseded {attempt, cycle, cause: wait-resume, restackId?}` (§11 "Ticket waits") |
@@ -5217,10 +5418,18 @@ with illustrative members:
5217
5418
  | Judge panels (§13.1.1) | Kernel `panel.started {panel, candidate, baseline, harnessPin, purpose, rubric, harness, judges}` (judges 1–20); kernel `panel.judge-started {panel, judge, session, order: candidate-first \| baseline-first, runner, model?, account?, stream?, substitution?}`; agent (judge) `panel.preferred {panel, judge, session, preference: A \| B \| tie, reason}` (nonblank reason, no order); kernel `panel.judged {panel, judge, session, order, preference, reason}`; kernel `panel.judge-ended {panel, judge, session, outcome: completed \| no-terminal \| failed \| expired \| interrupted \| reclaimed, error?, transcript?}`. All live on the log of the build that runs the panel, and all are decisive. |
5218
5419
  | Repository journal | dispatcher setting facts; run lifecycle, effective config, tick/queue diagnostics, reload and runner outcomes; the `harvest.*` workflow, recovery, and ledger facts; `ticket-preparation.*` claim boundaries; `ticket.handed-back` and `ticket.handback-settled`; `ticket.start-requested`, `ticket.start-cancelled`, `ticket.start-settled` and the advisory `ticket.identity-recorded`; configured hook health `hook.failing`, `hook.recovered` and `hook.skipped` (advisory attention, §16.1) |
5219
5420
 
5220
- Abort cleanup is a dispatcher-owned ordered saga. While an execution lease is
5221
- live, the janitor defers the saga so it cannot race process-tree teardown. Once
5222
- that supervisor releases the lease, or an abruptly orphaned lease expires, cleanup
5223
- closes an open unmerged PR without overriding a racing merge, releases the workspace,
5421
+ Abort cleanup is a dispatcher-owned ordered saga. A runner acknowledges abort
5422
+ for a running leaf; for a queued, paused or blocked leaf with no live execution
5423
+ lease, and for a node, the dispatcher appends `build.aborted` itself and runs
5424
+ the saga, never provisioning a workspace or starting a runner first. The first
5425
+ `build.aborted` accepts the abort and closes, unanswered, every escalation open
5426
+ at that moment. It also ends any janitor failure episode, so a cleanup failure
5427
+ after it starts a new episode and escalates under a new id. A repeated
5428
+ `build.aborted` closes nothing. While an
5429
+ execution lease is live, the janitor defers the saga so it cannot race
5430
+ process-tree teardown. Once that supervisor releases the lease, or an abruptly
5431
+ orphaned lease expires, cleanup closes an open unmerged PR without overriding a
5432
+ racing merge, releases the workspace,
5224
5433
  deletes the exact published remote branch and exact local branch, unions the
5225
5434
  `autobuild:aborted` label into the current ticket labels, moves the ticket once
5226
5435
  to its destination and posts an abort notice, reports the hand-back, and only
@@ -5238,6 +5447,16 @@ move, the `abort.ticket-returned` checkpoint and the hand-back report, because
5238
5447
  its node's sweep moves the ticket to the rejected role (§13.1.1). A closed
5239
5448
  attempt PR likewise records no `build.ticket-returned`.
5240
5449
 
5450
+ Abort's workspace release attempts commit preservation once. When preservation
5451
+ fails, including when the forge defers or cools down the archive, it records
5452
+ `workspace.commits-lost` (reason `abort: commit preservation failed — …`) and
5453
+ releases anyway: abort discards the build's work, and the receipt is its paper
5454
+ trail. Only lost repository authority, a mixed-version deferral or a live
5455
+ execution lease stop the release. An uncompleted publication request is
5456
+ recorded `publication.lost` without a settlement attempt. A failed provider
5457
+ teardown records `infrastructure.cleanup-attempted` with pending cleanup and
5458
+ stays due on the next tick, so no orphan environment is left behind.
5459
+
5241
5460
  Every dispatcher hand-back of a claimed or ready ticket other than completion —
5242
5461
  abort, spec-standard bounce, preparation recovery returning a confirmed claim,
5243
5462
  closed-unmerged PR and discard — appends one repository `ticket.handed-back`
@@ -5352,14 +5571,24 @@ version is the server's cache identity, not a compatibility gate. The client
5352
5571
  drops object properties its shape does not know, so additive server changes
5353
5572
  reach older readers. Invalid envelopes and values the client cannot represent
5354
5573
  (a missing field, an unknown variant) fail with a typed incompatibility error
5355
- naming the reducer and client/server versions. Clients send
5574
+ naming the reducer, client/server versions and upgrade advice. The error is
5575
+ terminal for every reader: `ab watch` and `ab wait` exit 1 at once instead of
5576
+ retrying, and never reconstruct the value from history. Clients send
5356
5577
  `x-autobuild-reducer-value-projection: 1`. The service retains frozen contracts for
5357
5578
  every supported published client, including clients with projection capability.
5358
5579
  It adapts canonical answers to the released finished shape and reducer version.
5359
- Unknown event variants in optional `lastEvent` are omitted, also in nested build
5360
- state, while cursor, progress, and compatibility facts remain canonical. The
5361
- required `seenTypes` set retains the event types known to that released reader.
5362
- Unrepresentable required values remain typed incompatibilities. A request may
5580
+ An optional `lastEvent` the release cannot represent is omitted, also in nested
5581
+ build state, when its type is unknown to the release or when it is a well-formed
5582
+ event under the server's catalog whose payload carries values the release
5583
+ predates; a malformed display event leaves the answer unchanged. Cursor,
5584
+ progress, and compatibility facts remain canonical. The required `seenTypes` set
5585
+ retains the event types known to that released reader. A declared
5586
+ released-value policy rewrites a widened literal to an older equivalent, or omits
5587
+ it when the field is optional, only where released readers then behave the same.
5588
+ A value that drives released decisions, such as an escalation's policy cause, and
5589
+ other unrepresentable required values remain typed incompatibilities. Every divergence from a supported contract is declared in that
5590
+ policy, and populated values covering every union variant are tested against
5591
+ every supported contract. A request may
5363
5592
  identify its generated finished-value catalog in `x-autobuild-catalog-identity`;
5364
5593
  a recorded published identity selects its frozen contract. An unrecognized catalog
5365
5594
  identity with projection capability retains the canonical answer, including source
@@ -5606,7 +5835,10 @@ carries the measured delta. The read-budget harness in
5606
5835
  lastEvent}`. `blocked` ≡ an open escalation: an `escalation.raised` (or the
5607
5836
  escalation a `phase.deferral-escalated` or `wait.entered` opens) without a
5608
5837
  matching `escalation.answered`, matched by id; a ticket wait's escalation also
5609
- closes on `wait.ended` and on a `wait-unresolvable` raise. `waitRequest` and
5838
+ closes on `wait.ended` and on a `wait-unresolvable` raise. The first
5839
+ `build.aborted` closes every escalation open then, without an
5840
+ `escalation.answered` and without entering `answeredEscalations`; one raised
5841
+ after it stays open. `waitRequest` and
5610
5842
  `wait` project the latest ticket-wait request and entered wait (§11 "Ticket
5611
5843
  waits"); `wait.ended?: {cause: operator | automatic | unresolvable, seq,
5612
5844
  message}` is the wait's first end. `reviewRoundCeilings` projects valid
@@ -5691,6 +5923,16 @@ rollup (§7.7): the build's `kind` (from `build.created`, default `work`), its
5691
5923
  {outcome, completedAt}`. It applies the build reducer's terminal rule, so
5692
5924
  `finished` is present exactly when the build's status is `done` or `aborted`.
5693
5925
 
5926
+ #### Done escalation entry
5927
+
5928
+ `doneEscalationEntry` is a registered build-scope value for the
5929
+ `doneEscalations` rollup (§7.7): the build's `kind`, its latest terminal fact
5930
+ (`done` or `aborted`) and its open escalation ids in raise order. It applies the build reducer's open-escalation
5931
+ rules exactly: raises, deferrals, janitor escalations and entered ticket waits
5932
+ open; answers, wait ends, janitor recovery, `wait-unresolvable`, verify
5933
+ supersession and the first abort close. Its ids always equal the build reducer's
5934
+ `openEscalations`.
5935
+
5694
5936
  ### 15.6 Walkthroughs
5695
5937
 
5696
5938
  **Happy path** (elided: `session.started/ended` brackets around every agent
@@ -5728,7 +5970,9 @@ A discard request is honored only while the build remains queued; one that races
5728
5970
  attachment is inert and cannot tear down live work. A human discard waits out
5729
5971
  any unexpired execution lease, then releases a partial workspace and stale
5730
5972
  lease, returns the ticket to Ready, and appends `build.completed {outcome:
5731
- discarded}` last. No runner is required.
5973
+ discarded}` last. No runner is required. A queued build has no open escalation,
5974
+ so a discard closes none; an escalation its cleanup raises stays open until it
5975
+ is answered or the janitor recovers.
5732
5976
 
5733
5977
  **A — grouped verification:** a failing member waits at its stage barrier for
5734
5978
  all siblings unless a fail-fast member fails. After cancellation and confirmed
@@ -5771,7 +6015,10 @@ verdict's finding marks `persists: [f1]` → round 3 again → kernel:
5771
6015
  names the exact replacement artifact it authorizes. `accept-target` answers only
5772
6016
  a leaf's `policy/target-rewritten` escalation (§7.4): it waives the rejected base
5773
6017
  and restacks the build's own commits onto the current target; other answer forms
5774
- skip that escalation. `guidance` feeds the answer
6018
+ skip that escalation. Answering a `done` build only acknowledges its open
6019
+ escalations: guidance or a bare retry records `escalation.answered`, requests no
6020
+ resume and leaves the build done, and every other answer form is refused.
6021
+ `guidance` feeds the answer
5775
6022
  into the next producer round as authoritative feedback; `dismiss-finding`
5776
6023
  marks the chain human-resolved and the next reviewer round is told so. Engine-routed
5777
6024
  guidance is latest-only per destination (`plan`, `code`, or one exact agent
@@ -5881,7 +6128,9 @@ SHAs could not be inspected. An environment that never started executing holds
5881
6128
  no unpublished work: objects its checkout lacks mean nothing to preserve, so
5882
6129
  cleanup records `workspace.commits-preserved` (or `workspace.commits-retained`)
5883
6130
  carrying forward earlier preserved heads, then releases and replaces it. Unknown fencing, inspection, transport, or
5884
- receipt-write outcomes leave the workspace and snapshots intact. A workspace
6131
+ receipt-write outcomes leave the workspace and snapshots intact, except under
6132
+ abort cleanup, which records `workspace.commits-lost` and tears the workspace
6133
+ down. A workspace
5885
6134
  flagged by `workspace.cleanup-required` is never launched into: the dispatcher
5886
6135
  releases it and provisions the next generation. Provisioning cut off by a
5887
6136
  recorded dispatcher teardown is the exception: the next invocation asks the
@@ -6076,8 +6325,8 @@ reopen re-enters the mainline at `implement` or `plan`, and the leaf reaches
6076
6325
  merge only through `finalize` again.
6077
6326
 
6078
6327
  **Forge CI on finished leaves.** A clean restack or a change on the base can
6079
- leave a finished leaf's own CI red on the forge without any local verify step
6080
- re-running. On the same janitor poll of a finished, open leaf PR (no phase or
6328
+ leave a finished leaf's own CI red on the forge without the local verify steps
6329
+ re-running (a clean-restack policy, §16.2, re-runs only opted-in steps). On the same janitor poll of a finished, open leaf PR (no phase or
6081
6330
  session running), the dispatcher reads the check runs and commit statuses at the
6082
6331
  PR's live head through the optional Forge `inspectHeadChecks` capability
6083
6332
  (GitHub: two ETag-conditional REST reads, so an unchanged head costs two 304s).
@@ -6169,7 +6418,8 @@ Workspace commit preservation (§12 D) is the strict exception: its unpublished
6169
6418
  commits may exist nowhere else. It tries the forge archive ref, then a
6170
6419
  `history-objects-<sha>` store copy excluding the preservation base, and never
6171
6420
  classifies a commit as `target` or proceeds unretained. When both fail, release
6172
- is refused and cleanup stays pending. A history copy is identified by its head:
6421
+ is refused and cleanup stays pending. Abort cleanup is the one exception: it
6422
+ records `workspace.commits-lost` and releases. A history copy is identified by its head:
6173
6423
  a later retention of the same commit reuses the existing copy and its saved
6174
6424
  base. Preservation records that base and, when it is no longer an ancestor of
6175
6425
  the current preservation base, retains the base itself the same way, to a
@@ -6757,6 +7007,7 @@ automatic = true # immediate/60-second target checks; false requi
6757
7007
  #vcpus = 4
6758
7008
  #timeoutSeconds = 2700
6759
7009
  #operationTimeoutMs = 30000 # provider calls, not VM/session lifetime
7010
+ #recoveryTimeoutMs = 120000 # ceiling: one stopped-sandbox resume plus guest git
6760
7011
  #environmentVariables = ["ANTHROPIC_API_KEY"]
6761
7012
 
6762
7013
  #[pr.imageHost] # optional public inline rendering for attached images
@@ -6914,7 +7165,11 @@ non-ancestor source records `verify.config-superseded` and starts a fresh cycle
6914
7165
  before constructing any further member. Already launched siblings settle first.
6915
7166
  A waiting leaf with completed verification retains its receipts after a clean
6916
7167
  rewrite when build-owned config is unchanged, even when the rewrite replaces
6917
- the pin commit's ancestry. Changed config still supersedes while waiting; a
7168
+ the pin commit's ancestry. Two clean restacks instead start a new cycle that
7169
+ the earlier receipts cannot satisfy: a root-targeting leaf's clean landing
7170
+ restack whose frozen `afterCleanRestack` policy enables any step re-verifies on
7171
+ the restacked base and head, and a clean wait-resume restack after a verify or
7172
+ finalize ticket wait re-verifies on the resumed base. Changed config still supersedes while waiting; a
6918
7173
  future verification cycle always captures fresh config before running steps.
6919
7174
  Old pass/skip receipts cannot satisfy that cycle, and supersession creates no
6920
7175
  failure or failure-budget charge. Unchanged config on a descendant head retains
@@ -6925,12 +7180,16 @@ replace its build-owned sections. Historical streams capture before further
6925
7180
  verification. Deployment-owned reloads remain live; environments are not
6926
7181
  re-provisioned.
6927
7182
 
6928
- Three configurable narrowing mechanisms govern which verify steps run, all
7183
+ Four configurable narrowing mechanisms govern which verify steps run, all
6929
7184
  resolving to the ordinary `skipped` outcome so exclusions stay queryable:
6930
7185
 
6931
7186
  - **Post-reconcile policy.** The cycle snapshot resolves repository and step
6932
7187
  `afterReconcile` settings before any plan or path exclusions, including for
6933
7188
  `always` steps. It applies only after a completed reconcile.
7189
+ - **Clean-restack policy.** A root-targeting leaf's clean awaiting-merge
7190
+ restack freezes repository and step `afterCleanRestack` settings in its
7191
+ restack intent. When any step is opted in, the cycle it opens skips the
7192
+ rest before any plan or path exclusions, including for `always` steps.
6934
7193
  - **Plan selection.** An approved plan may declare the complete subset of
6935
7194
  optional verify steps warranted by the spec, in strict front matter
6936
7195
  validated at deposit. The selection paired with the approving review
@@ -6940,7 +7199,7 @@ resolving to the ordinary `skipped` outcome so exclusions stay queryable:
6940
7199
  the cycle's pinned configured universe, the entire selection falls back to
6941
7200
  all configured optional steps. The kernel records one observation per cycle
6942
7201
  and plan revision naming the unknown steps. Mandatory steps, paths and
6943
- post-reconcile policy still apply. A valid selection continues to skip
7202
+ post-reconcile and clean-restack policies still apply. A valid selection continues to skip
6944
7203
  genuinely omitted optional steps. Strict new-plan validation is unchanged.
6945
7204
  - **Path applicability.** A step may declare positive changed-path selectors,
6946
7205
  evaluated by the kernel immediately before the step on every verify cycle,
@@ -6978,6 +7237,41 @@ and a reason naming the setting. Dashboards and PR summaries call this
6978
7237
  checks and branch protections still gate merge. For excluded steps, merged code
6979
7238
  is not re-verified, so breakage that only exists in the combination can merge.
6980
7239
 
7240
+ #### Clean-restack verification policy
7241
+
7242
+ Clean-restack re-verification defaults to disabled: omitting
7243
+ `[verify].afterCleanRestack` means `false`, and omission is preserved in the
7244
+ captured configuration. An optional boolean `[verify.<step>].afterCleanRestack`
7245
+ overrides the repository setting in either direction. Opt in per step on
7246
+ deterministic checks, for example `afterCleanRestack = true` in
7247
+ `[verify.lint]` and `[verify.types]`; an agent step re-runs only when opted
7248
+ in. Each target move under a waiting leaf re-runs every opted-in step, so
7249
+ keep the set to checks that are cheap and catch semantic drift.
7250
+
7251
+ The policy applies only to a root-targeting leaf's clean awaiting-merge
7252
+ restack, including one whose conflicts were all `[[generated]]` files and
7253
+ were regenerated. A leaf targeting an integration node relies on that node's
7254
+ own verification before root. When the runner builds the restack intent, it
7255
+ resolves the ordered policy from the configuration it decided with and, only
7256
+ if at least one step is enabled, freezes it as `cleanRestackPolicy` in
7257
+ `restack.publish-intended`. The same value is recorded on `restack.rewritten`
7258
+ and `restack.completed`, so a crash between intent and completion keeps the
7259
+ frozen policy. That completion is a verify cycle boundary, not a replay
7260
+ boundary: no further restack runs. While it is the newest code boundary,
7261
+ each step the policy disables records `verify.completed` with outcome
7262
+ `skipped`, `skipCause = "clean-restack-policy"`, and a reason naming the
7263
+ setting ("skipped by clean-restack policy: verify.afterCleanRestack = false").
7264
+ Enabled steps follow plan selection and path rules and cite the restacked
7265
+ base and head. A step absent from the frozen policy runs.
7266
+
7267
+ The leaf does not land until the cycle is satisfied. A failure routes through
7268
+ the ordinary repair loop (implement → code-review → verify-entry restack →
7269
+ ordinary verification) and counts toward `maxVerifyAttempts`. When every
7270
+ step passes or is skipped, the build returns to waiting, and landing consent
7271
+ survives as it does for any clean restack. An omitted or all-false policy
7272
+ records nothing, so existing event streams and decisions are unchanged. Node
7273
+ verification and optimization measurement invalidation are unaffected.
7274
+
6981
7275
  ### 16.3 Skill installation: vendored, namespaced, editable [D11]
6982
7276
 
6983
7277
  This project ships 14 canonical default skills for the fixed phases, the
@@ -7192,8 +7486,8 @@ absolute file path containing the edited text. Read the current ticket and
7192
7486
  reapply the intended changes before retrying; conflicts are never merged.
7193
7487
 
7194
7488
  File and Linear revisions fingerprint kind, target, title, body, canonical label/blocker sets,
7195
- state and urgent priority; file revisions also cover nonempty issue links. GitHub revisions
7196
- fingerprint kind, target, title, body, canonical label/blocker sets, state and issue links,
7489
+ state and any priority other than normal; file revisions also cover nonempty issue links. GitHub revisions
7490
+ fingerprint kind, target, title, body, canonical label/blocker sets (priority labels included), state and issue links,
7197
7491
  including the ticket's own issue; GitHub tickets carry no comments, and assignees
7198
7492
  are not part of a GitHub revision. Reverting
7199
7493
  identical content restores its fingerprint. File checks
@@ -7306,13 +7600,20 @@ consent was given at (null without consent), and a current forge CI failure
7306
7600
  Source `ab ticket tree` / `tickets.tree` enumerate all ticket states with listing
7307
7601
  diagnostics; effective build targets remain frozen independently of source metadata.
7308
7602
 
7309
- Default watch attention includes `integration.verification-failed`, `integration.landed`, `node.item-conflicted`,
7310
- `landing.consent-revoked`, `pr.checks-failed`, `optimization.noise-exceeded`, and conflicted `restack.replayed`. Derived `build.consent-ready` observations
7603
+ Default watch attention includes `integration.verification-failed`, `integration.landed`,
7604
+ `landing.consent-revoked`, `pr.checks-failed`, and `optimization.noise-exceeded`.
7605
+ Conflicted `restack.replayed` and `node.item-conflicted` are routine: reconcile or
7606
+ generated-file regeneration resolves them, so they stay out of default watch and
7607
+ wait attention, as they do in `repository.attention`. An unresolvable conflict
7608
+ reaches the operator only as `escalation.raised` (a reconcile escalation,
7609
+ exhausted reconcile attempts, or no progress) or `landing.consent-revoked`.
7610
+ Derived `build.consent-ready` observations
7311
7611
  carry target, branch, candidate and the durable readiness entry position in the
7312
7612
  existing cursor envelope. Cursor identities retain readiness episodes across
7313
7613
  restart; a new candidate or exit/re-entry can wake again. Explicit event globs
7314
- remain event-only. Wait adds `consent`, `node-merged`, `restack-conflicted`, and
7315
- includes these in attention; current-state waits return immediately, backlog
7614
+ remain event-only. Wait adds `consent`, `node-merged`, and `restack-conflicted`;
7615
+ attention includes consent and node merges but not restack conflicts, which
7616
+ `restack-conflicted` opts into. Current-state waits return immediately, backlog
7316
7617
  replay retains event ordering, including merge before terminal completion.
7317
7618
 
7318
7619
  Consent/hold readiness is signalled exclusively by `build.consent-ready`,
@@ -7433,7 +7734,8 @@ The janitor keeps retrying on its backoff underneath; a successful attempt
7433
7734
  clears the attention, closes the escalation unanswered and the build continues.
7434
7735
  Answering it with a bare retry makes the janitor attempt on its next tick. An
7435
7736
  episode raises at most one escalation; a new episode after recovery can raise
7436
- another. `policy.janitorBackoffMaxSeconds` sets the positive integer cap.
7737
+ another. The first `build.aborted` also ends the episode and closes its
7738
+ escalation, so abort cleanup failures start a new episode with a new id. `policy.janitorBackoffMaxSeconds` sets the positive integer cap.
7437
7739
  A pending control the janitor can act on wakes it during backoff: an abort, a
7438
7740
  pause, a resume of a paused build, a queued discard or an unacknowledged landing
7439
7741
  command. A leaf's resume that only cancelled a never-acknowledged pause is not