@defrex/autobuild 1.12.0 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/README.md +1 -1
  2. package/SPEC.md +435 -160
  3. package/bin/ab-build-runner.ts +8 -0
  4. package/docs/answering-blocked-builds.md +25 -3
  5. package/docs/architecture.md +124 -53
  6. package/docs/cli.md +1 -1
  7. package/docs/configuration.md +110 -15
  8. package/docs/dispatcher.md +19 -8
  9. package/docs/integration-overview.md +1 -1
  10. package/docs/integration-tree.md +12 -9
  11. package/docs/merge-policy.md +7 -2
  12. package/docs/operating.md +5 -3
  13. package/docs/operator-api.md +46 -23
  14. package/docs/operator-surfaces.md +7 -6
  15. package/docs/optimization-nodes.md +7 -6
  16. package/docs/plugin-authoring.md +46 -18
  17. package/docs/remote-store-protocol.md +51 -12
  18. package/docs/remote-ticket-protocol.md +85 -38
  19. package/docs/restacking.md +48 -3
  20. package/docs/setup.md +2 -1
  21. package/docs/ticket-migration.md +2 -2
  22. package/docs/ticket-sources.md +23 -8
  23. package/docs/tickets.md +4 -4
  24. package/docs/troubleshooting.md +17 -2
  25. package/docs/verification.md +3 -1
  26. package/package.json +3 -3
  27. package/packages/core/src/cli/build-control.ts +72 -6
  28. package/packages/core/src/cli/dashboard/actions.ts +4 -0
  29. package/packages/core/src/cli/dashboard/integration-row.ts +43 -19
  30. package/packages/core/src/cli/dashboard/model.ts +14 -8
  31. package/packages/core/src/cli/dashboard/poll.ts +218 -10
  32. package/packages/core/src/cli/dashboard/queue.ts +21 -10
  33. package/packages/core/src/cli/dashboard/row-text.ts +2 -1
  34. package/packages/core/src/cli/dashboard/vocabulary.ts +5 -1
  35. package/packages/core/src/cli/dispatch-frontend.ts +2 -1
  36. package/packages/core/src/cli/dispatch-tickets.ts +33 -12
  37. package/packages/core/src/cli/dispatch.ts +527 -144
  38. package/packages/core/src/cli/help.ts +38 -24
  39. package/packages/core/src/cli/main.ts +7 -5
  40. package/packages/core/src/cli/publication-settlement.ts +4 -0
  41. package/packages/core/src/cli/remote-poll.ts +22 -5
  42. package/packages/core/src/cli/repository-status.ts +19 -9
  43. package/packages/core/src/cli/status.ts +23 -11
  44. package/packages/core/src/cli/store-opening.ts +12 -0
  45. package/packages/core/src/cli/ticket-start.ts +3 -3
  46. package/packages/core/src/cli/ticket.ts +12 -11
  47. package/packages/core/src/cli/wait.ts +8 -28
  48. package/packages/core/src/cli/watch.ts +113 -50
  49. package/packages/core/src/config/reference-metadata.ts +7 -1
  50. package/packages/core/src/config/reference.ts +5 -2
  51. package/packages/core/src/config/schema.ts +51 -16
  52. package/packages/core/src/events/payloads.ts +74 -14
  53. package/packages/core/src/events/repository.ts +14 -3
  54. package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +27 -0
  55. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/0a10010ee5cf2e47.json +577 -0
  56. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/227701361be6d1e0.json +490 -0
  57. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/76e5043bae7a80ab.json +86 -0
  58. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/87a917802870bbed.json +87 -0
  59. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/9d85616e5b9e24c1.json +500 -0
  60. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/c7c94fbe7f63cf07.json +84 -0
  61. package/packages/core/src/kernel/clean-restack-policy.ts +40 -0
  62. package/packages/core/src/kernel/dispatch-capacity.ts +243 -107
  63. package/packages/core/src/kernel/done-escalations.ts +269 -0
  64. package/packages/core/src/kernel/engine.ts +28 -9
  65. package/packages/core/src/kernel/integration-landing.ts +24 -4
  66. package/packages/core/src/kernel/integration-stack.ts +39 -0
  67. package/packages/core/src/kernel/janitor-failure.ts +20 -1
  68. package/packages/core/src/kernel/log-index-value.ts +3 -0
  69. package/packages/core/src/kernel/log-index.ts +41 -2
  70. package/packages/core/src/kernel/open-pr-backpressure.ts +3 -3
  71. package/packages/core/src/kernel/reducer-registry.ts +3 -0
  72. package/packages/core/src/kernel/reducer-revisions.ts +15 -0
  73. package/packages/core/src/kernel/reducer.ts +27 -7
  74. package/packages/core/src/kernel/repository-attention.ts +14 -5
  75. package/packages/core/src/kernel/ticket-starts.ts +15 -4
  76. package/packages/core/src/kernel/verify-stages.ts +46 -7
  77. package/packages/core/src/operator/attention.ts +28 -3
  78. package/packages/core/src/operator/done-escalations.ts +38 -0
  79. package/packages/core/src/operator/presentation.ts +1 -1
  80. package/packages/core/src/operator/protocol.ts +8 -5
  81. package/packages/core/src/operator/query.ts +33 -19
  82. package/packages/core/src/operator/registry.ts +17 -13
  83. package/packages/core/src/operator/ticket-start.ts +8 -7
  84. package/packages/core/src/operator/tickets.ts +28 -9
  85. package/packages/core/src/plugin-sdk/index.ts +10 -0
  86. package/packages/core/src/plugins/manifest.ts +14 -1
  87. package/packages/core/src/ports/forge/create.ts +8 -0
  88. package/packages/core/src/ports/forge/github-transport.ts +5 -1
  89. package/packages/core/src/ports/forge/github.ts +3 -0
  90. package/packages/core/src/ports/tickets/contract.ts +147 -76
  91. package/packages/core/src/ports/tickets/create.ts +47 -7
  92. package/packages/core/src/ports/tickets/fake.ts +8 -4
  93. package/packages/core/src/ports/tickets/file-codec.ts +4 -3
  94. package/packages/core/src/ports/tickets/file.ts +7 -3
  95. package/packages/core/src/ports/tickets/github.ts +1 -0
  96. package/packages/core/src/ports/tickets/grants.ts +11 -3
  97. package/packages/core/src/ports/tickets/hosted-index.ts +5 -0
  98. package/packages/core/src/ports/tickets/linear.ts +28 -9
  99. package/packages/core/src/ports/tickets/migration.ts +4 -4
  100. package/packages/core/src/ports/tickets/operations.ts +4 -2
  101. package/packages/core/src/ports/tickets/priority-labels.ts +213 -0
  102. package/packages/core/src/ports/tickets/priority.ts +127 -21
  103. package/packages/core/src/ports/tickets/remote-protocol.ts +10 -0
  104. package/packages/core/src/ports/tickets/remote.ts +104 -11
  105. package/packages/core/src/ports/tickets/revision.ts +5 -3
  106. package/packages/core/src/ports/tickets/search.ts +9 -0
  107. package/packages/core/src/ports/tickets/tree.ts +8 -6
  108. package/packages/core/src/ports/types.ts +30 -15
  109. package/packages/core/src/ports/workspace/build-execution.ts +4 -0
  110. package/packages/core/src/ports/workspace/builtin-capabilities.ts +4 -0
  111. package/packages/core/src/ports/workspace/create.ts +16 -3
  112. package/packages/core/src/ports/workspace/execution-exit-marker.ts +41 -0
  113. package/packages/core/src/ports/workspace/recovery-step.ts +101 -0
  114. package/packages/core/src/ports/workspace/vercel-sandbox.ts +510 -145
  115. package/packages/core/src/processes/build-execution-state.ts +4 -0
  116. package/packages/core/src/processes/build-runner.ts +14 -1
  117. package/packages/core/src/processes/dispatcher.ts +544 -212
  118. package/packages/core/src/processes/execution-settlement.ts +1 -0
  119. package/packages/core/src/processes/harvest-runner.ts +12 -7
  120. package/packages/core/src/processes/infrastructure-failure-budget.ts +7 -2
  121. package/packages/core/src/processes/invocation-budget.ts +176 -0
  122. package/packages/core/src/processes/publication-loss.ts +38 -3
  123. package/packages/core/src/processes/workspace-preservation.ts +86 -15
  124. package/packages/core/src/store/contract.ts +81 -3
  125. package/packages/core/src/store/event-reads.ts +30 -1
  126. package/packages/core/src/store/reduced-reads.ts +23 -0
  127. package/packages/core/src/store/reducer-value-shapes.json +6628 -6469
  128. package/packages/core/src/store/reducer-value-validation.ts +181 -33
  129. package/packages/core/src/store/remote/client.ts +169 -29
  130. package/packages/core/src/store/remote/compatibility.ts +113 -56
  131. package/packages/core/src/store/remote/credentials.ts +4 -1
  132. package/packages/core/src/store/remote/protocol.ts +3 -0
  133. package/packages/core/src/store/remote/released-clients.json +11 -0
  134. package/packages/core/src/store/remote/released-reducer-values/1.13.0.json +35966 -0
  135. package/packages/core/src/store/remote/released-reducer-values/index.ts +18 -16
  136. package/packages/core/src/store/remote/released-value-policy.ts +144 -0
  137. package/packages/core/src/store/remote/retry.ts +406 -0
  138. package/packages/core/src/testing/dispatch-read-budget.ts +144 -10
  139. package/packages/core/src/testing/index.ts +2 -0
  140. package/packages/core/src/testing/invocation-budget.ts +42 -0
  141. package/packages/core/src/testing/reduced-read-budget.ts +381 -18
  142. package/packages/core/src/testing/released-value-coverage.ts +423 -0
  143. package/packages/core/src/web/overview-source.ts +19 -6
  144. package/skills/guide/SKILL.md +138 -67
  145. package/skills/guide/references/integration-tree.md +12 -9
  146. package/skills/guide/references/merge-policy.md +7 -2
  147. package/skills/guide/references/operator-api.md +46 -23
  148. package/skills/guide/references/optimization-nodes.md +7 -6
  149. package/skills/guide/references/plugin-authoring.md +46 -18
  150. package/skills/guide/references/remote-store-protocol.md +51 -12
  151. package/skills/guide/references/remote-ticket-protocol.md +85 -38
  152. package/skills/guide/references/restacking.md +48 -3
  153. package/skills/guide/references/setup.md +2 -1
  154. package/skills/guide/references/ticket-migration.md +2 -2
  155. package/skills/operate/SKILL.md +82 -51
  156. package/skills/plan/SKILL.md +4 -3
  157. package/skills/spec/SKILL.md +9 -5
  158. package/skills/tickets/SKILL.md +25 -17
  159. package/templates/hosted-service/package.json +2 -2
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,23 @@ 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, so a build completed while blocked,
1877
+ abort cleanup included, is listed until its escalation is answered.
1878
+ - **Arguments:** none, so each repository has one key. Nothing expires.
1879
+ - **Answer:** `{position, builds: [{slug, kind}]}` by slug, with `cursor: 0`.
1880
+ Readers confirm each listed build against its build-reducer state.
1881
+ - **Cost:** a read with nothing changed is the two constant reads, and the
1882
+ saved row is O(escalated done builds) however many builds have finished.
1883
+
1804
1884
  ## 8. The `ab` CLI
1805
1885
 
1806
1886
  The **only** channel between agents and the store — and the enforcement
@@ -1907,7 +1987,15 @@ owner delegation is short-lived, repository-bound and operator-only. The hosted
1907
1987
  dispatcher issues stored credentials with immutable dispatcher purpose (raw
1908
1988
  store and tickets only) per repository invocation. It deletes each credential on
1909
1989
  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
1990
+ TTL upper bound and the invocation deadline plus 60 seconds. Each invocation's
1991
+ budget is a wall-time bound: work stops, and in-flight store, ticket, forge and
1992
+ workspace requests are cancelled, at the work deadline, which is the budget minus
1993
+ a teardown reserve of `min(30 s, budget/4)`. Teardown (provisioning abandonment,
1994
+ repository-lease release, `dispatcher.run-stopped`) is bounded by the budget end;
1995
+ a write storage cannot finish by then is abandoned and the lease left to expire.
1996
+ A budget stop is a normal run stop. Credential deletion then gets the remaining
1997
+ budget and at least 5 seconds; issuance or deletion unsettled by then is
1998
+ reported and left to the capped expiry. Each served tick
1911
1999
  prunes at most 100 expired or revoked dispatcher rows using indexed probes;
1912
2000
  unexpired legacy rows retain their recorded expiry before eventual pruning.
1913
2001
  Already issued delegated grants do not depend on the parent row or its expiry.
@@ -2334,7 +2422,7 @@ handoff naming a draining predecessor, even with an empty drain map. It uses
2334
2422
  existing projections and adds no reads; only durable retirement clears evidence.
2335
2423
  The controls include: ticket intake, the
2336
2424
  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
2425
+ single-ticket start requests with their tier, `manual`, `urgent`, `high`, `normal` or `low` (`ticketStarts`, present when either is nonempty). It uses the same
2338
2426
  dispatch-settings reducer as dispatcher decisions and the dashboard. An absent
2339
2427
  repository stream reduces as an empty journal and reports intake on, repository
2340
2428
  pause off; the query does not create that stream,
@@ -2415,8 +2503,11 @@ call — the open escalations `builds.get` reports, the `merges.list` consent
2415
2503
  queue, the attention page of `repository.events` and the `repository.status`
2416
2504
  projection — adds the builds waiting on operator action (paused, stalled,
2417
2505
  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.
2506
+ item. Its escalations also include each `done` build with an open escalation,
2507
+ found through the `doneEscalations` rollup (§7.7), with status `done` and
2508
+ `builds.answer` as its acknowledgement. It takes the `repository.events`
2509
+ cursor, never waits, reads only open builds and those escalated done builds,
2510
+ and reads zero event rows when nothing changed since the cursor.
2420
2511
 
2421
2512
  Each registered project also has a per-repository binding at
2422
2513
  `<resource>/<host><path>`, derived from its identity. It serves the same table
@@ -2985,8 +3076,8 @@ nothing, reports a diagnostic and is retried on the next tick. Hosted clients
2985
3076
  read `ticketWait` from the digest wire answer; an older service that omits it
2986
3077
  yields no automatic release, and operators still end waits by answering.
2987
3078
 
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
3079
+ An ended wait requests a `resume` slot and is admitted before ticket claims at
3080
+ its level, as a parked finished build is (§12 "Slot admission order"); a `revise-spec` answer instead waits for
2990
3081
  the revision. The dispatcher observes the leaf's target when it launches the
2991
3082
  resume. Before the declaring phase resumes, and ahead of the plan and code
2992
3083
  loops, the engine decides a `restack` with trigger `wait-resume` and cycle
@@ -3070,69 +3161,86 @@ signals (telemetry, observations)
3070
3161
  → build → PR → merge
3071
3162
  ```
3072
3163
 
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.
3164
+ **Intake order.** When a slot is free, dispatch claims ready candidates by
3165
+ level, `urgent`, `high`, `normal` and then `low`, each level in the source's
3166
+ listing order (see Ticket priority in §13). Every admission gate is unchanged
3167
+ — blockers, labels, creation holds, capacity, intake off and repository pause
3168
+ — so a blocked ticket never holds back lower-level work. Priority never
3169
+ preempts: no level stops, pauses or displaces a running build.
3079
3170
 
3080
- **Slot admission order.** Free slots are admitted in five tiers:
3171
+ **Slot admission order.** Free slots are admitted in this order:
3081
3172
 
3082
3173
  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.
3174
+ 2. urgent waiting work, then urgent ticket claims;
3175
+ 3. high waiting work, then high ticket claims;
3176
+ 4. normal waiting work, then normal ticket claims;
3177
+ 5. low waiting work, then low ticket claims.
3178
+
3179
+ Waiting work is parked nodes and leaves that hold no slot and request one:
3180
+ `resume`, `reconcile`, `verification`, `reopen` or `propose` ("What holds a
3181
+ slot" below). A level's ticket claims are that level's start requests, oldest
3182
+ first, then its ordinary ready tickets while intake is on, in the source's
3183
+ listing order. Within each level, waiting work goes ahead of claims, and both
3184
+ go ahead of every lower level. Ordinary intake never claims a ticket with a
3185
+ pending start request at a non-`manual` tier: that request's start pass claims
3186
+ it at its tier. An
3187
+ optimization attempt's ready ticket claims at its node's level: the node's
3188
+ current build priority, any of the four, decided at claim. Nothing is
3189
+ reserved for attempts, and they never jump ahead of other work at their level.
3095
3190
 
3096
3191
  Each tier keeps its own order: start requests oldest first, parked leaves in
3097
3192
  the tick's visit order, nodes in slug order, tickets in the source's listing
3098
3193
  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.
3194
+ ready tickets do not. A build's level is frozen at claim on `build.created`:
3195
+ the request's level for a build started by a non-`manual` start request, and
3196
+ its ticket's level otherwise. It is changed by the human-authored advisory
3197
+ `build.priority-set` (`ab priority <slug> urgent|high|normal|low`, the operator
3198
+ `builds.control` action `priority`); a later ticket priority edit does not
3199
+ reach an existing build. Both facts encode the level compatibly:
3200
+ `build.created` carries `priority: urgent` for an urgent build and `level:
3201
+ high | low` for a high or low one, both omitted for normal;
3202
+ `build.priority-set` carries `{priority: urgent | normal, level?: high |
3203
+ low}`, with `priority: normal` for high and low. A reader takes `level` over
3204
+ `priority`. A reader older than this encoding drops the `level` key and reads a
3205
+ high or low build as normal, and every log written before it reads as urgent
3206
+ or normal, exactly as before.
3207
+
3208
+ Admission is arithmetic over reduced facts: a waiter is admitted when the
3209
+ slots occupied by every other build plus the slots reserved ahead of it are
3210
+ below `capacity`. Pending start requests are durable demand: the reduced
3211
+ `ticketStarts` counts them by tier, whatever intake says, and nothing while
3212
+ the repository is paused. Each reserves one slot ahead of the tiers below it
3213
+ until it settles or is cancelled, and never preempts. Reserved ahead of a
3214
+ waiter at level L are the `manual` requests and, for every level above L,
3215
+ that level's other waiters, its start requests and its ticket claim demand
3216
+ from the latest admission scan: `dispatcher.ticket-scan-completed` records
3217
+ `urgentWaiting`, `highWaiting` and `normalWaiting`, the non-node ready tickets
3218
+ at that level that passed every intake gate except capacity (each omitted when
3219
+ none; counted only while intake is on and the repository unpaused). Urgent
3220
+ demand is always counted; high and normal demand only while work of a lower
3221
+ level waits (a parked waiter or a start request), and low demand never, since
3222
+ nothing ranks below it. A start request at level L waits for waiters at L or
3223
+ above, every start request of a higher tier and the claim demand of every
3224
+ higher level. An ordinary claim at level L waits for waiters at L or above and
3225
+ every pending start request at L or above; a claim spends a slot of every
3226
+ level, and ready tickets are visited highest level first. Because demand
3227
+ discovered by an earlier scan can be stale, the dispatcher also defers, within
3228
+ a tick, any non-urgent parked admission into a free slot while a higher-level
3229
+ claim can exist and ticket claims can run (intake is on, the repository is
3230
+ unpaused, accounts are present and the forge is not cooling down). A
3231
+ higher-level claim can exist at every level when the source supports
3232
+ priority, and always for low work, since normal tickets exist in every
3233
+ source; without the capability, a high or normal waiter defers only while an
3234
+ open optimization node of a higher level can claim attempts. A deferral writes
3235
+ nothing and keeps the build's reservation against claims at its level; it
3236
+ makes that tick's admission scan due, and the deferred admissions are retried
3237
+ after the tick's dispatch only when that scan decided claims at every level
3238
+ (its claim loop ran to the end, or it proved no ticket could claim or count as
3239
+ demand). Otherwise they are decided again on a later tick. A forced scan is
3240
+ bounded per deferral state: an unchanged set of deferred builds and occupancy
3241
+ lists again only when a scan is due on its own. Only gate-passing tickets
3242
+ count, so a ticket blocked on a dependency reserves nothing at any level. Free
3243
+ slots only: priority never interrupts a running build or session.
3136
3244
 
3137
3245
  **Open-PR backpressure.** An optional intake throttle, off by default and
3138
3246
  independent of slots. When `[policy].maxOpenPrs` is set, the dispatcher
@@ -3144,7 +3252,7 @@ engages when the count reaches `maxOpenPrs` and stays engaged until the count
3144
3252
  drops to or below `resumeOpenPrs` (default `maxOpenPrs - 1`). Reaching
3145
3253
  `maxOpenPrs` takes precedence, so with `resumeOpenPrs = maxOpenPrs` intake
3146
3254
  stays paused at that count and resumes once it falls below. While engaged,
3147
- the dispatcher claims no new `normal`-priority ticket; `urgent` claims,
3255
+ the dispatcher claims no new `high`, `normal` or `low` ready ticket; `urgent` claims,
3148
3256
  in-flight builds, parked-build admission, reconciles, verification and
3149
3257
  landings continue, and capacity accounting is unchanged. The count is derived
3150
3258
  from the reduced build facts each tick already holds. The dispatcher records
@@ -3153,7 +3261,7 @@ from the reduced build facts each tick already holds. The dispatcher records
3153
3261
  transitions (a cleared fact names `drained`, or `disabled` when the key is
3154
3262
  removed while engaged); the engaged fact is the hysteresis memory a fresh
3155
3263
  process reads. Repository status and both dashboards report the count,
3156
- watermarks and whether normal intake is paused. `maxOpenPrs` is unset by
3264
+ watermarks and whether high, normal and low intake is paused. `maxOpenPrs` is unset by
3157
3265
  default, which disables backpressure entirely.
3158
3266
 
3159
3267
  **What holds a slot.** `capacity` is the repository's number of slots. A
@@ -3196,8 +3304,8 @@ the current spec has passed. The dispatcher records the finish as an advisory
3196
3304
  Release follows state; acquisition never does. An answer that lands while the
3197
3305
  build is still carried releases nothing: the build keeps its slot and requests
3198
3306
  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:
3307
+ slot, and intake reserves one for it ahead of ticket claims at its level
3308
+ (higher levels first, "Slot admission order"). The requests are:
3201
3309
 
3202
3310
  | Request | Raised by |
3203
3311
  |---|---|
@@ -3522,33 +3630,76 @@ anything is written; it never drops them. Writes that name no links are
3522
3630
  unaffected. `ab ticket create` and `update` take `--issues N[:refs],...`;
3523
3631
  operator and MCP ticket requests take `issueLinks`.
3524
3632
 
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.
3633
+ **Ticket priority.** A ticket's priority is one of four levels, highest
3634
+ first: `urgent`, `high`, `normal`, `low`. Absent means `normal`, the default.
3635
+ Normalized tickets omit the field for normal; JSON ticket output (`ab ticket
3636
+ show --json`, listings, operator `tickets.get` and `tickets.search`) always
3637
+ names exactly one level.
3638
+
3639
+ - **Dispatch.** Ready work is claimed by level, `urgent`, `high`, `normal`
3640
+ then `low`, each level in the source's listing order, and each level's
3641
+ claims go after that level's parked work and ahead of every lower level's
3642
+ (§12 "Slot admission order"). A ticket's build takes its level, and among
3643
+ ready tickets only urgent claims bypass open-PR backpressure. A claim
3644
+ freezes the build's level and nothing else changes; `ab priority` changes
3645
+ the build's level and never the ticket. A single-ticket start request has
3646
+ its own admission tier (§11), and a non-`manual` request sets its build's
3647
+ level.
3648
+ - **Optimization attempts** (§13.1.1) are the exception: an in-flight attempt
3649
+ of an open, unstopped optimization node claims at the node's current build
3650
+ level, any of the four, whatever its ticket says or whether its source
3651
+ stores priority. `ab priority <node> urgent|high|normal|low` therefore
3652
+ reaches the node's attempts claimed afterwards; an attempt already claimed
3653
+ keeps its build's level, as any build does. No slot is reserved for
3654
+ attempts, they preempt nothing, and within a level the source's order
3655
+ applies.
3656
+ - **Writes.** `ab ticket create` and `update` take `--priority
3657
+ urgent|high|normal|low`; operator and MCP `tickets.create` and
3658
+ `tickets.update` take the same `priority` values. Any other value is refused
3659
+ before anything is written, with an error naming the four levels. An update
3660
+ that omits priority never changes it. Harvest files every proposal normal;
3661
+ grooming sets another level.
3662
+ - **Native storage.** Sources that store all four levels declare the
3663
+ `priority` capability. The file source stores `priority = "<level>"` in its
3664
+ frontmatter for `urgent`, `high` and `low` and writes no key for normal; the
3665
+ in-memory fake behaves the same way. The hosted source stores all four in
3666
+ the hosted ticket store and lists ready tickets urgent, then high, then
3667
+ normal, then low, each in filing order. The Linear source maps Urgent (1),
3668
+ High (2) and Low (4) to `urgent`, `high` and `low`, and Medium (3) or No
3669
+ priority (0) to `normal`; writing `urgent`, `high` or `low` sets the
3670
+ matching Linear priority, and writing `normal` sets No priority only when the
3671
+ issue is Urgent, High or Low, leaving Medium untouched. File, hosted and
3672
+ Linear revisions cover priority.
3673
+ - **Label fallback.** A source without the capability (the GitHub source, and
3674
+ any plugin that does not declare it) gets priority through the ticket-source
3675
+ compatibility facade, which stores a level other than normal as exactly one
3676
+ label: `priority:urgent`, `priority:high` or `priority:low`; normal is none
3677
+ of them. Priority labels are matched case-insensitively, including
3678
+ hand-added ones; when several are present the highest wins, and the next
3679
+ priority write leaves exactly one (none for normal). They are reported as
3680
+ the ticket's `priority`, never in its `labels`. A labels replacement neither
3681
+ adds nor removes them, and a priority write never touches other labels,
3682
+ except that a source declaring `kindLabel` (GitHub's `node`) keeps that
3683
+ label in step with a kind change written beside the priority.
3684
+ Label writes, listing and search criteria, and `[tickets].readyLabels` or
3685
+ `createLabels` entries naming a priority label are refused (writes point to
3686
+ `--priority`; configuration fails at startup), so priority labels never
3687
+ satisfy or block `readyLabels`. Reading priority costs no extra request, and
3688
+ the revision changes with priority because labels are in it.
3689
+ - **Refusal.** Outside the facade, a raw source without the capability
3690
+ refuses a create or update naming any level but `normal` with a typed
3691
+ `TicketPriorityUnsupported` error naming the source, before anything is
3692
+ written; naming `normal` is a successful no-op. Through Autobuild this
3693
+ arises only from a hosted service that cannot store the level.
3694
+ - **Hosted version skew.** Current clients send, and current servers echo on
3695
+ every ticket response, the capability header
3696
+ `x-autobuild-ticket-priority-levels: 1`. A server answering a client that
3697
+ sends only the older `x-autobuild-ticket-priority: 1` keeps `urgent` and
3698
+ reports `high` and `low` as `normal`; without either header it names no
3699
+ priority. A current client refuses to write `high` or `low` to a server that
3700
+ does not echo the levels header, with `TicketPriorityUnsupported` naming the
3701
+ `hosted` source, before anything is written. Search hits carry an optional
3702
+ `priority`, projected the same way.
3552
3703
 
3553
3704
  **Ticket assignees.** A ticket may carry the usernames it is assigned to.
3554
3705
  Sources declare support with the `assignees` capability; only the GitHub source
@@ -3718,21 +3869,22 @@ the branch is open to targeting tickets immediately, without a PR. Idle integrat
3718
3869
  builds use no provisioned workspace, runner, execution lease, or dispatch capacity.
3719
3870
 
3720
3871
  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
3872
+ propose is admitted before ticket claims at its level (higher levels first,
3873
+ §12 "Slot admission order"). The request is durable: a
3723
3874
  prepared verification cycle, a restack conflict or an open proposal request,
3724
3875
  with no runner yet. Until the node holds its slot, intake reserves one
3725
3876
  slot for it, and the dispatcher checks its admission every tick regardless of
3726
3877
  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
3878
+ claim at its level or below. A node's admission counts every build that holds a slot, as every
3728
3879
  admission does. Blocked and paused descendants hold none (§12 "What holds a
3729
3880
  slot"), so they never stand between a node and the slot it needs to unblock
3730
3881
  them, and no node uses a descendant's slot. Admission is durable and precedes
3731
3882
  provisioning; a node's workspace never counts toward occupancy. Status and both dashboards report
3732
3883
  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
3884
+ report each node waiting for a slot ahead of ticket claims at its level,
3885
+ marking urgent, high and low waiters, the pending start requests of each tier
3886
+ and the urgent, high and normal ticket claims waiting ahead of lower-level
3887
+ parked work, and report every other parked
3736
3888
  build waiting to run again the same way. Idle collecting nodes remain free.
3737
3889
 
3738
3890
  An empty node has no PR and reports `integration`, `target`, and `empty`.
@@ -3775,7 +3927,13 @@ children's, and is refreshed before landing, so merging it closes them (see
3775
3927
  Forge issue links).
3776
3928
  Authoritative enforced up-to-date protection records fenced merge; uncertainty
3777
3929
  records unfenced merge and triggers immutable merged-tree comparison. A mismatch
3778
- raises operator attention and never rewrites the shared parent.
3930
+ raises operator attention and never rewrites the shared parent. A verified commit
3931
+ that is empty (its tree equals its parent's) and whose identity is missing from
3932
+ an otherwise tree-identical merge is accounted for, since forge rebase merges
3933
+ drop empty commits; duplicates, non-empty omissions and tree mismatches still
3934
+ raise attention. That attention, like any escalation raised after completion,
3935
+ stays on the dashboards and `repository.attention` until it is closed with
3936
+ `ab answer`, which does not change the build's done status.
3779
3937
  The repository build digest carries an additive optional pending-audit signal from
3780
3938
  `integration.landed` with an operation until `integration.audited` settles it.
3781
3939
  Settled nodes without that signal require no full build reads; completion does
@@ -4395,8 +4553,8 @@ runtime compatibility is not requested; the dispatcher instead records
4395
4553
  `optimization.proposal-deferred {reason}` (`paused`, `blocked`, `command`,
4396
4554
  `restack`, `integration`, `landing` or `compatibility`), and reconsiders the
4397
4555
  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
4556
+ request is the node's `propose` slot request, admitted ahead of ticket claims
4557
+ at the node's level (§13.1, §12 "Slot admission order"). Before admission the dispatcher re-checks it against current
4400
4558
  state: a request whose node has stopped, whose active-hours budget is spent,
4401
4559
  whose room fell to zero or below the recorded room, or whose node has no free
4402
4560
  concurrency slot, and for which no session has started, records
@@ -4717,8 +4875,9 @@ over one server-sent event stream. It appends nothing, takes no lease and
4717
4875
  registers no presence.
4718
4876
 
4719
4877
  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
4878
+ process starts the overview from the `buildRoster` and `doneEscalations`
4879
+ rollups (§7.7) and targeted reads of its live and escalated done builds, then
4880
+ advances it by the changed-builds feed. Its
4722
4881
  recurring reads, made only while a browser is subscribed:
4723
4882
 
4724
4883
  | Occurrence | Reads | Cost |
@@ -4728,13 +4887,14 @@ recurring reads, made only while a browser is subscribed:
4728
4887
  | 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
4888
  | A changed build started, finished, aborted or is done | `buildRoster` | 1 call per poll |
4730
4889
  | 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 |
4890
+ | 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
4891
 
4733
4892
  No read grows with history, build count or tab count, and nothing is read
4734
4893
  while no browser is connected. The overview never lists builds, analytics
4735
4894
  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
4895
+ remote store that lacks the roster, `doneEscalations` or the feed, or serves a
4896
+ different rollup version, fails the read with its typed error and never falls
4897
+ back to either. Until the dispatcher records an
4738
4898
  effective configuration the frame has no `overview` and makes no build read.
4739
4899
  The web protocol's overview and rows carry the shared dashboard projection's
4740
4900
  terms: status, phase, attention, waits, step timers, finished outcomes, the
@@ -4878,10 +5038,15 @@ compared numerically. Build creation and every build event also record the new
4878
5038
  position as that build's latest change position, in the same transaction, which
4879
5039
  the changed-builds feed (§7.2) reads.
4880
5040
  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
5041
+ then makes exactly one store request. Discovery never lists builds: a cold
5042
+ start (initial hydration or a feed reset) samples the change position, then
5043
+ reads `listOpenBuilds(repo)` and the `doneEscalations` rollup (§7.7); every
5044
+ later refresh reads only `listBuildsChangedSince` from that watermark and
5045
+ re-reads the builds it reports. Position or configuration changes, and at most
5046
+ ten seconds between full reads, refresh the snapshot, including the visible
5047
+ builds' stream and artifact enrichment. A remote store on a different
5048
+ `doneEscalations` version, or without the open-builds or feed routes, fails the
5049
+ refresh with its typed error and never falls back to a listing. Failed or
4885
5050
  cancelled reads do not acknowledge the sampled position. Open session feeds poll
4886
5051
  independently; kernel ticks and watch/wait retain their existing reads.
4887
5052
 
@@ -4988,8 +5153,20 @@ standalone `dispatcher.tick-failed` diagnostic before the next operational tick.
4988
5153
  An unacknowledged diagnostic remains pending and may be duplicated after a lost
4989
5154
  response. Reporting never closes a later tick boundary or gates committed
4990
5155
  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.
5156
+ still stop the loop. Once mode ends its run after its single tick: a failed tick
5157
+ whose `dispatcher.tick-failed` is durable records a normal `dispatcher.run-stopped`
5158
+ with exit code 1 and the error, then rethrows the original error; an unreported
5159
+ failure, a fatal forge publication or a fatal ticket preparation stops abnormally.
5160
+ Stopping before recovery leaves only local warnings for unreported failures.
5161
+
5162
+ A dispatcher with a hosted ticket source publishes its ticket policy and settles
5163
+ targeted listing at its first tick boundary, as ticket preparation, not while it
5164
+ is constructed. A transient preparation failure is a tick failure retried on the
5165
+ next tick; a permanent one (authentication, a service predating the policy, a
5166
+ validation error) is fatal. A tick-failure episode spans runs, so consecutive
5167
+ one-tick runs accumulate one: any completed tick ends it, as does a clean,
5168
+ abnormal or forced stop of the run that last failed, but a new run or a one-tick
5169
+ run's normal stop after its failed tick does not.
4993
5170
 
4994
5171
  Repository tick telemetry is bounded mutable operational metadata, like leases.
4995
5172
  `beginRepoTick` persists the open boundary before unsafe work; `finishRepoTick`
@@ -5041,7 +5218,11 @@ setup failures, and blockers. Dashboard rows derive from build and repository ev
5041
5218
  effective configuration only, so heartbeat or lease renewal without an event
5042
5219
  does not alter them. Every nonterminal build, including `queued`, has a
5043
5220
  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
5221
+ durable failure. A `done` build with an open escalation, such as a
5222
+ post-landing integration audit raised after it completed or a question still
5223
+ open when abort cleanup completed, also has a row, `BLOCKED` with the note
5224
+ `done` and its question, until an operator acknowledges it with `ab answer`;
5225
+ it holds no slot and offers no other control. A human may discard only such a queued build. Discard is
5045
5226
  dispatcher cleanup, returns the ticket to its
5046
5227
  configured Ready state, and completes with
5047
5228
  `discarded`; it is deliberately distinct from abort, which returns work to
@@ -5068,12 +5249,12 @@ using a slot and the word tells why.
5068
5249
  | | 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
5250
  | | held | `PAUSING` | a pause was requested and the runner is still stopping |
5070
5251
  | | 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 |
5252
+ | 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
5253
  | 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
5254
  | | none | `MERGING` | a finished pipeline with merge consent, waiting for merge gates or for the forge to merge |
5074
5255
  | | none | `PAUSED` | an acknowledged pause |
5075
5256
  | | 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 |
5257
+ | 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
5258
  | dim (`pending`) | none | `CLEANING` | abort cleanup |
5078
5259
 
5079
5260
  A build's slot state picks its tone first, then the word within that tone.
@@ -5180,7 +5361,10 @@ rejection is `EventValidationError`.
5180
5361
  require a boundary. The store is the *only* coordination surface — no side
5181
5362
  channel — and polling covers commands exactly the way it covers
5182
5363
  `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
5364
+ commands and escalation answers on resume. Abort is the exception: the
5365
+ dispatcher acknowledges it itself for any node, and for a queued, paused
5366
+ or blocked leaf with no live execution lease. It never provisions a
5367
+ workspace or starts a runner to do so. While a turn is live, the runner
5184
5368
  subscribes from its session boundary and forwards pause or abort as caller-owned
5185
5369
  cancellation to the AgentRunner; it closes the session transcript without
5186
5370
  recording `phase.failed`, records suspension for pause, and acknowledges the
@@ -5198,16 +5382,16 @@ with illustrative members:
5198
5382
  | Family | Examples |
5199
5383
  |---|---|
5200
5384
  | 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) |
5385
+ | 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
5386
  | 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
5387
  | 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
5388
  | 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
5389
  | 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?}` |
5390
+ | 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
5391
  | Integration attention | Kernel/dispatcher `integration.verification-failed {id, head, parent, steps, guidance}`: one durable failed-cycle notification, recovered from exact verification receipts |
5208
5392
  | 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
5393
  | 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) |
5394
+ | 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
5395
  | Head path facts | advisory `head.paths-recorded {source, head, destination, mergeBase, total, preview, resolution?, artifact}` |
5212
5396
  | 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
5397
  | 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 +5401,14 @@ with illustrative members:
5217
5401
  | 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
5402
  | 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
5403
 
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,
5404
+ Abort cleanup is a dispatcher-owned ordered saga. A runner acknowledges abort
5405
+ for a running leaf; for a queued, paused or blocked leaf with no live execution
5406
+ lease, and for a node, the dispatcher appends `build.aborted` itself and runs
5407
+ the saga, never provisioning a workspace or starting a runner first. While an
5408
+ execution lease is live, the janitor defers the saga so it cannot race
5409
+ process-tree teardown. Once that supervisor releases the lease, or an abruptly
5410
+ orphaned lease expires, cleanup closes an open unmerged PR without overriding a
5411
+ racing merge, releases the workspace,
5224
5412
  deletes the exact published remote branch and exact local branch, unions the
5225
5413
  `autobuild:aborted` label into the current ticket labels, moves the ticket once
5226
5414
  to its destination and posts an abort notice, reports the hand-back, and only
@@ -5238,6 +5426,16 @@ move, the `abort.ticket-returned` checkpoint and the hand-back report, because
5238
5426
  its node's sweep moves the ticket to the rejected role (§13.1.1). A closed
5239
5427
  attempt PR likewise records no `build.ticket-returned`.
5240
5428
 
5429
+ Abort's workspace release attempts commit preservation once. When preservation
5430
+ fails, including when the forge defers or cools down the archive, it records
5431
+ `workspace.commits-lost` (reason `abort: commit preservation failed — …`) and
5432
+ releases anyway: abort discards the build's work, and the receipt is its paper
5433
+ trail. Only lost repository authority, a mixed-version deferral or a live
5434
+ execution lease stop the release. An uncompleted publication request is
5435
+ recorded `publication.lost` without a settlement attempt. A failed provider
5436
+ teardown records `infrastructure.cleanup-attempted` with pending cleanup and
5437
+ stays due on the next tick, so no orphan environment is left behind.
5438
+
5241
5439
  Every dispatcher hand-back of a claimed or ready ticket other than completion —
5242
5440
  abort, spec-standard bounce, preparation recovery returning a confirmed claim,
5243
5441
  closed-unmerged PR and discard — appends one repository `ticket.handed-back`
@@ -5352,14 +5550,24 @@ version is the server's cache identity, not a compatibility gate. The client
5352
5550
  drops object properties its shape does not know, so additive server changes
5353
5551
  reach older readers. Invalid envelopes and values the client cannot represent
5354
5552
  (a missing field, an unknown variant) fail with a typed incompatibility error
5355
- naming the reducer and client/server versions. Clients send
5553
+ naming the reducer, client/server versions and upgrade advice. The error is
5554
+ terminal for every reader: `ab watch` and `ab wait` exit 1 at once instead of
5555
+ retrying, and never reconstruct the value from history. Clients send
5356
5556
  `x-autobuild-reducer-value-projection: 1`. The service retains frozen contracts for
5357
5557
  every supported published client, including clients with projection capability.
5358
5558
  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
5559
+ An optional `lastEvent` the release cannot represent is omitted, also in nested
5560
+ build state, when its type is unknown to the release or when it is a well-formed
5561
+ event under the server's catalog whose payload carries values the release
5562
+ predates; a malformed display event leaves the answer unchanged. Cursor,
5563
+ progress, and compatibility facts remain canonical. The required `seenTypes` set
5564
+ retains the event types known to that released reader. A declared
5565
+ released-value policy rewrites a widened literal to an older equivalent, or omits
5566
+ it when the field is optional, only where released readers then behave the same.
5567
+ A value that drives released decisions, such as an escalation's policy cause, and
5568
+ other unrepresentable required values remain typed incompatibilities. Every divergence from a supported contract is declared in that
5569
+ policy, and populated values covering every union variant are tested against
5570
+ every supported contract. A request may
5363
5571
  identify its generated finished-value catalog in `x-autobuild-catalog-identity`;
5364
5572
  a recorded published identity selects its frozen contract. An unrecognized catalog
5365
5573
  identity with projection capability retains the canonical answer, including source
@@ -5691,6 +5899,16 @@ rollup (§7.7): the build's `kind` (from `build.created`, default `work`), its
5691
5899
  {outcome, completedAt}`. It applies the build reducer's terminal rule, so
5692
5900
  `finished` is present exactly when the build's status is `done` or `aborted`.
5693
5901
 
5902
+ #### Done escalation entry
5903
+
5904
+ `doneEscalationEntry` is a registered build-scope value for the
5905
+ `doneEscalations` rollup (§7.7): the build's `kind`, its latest terminal fact
5906
+ (`done` or `aborted`) and its open escalation ids in raise order. It applies the build reducer's open-escalation
5907
+ rules exactly: raises, deferrals, janitor escalations and entered ticket waits
5908
+ open; answers, wait ends, janitor recovery, `wait-unresolvable` and verify
5909
+ supersession close. Its ids always equal the build reducer's
5910
+ `openEscalations`.
5911
+
5694
5912
  ### 15.6 Walkthroughs
5695
5913
 
5696
5914
  **Happy path** (elided: `session.started/ended` brackets around every agent
@@ -5771,7 +5989,10 @@ verdict's finding marks `persists: [f1]` → round 3 again → kernel:
5771
5989
  names the exact replacement artifact it authorizes. `accept-target` answers only
5772
5990
  a leaf's `policy/target-rewritten` escalation (§7.4): it waives the rejected base
5773
5991
  and restacks the build's own commits onto the current target; other answer forms
5774
- skip that escalation. `guidance` feeds the answer
5992
+ skip that escalation. Answering a `done` build only acknowledges its open
5993
+ escalations: guidance or a bare retry records `escalation.answered`, requests no
5994
+ resume and leaves the build done, and every other answer form is refused.
5995
+ `guidance` feeds the answer
5775
5996
  into the next producer round as authoritative feedback; `dismiss-finding`
5776
5997
  marks the chain human-resolved and the next reviewer round is told so. Engine-routed
5777
5998
  guidance is latest-only per destination (`plan`, `code`, or one exact agent
@@ -5881,7 +6102,9 @@ SHAs could not be inspected. An environment that never started executing holds
5881
6102
  no unpublished work: objects its checkout lacks mean nothing to preserve, so
5882
6103
  cleanup records `workspace.commits-preserved` (or `workspace.commits-retained`)
5883
6104
  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
6105
+ receipt-write outcomes leave the workspace and snapshots intact, except under
6106
+ abort cleanup, which records `workspace.commits-lost` and tears the workspace
6107
+ down. A workspace
5885
6108
  flagged by `workspace.cleanup-required` is never launched into: the dispatcher
5886
6109
  releases it and provisions the next generation. Provisioning cut off by a
5887
6110
  recorded dispatcher teardown is the exception: the next invocation asks the
@@ -6076,8 +6299,8 @@ reopen re-enters the mainline at `implement` or `plan`, and the leaf reaches
6076
6299
  merge only through `finalize` again.
6077
6300
 
6078
6301
  **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
6302
+ leave a finished leaf's own CI red on the forge without the local verify steps
6303
+ 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
6304
  session running), the dispatcher reads the check runs and commit statuses at the
6082
6305
  PR's live head through the optional Forge `inspectHeadChecks` capability
6083
6306
  (GitHub: two ETag-conditional REST reads, so an unchanged head costs two 304s).
@@ -6169,7 +6392,8 @@ Workspace commit preservation (§12 D) is the strict exception: its unpublished
6169
6392
  commits may exist nowhere else. It tries the forge archive ref, then a
6170
6393
  `history-objects-<sha>` store copy excluding the preservation base, and never
6171
6394
  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:
6395
+ is refused and cleanup stays pending. Abort cleanup is the one exception: it
6396
+ records `workspace.commits-lost` and releases. A history copy is identified by its head:
6173
6397
  a later retention of the same commit reuses the existing copy and its saved
6174
6398
  base. Preservation records that base and, when it is no longer an ancestor of
6175
6399
  the current preservation base, retains the base itself the same way, to a
@@ -6757,6 +6981,7 @@ automatic = true # immediate/60-second target checks; false requi
6757
6981
  #vcpus = 4
6758
6982
  #timeoutSeconds = 2700
6759
6983
  #operationTimeoutMs = 30000 # provider calls, not VM/session lifetime
6984
+ #recoveryTimeoutMs = 120000 # one stopped-sandbox resume plus guest git
6760
6985
  #environmentVariables = ["ANTHROPIC_API_KEY"]
6761
6986
 
6762
6987
  #[pr.imageHost] # optional public inline rendering for attached images
@@ -6914,7 +7139,11 @@ non-ancestor source records `verify.config-superseded` and starts a fresh cycle
6914
7139
  before constructing any further member. Already launched siblings settle first.
6915
7140
  A waiting leaf with completed verification retains its receipts after a clean
6916
7141
  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
7142
+ the pin commit's ancestry. Two clean restacks instead start a new cycle that
7143
+ the earlier receipts cannot satisfy: a root-targeting leaf's clean landing
7144
+ restack whose frozen `afterCleanRestack` policy enables any step re-verifies on
7145
+ the restacked base and head, and a clean wait-resume restack after a verify or
7146
+ finalize ticket wait re-verifies on the resumed base. Changed config still supersedes while waiting; a
6918
7147
  future verification cycle always captures fresh config before running steps.
6919
7148
  Old pass/skip receipts cannot satisfy that cycle, and supersession creates no
6920
7149
  failure or failure-budget charge. Unchanged config on a descendant head retains
@@ -6925,12 +7154,16 @@ replace its build-owned sections. Historical streams capture before further
6925
7154
  verification. Deployment-owned reloads remain live; environments are not
6926
7155
  re-provisioned.
6927
7156
 
6928
- Three configurable narrowing mechanisms govern which verify steps run, all
7157
+ Four configurable narrowing mechanisms govern which verify steps run, all
6929
7158
  resolving to the ordinary `skipped` outcome so exclusions stay queryable:
6930
7159
 
6931
7160
  - **Post-reconcile policy.** The cycle snapshot resolves repository and step
6932
7161
  `afterReconcile` settings before any plan or path exclusions, including for
6933
7162
  `always` steps. It applies only after a completed reconcile.
7163
+ - **Clean-restack policy.** A root-targeting leaf's clean awaiting-merge
7164
+ restack freezes repository and step `afterCleanRestack` settings in its
7165
+ restack intent. When any step is opted in, the cycle it opens skips the
7166
+ rest before any plan or path exclusions, including for `always` steps.
6934
7167
  - **Plan selection.** An approved plan may declare the complete subset of
6935
7168
  optional verify steps warranted by the spec, in strict front matter
6936
7169
  validated at deposit. The selection paired with the approving review
@@ -6940,7 +7173,7 @@ resolving to the ordinary `skipped` outcome so exclusions stay queryable:
6940
7173
  the cycle's pinned configured universe, the entire selection falls back to
6941
7174
  all configured optional steps. The kernel records one observation per cycle
6942
7175
  and plan revision naming the unknown steps. Mandatory steps, paths and
6943
- post-reconcile policy still apply. A valid selection continues to skip
7176
+ post-reconcile and clean-restack policies still apply. A valid selection continues to skip
6944
7177
  genuinely omitted optional steps. Strict new-plan validation is unchanged.
6945
7178
  - **Path applicability.** A step may declare positive changed-path selectors,
6946
7179
  evaluated by the kernel immediately before the step on every verify cycle,
@@ -6978,6 +7211,41 @@ and a reason naming the setting. Dashboards and PR summaries call this
6978
7211
  checks and branch protections still gate merge. For excluded steps, merged code
6979
7212
  is not re-verified, so breakage that only exists in the combination can merge.
6980
7213
 
7214
+ #### Clean-restack verification policy
7215
+
7216
+ Clean-restack re-verification defaults to disabled: omitting
7217
+ `[verify].afterCleanRestack` means `false`, and omission is preserved in the
7218
+ captured configuration. An optional boolean `[verify.<step>].afterCleanRestack`
7219
+ overrides the repository setting in either direction. Opt in per step on
7220
+ deterministic checks, for example `afterCleanRestack = true` in
7221
+ `[verify.lint]` and `[verify.types]`; an agent step re-runs only when opted
7222
+ in. Each target move under a waiting leaf re-runs every opted-in step, so
7223
+ keep the set to checks that are cheap and catch semantic drift.
7224
+
7225
+ The policy applies only to a root-targeting leaf's clean awaiting-merge
7226
+ restack, including one whose conflicts were all `[[generated]]` files and
7227
+ were regenerated. A leaf targeting an integration node relies on that node's
7228
+ own verification before root. When the runner builds the restack intent, it
7229
+ resolves the ordered policy from the configuration it decided with and, only
7230
+ if at least one step is enabled, freezes it as `cleanRestackPolicy` in
7231
+ `restack.publish-intended`. The same value is recorded on `restack.rewritten`
7232
+ and `restack.completed`, so a crash between intent and completion keeps the
7233
+ frozen policy. That completion is a verify cycle boundary, not a replay
7234
+ boundary: no further restack runs. While it is the newest code boundary,
7235
+ each step the policy disables records `verify.completed` with outcome
7236
+ `skipped`, `skipCause = "clean-restack-policy"`, and a reason naming the
7237
+ setting ("skipped by clean-restack policy: verify.afterCleanRestack = false").
7238
+ Enabled steps follow plan selection and path rules and cite the restacked
7239
+ base and head. A step absent from the frozen policy runs.
7240
+
7241
+ The leaf does not land until the cycle is satisfied. A failure routes through
7242
+ the ordinary repair loop (implement → code-review → verify-entry restack →
7243
+ ordinary verification) and counts toward `maxVerifyAttempts`. When every
7244
+ step passes or is skipped, the build returns to waiting, and landing consent
7245
+ survives as it does for any clean restack. An omitted or all-false policy
7246
+ records nothing, so existing event streams and decisions are unchanged. Node
7247
+ verification and optimization measurement invalidation are unaffected.
7248
+
6981
7249
  ### 16.3 Skill installation: vendored, namespaced, editable [D11]
6982
7250
 
6983
7251
  This project ships 14 canonical default skills for the fixed phases, the
@@ -7192,8 +7460,8 @@ absolute file path containing the edited text. Read the current ticket and
7192
7460
  reapply the intended changes before retrying; conflicts are never merged.
7193
7461
 
7194
7462
  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,
7463
+ state and any priority other than normal; file revisions also cover nonempty issue links. GitHub revisions
7464
+ fingerprint kind, target, title, body, canonical label/blocker sets (priority labels included), state and issue links,
7197
7465
  including the ticket's own issue; GitHub tickets carry no comments, and assignees
7198
7466
  are not part of a GitHub revision. Reverting
7199
7467
  identical content restores its fingerprint. File checks
@@ -7306,13 +7574,20 @@ consent was given at (null without consent), and a current forge CI failure
7306
7574
  Source `ab ticket tree` / `tickets.tree` enumerate all ticket states with listing
7307
7575
  diagnostics; effective build targets remain frozen independently of source metadata.
7308
7576
 
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
7577
+ Default watch attention includes `integration.verification-failed`, `integration.landed`,
7578
+ `landing.consent-revoked`, `pr.checks-failed`, and `optimization.noise-exceeded`.
7579
+ Conflicted `restack.replayed` and `node.item-conflicted` are routine: reconcile or
7580
+ generated-file regeneration resolves them, so they stay out of default watch and
7581
+ wait attention, as they do in `repository.attention`. An unresolvable conflict
7582
+ reaches the operator only as `escalation.raised` (a reconcile escalation,
7583
+ exhausted reconcile attempts, or no progress) or `landing.consent-revoked`.
7584
+ Derived `build.consent-ready` observations
7311
7585
  carry target, branch, candidate and the durable readiness entry position in the
7312
7586
  existing cursor envelope. Cursor identities retain readiness episodes across
7313
7587
  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
7588
+ remain event-only. Wait adds `consent`, `node-merged`, and `restack-conflicted`;
7589
+ attention includes consent and node merges but not restack conflicts, which
7590
+ `restack-conflicted` opts into. Current-state waits return immediately, backlog
7316
7591
  replay retains event ordering, including merge before terminal completion.
7317
7592
 
7318
7593
  Consent/hold readiness is signalled exclusively by `build.consent-ready`,