@defrex/autobuild 1.12.0 → 1.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/README.md +1 -1
  2. package/SPEC.md +465 -163
  3. package/bin/ab-build-runner.ts +8 -0
  4. package/docs/answering-blocked-builds.md +28 -4
  5. package/docs/architecture.md +136 -53
  6. package/docs/cli.md +1 -1
  7. package/docs/configuration.md +120 -17
  8. package/docs/dispatcher.md +19 -8
  9. package/docs/integration-overview.md +1 -1
  10. package/docs/integration-tree.md +12 -9
  11. package/docs/merge-policy.md +7 -2
  12. package/docs/operating.md +13 -3
  13. package/docs/operator-api.md +46 -23
  14. package/docs/operator-surfaces.md +7 -6
  15. package/docs/optimization-nodes.md +7 -6
  16. package/docs/plugin-authoring.md +46 -18
  17. package/docs/remote-store-protocol.md +52 -13
  18. package/docs/remote-ticket-protocol.md +85 -38
  19. package/docs/restacking.md +48 -3
  20. package/docs/setup.md +2 -1
  21. package/docs/ticket-migration.md +2 -2
  22. package/docs/ticket-sources.md +23 -8
  23. package/docs/tickets.md +4 -4
  24. package/docs/troubleshooting.md +32 -2
  25. package/docs/verification.md +3 -1
  26. package/package.json +3 -3
  27. package/packages/core/src/cli/build-control.ts +72 -6
  28. package/packages/core/src/cli/dashboard/actions.ts +4 -0
  29. package/packages/core/src/cli/dashboard/integration-row.ts +43 -19
  30. package/packages/core/src/cli/dashboard/model.ts +14 -8
  31. package/packages/core/src/cli/dashboard/poll.ts +218 -10
  32. package/packages/core/src/cli/dashboard/queue.ts +21 -10
  33. package/packages/core/src/cli/dashboard/row-text.ts +2 -1
  34. package/packages/core/src/cli/dashboard/vocabulary.ts +5 -1
  35. package/packages/core/src/cli/dispatch-frontend.ts +2 -1
  36. package/packages/core/src/cli/dispatch-tickets.ts +33 -12
  37. package/packages/core/src/cli/dispatch.ts +547 -145
  38. package/packages/core/src/cli/help.ts +38 -24
  39. package/packages/core/src/cli/main.ts +7 -5
  40. package/packages/core/src/cli/publication-settlement.ts +4 -0
  41. package/packages/core/src/cli/remote-poll.ts +22 -5
  42. package/packages/core/src/cli/repository-status.ts +19 -9
  43. package/packages/core/src/cli/status.ts +23 -11
  44. package/packages/core/src/cli/store-opening.ts +12 -0
  45. package/packages/core/src/cli/ticket-start.ts +3 -3
  46. package/packages/core/src/cli/ticket.ts +12 -11
  47. package/packages/core/src/cli/wait.ts +8 -28
  48. package/packages/core/src/cli/watch.ts +113 -50
  49. package/packages/core/src/config/reference-metadata.ts +7 -1
  50. package/packages/core/src/config/reference.ts +5 -2
  51. package/packages/core/src/config/schema.ts +51 -16
  52. package/packages/core/src/events/payloads.ts +74 -14
  53. package/packages/core/src/events/policy.ts +1 -0
  54. package/packages/core/src/events/repository.ts +33 -3
  55. package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +31 -0
  56. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/be211f0e31a65006.json.gz +0 -0
  57. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/0a10010ee5cf2e47.json +577 -0
  58. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/227701361be6d1e0.json +490 -0
  59. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/312cc4090820a612.json +1078 -0
  60. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/76e5043bae7a80ab.json +86 -0
  61. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/87a917802870bbed.json +87 -0
  62. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/9d85616e5b9e24c1.json +500 -0
  63. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/a2780567b4989fb6.json +105 -0
  64. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/c7c94fbe7f63cf07.json +84 -0
  65. package/packages/core/src/kernel/clean-restack-policy.ts +40 -0
  66. package/packages/core/src/kernel/dispatch-capacity.ts +243 -107
  67. package/packages/core/src/kernel/done-escalations.ts +273 -0
  68. package/packages/core/src/kernel/engine.ts +28 -9
  69. package/packages/core/src/kernel/integration-landing.ts +24 -4
  70. package/packages/core/src/kernel/integration-stack.ts +39 -0
  71. package/packages/core/src/kernel/janitor-failure.ts +20 -1
  72. package/packages/core/src/kernel/log-index-value.ts +3 -0
  73. package/packages/core/src/kernel/log-index.ts +41 -2
  74. package/packages/core/src/kernel/open-pr-backpressure.ts +3 -3
  75. package/packages/core/src/kernel/reducer-registry.ts +3 -0
  76. package/packages/core/src/kernel/reducer-revisions.ts +19 -0
  77. package/packages/core/src/kernel/reducer.ts +42 -8
  78. package/packages/core/src/kernel/repository-attention.ts +14 -5
  79. package/packages/core/src/kernel/repository-read-facts.ts +9 -0
  80. package/packages/core/src/kernel/ticket-starts.ts +15 -4
  81. package/packages/core/src/kernel/verify-stages.ts +46 -7
  82. package/packages/core/src/operator/attention.ts +28 -3
  83. package/packages/core/src/operator/done-escalations.ts +38 -0
  84. package/packages/core/src/operator/presentation.ts +1 -1
  85. package/packages/core/src/operator/protocol.ts +8 -5
  86. package/packages/core/src/operator/query.ts +33 -19
  87. package/packages/core/src/operator/registry.ts +17 -13
  88. package/packages/core/src/operator/ticket-start.ts +8 -7
  89. package/packages/core/src/operator/tickets.ts +28 -9
  90. package/packages/core/src/plugin-sdk/index.ts +10 -0
  91. package/packages/core/src/plugins/manifest.ts +14 -1
  92. package/packages/core/src/ports/forge/create.ts +8 -0
  93. package/packages/core/src/ports/forge/github-transport.ts +5 -1
  94. package/packages/core/src/ports/forge/github.ts +3 -0
  95. package/packages/core/src/ports/tickets/contract.ts +147 -76
  96. package/packages/core/src/ports/tickets/create.ts +47 -7
  97. package/packages/core/src/ports/tickets/fake.ts +8 -4
  98. package/packages/core/src/ports/tickets/file-codec.ts +4 -3
  99. package/packages/core/src/ports/tickets/file.ts +7 -3
  100. package/packages/core/src/ports/tickets/github.ts +1 -0
  101. package/packages/core/src/ports/tickets/grants.ts +11 -3
  102. package/packages/core/src/ports/tickets/hosted-index.ts +5 -0
  103. package/packages/core/src/ports/tickets/linear.ts +28 -9
  104. package/packages/core/src/ports/tickets/migration.ts +4 -4
  105. package/packages/core/src/ports/tickets/operations.ts +4 -2
  106. package/packages/core/src/ports/tickets/priority-labels.ts +213 -0
  107. package/packages/core/src/ports/tickets/priority.ts +127 -21
  108. package/packages/core/src/ports/tickets/remote-protocol.ts +10 -0
  109. package/packages/core/src/ports/tickets/remote.ts +104 -11
  110. package/packages/core/src/ports/tickets/revision.ts +5 -3
  111. package/packages/core/src/ports/tickets/search.ts +9 -0
  112. package/packages/core/src/ports/tickets/tree.ts +8 -6
  113. package/packages/core/src/ports/types.ts +30 -15
  114. package/packages/core/src/ports/workspace/build-execution.ts +13 -1
  115. package/packages/core/src/ports/workspace/builtin-capabilities.ts +4 -0
  116. package/packages/core/src/ports/workspace/create.ts +16 -3
  117. package/packages/core/src/ports/workspace/execution-exit-marker.ts +41 -0
  118. package/packages/core/src/ports/workspace/recovery-step.ts +101 -0
  119. package/packages/core/src/ports/workspace/vercel-sandbox.ts +596 -144
  120. package/packages/core/src/processes/build-execution-state.ts +4 -0
  121. package/packages/core/src/processes/build-runner.ts +14 -1
  122. package/packages/core/src/processes/dispatcher.ts +841 -230
  123. package/packages/core/src/processes/execution-settlement.ts +25 -3
  124. package/packages/core/src/processes/harvest-runner.ts +12 -7
  125. package/packages/core/src/processes/infrastructure-failure-budget.ts +7 -2
  126. package/packages/core/src/processes/invocation-budget.ts +176 -0
  127. package/packages/core/src/processes/publication-loss.ts +38 -3
  128. package/packages/core/src/processes/tick-publication.ts +1 -0
  129. package/packages/core/src/processes/workspace-preservation.ts +86 -15
  130. package/packages/core/src/store/contract.ts +88 -3
  131. package/packages/core/src/store/event-reads.ts +30 -1
  132. package/packages/core/src/store/reduced-reads.ts +23 -0
  133. package/packages/core/src/store/reducer-value-shapes.json +6759 -6490
  134. package/packages/core/src/store/reducer-value-validation.ts +188 -33
  135. package/packages/core/src/store/remote/client.ts +169 -29
  136. package/packages/core/src/store/remote/compatibility.ts +113 -56
  137. package/packages/core/src/store/remote/credentials.ts +4 -1
  138. package/packages/core/src/store/remote/protocol.ts +3 -0
  139. package/packages/core/src/store/remote/released-clients.json +22 -0
  140. package/packages/core/src/store/remote/released-reducer-values/1.13.0.json +35966 -0
  141. package/packages/core/src/store/remote/released-reducer-values/1.14.0.json +36076 -0
  142. package/packages/core/src/store/remote/released-reducer-values/index.ts +20 -16
  143. package/packages/core/src/store/remote/released-value-policy.ts +144 -0
  144. package/packages/core/src/store/remote/retry.ts +406 -0
  145. package/packages/core/src/store/repo-state-events.ts +1 -0
  146. package/packages/core/src/testing/dispatch-read-budget.ts +155 -11
  147. package/packages/core/src/testing/index.ts +2 -0
  148. package/packages/core/src/testing/invocation-budget.ts +42 -0
  149. package/packages/core/src/testing/reduced-read-budget.ts +589 -19
  150. package/packages/core/src/testing/released-value-coverage.ts +423 -0
  151. package/packages/core/src/web/overview-source.ts +19 -6
  152. package/skills/guide/SKILL.md +147 -67
  153. package/skills/guide/references/integration-tree.md +12 -9
  154. package/skills/guide/references/merge-policy.md +7 -2
  155. package/skills/guide/references/operator-api.md +46 -23
  156. package/skills/guide/references/optimization-nodes.md +7 -6
  157. package/skills/guide/references/plugin-authoring.md +46 -18
  158. package/skills/guide/references/remote-store-protocol.md +52 -13
  159. package/skills/guide/references/remote-ticket-protocol.md +85 -38
  160. package/skills/guide/references/restacking.md +48 -3
  161. package/skills/guide/references/setup.md +2 -1
  162. package/skills/guide/references/ticket-migration.md +2 -2
  163. package/skills/operate/SKILL.md +136 -55
  164. package/skills/plan/SKILL.md +4 -3
  165. package/skills/spec/SKILL.md +9 -5
  166. package/skills/tickets/SKILL.md +25 -17
  167. package/templates/hosted-service/package.json +2 -2
@@ -356,10 +356,14 @@ non-ancestor source records `verify.config-superseded` and starts a fresh cycle
356
356
  before constructing any further member. Already launched siblings settle first.
357
357
  A leaf awaiting merge with completed verification retains its receipts after a
358
358
  clean rewrite when build-owned config is unchanged, even when the rewrite
359
- replaces the pin commit's ancestry. A clean wait-resume restack after a verify
360
- or finalize ticket wait is different: it starts a new verification cycle on the
361
- resumed base even when config is unchanged, and the earlier results cannot
362
- satisfy it. Changed config still supersedes while waiting; a
359
+ replaces the pin commit's ancestry. Two clean restacks are different: each
360
+ starts a new verification cycle even when config is unchanged, and the earlier
361
+ results cannot satisfy it. A clean landing restack of a root-targeting leaf
362
+ whose frozen `afterCleanRestack` policy enables any step re-verifies on the
363
+ restacked base and head (see
364
+ [Clean-restack re-verification](restacking.md#clean-restack-re-verification)).
365
+ A clean wait-resume restack after a verify or finalize ticket wait re-verifies
366
+ on the resumed base. Changed config still supersedes while waiting; a
363
367
  future verification cycle always captures fresh config before running steps.
364
368
  Old pass/skip receipts cannot satisfy that cycle, and supersession creates no
365
369
  failure or failure-budget charge. Unchanged config on a descendant head retains
@@ -585,7 +589,7 @@ any table header.
585
589
  - **Reload:** Hot: next dispatcher action captures the accepted value. A running invocation keeps its captured values.
586
590
  - **Local override:** Allowed in .autobuild/local.toml.
587
591
 
588
- **Description:** Slots for this repository. A build holds one from admission (a ticket claim, a start request or an admitted slot request) until it waits on a human, another ticket, the forge or its children, or ends. A build whose outside wait ends is admitted again ahead of normal ticket claims, urgent work first (see [slot admission order](dispatcher.md#slot-admission-order)). Occupancy never exceeds capacity.
592
+ **Description:** Slots for this repository. A build holds one from admission (a ticket claim, a start request or an admitted slot request) until it waits on a human, another ticket, the forge or its children, or ends. A build whose outside wait ends is admitted again ahead of ticket claims at its level, higher levels first (see [slot admission order](dispatcher.md#slot-admission-order)). Occupancy never exceeds capacity.
589
593
 
590
594
  **Constraints:** safe integer; > 0
591
595
 
@@ -1201,6 +1205,7 @@ image = "vercel/sandbox/universal:latest"
1201
1205
  vcpus = 4
1202
1206
  timeoutSeconds = 2700
1203
1207
  operationTimeoutMs = 30000
1208
+ recoveryTimeoutMs = 120000
1204
1209
  snapshotExpirationSeconds = 86400
1205
1210
  region = "iad1"
1206
1211
  failoverRegions = ["sfo1"]
@@ -1291,6 +1296,20 @@ preflight = "test \"$(pi --version)\" = \"0.84.4\" && pi update --models"
1291
1296
 
1292
1297
  **Constraints:** safe integer; ≥ 1000; ≤ 300000
1293
1298
 
1299
+ #### `workspace.config.recoveryTimeoutMs`
1300
+
1301
+ **TOML key:** `workspace.config.recoveryTimeoutMs`
1302
+
1303
+ - **Type:** `number`
1304
+ - **Default:** `120000`
1305
+ - **Required:** Optional
1306
+ - **Reload:** Dispatcher restart required; startup adapters retain their configuration. Build-owned pipeline: captured from the execution checkout each verify cycle; later base-branch edits do not replace it. Workspace provisioning applies at the next build launch. A running invocation keeps its captured values.
1307
+ - **Local override:** Committed only: set in autobuild.toml.
1308
+
1309
+ **Description:** Ceiling in milliseconds for one stopped-sandbox recovery: an explicit cold resume plus the guest git work that follows it, including a push. A bounded invocation starts a recovery when a realistic resume (about 45 s) plus its cleanup reserve still fits, and its deadline bounds the recovery further. Separate from operationTimeoutMs.
1310
+
1311
+ **Constraints:** safe integer; ≥ 1000; ≤ 600000
1312
+
1294
1313
  #### `workspace.config.snapshotExpirationSeconds`
1295
1314
 
1296
1315
  **TOML key:** `workspace.config.snapshotExpirationSeconds`
@@ -1586,7 +1605,35 @@ and verified Git checkpoints remain authoritative. See the
1586
1605
  Paused and policy-blocked builds release their sandbox after the execution
1587
1606
  lease expires. Resume creates a replacement and reruns setup. Graceful shutdown
1588
1607
  bounds stop/delete calls by `operationTimeoutMs`; an unknown acknowledgement
1589
- keeps ownership fenced until lease expiry and is retried visibly. After abrupt
1608
+ keeps ownership fenced until lease expiry and is retried visibly.
1609
+
1610
+ A persistent sandbox that stopped (for example, on its own timeout) is never
1611
+ treated as running:
1612
+
1613
+ - **Finished work settles.** The guest runner records its exit on the
1614
+ sandbox filesystem. Observing a stopped sandbox resumes it, reads that
1615
+ record, and stops it again, so a finished session's `publication.requested`
1616
+ is published instead of the execution being declared lost.
1617
+ - **Resume has its own budget.** Preservation and publication resume a
1618
+ stopped sandbox explicitly. `recoveryTimeoutMs` (default 120 s) is the
1619
+ ceiling for the cold resume plus the guest git work and push.
1620
+ `operationTimeoutMs` still bounds each metadata acknowledgement.
1621
+ - **The invocation deadline wins.** A hosted invocation starts a recovery
1622
+ only while a realistic resume (about 45 s) plus the cleanup reserve
1623
+ (`2 × operationTimeoutMs`) still fits, and stops recovery early enough to
1624
+ restore policy and stop the sandbox before it ends. A resume the deadline
1625
+ cuts short is stopped, or left uncertain until a later fence, and charges
1626
+ no infrastructure attempt.
1627
+ - **Deferred work runs first next time.** Work that cannot fit is deferred:
1628
+ the tick counts it as `recoveryDeferred`, logs
1629
+ `build <slug>: <step> deferred by the invocation budget`, and records the
1630
+ build in the latest-only `dispatcher.work-deferred` fact. The next
1631
+ invocation sweeps those builds before anything else.
1632
+ - **No redundant stops.** Fence and cleanup skip `stop()` for a sandbox the
1633
+ provider already reports stopped.
1634
+ - **Failures name their step.** `infrastructure.failed` and the exhaustion
1635
+ escalation say which step failed: `resume`, `fence`, `preserve`, or
1636
+ `cleanup`. See [troubleshooting](troubleshooting.md#infrastructure-escalation-names-a-recovery-step). After abrupt
1590
1637
  supervisor loss, Vercel's configured `timeoutSeconds` bounds orphan compute, and
1591
1638
  the next dispatcher waits for lease expiry before exact-name cleanup. Provider
1592
1639
  quota/vCPU/duration messages are retained verbatim in infrastructure events and
@@ -1609,8 +1656,8 @@ is different: the next invocation verifies it and finishes it in the same
1609
1656
  generation. If it cannot be finished, it is released and replaced without
1610
1657
  consuming `maxInfrastructureAttempts`. A bounded dispatcher invocation does not
1611
1658
  start provisioning with less than about 150 s of budget left; it records
1612
- `provisioningDeferred` in the tick report and leaves the build to the next
1613
- invocation.
1659
+ `provisioningDeferred` in the tick report, logs the build, and records it in
1660
+ `dispatcher.work-deferred`, so the next invocation provisions it first.
1614
1661
 
1615
1662
  The representative actual-provider check is opt-in and must point at an
1616
1663
  independent consuming repository whose `autobuild.toml` selects the universal
@@ -1832,6 +1879,19 @@ and a reason naming the setting. Dashboards and PR summaries call this
1832
1879
  checks and branch protections still gate merge. For excluded steps, merged code
1833
1880
  is not re-verified, so breakage that only exists in the combination can merge.
1834
1881
 
1882
+ Clean-restack re-verification defaults to disabled: omitting
1883
+ `[verify].afterCleanRestack` means `false`. An optional boolean
1884
+ `[verify.<step>].afterCleanRestack` overrides it in either direction. When a
1885
+ root-targeting leaf waiting to land restacks cleanly (including a
1886
+ `[[generated]]` regeneration), opted-in steps re-run on the restacked head
1887
+ before it lands; the rest record `skipped` with
1888
+ `skipCause = "clean-restack-policy"` ("skipped by clean-restack policy").
1889
+ A failure routes through the ordinary repair loop. Opt in per step on cheap
1890
+ deterministic checks, for example `afterCleanRestack = true` in
1891
+ `[verify.lint]`: every target move under a waiting leaf re-runs them. Leaves
1892
+ targeting an integration node rely on the node's verification instead. See
1893
+ [Restacking](restacking.md#clean-restack-re-verification).
1894
+
1835
1895
 
1836
1896
  `[verify].steps` defines the configured universe and execution order. It is
1837
1897
  optional and defaults to no verify phases. Every listed name needs one matching
@@ -1889,6 +1949,20 @@ There are two strict step variants:
1889
1949
 
1890
1950
  **Constraints:** None beyond the input type.
1891
1951
 
1952
+ #### `verify.afterCleanRestack`
1953
+
1954
+ **TOML key:** `verify.afterCleanRestack`
1955
+
1956
+ - **Type:** `boolean`
1957
+ - **Default:** `false (omission is preserved)`
1958
+ - **Required:** Optional
1959
+ - **Reload:** Hot: next dispatcher action captures the accepted value. Build-owned pipeline: captured from the execution checkout each verify cycle; later base-branch edits do not replace it. Workspace provisioning applies at the next build launch. A running invocation keeps its captured values.
1960
+ - **Local override:** Committed only: set in autobuild.toml.
1961
+
1962
+ **Description:** Whether verification re-runs on the restacked head after a clean awaiting-landing restack of a root-targeting leaf, before it lands. A step override takes precedence.
1963
+
1964
+ **Constraints:** None beyond the input type.
1965
+
1892
1966
  #### `verify.<step>`
1893
1967
 
1894
1968
  **TOML key:** `verify.<step>`
@@ -1959,6 +2033,20 @@ There are two strict step variants:
1959
2033
 
1960
2034
  **Constraints:** None beyond the input type.
1961
2035
 
2036
+ #### `verify.<step>.afterCleanRestack` (kind = "check")
2037
+
2038
+ **TOML key:** `verify.<step>.afterCleanRestack`
2039
+
2040
+ - **Type:** `boolean`
2041
+ - **Default:** `omitted`
2042
+ - **Required:** Optional when kind = "check"
2043
+ - **Reload:** Hot: next dispatcher action captures the accepted value. Build-owned pipeline: captured from the execution checkout each verify cycle; later base-branch edits do not replace it. Workspace provisioning applies at the next build launch. A running invocation keeps its captured values.
2044
+ - **Local override:** Committed only: set in autobuild.toml.
2045
+
2046
+ **Description:** Step override wins over `[verify].afterCleanRestack`; true re-runs this step on the restacked head after a clean awaiting-landing restack of a root-targeting leaf, false records it skipped.
2047
+
2048
+ **Constraints:** None beyond the input type.
2049
+
1962
2050
  #### `verify.<step>.paths` (kind = "check")
1963
2051
 
1964
2052
  **TOML key:** `verify.<step>.paths`
@@ -2043,6 +2131,20 @@ There are two strict step variants:
2043
2131
 
2044
2132
  **Constraints:** None beyond the input type.
2045
2133
 
2134
+ #### `verify.<step>.afterCleanRestack` (kind = "agent")
2135
+
2136
+ **TOML key:** `verify.<step>.afterCleanRestack`
2137
+
2138
+ - **Type:** `boolean`
2139
+ - **Default:** `omitted`
2140
+ - **Required:** Optional when kind = "agent"
2141
+ - **Reload:** Hot: next dispatcher action captures the accepted value. Build-owned pipeline: captured from the execution checkout each verify cycle; later base-branch edits do not replace it. Workspace provisioning applies at the next build launch. A running invocation keeps its captured values.
2142
+ - **Local override:** Committed only: set in autobuild.toml.
2143
+
2144
+ **Description:** Step override wins over `[verify].afterCleanRestack`; true re-runs this step on the restacked head after a clean awaiting-landing restack of a root-targeting leaf, false records it skipped.
2145
+
2146
+ **Constraints:** None beyond the input type.
2147
+
2046
2148
  #### `verify.<step>.paths` (kind = "agent")
2047
2149
 
2048
2150
  **TOML key:** `verify.<step>.paths`
@@ -2172,9 +2274,10 @@ approved plan; reconciliation reuses it.
2172
2274
  If the approved selection later names any step absent from the cycle's pinned
2173
2275
  configured universe, the entire selection falls back to all configured optional
2174
2276
  steps. The kernel records one observation per cycle and plan revision naming
2175
- the unknown steps. Mandatory steps, path applicability and post-reconcile policy
2176
- still apply. A valid selection continues to skip genuinely omitted optional
2177
- steps. Strict validation when depositing a new plan is unchanged.
2277
+ the unknown steps. Mandatory steps, path applicability and post-reconcile and
2278
+ clean-restack policies still apply. A valid selection continues to skip
2279
+ genuinely omitted optional steps. Strict validation when depositing a new plan
2280
+ is unchanged.
2178
2281
 
2179
2282
  For each step the kernel evaluates approved-plan selection first, then path
2180
2283
  applicability. Exclusion by either mechanism records a queryable `skipped`
@@ -3061,7 +3164,7 @@ that defaults to `false`.
3061
3164
 
3062
3165
  While open unmerged root PRs (leaves and integration nodes; not children of a
3063
3166
  node) reach `maxOpenPrs`, the dispatcher makes no new ordinary ready-queue
3064
- claim of a `normal`-priority ticket until the count drops to `resumeOpenPrs`. Reaching `maxOpenPrs` takes
3167
+ claim of a `high`, `normal` or `low` ticket until the count drops to `resumeOpenPrs`. Reaching `maxOpenPrs` takes
3065
3168
  precedence: when `resumeOpenPrs` equals `maxOpenPrs`, intake stays paused at
3066
3169
  that count and resumes once the count falls below it. Urgent claims, in-flight
3067
3170
  builds, reconciles and landings continue; capacity is unchanged. Every `ab start`
@@ -3347,7 +3450,7 @@ status` reports the state as `capacity.backpressure`.
3347
3450
  - **Reload:** Hot: next dispatcher action captures the accepted value. A running invocation keeps its captured values.
3348
3451
  - **Local override:** Committed only: set in autobuild.toml.
3349
3452
 
3350
- **Description:** Open unmerged root build PRs (leaves and integration nodes) at which the dispatcher stops ordinary ready-queue claims of `normal`-priority tickets. In-flight work, reconciles, landings, `urgent` claims and every `ab start` (`tickets.start`) request continue, subject to capacity and repository pause. Unset disables open-PR backpressure.
3453
+ **Description:** Open unmerged root build PRs (leaves and integration nodes) at which the dispatcher stops ordinary ready-queue claims of `high`, `normal` and `low` tickets. In-flight work, reconciles, landings, `urgent` claims and every `ab start` (`tickets.start`) request continue, subject to capacity and repository pause. Unset disables open-PR backpressure.
3351
3454
 
3352
3455
  **Constraints:** safe integer; > 0
3353
3456
 
@@ -3361,7 +3464,7 @@ status` reports the state as `capacity.backpressure`.
3361
3464
  - **Reload:** Hot: next dispatcher action captures the accepted value. A running invocation keeps its captured values.
3362
3465
  - **Local override:** Committed only: set in autobuild.toml.
3363
3466
 
3364
- **Description:** Open root PR count at or below which paused `normal` intake resumes; defaults to `maxOpenPrs - 1`. Reaching `maxOpenPrs` takes precedence, so when this equals `maxOpenPrs` intake stays paused at that count and resumes once the count falls below `maxOpenPrs`. Inert without `maxOpenPrs`.
3467
+ **Description:** Open root PR count at or below which paused high, normal and low intake resumes; defaults to `maxOpenPrs - 1`. Reaching `maxOpenPrs` takes precedence, so when this equals `maxOpenPrs` intake stays paused at that count and resumes once the count falls below `maxOpenPrs`. Inert without `maxOpenPrs`.
3365
3468
 
3366
3469
  **Constraints:** safe integer; ≥ 0; Must not exceed `maxOpenPrs`.
3367
3470
 
@@ -4249,7 +4352,7 @@ build or repository catalog, or `dispatcher.lost`; a glob that matches nothing
4249
4352
  is rejected. Every error names the hook, at startup and on reload.
4250
4353
 
4251
4354
  **Default filter.** A hook without `events` receives exactly `ab watch`'s default
4252
- attention set: the build attention events, conflicted restacks, the derived
4355
+ attention set: the build attention events, the derived
4253
4356
  `build.consent-ready` and `build.merge-decision` observations, repository
4254
4357
  attention including `hook.failing`, `hook.recovered` and `hook.skipped`, the
4255
4358
  derived persistent-failure observations, and `dispatcher.lost`. Supplying
@@ -4729,8 +4832,8 @@ action. Check the gates in this order:
4729
4832
  next move, runner or not. Paused builds, builds blocked on a question once
4730
4833
  nothing is still working on them, builds waiting for a merge decision or
4731
4834
  merge gates, and builds waiting on other tickets hold none. An answered or resumed build, one whose ticket wait ended,
4732
- and one that must re-verify or reconcile reserve a slot ahead of normal
4733
- claims until admitted; urgent work goes first (see
4835
+ and one that must re-verify or reconcile reserve a slot ahead of claims at
4836
+ their level until admitted; higher levels go first (see
4734
4837
  [slot admission order](dispatcher.md#slot-admission-order)). Inspect `ab repository status`, `ab builds --queued` and
4735
4838
  `ab build status <slug>` rather than looking only for a live process.
4736
4839
  7. **Duplicate work:** a ready ticket already represented by an active build is
@@ -51,23 +51,34 @@ A ticket is claimed when it passes every gate:
51
51
  - **Blockers.** Every dependency is done.
52
52
  - **Destination.** Its target (`main` or an integration node) accepts new work.
53
53
 
54
- Others stay queued. Urgent tickets are claimed before normal ones, each in the source's order; priority never preempts a running build. With `[policy].maxOpenPrs` set, open-PR backpressure pauses new normal-priority claims while that many root PRs are open and unmerged, until the count drains to `resumeOpenPrs` (below `maxOpenPrs` when the two are equal); urgent claims and in-flight work continue. See [`[policy]`](configuration.md#policy). See [Tickets and specs](tickets.md) for grooming and [Intake and harvest](intake.md) for proposed work.
54
+ Others stay queued. Ready tickets are claimed by level, `urgent`, `high`, `normal`, then `low`, each level in the source's order; priority never preempts a running build. With `[policy].maxOpenPrs` set, open-PR backpressure pauses new claims of every ticket but urgent ones while that many root PRs are open and unmerged, until the count drains to `resumeOpenPrs` (below `maxOpenPrs` when the two are equal); urgent claims and in-flight work continue. See [`[policy]`](configuration.md#policy). See [Tickets and specs](tickets.md) for grooming and [Intake and harvest](intake.md) for proposed work.
55
55
 
56
- To start one ticket without turning intake on for the whole ready queue, run `ab start <ticket-id> [--priority manual|urgent|normal]` (or the `tickets.start` operator tool). The running dispatcher, local or hosted, claims just that ticket on its next tick with a free slot in the request's tier and records the outcome as a `ticket.start-settled` event shown by `ab watch` and `ab repository status`. The default `manual` tier goes ahead of all waiting work; `urgent` and `normal` wait their turn as described below. The ticket must still be in the ready state, meet the spec standard, have no unresolved blockers and a destination that accepts work, and is deduplicated against existing builds; capacity and repository pause still apply. Listing labels and the ready assignee are not applied, because the ticket is named. Every tier bypasses intake off and open-PR backpressure for that ticket only. See `ab help start`.
56
+ To start one ticket without turning intake on for the whole ready queue, run `ab start <ticket-id> [--priority manual|urgent|high|normal|low]` (or the `tickets.start` operator tool). The running dispatcher, local or hosted, claims just that ticket on its next tick with a free slot in the request's tier and records the outcome as a `ticket.start-settled` event shown by `ab watch` and `ab repository status`. The default `manual` tier goes ahead of all waiting work; the four level tiers wait their turn as described below. The ticket must still be in the ready state, meet the spec standard, have no unresolved blockers and a destination that accepts work, and is deduplicated against existing builds; capacity and repository pause still apply. Listing labels and the ready assignee are not applied, because the ticket is named. Every tier bypasses intake off and open-PR backpressure for that ticket only. See `ab help start`.
57
57
 
58
- Each build gets its own workspace (local git worktree or remote sandbox) and a build-runner that owns its pipeline. Capacity is the repository's number of slots. A build takes a slot only by admission (a ticket claim, a start request or an admitted slot request) and holds it while Autobuild owes its next move, runner or not: between phases, while provisioning, across a crashed runner or expired lease, while a requested pause or abort winds down, and while work it started outlasts a question: other steps of a verify stage, or a recorded launch and its execution. The dispatcher records `slot.admitted` before every such launch. It releases the slot as soon as it waits on the outside world: an open question nothing is still working past, an acknowledged pause, a merge decision or merge gates, or other tickets (`ab wait-on`). When that wait ends (an answer, a resume, a moved target, a conflicted PR, an ended ticket wait) the build holds no slot until it is admitted again, ahead of normal ticket claims. Occupancy never exceeds `capacity`. Builds without a slot keep their workspaces, so retained workspaces can exceed `capacity`. An integration node takes a slot only when admitted to verify, reconcile or propose, and holds it until that work is done; it holds none while collecting children, waiting for a repair child, or blocked. See [the integration tree](integration-overview.md). `ab builds`, `ab build status` and `ab repository status` report each build's slot state; see [Operator surfaces](operator-surfaces.md).
58
+ Each build gets its own workspace (local git worktree or remote sandbox) and a build-runner that owns its pipeline. Capacity is the repository's number of slots. A build takes a slot only by admission (a ticket claim, a start request or an admitted slot request) and holds it while Autobuild owes its next move, runner or not: between phases, while provisioning, across a crashed runner or expired lease, while a requested pause or abort winds down, and while work it started outlasts a question: other steps of a verify stage, or a recorded launch and its execution. The dispatcher records `slot.admitted` before every such launch. It releases the slot as soon as it waits on the outside world: an open question nothing is still working past, an acknowledged pause, a merge decision or merge gates, or other tickets (`ab wait-on`). When that wait ends (an answer, a resume, a moved target, a conflicted PR, an ended ticket wait) the build holds no slot until it is admitted again, ahead of ticket claims at its level. Occupancy never exceeds `capacity`. Builds without a slot keep their workspaces, so retained workspaces can exceed `capacity`. An integration node takes a slot only when admitted to verify, reconcile or propose, and holds it until that work is done; it holds none while collecting children, waiting for a repair child, or blocked. See [the integration tree](integration-overview.md). `ab builds`, `ab build status` and `ab repository status` report each build's slot state; see [Operator surfaces](operator-surfaces.md).
59
59
 
60
60
  ## Slot admission order
61
61
 
62
62
  A free slot goes, in order, to:
63
63
 
64
64
  1. `manual` start requests (`ab start`'s default);
65
- 2. urgent parked work: nodes and finished or waiting builds that must verify, reconcile, resume or propose;
66
- 3. urgent ticket claims: `ab start --priority urgent` requests, then urgent ready tickets;
67
- 4. normal parked work;
68
- 5. normal ticket claims: `ab start --priority normal` requests, then normal ready tickets.
65
+ 2. urgent waiting work, then urgent ticket claims;
66
+ 3. high waiting work, then high ticket claims;
67
+ 4. normal waiting work, then normal ticket claims;
68
+ 5. low waiting work, then low ticket claims.
69
69
 
70
- Each tier keeps its usual order, start requests oldest first. A pending start request reserves its slot ahead of the tiers below it until it settles or is cancelled. An ordinary build takes its ticket's priority when it is claimed; a build started by an `urgent` request is urgent, and `manual` never becomes a build priority. An [optimization node's attempts](optimization-nodes.md#attempts) claim at the node's current priority instead: a later `ab priority` on the node affects attempts claimed afterwards, while an already claimed attempt keeps its build priority. `ab priority <slug> urgent|normal` (or the `builds.control` action `priority`) changes an active build's priority, for example to expedite a waiting reconcile that now blocks other work; it never changes the ticket. While urgent tickets are ready, normal parked work waits for a slot until the dispatcher has offered urgent tickets the free slots that tick. An urgent ticket blocked on a dependency reserves nothing. Priority orders free slots only: it never interrupts a running build. `ab repository status`, `ab builds` and both dashboards mark urgent waiters, pending start requests by tier and urgent ticket claims waiting ahead of normal parked work.
70
+ | Term | Means |
71
+ | --- | --- |
72
+ | Waiting work | nodes and finished or waiting builds that must verify, reconcile, resume, reopen or propose |
73
+ | A level's ticket claims | `ab start --priority <level>` requests, oldest first, then that level's ready tickets in the source's order |
74
+
75
+ - **Build level.** A build takes its ticket's level. A build started by a non-`manual` request takes the request's level; `manual` never becomes a build level. A ticket with a pending non-`manual` request is claimed only by that request, at its tier, ahead of that level's ready tickets.
76
+ - **Optimization attempts.** [Attempts](optimization-nodes.md#attempts) claim at the node's current level, any of the four. A later `ab priority` on the node affects attempts claimed afterwards; an already claimed attempt keeps its level.
77
+ - **Changing a build.** `ab priority <slug> urgent|high|normal|low` (or the `builds.control` action `priority`) changes an active build's level, for example to expedite a waiting reconcile that now blocks other work, or to defer one with `low`. It never changes the ticket.
78
+ - **Reservations.** A pending start request reserves its slot ahead of the tiers below it until it settles or is cancelled. Lower-level waiting work waits while gate-passing higher-level tickets are ready, until the dispatcher has offered them the free slots that tick. A ticket blocked on a dependency reserves nothing at any level.
79
+ - **Unread start requests.** A tick reads at most eight `manual` and `urgent` requests and eight `high`, `normal` and `low` requests. While a request at a level is left unread, nothing below that level is admitted that tick, and that level's ready tickets wait too. That level's waiting work still goes first. A later tick reads the request once the requests ahead of it settle.
80
+ - **No preemption.** Priority orders free slots only: it never interrupts a running build.
81
+ - **Status.** `ab repository status`, `ab builds` and both dashboards show each waiter's level, pending start requests by tier, and higher-level ticket claims waiting ahead of lower-level waiting work.
71
82
 
72
83
 
73
84
  ## The log is the source of truth
@@ -42,7 +42,7 @@ A leaf contributes one canonical net change, however many commits it took.
42
42
 
43
43
  - **Identity.** The `Autobuild-Build: <slug>` trailer carries it across SHA rewrites. Root squash merges keep it; node integration keeps each contributing identity, in order, alongside the node's verified hand-pushed tweaks, rather than one node commit.
44
44
  - **Restacks.** When a destination moves, a leaf restacks onto it at its usual restack points; a node restacks only on demand, and each descendant node needs its own demand. Clean replay is automatic, and so is a conflict confined to files the repository declares as generated, which their declared command rebuilds. Any other conflict attaches a reconcile runner with the source change's context, then verification as required.
45
- - **Reverification.** Node verification covers the exact node head and parent; a change to either voids merge eligibility until reverified, even after a clean restack. A cleanly restacked waiting leaf can keep its prior verification; reports cite their actual head and base.
45
+ - **Reverification.** Node verification covers the exact node head and parent; a change to either voids merge eligibility until reverified, even after a clean restack. A cleanly restacked waiting leaf keeps its prior verification unless `afterCleanRestack` opts steps in for a root-targeting leaf, which re-run before it lands; reports cite their actual head and base.
46
46
 
47
47
 
48
48
  ## Blockers are a separate graph
@@ -13,7 +13,9 @@ See [restacking](restacking.md) for change identity and replay.
13
13
  Presence is checked only at claim, never to interrupt existing work. The newest
14
14
  build generation supplies evidence; ambiguous or unavailable evidence leaves the
15
15
  dependent queued. Confirmed merge SHA reachability can prove presence without
16
- a trailer, and a merged node transports its whole owned contribution. Empty
16
+ a trailer, and a merged node transports its whole owned contribution. A child
17
+ whose commit became empty and was dropped by a forge rebase merge still counts as
18
+ landed through that contribution. Empty
17
19
  completed nodes contribute nothing. Sibling work waits for merge into the common
18
20
  ancestor and demand the minimal restack path; same-node merges satisfy presence directly.
19
21
 
@@ -101,11 +103,12 @@ has commits its current parent lacks; parent-only advancement remains empty.
101
103
  A node takes a slot only by admission for runner work: `reconcile` for a
102
104
  restack conflict, `verification` for an integration cycle or a measurement, and
103
105
  `propose` for an optimization node's open proposal request. The request is
104
- durable and is admitted before normal ticket claims, urgent work first. Until
105
- the node holds its slot, intake reserves one slot for it, and the dispatcher
106
- checks its admission every tick regardless of idle node polling, so a slot
107
- freed in any tick goes to the node, not to a new normal claim. Admission counts
108
- every build that holds a slot, as every admission does.
106
+ durable and is admitted before ticket claims at its level, higher levels first. Until
107
+ the node holds its slot, intake reserves one slot for it ahead of claims at its
108
+ own level and below, and the dispatcher checks its admission every tick
109
+ regardless of idle node polling. A slot freed in any tick goes to the node, not
110
+ to a new claim at its level or below; higher-level demand can take it first.
111
+ Admission counts every build that holds a slot, as every admission does.
109
112
 
110
113
  - **Recorded before provisioning.** Admission is a durable `slot.admitted`
111
114
  fact naming the work it admitted.
@@ -122,8 +125,8 @@ every build that holds a slot, as every admission does.
122
125
  slot it needs to unblock them.
123
126
 
124
127
  Status and both dashboards report occupancy against configured capacity, and
125
- each node waiting for a slot ahead of normal ticket claims, marking urgent
126
- ones.
128
+ each node waiting for a slot ahead of ticket claims at its level, marking
129
+ urgent, high and low ones.
127
130
  Status also reports every build's slot state (`slot`, `capacity.slots`):
128
131
  an admitted node reports `held`; a node awaiting admission reports its request.
129
132
 
@@ -263,7 +266,7 @@ An optimization node follows `branch opening → starting measurement →
263
266
  (propose → collecting)*`, then completes, verifies and merges like any node.
264
267
  Once the starting value is measured, the dispatcher requests a `propose`
265
268
  session whenever the node has room within its concurrency and attempts budget.
266
- The request takes a slot ahead of normal ticket claims, like node reconcile and
269
+ The request takes a slot ahead of ticket claims at the node's level, like node reconcile and
267
270
  verification. The session runs the `ab-propose` skill on the node head, reads
268
271
  the attempt ledger and deposits proposals with `ab propose`; it never creates
269
272
  tickets. The dispatcher files each proposal as a work ticket targeting the
@@ -188,7 +188,10 @@ Node-to-GitHub-root merge uses PR rebase merge guarded on verified head after
188
188
  a final parent freshness read. Enforced up-to-date protection provides a fenced
189
189
  merge; uncertainty is recorded as unfenced and requires immutable merged-tree
190
190
  audit. A mismatch raises operator attention without rewriting the shared parent.
191
- Pending audits survive completion and retry until settled.
191
+ A verified empty child commit that the rebase merge dropped is accounted for when
192
+ the merged tree matches; a missing non-empty commit or a duplicate identity still
193
+ raises attention. Answer it with `ab answer`, which acknowledges it without
194
+ reopening the build. Pending audits survive completion and retry until settled.
192
195
 
193
196
  Root leaves land by one of three routes. Behind a real merge-blocking gate,
194
197
  Autobuild arms GitHub-native auto-merge. An authoritatively ungated root
@@ -259,7 +262,9 @@ displaced history under immutable exact archive refs
259
262
  them. Where it refuses, they keep a BuildStore copy (`history-objects-<sha>`),
260
263
  or record one `history-unretained` warning and proceed.
261
264
  - **Workspace preservation** keeps unpublished workspace commits under archive
262
- refs, else as BuildStore copies. When neither holds them, release is refused.
265
+ refs, else as BuildStore copies. When neither holds them, release is refused,
266
+ except under abort cleanup, which records `workspace.commits-lost` and
267
+ releases.
263
268
  - There is never a branch or tag fallback. When an environment refuses non-branch
264
269
  Git pushes, as Claude Code on the web's GitHub proxy does, the GitHub adapter
265
270
  creates the same archive ref through REST ref creation and confirms it by exact
package/docs/operating.md CHANGED
@@ -37,6 +37,14 @@ Agree on boundaries before the agent acts: moving a ticket to ready can start a
37
37
 
38
38
  The agent answers questions your instructions settle and escalates ambiguous goals, scope or compatibility tradeoffs, consequential or destructive choices, missing authority or access, and dispatcher trouble.
39
39
 
40
+ While it waits on you, the agent keeps operating everything else. Later updates would bury the request, so the agent repeats it, locally and over MCP alike:
41
+
42
+ - This is operator behavior, not something every agent does. It applies only to the agent holding the operator role and running the standing watch or `repository.attention` rounds, not to build sessions, spec or ticket sessions, or a one-off question.
43
+ - Every status message, whether a round summary, an outcome report or a reply, ends with a **Waiting on you** section.
44
+ - The section lists each open escalation or decision, merge awaiting your consent, question put to you, and attention it must report rather than fix, such as a forge-only merge, a missing credential or a maintainer-only dispatcher restart.
45
+ - Each item is restated in full: ticket and build, what is needed, the options and the agent's recommendation. You can act on the latest message alone. The agent checks each item against current state first, so a resolved one is never repeated from memory.
46
+ - Resolved items drop out. When nothing waits, the message ends with one line saying so, such as `Waiting on you: nothing.`
47
+
40
48
  ## Watch for attention
41
49
 
42
50
  ```
@@ -63,7 +71,9 @@ Re-arm with `bun ab watch --operator --json --since <watch-cursor>` using only
63
71
  the standing watch's own cursor. This preserves one ID and original start time
64
72
  across a presence re-arm gap of up to five minutes. This presence TTL is separate
65
73
  from hosted event-window eligibility. After termination withdraws presence,
66
- the same cursor re-registers the same ID and start time. Reconcile current and
74
+ the same cursor re-registers the same ID and start time. Settled builds drop out
75
+ of the cursor once their events are delivered, so re-arms stay proportional to
76
+ active builds. Reconcile current and
67
77
  newly dispatched builds after arming and on timeout. Keep operating after the initial work ends,
68
78
  until you end or hand off the role. `wait` does not heartbeat or carry registration
69
79
  identity: a separate unflagged diagnostic wait/watch must never replace the
@@ -140,14 +150,14 @@ Intake off only stops new ticket claims; a repository pause also holds queued bu
140
150
  bun ab priority my-build urgent
141
151
  ```
142
152
 
143
- - **`priority`** sets an active build's slot-admission priority to `urgent` or `normal` without touching its ticket. An urgent build waiting to re-verify, reconcile or resume takes the next free slot ahead of normal work; see [slot admission order](dispatcher.md#slot-admission-order). It never interrupts running work.
153
+ - **`priority`** sets an active build's slot-admission level to `urgent`, `high`, `normal` or `low` without touching its ticket. A build waiting to re-verify, reconcile or resume takes the next free slot ahead of its own level's ticket claims and all lower-level work; see [slot admission order](dispatcher.md#slot-admission-order). It never interrupts running work.
144
154
 
145
155
  ```
146
156
  bun ab start AUT-12
147
157
  bun ab start AUT-13 --priority urgent
148
158
  ```
149
159
 
150
- - **`start`** asks the running dispatcher to claim one ticket on its next tick with a free slot, even while intake is off or open-PR backpressure is engaged, and nothing else. By default (`--priority manual`) the request goes ahead of all waiting work; `--priority urgent` waits for urgent parked work and makes the build urgent, and `--priority normal` waits for normal parked work and urgent claims. Repeating the command with another priority updates the pending request. The ticket must still be ready, meet the spec standard and have no unresolved blockers; a request that cannot start settles once with its reason. `ab watch` reports the outcome and `ab repository status` lists pending requests with their priority. `--cancel` withdraws a pending request.
160
+ - **`start`** asks the running dispatcher to claim one ticket on its next tick with a free slot, even while intake is off or open-PR backpressure is engaged, and nothing else. By default (`--priority manual`) the request goes ahead of all waiting work and the build takes its ticket's level. `--priority urgent|high|normal|low` waits for waiting work at that level or above and for higher-level claims, goes ahead of that level's ready tickets, and sets the build's level. Repeating the command with another priority updates the pending request. The ticket must still be ready, meet the spec standard and have no unresolved blockers; a request that cannot start settles once with its reason. `ab watch` reports the outcome and `ab repository status` lists pending requests with their priority. `--cancel` withdraws a pending request.
151
161
 
152
162
  ## Authorize merge
153
163