@defrex/autobuild 1.8.1 → 1.10.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 (429) hide show
  1. package/README.md +3 -3
  2. package/SPEC.md +1602 -134
  3. package/bin/ab-dispatch-generation.ts +2 -0
  4. package/docs/agent-runtimes.md +30 -3
  5. package/docs/answering-blocked-builds.md +15 -7
  6. package/docs/architecture.md +320 -53
  7. package/docs/builds.md +5 -0
  8. package/docs/cli.md +7 -1
  9. package/docs/configuration-overview.md +1 -0
  10. package/docs/configuration.md +515 -49
  11. package/docs/dispatcher-hosting.md +4 -0
  12. package/docs/dispatcher.md +17 -3
  13. package/docs/forges.md +1 -1
  14. package/docs/getting-started.md +1 -1
  15. package/docs/integration-overview.md +4 -2
  16. package/docs/integration-tree.md +102 -11
  17. package/docs/merge-policy.md +70 -14
  18. package/docs/migration-1.0.md +2 -1
  19. package/docs/operating.md +53 -4
  20. package/docs/operator-api.md +128 -16
  21. package/docs/optimization-nodes.md +1042 -0
  22. package/docs/overview.md +1 -1
  23. package/docs/plugin-authoring.md +50 -13
  24. package/docs/remote-store-protocol.md +46 -7
  25. package/docs/remote-ticket-protocol.md +50 -2
  26. package/docs/restacking.md +102 -10
  27. package/docs/seams.md +2 -2
  28. package/docs/setup.md +16 -3
  29. package/docs/skills.md +4 -2
  30. package/docs/spec-standard.md +2 -1
  31. package/docs/ticket-dependencies.md +5 -0
  32. package/docs/ticket-migration.md +4 -2
  33. package/docs/ticket-sources.md +30 -12
  34. package/docs/tickets.md +15 -6
  35. package/docs/troubleshooting.md +3 -2
  36. package/docs/verification.md +18 -6
  37. package/docs/workspaces.md +3 -1
  38. package/package.json +4 -3
  39. package/packages/core/src/accounts/chatgpt-oauth.ts +7 -5
  40. package/packages/core/src/cli/attempt.ts +103 -0
  41. package/packages/core/src/cli/attention.ts +11 -1
  42. package/packages/core/src/cli/binary-direct.ts +52 -1
  43. package/packages/core/src/cli/binary.ts +5 -3
  44. package/packages/core/src/cli/build-control.ts +328 -66
  45. package/packages/core/src/cli/context.ts +268 -15
  46. package/packages/core/src/cli/dashboard/detail.ts +26 -2
  47. package/packages/core/src/cli/dashboard/facts.ts +40 -3
  48. package/packages/core/src/cli/dashboard/integration-detail.ts +7 -2
  49. package/packages/core/src/cli/dashboard/landing-display.ts +24 -3
  50. package/packages/core/src/cli/dashboard/model.ts +127 -33
  51. package/packages/core/src/cli/dashboard/objective-row.ts +189 -0
  52. package/packages/core/src/cli/dashboard/render.ts +49 -3
  53. package/packages/core/src/cli/dashboard/reopen-display.ts +39 -0
  54. package/packages/core/src/cli/dashboard/tree.ts +12 -1
  55. package/packages/core/src/cli/dispatch-frontend.ts +9 -1
  56. package/packages/core/src/cli/dispatch-launch-stop.ts +55 -0
  57. package/packages/core/src/cli/dispatch-launcher.ts +26 -44
  58. package/packages/core/src/cli/dispatch-repository-feed.ts +1 -1
  59. package/packages/core/src/cli/dispatch.ts +136 -5
  60. package/packages/core/src/cli/env.ts +42 -0
  61. package/packages/core/src/cli/help.ts +212 -11
  62. package/packages/core/src/cli/init-agent.ts +4 -1
  63. package/packages/core/src/cli/init-readiness-remote.ts +3 -2
  64. package/packages/core/src/cli/init-validation.ts +2 -2
  65. package/packages/core/src/cli/init.ts +3 -2
  66. package/packages/core/src/cli/judge-entry.ts +82 -0
  67. package/packages/core/src/cli/judge.ts +233 -0
  68. package/packages/core/src/cli/landings.ts +3 -2
  69. package/packages/core/src/cli/main.ts +412 -143
  70. package/packages/core/src/cli/measurement-text.ts +19 -0
  71. package/packages/core/src/cli/objective.ts +154 -0
  72. package/packages/core/src/cli/publication-settlement.ts +106 -22
  73. package/packages/core/src/cli/repo-lease.ts +1 -0
  74. package/packages/core/src/cli/repository-status.ts +179 -19
  75. package/packages/core/src/cli/status.ts +195 -17
  76. package/packages/core/src/cli/store-opening.ts +4 -0
  77. package/packages/core/src/cli/terminals.ts +205 -8
  78. package/packages/core/src/cli/ticket-start.ts +53 -0
  79. package/packages/core/src/cli/ticket.ts +68 -2
  80. package/packages/core/src/cli/upgrade-agent.ts +12 -8
  81. package/packages/core/src/cli/wait.ts +8 -2
  82. package/packages/core/src/cli/watch.ts +1325 -628
  83. package/packages/core/src/config/create-labels.ts +23 -0
  84. package/packages/core/src/config/live.ts +3 -0
  85. package/packages/core/src/config/load.ts +19 -0
  86. package/packages/core/src/config/pipeline-source.ts +1 -3
  87. package/packages/core/src/config/roles.ts +182 -73
  88. package/packages/core/src/config/schema.ts +226 -9
  89. package/packages/core/src/events/catalog.ts +41 -3
  90. package/packages/core/src/events/compatibility.ts +7 -1
  91. package/packages/core/src/events/payloads.ts +610 -1
  92. package/packages/core/src/events/policy.ts +62 -0
  93. package/packages/core/src/events/repository.ts +147 -21
  94. package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +1512 -199
  95. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/0ab2a90d0305dc9d.json.gz +0 -0
  96. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/10a4657408d4e121.json.gz +0 -0
  97. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/1152a2e97ee81728.json.gz +0 -0
  98. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/13ca84752c5f8b54.json.gz +0 -0
  99. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/1411d1cdbdd9911e.json.gz +0 -0
  100. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/1444fe1fa7fc802c.json.gz +0 -0
  101. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/1491ac0600349391.json.gz +0 -0
  102. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/1921f86f752428c9.json.gz +0 -0
  103. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/1972c1d66008ef6b.json.gz +0 -0
  104. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/19e8e43e7f3f1a06.json.gz +0 -0
  105. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/20a85c143c3e8164.json.gz +0 -0
  106. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/21ce2c0bf58318e1.json.gz +0 -0
  107. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/293dcb3a94fb3470.json.gz +0 -0
  108. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/2ab7436356267118.json.gz +0 -0
  109. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/2d084641735caaff.json.gz +0 -0
  110. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/3237bcecf68e5db9.json.gz +0 -0
  111. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/33d0cc593610e56f.json.gz +0 -0
  112. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/3451ed2136dcc356.json.gz +0 -0
  113. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/358ec8693f2237e6.json.gz +0 -0
  114. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/35cf9ccc4478b2d2.json.gz +0 -0
  115. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/3649e7bd1203f154.json.gz +0 -0
  116. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/378da6dece82202a.json.gz +0 -0
  117. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/38c75099d9191471.json.gz +0 -0
  118. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/398952f1f01db1a3.json.gz +0 -0
  119. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/3b64d352d56c9121.json.gz +0 -0
  120. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/3dc486226c05372d.json.gz +0 -0
  121. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/431c9bb2ee8838e0.json.gz +0 -0
  122. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/4400dffca929e2f0.json.gz +0 -0
  123. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/49064fc079964a5c.json.gz +0 -0
  124. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/4edded75f17742f4.json.gz +0 -0
  125. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/4f00c0f2c8afd159.json.gz +0 -0
  126. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/516a5a7aadf97587.json.gz +0 -0
  127. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/516dc6ea85d67cd7.json.gz +0 -0
  128. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/584e2ba74608e051.json.gz +0 -0
  129. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/59ffaa6974094c72.json.gz +0 -0
  130. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/5bb43afb121674c6.json.gz +0 -0
  131. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/5f0ca42af862c4ee.json.gz +0 -0
  132. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/6118031132db9bfc.json.gz +0 -0
  133. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/63107a8d58776b63.json.gz +0 -0
  134. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/63546b08d4d6fa11.json.gz +0 -0
  135. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/643d70429ce03dad.json.gz +0 -0
  136. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/677ea92572c29082.json.gz +0 -0
  137. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/6ae5bf60504d6467.json.gz +0 -0
  138. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/6efdc8defc75fccb.json.gz +0 -0
  139. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/71c53d33f09d8204.json.gz +0 -0
  140. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/7267ca2757cffba7.json.gz +0 -0
  141. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/76b7d4244082b3f9.json.gz +0 -0
  142. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/7749f918c6f10968.json.gz +0 -0
  143. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/7833e42d16301424.json.gz +0 -0
  144. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/7d4edad0614adaf1.json.gz +0 -0
  145. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/837365898d04f45a.json.gz +0 -0
  146. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/85f9f0c921b8b5bb.json.gz +0 -0
  147. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/8879f57a24733897.json.gz +0 -0
  148. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/88cb9e71bdec972d.json.gz +0 -0
  149. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/8a0cd6dd06cc155e.json.gz +0 -0
  150. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/8aa9ca8609dc051d.json.gz +0 -0
  151. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/8c8640255bd61658.json.gz +0 -0
  152. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/8cc15eb1807c0157.json.gz +0 -0
  153. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/8ced97c44bc0af3a.json.gz +0 -0
  154. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/8d4144004720b9f8.json.gz +0 -0
  155. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/8db633ead1807f8b.json.gz +0 -0
  156. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/8e42cdbd0994ab0c.json.gz +0 -0
  157. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/9011d0f6ff955ef9.json.gz +0 -0
  158. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/916ebc5433801c41.json.gz +0 -0
  159. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/9539b995af5c54a9.json.gz +0 -0
  160. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/95f391bfd7b7dbd7.json.gz +0 -0
  161. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/9613e8fa568a9281.json.gz +0 -0
  162. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/9a68f8753bd9038d.json.gz +0 -0
  163. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/9b25e58227080094.json.gz +0 -0
  164. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/9ee3919fbd4f9458.json.gz +0 -0
  165. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/a04a34cc2717147b.json.gz +0 -0
  166. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/a0b32c12e4e6edb6.json.gz +0 -0
  167. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/a55218252707bdd3.json.gz +0 -0
  168. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/a732fd08b31522a6.json.gz +0 -0
  169. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/a9d206a01f9039e5.json.gz +0 -0
  170. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/abf7fe3c92c82f2d.json.gz +0 -0
  171. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/ac928b04842c00db.json.gz +0 -0
  172. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/af953392d81911da.json.gz +0 -0
  173. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/b0d877c44810ecb0.json.gz +0 -0
  174. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/b0f7c6ebb2db57fc.json.gz +0 -0
  175. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/b905c22ec17eed31.json.gz +0 -0
  176. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/bce0c54e865f4b79.json.gz +0 -0
  177. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/c68b7ee2e2610f30.json.gz +0 -0
  178. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/c7f7e0378aeea237.json.gz +0 -0
  179. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/c98cb1659eb142b6.json.gz +0 -0
  180. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/ca830adf06ed55a1.json.gz +0 -0
  181. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/cb3a219f33e437ca.json.gz +0 -0
  182. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/cf1e0c0d82567e0c.json.gz +0 -0
  183. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/d008d86d9ff77b30.json.gz +0 -0
  184. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/d1432a819d8e48c5.json.gz +0 -0
  185. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/d185ed6aa9192aff.json.gz +0 -0
  186. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/d873fad29d6c7e55.json.gz +0 -0
  187. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/db84b12316e2da4a.json.gz +0 -0
  188. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/ddf6dc967d898767.json.gz +0 -0
  189. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/dfc64de6e7bfc0a0.json.gz +0 -0
  190. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/e2f18fa32fe1f6d0.json.gz +0 -0
  191. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/e37393fed29e84c5.json.gz +0 -0
  192. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/e6a8585e2a054ff6.json.gz +0 -0
  193. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/e7e9e327baca6903.json.gz +0 -0
  194. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/e86447af0571672c.json.gz +0 -0
  195. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/ea819202d22122e5.json.gz +0 -0
  196. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/eb4535585f2e84f6.json.gz +0 -0
  197. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/eb7ddd5319d09e27.json.gz +0 -0
  198. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/eca4959b2b87ae15.json.gz +0 -0
  199. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/ee10d7959ec4843c.json.gz +0 -0
  200. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/ef1b68347966ab26.json.gz +0 -0
  201. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/f3e55425cc41f230.json.gz +0 -0
  202. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/f40042c1cdb9fd43.json.gz +0 -0
  203. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/f48466215c790a3f.json.gz +0 -0
  204. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/f5b9ace9b59351e7.json.gz +0 -0
  205. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/fa8f1475a55be935.json.gz +0 -0
  206. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/fb21116a15d0b1f1.json.gz +0 -0
  207. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/fe95444fbeabe592.json.gz +0 -0
  208. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/09bf0a1611d07363.json +984 -0
  209. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/10eac4988d66e161.json +1067 -0
  210. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/1a436b5fb45aee3e.json +1116 -0
  211. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/249db6f7a41f90e2.json +161 -0
  212. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/25dcb2fb6eaa83f4.json +858 -0
  213. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/2e1bdc763924616f.json +4932 -0
  214. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/30e9dabce3c4263d.json +399 -0
  215. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/4898ef339c68fa36.json +83 -0
  216. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/51816c0ffa62af6e.json +417 -0
  217. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/561bf45320062a44.json +83 -0
  218. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/5672d0233085d050.json +84 -0
  219. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/5e39f42cbdbf35ef.json +163 -0
  220. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/7771a7a2250f9964.json +868 -0
  221. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/881c491321bec99a.json +1074 -0
  222. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/965f25c3af1d2cdc.json +160 -0
  223. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/9b76d89da575ca90.json +20 -0
  224. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/9eb485320a72a9ff.json +233 -0
  225. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/a60448c01016135e.json +18 -0
  226. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/a6584fb61b6679bd.json +97 -0
  227. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/c88365c25b3186d3.json +543 -0
  228. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/e8f0481b23f90056.json +711 -0
  229. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/ee55782ed40ebbac.json +110 -0
  230. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/fc5082fac8167f3d.json +98 -0
  231. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/fd55c329cfe921cc.json +1069 -0
  232. package/packages/core/src/kernel/attempt-creation-key.ts +20 -0
  233. package/packages/core/src/kernel/attempt-settlement.ts +125 -0
  234. package/packages/core/src/kernel/auto-merge-default.ts +1 -3
  235. package/packages/core/src/kernel/auto-merge.ts +34 -3
  236. package/packages/core/src/kernel/dispatch-capacity.ts +312 -38
  237. package/packages/core/src/kernel/dispatch-placement.ts +1 -1
  238. package/packages/core/src/kernel/dispatch-settings.ts +1 -4
  239. package/packages/core/src/kernel/dispatch-status.ts +3 -5
  240. package/packages/core/src/kernel/dispatch-upgrade.ts +1 -1
  241. package/packages/core/src/kernel/engine.ts +109 -13
  242. package/packages/core/src/kernel/forge-checks.ts +140 -0
  243. package/packages/core/src/kernel/forge-health.ts +2 -2
  244. package/packages/core/src/kernel/generated-files.ts +43 -0
  245. package/packages/core/src/kernel/generated-regeneration.ts +254 -0
  246. package/packages/core/src/kernel/generators/build-log.ts +30 -2
  247. package/packages/core/src/kernel/generators/optimization-log.ts +578 -0
  248. package/packages/core/src/kernel/generators/panel-log.ts +133 -0
  249. package/packages/core/src/kernel/generators/repository-journals.ts +18 -0
  250. package/packages/core/src/kernel/guarded-forge.ts +76 -11
  251. package/packages/core/src/kernel/harvest.ts +1 -4
  252. package/packages/core/src/kernel/head-paths.ts +4 -1
  253. package/packages/core/src/kernel/history-retention.ts +337 -0
  254. package/packages/core/src/kernel/incremental-fixtures.ts +6 -0
  255. package/packages/core/src/kernel/incremental.ts +14 -4
  256. package/packages/core/src/kernel/integration-landing.ts +64 -13
  257. package/packages/core/src/kernel/integration-stack.ts +123 -20
  258. package/packages/core/src/kernel/integration-state.ts +39 -2
  259. package/packages/core/src/kernel/janitor-failure.ts +2 -0
  260. package/packages/core/src/kernel/kernel-git.ts +1 -1
  261. package/packages/core/src/kernel/landing-measurement.ts +275 -0
  262. package/packages/core/src/kernel/landing-readiness.ts +2 -0
  263. package/packages/core/src/kernel/landing-state.ts +76 -1
  264. package/packages/core/src/kernel/leaf-restack-state.ts +17 -1
  265. package/packages/core/src/kernel/log-index-value.ts +2 -0
  266. package/packages/core/src/kernel/log-index.ts +81 -3
  267. package/packages/core/src/kernel/measurement.ts +406 -0
  268. package/packages/core/src/kernel/mixed-version.ts +6 -3
  269. package/packages/core/src/kernel/node-landing.ts +92 -18
  270. package/packages/core/src/kernel/node-restack-state.ts +27 -1
  271. package/packages/core/src/kernel/node-restack-transaction.ts +80 -23
  272. package/packages/core/src/kernel/node-verification-context.ts +14 -4
  273. package/packages/core/src/kernel/open-pr-backpressure-state.ts +24 -0
  274. package/packages/core/src/kernel/open-pr-backpressure.ts +133 -0
  275. package/packages/core/src/kernel/optimization-admission.ts +249 -0
  276. package/packages/core/src/kernel/optimization.ts +774 -0
  277. package/packages/core/src/kernel/panel.ts +225 -0
  278. package/packages/core/src/kernel/phases.ts +42 -6
  279. package/packages/core/src/kernel/pr-attachments.ts +4 -16
  280. package/packages/core/src/kernel/pr-summary.ts +2 -2
  281. package/packages/core/src/kernel/read-deferrals.ts +2 -2
  282. package/packages/core/src/kernel/read-facts.ts +69 -31
  283. package/packages/core/src/kernel/reconcile-restack.ts +352 -103
  284. package/packages/core/src/kernel/reducer-identity.ts +659 -0
  285. package/packages/core/src/kernel/reducer-registry.ts +37 -3
  286. package/packages/core/src/kernel/reducer-revisions.ts +50 -0
  287. package/packages/core/src/kernel/reducer.ts +208 -9
  288. package/packages/core/src/kernel/reopen-state.ts +48 -0
  289. package/packages/core/src/kernel/reopen.ts +143 -0
  290. package/packages/core/src/kernel/replay-retention.ts +208 -39
  291. package/packages/core/src/kernel/repository-attention.ts +1 -1
  292. package/packages/core/src/kernel/service-facts.ts +19 -7
  293. package/packages/core/src/kernel/terminal-guard.ts +13 -5
  294. package/packages/core/src/kernel/ticket-handbacks.ts +1 -1
  295. package/packages/core/src/kernel/ticket-migrations.ts +1 -1
  296. package/packages/core/src/kernel/ticket-preparation.ts +1 -1
  297. package/packages/core/src/kernel/ticket-source-health.ts +1 -1
  298. package/packages/core/src/kernel/ticket-starts.ts +118 -0
  299. package/packages/core/src/kernel/ticket-wait.ts +37 -2
  300. package/packages/core/src/kernel/verify-diff-base.ts +62 -0
  301. package/packages/core/src/kernel/verify-stage-state.ts +1 -0
  302. package/packages/core/src/kernel/verify-stages.ts +41 -1
  303. package/packages/core/src/objective.ts +532 -0
  304. package/packages/core/src/ontology.ts +49 -6
  305. package/packages/core/src/operator/annotations.ts +35 -4
  306. package/packages/core/src/operator/control.ts +2 -1
  307. package/packages/core/src/operator/index.ts +12 -0
  308. package/packages/core/src/operator/optimization.ts +307 -0
  309. package/packages/core/src/operator/protocol.ts +30 -1
  310. package/packages/core/src/operator/query.ts +15 -1
  311. package/packages/core/src/operator/registry.ts +219 -13
  312. package/packages/core/src/operator/requests.ts +25 -2
  313. package/packages/core/src/operator/ticket-start.ts +152 -0
  314. package/packages/core/src/operator/tickets.ts +3 -2
  315. package/packages/core/src/plugin-sdk/index.ts +9 -1
  316. package/packages/core/src/plugins/registry.ts +1 -0
  317. package/packages/core/src/ports/forge/contract.ts +9 -0
  318. package/packages/core/src/ports/forge/fake.ts +151 -10
  319. package/packages/core/src/ports/forge/git-rewrite.ts +38 -5
  320. package/packages/core/src/ports/forge/github-readiness.ts +1 -1
  321. package/packages/core/src/ports/forge/github-squash-message.ts +89 -0
  322. package/packages/core/src/ports/forge/github-transport.ts +186 -1
  323. package/packages/core/src/ports/forge/github.ts +846 -239
  324. package/packages/core/src/ports/forge/readiness.ts +15 -3
  325. package/packages/core/src/ports/forge-failure.ts +22 -0
  326. package/packages/core/src/ports/forge-request-context.ts +23 -1
  327. package/packages/core/src/ports/forge-telemetry.ts +16 -0
  328. package/packages/core/src/ports/runner/antigravity.ts +1071 -0
  329. package/packages/core/src/ports/runner/claude.ts +6 -1
  330. package/packages/core/src/ports/runner/codex.ts +11 -2
  331. package/packages/core/src/ports/runner/contract.ts +25 -1
  332. package/packages/core/src/ports/runner/fake.ts +2 -2
  333. package/packages/core/src/ports/runner/native-cli-fixture.ts +40 -5
  334. package/packages/core/src/ports/runner/native-process-fixture.ts +4 -1
  335. package/packages/core/src/ports/runner/pi.ts +23 -7
  336. package/packages/core/src/ports/runner/production.ts +19 -2
  337. package/packages/core/src/ports/runner/session-env.ts +65 -5
  338. package/packages/core/src/ports/runner/start-prompt.ts +6 -4
  339. package/packages/core/src/ports/tickets/contract.ts +4 -2
  340. package/packages/core/src/ports/tickets/github.ts +20 -5
  341. package/packages/core/src/ports/tickets/hosted-index.ts +6 -1
  342. package/packages/core/src/ports/tickets/labels.ts +21 -0
  343. package/packages/core/src/ports/tickets/linear.ts +33 -0
  344. package/packages/core/src/ports/tickets/migration.ts +2 -0
  345. package/packages/core/src/ports/tickets/priority.ts +11 -0
  346. package/packages/core/src/ports/tickets/remote-protocol.ts +71 -6
  347. package/packages/core/src/ports/tickets/remote.ts +138 -16
  348. package/packages/core/src/ports/tickets/tree.ts +17 -4
  349. package/packages/core/src/ports/types.ts +145 -7
  350. package/packages/core/src/ports/workspace/builtin-capabilities.ts +7 -4
  351. package/packages/core/src/ports/workspace/commit-preservation.ts +182 -64
  352. package/packages/core/src/ports/workspace/create.ts +3 -0
  353. package/packages/core/src/ports/workspace/git-worktree.ts +13 -1
  354. package/packages/core/src/ports/workspace/vercel-sandbox.ts +242 -61
  355. package/packages/core/src/processes/build-execution-state.ts +5 -6
  356. package/packages/core/src/processes/build-runner.ts +1435 -132
  357. package/packages/core/src/processes/dispatch-failure-budget.ts +1 -1
  358. package/packages/core/src/processes/dispatcher-selectors.ts +15 -13
  359. package/packages/core/src/processes/dispatcher.ts +2874 -266
  360. package/packages/core/src/processes/execution-no-progress.ts +38 -1
  361. package/packages/core/src/processes/execution-settlement.ts +2 -6
  362. package/packages/core/src/processes/harvest-execution-state.ts +2 -6
  363. package/packages/core/src/processes/harvest-runner.ts +7 -2
  364. package/packages/core/src/processes/hook-command.ts +125 -0
  365. package/packages/core/src/processes/hook-webhook.ts +144 -0
  366. package/packages/core/src/processes/hooks.ts +740 -0
  367. package/packages/core/src/processes/infrastructure-failure-budget.ts +1 -3
  368. package/packages/core/src/processes/judge-launcher.ts +38 -0
  369. package/packages/core/src/processes/measurement-runner.ts +235 -0
  370. package/packages/core/src/processes/optimization-merges.ts +101 -0
  371. package/packages/core/src/processes/optimization-stop.ts +179 -0
  372. package/packages/core/src/processes/panel-runner.ts +756 -0
  373. package/packages/core/src/processes/phase-failure-budget.ts +1 -0
  374. package/packages/core/src/processes/publication-state.ts +1 -4
  375. package/packages/core/src/processes/repo-view.ts +77 -5
  376. package/packages/core/src/processes/sandbox-state.ts +1 -4
  377. package/packages/core/src/processes/tick-state.ts +1 -3
  378. package/packages/core/src/processes/workspace-preservation.ts +67 -9
  379. package/packages/core/src/scenarios/harness.ts +19 -8
  380. package/packages/core/src/store/contract.ts +72 -0
  381. package/packages/core/src/store/digest.ts +89 -7
  382. package/packages/core/src/store/judge-authority.ts +161 -0
  383. package/packages/core/src/store/phase-session.ts +226 -4
  384. package/packages/core/src/store/reduced-reads.ts +10 -0
  385. package/packages/core/src/store/reducer-value-shapes.json +17254 -11861
  386. package/packages/core/src/store/remote/client.ts +12 -2
  387. package/packages/core/src/store/remote/credentials.ts +31 -1
  388. package/packages/core/src/store/remote/index.ts +8 -0
  389. package/packages/core/src/store/remote/protocol.ts +38 -0
  390. package/packages/core/src/store/remote/released-clients.json +22 -0
  391. package/packages/core/src/store/remote/released-reducer-values/1.10.0.json +34439 -0
  392. package/packages/core/src/store/remote/released-reducer-values/1.9.0.json +29475 -0
  393. package/packages/core/src/store/remote/released-reducer-values/index.ts +18 -14
  394. package/packages/core/src/store/remote/token.ts +13 -4
  395. package/packages/core/src/store/repo-state-events.ts +9 -8
  396. package/packages/core/src/store/retention.ts +16 -2
  397. package/packages/core/src/store/session-reducer.ts +1 -4
  398. package/packages/core/src/store/ticket-assets.ts +1 -3
  399. package/packages/core/src/store/types.ts +9 -0
  400. package/packages/core/src/testing/dispatch-read-budget.ts +70 -0
  401. package/packages/core/src/testing/git-config-isolation.ts +25 -0
  402. package/packages/core/src/testing/index.ts +14 -0
  403. package/packages/core/src/testing/reduced-read-budget.ts +3950 -54
  404. package/skills/code-review/SKILL.md +16 -0
  405. package/skills/finalize/SKILL.md +10 -4
  406. package/skills/guide/SKILL.md +464 -83
  407. package/skills/guide/references/integration-tree.md +102 -11
  408. package/skills/guide/references/merge-policy.md +70 -14
  409. package/skills/guide/references/migration-1.0.md +2 -1
  410. package/skills/guide/references/operator-api.md +128 -16
  411. package/skills/guide/references/optimization-nodes.md +1042 -0
  412. package/skills/guide/references/plugin-authoring.md +50 -13
  413. package/skills/guide/references/remote-store-protocol.md +46 -7
  414. package/skills/guide/references/remote-ticket-protocol.md +50 -2
  415. package/skills/guide/references/restacking.md +102 -10
  416. package/skills/guide/references/setup.md +16 -3
  417. package/skills/guide/references/spec-standard.md +2 -1
  418. package/skills/guide/references/ticket-dependencies.md +5 -0
  419. package/skills/guide/references/ticket-migration.md +4 -2
  420. package/skills/implement/SKILL.md +51 -1
  421. package/skills/judge/SKILL.md +43 -0
  422. package/skills/operate/SKILL.md +267 -32
  423. package/skills/plan/SKILL.md +18 -0
  424. package/skills/plan-review/SKILL.md +15 -1
  425. package/skills/propose/SKILL.md +121 -0
  426. package/skills/reconcile/SKILL.md +21 -2
  427. package/skills/spec/SKILL.md +30 -4
  428. package/skills/tickets/SKILL.md +44 -5
  429. package/templates/hosted-service/package.json +2 -2
package/SPEC.md CHANGED
@@ -61,8 +61,13 @@ every design decision below answers to:
61
61
  Triage without a human grooming it to Ready. That single gate is where
62
62
  taste and prioritization live. A repository may waive the gate for its own
63
63
  harvest by naming a filing state (`[tickets].proposalState`, §12); the
64
- waiver is explicit, repository-wide, and configured, and no code path
65
- reaches Ready without one.
64
+ waiver is explicit, repository-wide, and configured. The one other path
65
+ is an optimization node's attempts (§13.1.1): grooming the node's
66
+ objective, its purpose, budget and stop policy, is the dispatch decision
67
+ for every attempt it generates. The node's proposer files attempts
68
+ straight to Ready, bounded by that budget, and each must pass the ratchet
69
+ before it affects anything. No other generated work reaches Ready without
70
+ the waiver.
66
71
  4. **Every step leaves a paper trail** — queryable, not carried in the repo.
67
72
  5. **Processes communicate only through durable state.** There is no private
68
73
  channel between Autobuild processes — not kernel to operator UI, not parent
@@ -88,7 +93,7 @@ Interfaces to the world, each with swappable adapters:
88
93
  | Port | Duty | Initial adapters |
89
94
  |---|---|---|
90
95
  | `TicketSource` | list/claim/comment/transition/create/update tickets; add, remove, and resolve declared dependencies | file-based (default directory); Linear; hosted; GitHub Issues; third-party in-process registrations |
91
- | `AgentRunner` | run agent sessions (see §9) | Claude Code CLI (headless); Codex CLI (`exec --json`); local pi CLI (`--mode rpc`, minimum 0.84.3); third-party in-process registrations |
96
+ | `AgentRunner` | run agent sessions (see §9) | Claude Code CLI (headless); Codex CLI (`exec --json`); local pi CLI (`--mode rpc`, minimum 0.84.3); Antigravity CLI (`agy -p --output-format stream-json`); third-party in-process registrations |
92
97
  | `Workspace` | provision isolated working copies | git worktree; third-party in-process registrations; later remote sandbox |
93
98
  | `Forge` | git + PR plumbing | GitHub; local Git; third-party in-process registrations |
94
99
  | `TelemetrySource` | production signals | Sentry; later log streams |
@@ -184,12 +189,17 @@ environment-only.
184
189
 
185
190
  Forge readiness is an optional read-only port capability, inspected on the host
186
191
  by init validation and once at dispatch startup after repository lease acquisition.
187
- It reports squash/rebase merge methods and kernel build/node/archive publication
188
- permissions as hard requirements, and protected-target linear history and root
189
- freshness as recommendations. Results are pass, fail, or unknown; incomplete
192
+ It reports squash/rebase merge methods and kernel build/node publication
193
+ permissions as hard requirements, and archive-ref publication, protected-target
194
+ linear history and root freshness as recommendations. Archive refs are optional
195
+ forge-side backup of displaced leaf and node history and of unpublished
196
+ workspace commits: where the forge refuses them, rewrites and node writes keep a
197
+ BuildStore copy or warn and proceed, and workspace preservation keeps a
198
+ BuildStore copy or refuses the release (§15.7). Results are pass, fail, or unknown; incomplete
190
199
  inspection never proves permission. Local Git passes trivially; legacy plugins
191
200
  report unknown. Known hard failures fail init validation and produce one durable
192
- `dispatcher.forge-readiness-failed` repository fact per run/check. They do not
201
+ `dispatcher.forge-readiness-failed` repository fact per run/check; historical
202
+ facts naming `archive-refs` still decode. They do not
193
203
  add a dispatch admission gate. Repository attention watches (`ab watch`), dashboard
194
204
  warnings, and operator queries expose all failures and remediation for the run;
195
205
  `ab wait` remains build-only. No setting is changed and no probe ref is pushed.
@@ -303,7 +313,9 @@ cached answers too. Legacy peers remain functional with full reads.
303
313
  The launcher observes presentation stop/continue liveness so Ctrl-Z returns the
304
314
  shell prompt and `fg` resumes only the presentation; the kernel keeps running.
305
315
  Terminal restoration by the launcher is a fallback for abnormal termination,
306
- never a second alternate-screen exit after a clean generation stop.
316
+ never a second alternate-screen exit after a clean generation stop. A
317
+ generation that exits from the stop signal the launcher itself received is a
318
+ clean stop, and in `--plain` mode the launcher restores no terminal mode.
307
319
  Automatic upgrades default on (`[upgrade] automatic = true`). The resident
308
320
  kernel checks immediately and every 60 seconds independently of dispatch ticks.
309
321
  It resolves the root manifest and Bun lock from a single authoritative base
@@ -534,6 +546,79 @@ clock is therefore consulted only once that window ends, at most one scan
534
546
  interval after the recorded measurement; the dispatcher then treats it as a
535
547
  clock rollback, rescans, and resets the cache to the current clock.
536
548
 
549
+ **Single-ticket start requests.** An operator can ask the running dispatcher,
550
+ local or hosted, to start one named ticket whether or not intake is on:
551
+ `ab start <ticket-id> [--priority manual|urgent|normal]`, the operator tool
552
+ `tickets.start {priority?}`, or HTTP `POST …/tickets/{id}/start` with an
553
+ optional `{priority}` body. The priority is the request's slot-admission tier
554
+ (§12 "Slot admission order") and defaults to `manual`. The request
555
+ canonicalizes the id through the configured source's `get` (refusing an
556
+ unknown ticket) and appends one human-attributed repository
557
+ `ticket.start-requested {ticket, priority}` naming the canonical ref. A pending
558
+ request with the same priority makes it a no-op; one with another priority is
559
+ updated by the new event, keeping the first request's sequence, so settlement
560
+ and cancellation still name one request. `ab start --cancel`
561
+ (`tickets.start {cancel: true}`, `POST …/tickets/{id}/start/cancel`), which
562
+ takes no priority, appends
563
+ `ticket.start-cancelled` for the pending request, and nothing when none is
564
+ pending. A reduced `ticketStarts` part of the repository read facts holds the
565
+ pending requests and the eight most recent settlements; a settlement or
566
+ cancellation applies only to the request sequence it names.
567
+
568
+ Each tick evaluates pending requests in two passes, at most eight per pass,
569
+ each in tier order and then oldest first, and claims nothing else for them:
570
+ `manual` and `urgent` requests after node admission and before ordinary
571
+ intake, and `normal` requests after ordinary intake and the deferred normal
572
+ parked admissions, so that urgent claims and normal parked work found in the
573
+ same tick go first. Each request belongs to one pass. With none pending a pass
574
+ reads nothing; otherwise it makes one targeted `get` per request. Every tier
575
+ bypasses intake off, and open-PR backpressure, without enabling intake for any
576
+ other ticket. A request whose ticket has an active build settles
577
+ `started` when that build was created after the request (its own claim whose
578
+ settlement was lost) and `already-building` otherwise; a ticket outside the
579
+ configured ready state settles `terminal` when it is done, resolved or rejected
580
+ and `not-ready` otherwise; a missing ticket settles `missing`. Dispatch labels
581
+ and the ready assignee are not applied, because the operator named the ticket.
582
+ The rest is admitted through the ordinary dispatch path in a targeted mode that
583
+ skips the ready listing, the scan checkpoint and the standing queue report but
584
+ keeps every gate: creation holds, profile conflicts, node targets, dependency
585
+ verdicts, the spec-standard quality gate and its bounce, the claim and its
586
+ preparation journal, capacity, repository pause, accounts and forge health.
587
+ A claimed build's priority (§13) is `urgent` when the request's priority was
588
+ `urgent`, even on a source without the priority capability, and otherwise its
589
+ ticket's own; `manual` is admission-only and never a build priority.
590
+ Outcomes are `started` with the slug, `invalid` for a bounce (with the missing
591
+ parts) or a profile conflict, `blocked` for unresolved blockers or an
592
+ unavailable target, and `claim-refused` for a refused claim. A pause, no free
593
+ slot, a creation hold, an in-flight preparation, a failed dependency read, a
594
+ ticket-source error or the tick budget leaves the request pending for the next
595
+ tick. Each settlement is one dispatcher `ticket.start-settled` carrying the
596
+ request's priority, after a journal refresh confirms the request is still
597
+ pending, and it is default watch attention. There is no force: capacity is
598
+ respected and nothing is preempted.
599
+ The claim itself proceeds only after a journal refresh confirms the request is
600
+ still pending, so a cancellation that lands while a pass is reading the ticket
601
+ prevents it. The stage measures capacity, for a wait and for an admission
602
+ alike, from the build facts the same tick's janitor, dispatch recovery, lease
603
+ sweep and mixed-version deferral check have already read, and the stage's own
604
+ deferral checks serve those reads too. A build is read again only when the tick skipped it,
605
+ or wrote to it after reading it, unless it is a leaf provisioning a runner,
606
+ which holds its slot whatever its state. So a pending request adds no per-build
607
+ read on a fresh dispatcher process or a long-lived one, and a write by another
608
+ process during the tick is seen on the next tick, as it is by intake. The
609
+ admission pass runs when that measurement shows a free slot in a request's
610
+ tier, or for a node or a blocked target not yet checked. A claim spends only
611
+ its own tier's slot: lower tiers already reserved it while it was pending.
612
+
613
+ Hosted active builds may record a legacy ticket alias. While a request is
614
+ pending, the dispatcher resolves the canonical identity of each active hosted
615
+ build without one, at most 16 per tick, and saves it durably in an advisory
616
+ `ticket.identity-recorded`, which also releases builds that are no longer
617
+ active. Each build is resolved once in its life. Matching is then a
618
+ case-insensitive comparison over recorded and projected identities with no
619
+ source read, and a hosted request is neither admitted nor settled as building
620
+ until every active hosted build has an identity.
621
+
537
622
 
538
623
  ### 3.4 The event log spine
539
624
 
@@ -620,12 +705,31 @@ the bare phase names throughout.
620
705
 
621
706
  Work builds retain the fixed grammar below. Integration builds instead follow
622
707
  `spec → branch opening → collecting → complete → verify:* → authorization → merge → close`.
708
+ An optimization node (§13.1.1) follows
709
+ `spec → branch opening → starting measurement → (propose → collecting)* → complete → verify:* → authorization → merge → close`;
710
+ a plain node keeps the plain grammar.
623
711
  Authorization follows ordered merge policy: nodes default to explicit consent,
624
712
  while an auto rule authorizes a complete, verified candidate without a command.
625
- They never enter plan, implement, code-review or finalize. A node conflict uses
713
+ Nodes never enter plan, implement, code-review or finalize; they enter
714
+ reconcile, and optimization nodes also enter `propose`. A node conflict uses
626
715
  source-aware reconcile. Idle collecting nodes own no execution resources;
627
- reconcile and verification use descendant-sensitive execution capacity (§12).
628
- Empty nodes have no PR.
716
+ reconcile, verification and propose use descendant-sensitive execution
717
+ capacity (§12). Empty nodes have no PR.
718
+
719
+ The **propose** phase is an optimization node's own agent phase. The
720
+ dispatcher requests it (`optimization.proposal-requested`) only when the node
721
+ is open with an accepted objective, has not stopped, has a starting
722
+ measurement under the current ruler, has no open request, and has fewer than
723
+ two consecutive empty proposals, and when its room is positive. Room is the
724
+ smaller of the free concurrency slots (`proposer.concurrency` minus attempts
725
+ queued or running) and the remaining attempts budget, and is zero once the
726
+ attempts or hours budget is spent. A paused, blocked or otherwise held node
727
+ is deferred instead. The request takes a slot ahead of normal ticket claims,
728
+ like node reconcile and verification (§12 "Slot admission order"), and is re-checked against current state
729
+ before it is admitted. The session runs the `ab-propose` skill on the node
730
+ head's tree and ends with `ab propose <file>`, `ab propose --none <reason>` or
731
+ `ab escalate`; `ab done` and `ab verdict` are refused. The proposer only
732
+ deposits proposals: the dispatcher files each as an attempt ticket (§13.1.1).
629
733
 
630
734
  ```
631
735
  spec → plan ⇄ plan-review → implement ⇄ code-review → verify:* → finalize (+ finalize:*)
@@ -708,13 +812,16 @@ This is kernel work within the fixed grammar, not another phase. A verify failur
708
812
  returns to implementation; its new commits append to the canonical change, and
709
813
  the next approved cycle collapses and restacks again. A build resuming from a
710
814
  ticket wait (§11 "Ticket waits") first restacks onto the target's current head
711
- when the target moved, so the resumed phase sees the merged blockers. While
815
+ when the target moved, so the resumed phase sees the merged blockers. When the
816
+ wait was declared in `verify:*` or `finalize`, a clean wait-resume restack opens
817
+ a new verification cycle: verification re-runs from the first step on the
818
+ restacked base, and earlier results satisfy neither finalize nor landing. While
712
819
  waiting to merge after finalize and its post-steps, an observed target move
713
820
  also schedules a restack.
714
821
  For a node-targeted leaf, published finalize-step commits also schedule one
715
822
  waiting restack, even when the target SHA is unchanged, so guarded merge
716
823
  preserves one canonical build identity.
717
- Clean waiting restacks retain existing verification when build-owned config is
824
+ Clean awaiting-merge restacks retain existing verification when build-owned config is
718
825
  unchanged (§16.1), including when replay replaces the pin commit's ancestry.
719
826
  Conflicts use reconcile and its captured post-reconcile policy. A conflict before initial verification,
720
827
  including one at a wait resume, cannot skip initial checks through that policy.
@@ -775,7 +882,8 @@ to configured Ready under the dispatcher's preparation recovery contract
775
882
  are recorded once and never renamed.
776
883
 
777
884
  **Immutability:** the spec cannot change during a build except through the
778
- explicit operator revision protocol (leaf escalation or the node exception below). Every downstream reviewer approves
885
+ explicit operator revision protocol (leaf escalation, a settled leaf's reopen
886
+ (§15.7), or the node exception below). Every downstream reviewer approves
779
887
  conformance *to it*; a drifting spec silently converts approvals into
780
888
  approvals-of-something-else. A phase discovering the spec itself is wrong
781
889
  raises an `escalation`; the operator agent or a human answers with
@@ -802,7 +910,8 @@ pending controls, merge intent and ended PRs refuse the no-escalation path.
802
910
  A concurrent state change refuses publication with a retry explanation;
803
911
  uncited artifacts are inert. Leaves still require an open escalation and
804
912
  restart from `plan` after any unfinished reconcile resumes under the revised
805
- spec and its publication is confirmed.
913
+ spec and its publication is confirmed. A settled, unmerged leaf awaiting merge
914
+ revises without an escalation through `ab reopen`.
806
915
 
807
916
  Caught preparation failures before an established build follow the durable
808
917
  claim recovery contract in §5; incomplete hosted snapshots never launch a build.
@@ -1093,7 +1202,9 @@ gate-evaluation cost is flat in accumulated build history, with the full
1093
1202
  per-build scan paid only when a gate actually trips and a scan packet is built.
1094
1203
  The digest also carries the build's node targets, every node its target or
1095
1204
  parent moves ever named, so the dispatcher finds a node's child builds from
1096
- digests and reads full facts only for builds that name that node.
1205
+ digests and reads full facts only for builds that name that node. Optimization
1206
+ nodes add an `optimization` signal from which the dispatcher's proposer stage
1207
+ selects work (§13.1.1).
1097
1208
 
1098
1209
  Stateless repository-level readers also have a bounded journal read,
1099
1210
  `getRepoStateEvents(repo)` (AUT-489): every durable, slow-growing event type
@@ -1220,7 +1331,11 @@ The base-selection invariants make this safe with Git:
1220
1331
  fetched origin tip of the configured base branch (fetched into a
1221
1332
  build-scoped internal ref so concurrent dispatches cannot clobber each
1222
1333
  other or the user's refs). If the remote is unavailable, creation falls
1223
- back to the local base and records the diagnostic.
1334
+ back to the local base and records the diagnostic. The recorded base is
1335
+ the commit the workspace actually checked out, read back from its HEAD
1336
+ after checkout; a provider that reuses a completed environment from a
1337
+ failed attempt records that environment's checkout, never a target head
1338
+ read separately. A target that moved since is a restack concern.
1224
1339
  - **Re-provisioning resumes; eligible restacks rewrite.** Provisioning alone
1225
1340
  resumes the published branch. The kernel collapses and restacks at verify
1226
1341
  entry, at a ticket-wait resume, and after target moves while awaiting merge. The first
@@ -1257,8 +1372,10 @@ The base-selection invariants make this safe with Git:
1257
1372
  publication promotes the contribution/path base, as does a wait-resume
1258
1373
  fast-forward (`restack.advanced`). Every new verify start and
1259
1374
  result, including skips, cites the cycle's base and head. Those citations stay
1260
- frozen throughout the cycle and survive clean waiting restacks; historical
1261
- facts without citations remain readable. Upstream-only paths are excluded.
1375
+ frozen throughout the cycle and survive clean awaiting-merge restacks; a clean
1376
+ wait-resume restack after a `verify:*` or `finalize` wait starts a fresh cycle
1377
+ that cites the restacked base and head. Historical facts without citations
1378
+ remain readable. Upstream-only paths are excluded.
1262
1379
  - **Work distance is advisory durable telemetry.** Each admitted work target poll
1263
1380
  samples destination-only commits (`BUILD..TARGET`), even when only the build
1264
1381
  head changed. `target.distance` pins branch, target SHA, nullable build head
@@ -1487,8 +1604,21 @@ AB_TOKEN # signed credential for this exact phase session (remote store)
1487
1604
  ```
1488
1605
 
1489
1606
  A harvest session instead carries `AB_REPO`, `AB_HARVEST`, and an `AB_PHASE`
1490
- of `synthesize@N` or `review@N`. The AgentRunner invocation argument is
1491
- opaque: a build skill receives its slug; a harvest skill receives its run id.
1607
+ of `synthesize@N` or `review@N`. A judge session of a judge panel (§13.1.1)
1608
+ carries only `AB_JUDGE` (`<build>:<panel>:<judge>`), `AB_SESSION`,
1609
+ `AB_CONTEXT_DIR` and, for a remote store only, `AB_STORE` and `AB_TOKEN`; it
1610
+ has no `AB_BUILD` and no `AB_PHASE`, no inherited `AB_*`, `GIT_*`, `PWD` or
1611
+ `OLDPWD` value, no inherited value naming a protected location (§13.1.1), and
1612
+ its `PATH` starts with its own scratch launcher directory instead of the
1613
+ distribution's. A judge session has no read authority. With a remote store its
1614
+ Store handle appends exactly one `panel.preferred` for its own panel, judge
1615
+ and session while that session is open and refuses every other operation.
1616
+ With a local store it holds no Store and never learns the store's path:
1617
+ `ab judge prefer` saves its preference to an outbox in its root, which the
1618
+ runner commits. Any read command run with `AB_JUDGE` set fails before opening
1619
+ a Store. The AgentRunner
1620
+ invocation argument is opaque: a build skill receives its slug; a harvest skill
1621
+ receives its run id; a judge skill receives its panel id.
1492
1622
  The CLI resolves identity from ambient auth. Every build process holds an
1493
1623
  interface-enforced build-scoped Store handle. At the phase CLI opening boundary,
1494
1624
  both local and remote handles are wrapped with authority over exactly
@@ -1552,7 +1682,17 @@ that build, and harvest mutations target only the prepared run and execution,
1552
1682
  its artifacts and streams, with heartbeat authority for its adopted lease holder.
1553
1683
  Phase grants also enforce agent session attribution. They cannot create builds or
1554
1684
  operator sessions, administer repositories, invoke operator routes, or delegate.
1555
- A runner can delegate only to a recorded session within its own authority.
1685
+ A runner can delegate only to a recorded session within its own authority. A
1686
+ build runner alone may also issue a `build-judge` grant for a recorded
1687
+ `panel.judge-started` session, binding its panel and judge. That grant is
1688
+ write-only: the service refuses every read, and admits only one
1689
+ `panel.preferred` for its exact panel, judge and session while the session is
1690
+ open and has not already preferred. The service decides that write and
1691
+ appends it in one conditional step (`appendIfCurrent` at the delegation
1692
+ value's cursor, retried a bounded number of times), so concurrent requests from
1693
+ one judge session record at most one preference; the loser is refused like a
1694
+ sequential retry, and sustained contention is a 409 `conflict`. It retires 60
1695
+ seconds after `panel.judge-ended`.
1556
1696
 
1557
1697
  Delegated grants have no fixed wall-clock expiry. The service checks signed
1558
1698
  bindings against authoritative durable lifecycle facts on every request and
@@ -1598,7 +1738,7 @@ sessions need no separate global installation.
1598
1738
  | `ab artifact get <kind>[@rev]` | fetch an artifact within own build | no |
1599
1739
  | `ab artifact download …` | read-only exact-byte retrieval; operator-wide without identity, own-build only with ambient phase identity; works after build termination | no |
1600
1740
  | `ab observe --kind <followup\|refactor\|latent-bug> …` | structured observation, any phase, any time | no |
1601
- | `ab done` | complete a producer phase (validates, then runs phase plumbing) | **yes** |
1741
+ | `ab done` | complete a producer phase (validates, then runs phase plumbing); in an optimization attempt's implement, `--no-improvement <reason>` declines instead (§13.1.1) | **yes** |
1602
1742
  | `ab verdict <approve\|revise\|escalate\|pass\|fail\|skip> …` | complete a review/verify phase | **yes** |
1603
1743
  | `ab escalate <question>` | park the build for external judgment | **yes** |
1604
1744
  | `ab mcp [--store <ref>] [--repo <id>]` | serve the agent tool registry as an MCP server over stdio; fails closed inside a phase | no |
@@ -1630,6 +1770,7 @@ A phase-scoped hydration into the gitignored scratch dir:
1630
1770
  contributions/ # node verify: <build>/spec.md
1631
1771
  plan.md # per phase needs (see table)
1632
1772
  findings.json # current feedback, when round > 1
1773
+ reopen.json # an operator's reopen of a settled leaf (§15.7), every phase
1633
1774
  history/ # prior-round artifacts where the phase needs them
1634
1775
  verify/ # failure reports routed back to implement
1635
1776
  assets/ # the ticket assets the build froze (§6.3), every phase:
@@ -1664,12 +1805,16 @@ terminals:
1664
1805
  |---|---|---|
1665
1806
  | `plan` | ticket, spec; prior plan rev + findings (round > 1) | `done` (requires `plan` artifact) |
1666
1807
  | `plan-review` | spec, plan@latest, all prior rounds' findings (for `persists` marking) | `verdict` (requires notes artifact) |
1667
- | `implement` | spec, approved plan, feedback (findings **or** verify report), own prior notes | `done` (requires clean worktree + notes) |
1808
+ | `implement` | spec, approved plan, feedback (findings **or** verify report), own prior notes | `done` (requires clean worktree + notes; an attempt's `done --no-improvement` requires neither) |
1668
1809
  | `code-review` | spec, plan, commit range `{base, head}`, prior findings, implement-notes | `verdict` |
1669
1810
  | `verify:<step>` (agent) | spec (acceptance criteria), step config, commit range; node contribution specs and provenance | `verdict pass` \| `verdict fail --report` \| `verdict skip --reason` |
1670
1811
  | `finalize` | spec, plan, verify reports, PR template config | `done` (requires `pr-description` artifact) |
1671
1812
  | `reconcile` | spec, plan, implement-notes, conflict `{baseSha}` and kernel-prepared replay transaction | `done` (requires one replayed commit on the frozen base) |
1672
1813
 
1814
+ Every phase also accepts `escalate`. In a work build every phase additionally
1815
+ accepts `wait-on` (§11), and the manifest's `allowedTerminals` lists it; a node
1816
+ build's manifest omits `wait-on`, and `ab wait-on` refuses there.
1817
+
1673
1818
  In node `verify:*` context, `nodeVerification` in the manifest identifies the frozen
1674
1819
  `range`, `indexPath`, `contributions`, `handPushedCommits` and `unattributedCommits`. Each contribution
1675
1820
  has `build`, its preparation-time stored `ticket` identity, `spec: {kind: 'spec', rev}`,
@@ -1753,9 +1898,15 @@ or `escalate`, or in a work build `wait-on`, which declares a ticket wait
1753
1898
  (§11). The CLI rejects a second terminal call, and each terminal
1754
1899
  validates its preconditions before emitting the phase event (no `done`
1755
1900
  without the required artifacts; no `done` on a dirty worktree in
1756
- `implement`). A normally completed turn that ends **without** any terminal
1757
- call is an infra failure: the runner emits
1758
- `phase.failed {error: "no-terminal"}` and applies retry policy.
1901
+ `implement`, except an optimization attempt's `done --no-improvement`). A
1902
+ normally completed turn that ends **without** any terminal call is an infra
1903
+ failure: the runner emits
1904
+ `phase.failed {error: "no-terminal"}` and applies retry policy. A judge
1905
+ session is not a phase: it ends with exactly one `ab judge prefer`, which
1906
+ refuses a blank reason, an unknown preference and a second call, concurrent
1907
+ calls included; a judge turn without it, or whose saved outbox preference
1908
+ cannot be committed, records `panel.judge-ended {outcome: "no-terminal"}`
1909
+ under the panel's failure policy (§13.1.1).
1759
1910
 
1760
1911
  Provider/runtime-declared turn failures are a separate `AgentRunner` result
1761
1912
  (§9), never conflated with agent silence. When the selected role has declared
@@ -1820,7 +1971,7 @@ the exact validated SHA and confirms forge readback before recording that head a
1820
1971
  A no-op step has no push. Agents only ever commit locally. Consequences: forge
1821
1972
  credentials **never enter the sandbox** (load-bearing once builds run on
1822
1973
  remote sandboxes), ordinary implementation history is extended and reconcile
1823
- uses exact expected-head guarded rewrites with archived evidence, and the
1974
+ uses exact expected-head guarded rewrites with retained evidence, and the
1824
1975
  push-at-boundary rule from [D3] is enforced by construction rather than
1825
1976
  convention. The same rule bounds an external operator's small fixes: an operator
1826
1977
  sandbox publishes work only through the `sandbox.publish` tool, whose push and
@@ -1924,9 +2075,21 @@ Observation harvest uses a separate typed, repository-scoped namespace
1924
2075
  commands: context hydration, a producer terminal, a reviewer terminal, and a
1925
2076
  sessionless read-only status projection.
1926
2077
 
2078
+ A judge session (§13.1.1) uses `ab judge context|prefer`. `ab judge context
2079
+ [--json]` writes `purpose.md`, `rubric.md` and `context.json` (`{judge,
2080
+ variants: {A, B}, purpose, rubric, allowedTerminals: ["prefer"]}`) into
2081
+ `$AB_CONTEXT_DIR` from the brief in the judge's root and the rubric under `A/`;
2082
+ it makes no Store read. `ab judge prefer <A|B|tie> (--reason <text> |
2083
+ --reason-file <file>)` is the judge's terminal: with a remote store it appends
2084
+ `panel.preferred` through the write-only grant; with a local store it creates
2085
+ `$AB_CONTEXT_DIR/preference.json` exclusively, so only one call succeeds, and
2086
+ the runner records it. Inside a judge session `ab` is the judge-only launcher,
2087
+ which runs these two commands and refuses every other.
2088
+
1927
2089
  `ab repository status [--json] [--store <ref>]` is the sessionless read-only
1928
2090
  projection of the repository journal's dispatcher controls: ticket intake, the
1929
- repository-wide pause, and the harvest gate. It uses the same
2091
+ repository-wide pause, and the harvest gate, plus pending and recently settled
2092
+ single-ticket start requests with their priority (`ticketStarts`, present when either is nonempty). It uses the same
1930
2093
  dispatch-settings reducer as dispatcher decisions and the dashboard. An absent
1931
2094
  repository stream reduces as an empty journal and reports intake on, repository
1932
2095
  pause off; the query does not create that stream,
@@ -1958,6 +2121,11 @@ presence and its final renewal for re-arming. SIGKILL cannot be caught and still
1958
2121
  relies on TTL expiry. `ab wait` does not
1959
2122
  renew or preserve this identity. MCP presence and dashboard display are deferred.
1960
2123
 
2124
+ Every `ab watch --json` record carries an `id` stable across redelivery and
2125
+ resume: `build:<slug>:<seq>`, `repo:<seq>`, `<observation type>:<dedupe
2126
+ identity>` for derived observations, or `dispatcher.lost:<run>`. Configured
2127
+ hooks (§16.1) receive exactly these records.
2128
+
1961
2129
  Filing agents check CLI repository status before ready filing. With a live
1962
2130
  operator they put intent, rejected alternatives and out-of-scope reasons into
1963
2131
  ticket bodies, file, tell the human the existing operator will pick it up, and
@@ -2115,14 +2283,17 @@ non-resumable), used for slug naming (§6.3) and vendored-skill conflict
2115
2283
  resolution (§16.3). A runtime without it is valid; each caller owns its
2116
2284
  deterministic fail-safe.
2117
2285
 
2118
- - **Adapters:** three builtins sit behind the interface: the locally installed
2286
+ - **Adapters:** four builtins sit behind the interface: the locally installed
2119
2287
  Claude Code CLI in headless mode for Claude models; the locally installed
2120
- Codex CLI for unqualified `gpt-*` models; and the locally installed pi CLI
2288
+ Codex CLI for unqualified `gpt-*` models; the locally installed pi CLI
2121
2289
  (minimum version 0.84.3), driven headlessly through `--mode rpc`, for every
2122
- provider-qualified model that installation resolves. Each adapter uses its
2123
- CLI's local authenticated login; pi also owns its local model catalog and
2124
- keeps one persistent RPC process alive across review-loop continuations. All
2125
- three provide tool-free one-shot completion. Plugins may register additional
2290
+ provider-qualified model that installation resolves; and the locally
2291
+ installed Antigravity CLI (`agy`) for `gemini-`, `claude-` and `gpt-` slugs,
2292
+ using ambient agy auth and `--conversation` native resume. Each adapter uses
2293
+ its CLI's local authenticated login; pi also owns its local model catalog and
2294
+ keeps one persistent RPC process alive across review-loop continuations.
2295
+ Claude, Codex and Pi provide tool-free one-shot completion; Antigravity omits
2296
+ it because agy cannot guarantee tool-free execution. Plugins may register additional
2126
2297
  adapters, each under a *distinct runtime name*, never
2127
2298
  as a mode flag on an existing one. Plugin adapters must pass the exported
2128
2299
  AgentRunner contract suite.
@@ -2166,7 +2337,9 @@ deterministic fail-safe.
2166
2337
  that concrete role's effective primary axes and is resolved and validated
2167
2338
  eagerly with indexed problems in the aggregate startup error.
2168
2339
  4. A **declared** key that nothing ever requests is resolved, validated, and
2169
- then never used. `ab dispatch` reports it at startup as a warning.
2340
+ then never used. `ab dispatch` reports it at startup as a warning. This
2341
+ includes `[profiles.<name>.roles.<role>]` entries, reported under that
2342
+ header.
2170
2343
 
2171
2344
  Each `args` string is one argv token, preserved in order and appended to
2172
2345
  every phase and tool-free one-shot invocation for that role. Adapters reject
@@ -2200,7 +2373,7 @@ deterministic fail-safe.
2200
2373
  the failed conversation. Selection is non-sticky: every later phase, loop
2201
2374
  continuation, and retry starts from the primary. The final failure controls
2202
2375
  retry/permanent behavior. This applies to core phases, agent verify/finalize,
2203
- and Harvest, but not tool-free one-shots. Every selected runtime/model/args
2376
+ Harvest and judge sessions (§13.1.1), but not tool-free one-shots. Every selected runtime/model/args
2204
2377
  tuple is recorded on `session.started`; fallback starts cite the preceding target and
2205
2378
  verbatim error, while exhausted `phase.failed`/`harvest.failed` facts carry
2206
2379
  the complete ordered attempt list.
@@ -2236,13 +2409,16 @@ deterministic fail-safe.
2236
2409
  session boundary, like `[roles]`, so an edit reaches the in-flight builds that
2237
2410
  selected the profile at their next session and no other build. Every agent
2238
2411
  session of the build resolves through it — plan, plan review, implement,
2239
- code review, agent verify and finalize steps, and reconcile — and
2240
- `session.started.profile` records `{ name, configured }`. When a reload
2412
+ code review, agent verify and finalize steps, reconcile, and the `judge`
2413
+ sessions of a panel run on the build — and `session.started.profile`
2414
+ records `{ name, configured }`. When a reload
2241
2415
  removes the profile, later sessions use the repository roles with
2242
2416
  `configured: false`, and `ab build status` says the recorded profile is no
2243
2417
  longer configured. A resumed session keeps its recorded target as before.
2244
2418
  Sessions outside a build (`slug`, `upgrade`, `harvest`, `harvest-review`)
2245
- never use a profile.
2419
+ never use a profile, so a profile entry on one of those keys is unconsumed.
2420
+ Dispatch applies the unconsumed, deprecated skill-name and `extensions`
2421
+ warnings to profile entries as it does to `[roles]`.
2246
2422
  - **Transcripts come back through the interface**, not scraped from disk, so
2247
2423
  every adapter must produce one whenever its owning runner reaches the session
2248
2424
  end boundary, including turns rejected by a provider after a handle exists.
@@ -2269,7 +2445,10 @@ deterministic fail-safe.
2269
2445
  `{ kind: 'repo', repo }` instead of build-scoped, `harvest.session.started`
2270
2446
  carries the returned stream id, `phase` is spelled `harvest:<step>`, each
2271
2447
  revise round is its own bracket and its own stream, and a closed stream
2272
- finalizes onto the repository scope. Harvest journal events
2448
+ finalizes onto the repository scope. A judge session (§13.1.1) streams the
2449
+ same way on the build scope: its `phase` is spelled `judge:<panel>:<judge>`,
2450
+ `panel.judge-started` carries the stream id, and the stream closes before
2451
+ `panel.judge-ended`. Harvest journal events
2273
2452
  (`harvest.step.*`, `harvest.proposals.submitted`, `harvest.review.verdict`,
2274
2453
  and their kin) are deliberately not translated into parts — they are typed
2275
2454
  journal facts, observable via `ab watch --repository`, not harness output.
@@ -2398,7 +2577,7 @@ the matching phase and `round`; a missing round cannot broaden either cause.
2398
2577
  `review-round-limit` retains the same matching-round effect.
2399
2578
  `verify-failure-limit` is the explicit phase-level case and re-arms every
2400
2579
  phase-runner failure round for its verify target. `reconcile-no-progress`,
2401
- `setup-failure-limit` and `wait-unresolvable` have no phase-runner failure-budget effect (setup's own
2580
+ `setup-failure-limit`, `wait-unresolvable` and `measurement-failed` have no phase-runner failure-budget effect (setup's own
2402
2581
  answer/retry accounting remains separate). Agent and stall raises, and
2403
2582
  cause-less historical policy raises, retain the legacy shape rule: a matching
2404
2583
  round resets that round and an absent round resets all rounds for the target.
@@ -2465,7 +2644,12 @@ diagnostic and is retried on the next tick.
2465
2644
 
2466
2645
  An entered wait opens an escalation with id `escalation`, the declaring phase
2467
2646
  and round, `source: agent`, the declaring session and the waited tickets as
2468
- `refs`; its question begins `Waiting on`. The build is `blocked`. A work build
2647
+ `refs`; its question begins `Waiting on`. The build is `blocked`. An
2648
+ escalation whose sole cause is an open ticket wait is not operator attention:
2649
+ `ab wait --for attention` and other build-attention reads ignore it, as
2650
+ default `ab watch` ignores `wait.entered` and `wait.ended`; any other open
2651
+ escalation, including a `wait-unresolvable` raise, is attention. Waiting stays
2652
+ visible through status surfaces. A work build
2469
2653
  whose only open escalation is its wait, and which has no runner working, holds
2470
2654
  no capacity slot and keeps its branch, workspace and completed phase work
2471
2655
  (§12 "What holds a slot"). A wait ends at its first end fact: an
@@ -2514,8 +2698,8 @@ nothing, reports a diagnostic and is retried on the next tick. Hosted clients
2514
2698
  read `ticketWait` from the digest wire answer; an older service that omits it
2515
2699
  yields no automatic release, and operators still end waits by answering.
2516
2700
 
2517
- An ended wait requests a `resume` slot and is admitted before new ticket
2518
- claims, as a parked finished build is; a `revise-spec` answer instead waits for
2701
+ An ended wait requests a `resume` slot and is admitted before normal ticket
2702
+ claims, as a parked finished build is (§12 "Slot admission order"); a `revise-spec` answer instead waits for
2519
2703
  the revision. The dispatcher observes the leaf's target when it launches the
2520
2704
  resume. Before the declaring phase resumes, and ahead of the plan and code
2521
2705
  loops, the engine decides a `restack` with trigger `wait-resume` and cycle
@@ -2524,7 +2708,17 @@ work sits on. When the target has not moved, no restack runs. A build with
2524
2708
  published work replays it through the guarded automatic restack (`restack.*`
2525
2709
  facts carry the `wait-resume` trigger); a conflict runs `reconcile` for that
2526
2710
  transaction, which counts as initial verification, and the declaring phase
2527
- resumes after `restack.completed`. A build with nothing published, whose local
2711
+ resumes after `restack.completed`. That conflicted path re-verifies in full
2712
+ because `reconcile.completed` opens a new verify cycle. A clean
2713
+ `restack.completed` for a wait declared in `verify:*` or `finalize` is itself a
2714
+ verify cycle boundary: results at or before it describe the old base and
2715
+ satisfy neither finalize nor landing, verification re-runs from the first
2716
+ configured step at a new attempt, and its facts cite the restacked base and
2717
+ head. The boundary is not a replay boundary, so the verify-entry restack does
2718
+ not run again. Clean is decided from facts already in the log: a
2719
+ reconcile-linked completion carries the `reconcile.completed` seq as its cycle,
2720
+ a clean one the wait end's. Waits declared in earlier phases add no boundary,
2721
+ because the code loop's next approval opens a new cycle. A build with nothing published, whose local
2528
2722
  branch has no commits the target lacks and whose workspace has no uncommitted
2529
2723
  tracked changes (plan, plan-review, implement before its first commit),
2530
2724
  fast-forwards its local branch to the fresh target snapshot and records `restack.advanced
@@ -2547,13 +2741,19 @@ target, or none when the replay is clean. With the target unchanged the same
2547
2741
  attempt resumes with its replay intact.
2548
2742
 
2549
2743
  The engine's ordinary rules then re-run the declaring phase: a
2550
- producer at the same round, a reviewer at the same review round, an agent
2551
- verifier at the same step and attempt, and finalize or reconcile. Guidance
2744
+ producer at the same round, a reviewer at the same review round, and
2745
+ reconcile. An agent verifier resumes at the same step and attempt, and finalize
2746
+ or its post-step resumes directly, only when the target was unchanged. After a
2747
+ clean wait-resume restack, a verifier or finalize wait re-verifies from the
2748
+ first step in the new cycle; finalize, or the remaining post-steps of a
2749
+ post-step wait, run once that cycle passes. Guidance
2552
2750
  reaches the session through its usual carrier, and its
2553
2751
  `$AB_CONTEXT_DIR/guidance.json` gains a `wait` block — `{id, tickets, reason,
2554
2752
  outcome: refused | ended, cause, message}` — whenever the guidance is the
2555
2753
  wait's refusal or answer (including the answer to its `wait-unresolvable`
2556
- escalation), or when the wait ended without guidance text. A
2754
+ escalation), or when the wait ended without guidance text. The block goes only
2755
+ to the declaring phase at its declaring round or attempt: a verifier re-run at
2756
+ a new attempt receives the answer as guidance without it. A
2557
2757
  review phase's wait resumes that review round and never feeds the next
2558
2758
  producer. `ab build status` shows a requested, open, or ended-but-not-resumed
2559
2759
  wait and the tickets it names. Node builds cannot declare waits.
@@ -2590,6 +2790,79 @@ creation holds, capacity, intake off and repository pause — so a blocked urgen
2590
2790
  ticket never holds back normal work. Priority never preempts: an urgent ticket
2591
2791
  does not stop, pause or displace a running build.
2592
2792
 
2793
+ **Slot admission order.** Free slots are admitted in five tiers:
2794
+
2795
+ 1. `manual` single-ticket start requests (the `ab start` default, §11);
2796
+ 2. urgent parked work (nodes and parked leaves waiting for verification,
2797
+ reconcile, resume or propose);
2798
+ 3. urgent ticket claims: `urgent` start requests, then ordinary urgent ready
2799
+ tickets while intake is on;
2800
+ 4. normal parked work;
2801
+ 5. normal ticket claims: `normal` start requests, then ordinary normal ready
2802
+ tickets while intake is on.
2803
+
2804
+ Each tier keeps its own order: start requests oldest first, parked leaves in
2805
+ the tick's visit order, nodes in slug order, tickets in the source's listing
2806
+ order. Start requests bypass intake off and open-PR backpressure; ordinary
2807
+ ready tickets do not. A build's
2808
+ priority is frozen from its claimed ticket on `build.created` (`priority:
2809
+ urgent`; omitted for normal and in historical logs) and changed by the
2810
+ human-authored advisory `build.priority-set {priority: urgent | normal}`
2811
+ (`ab priority <slug> urgent|normal`, the operator `builds.control` action
2812
+ `priority`); a later ticket priority edit does not reach an existing build.
2813
+ Absent priority reads as normal. Admission is arithmetic over reduced facts: a
2814
+ waiter is admitted when the slots occupied by every other build plus the
2815
+ slots reserved ahead of it are below `capacity`. Pending start requests are
2816
+ durable demand: the reduced `ticketStarts` counts them by tier, whatever
2817
+ intake says, and nothing while the repository is paused. Each reserves one slot
2818
+ ahead of the tiers below it until it settles or is cancelled, and never
2819
+ preempts. Only `manual` requests are reserved ahead of urgent parked work.
2820
+ Ahead of normal parked work are the `manual` and `urgent` requests, the urgent
2821
+ waiters' slot reservations and the urgent claim demand of the latest admission
2822
+ scan:
2823
+ `dispatcher.ticket-scan-completed` records `urgentWaiting`, the urgent non-node
2824
+ ready tickets that passed every intake gate except capacity (omitted when
2825
+ none; counted only while intake is on and the repository unpaused). An
2826
+ `urgent` start request waits for urgent reservations and `manual` requests; an
2827
+ ordinary urgent claim also for `urgent` requests. A `normal` start request
2828
+ waits for every waiter, the `manual` and `urgent` requests and the urgent claim
2829
+ demand; an ordinary normal claim waits for every waiter and every pending start
2830
+ request. Because demand discovered by an earlier scan can be stale,
2831
+ the dispatcher also defers, within a tick, any normal parked admission into a
2832
+ free slot while ticket claims can run (the source supports priority, intake is
2833
+ on, the repository is unpaused, accounts are present and the forge is not
2834
+ cooling down). A deferral writes nothing and keeps the build's reservation
2835
+ against normal claims; it makes that tick's admission scan due, and the
2836
+ deferred admissions are retried after the tick's dispatch only when that scan
2837
+ completed its urgent decision (its claim loop ran to the end, or it proved no
2838
+ urgent ticket ready). Otherwise they are decided again on a later tick. A
2839
+ forced scan is bounded per deferral state: an unchanged set of deferred builds
2840
+ and occupancy lists again only when a scan is due on its own. Only gate-passing
2841
+ urgent tickets count, so an urgent ticket blocked on a dependency never holds
2842
+ back normal parked work. Free slots only: priority never interrupts a running
2843
+ build or session.
2844
+
2845
+ **Open-PR backpressure.** When `[policy].maxOpenPrs` is set, the dispatcher
2846
+ counts open unmerged root PRs: nonterminal builds with an open or conflicted
2847
+ PR and no integration-node target, root leaves and root integration nodes
2848
+ alike. Children targeting a node do not count. A PR whose active landing
2849
+ command is `hold` counts unless `excludeHeldOpenPrs = true`. Backpressure
2850
+ engages when the count reaches `maxOpenPrs` and stays engaged until the count
2851
+ drops to or below `resumeOpenPrs` (default `maxOpenPrs - 1`). Reaching
2852
+ `maxOpenPrs` takes precedence, so with `resumeOpenPrs = maxOpenPrs` intake
2853
+ stays paused at that count and resumes once it falls below. While engaged,
2854
+ the dispatcher claims no new `normal`-priority ticket; `urgent` claims,
2855
+ in-flight builds, parked-build admission, reconciles, verification and
2856
+ landings continue, and capacity accounting is unchanged. The count is derived
2857
+ from the reduced build facts each tick already holds. The dispatcher records
2858
+ `dispatcher.open-pr-backpressure-engaged` and
2859
+ `dispatcher.open-pr-backpressure-cleared` repository facts only on
2860
+ transitions (a cleared fact names `drained`, or `disabled` when the key is
2861
+ removed while engaged); the engaged fact is the hysteresis memory a fresh
2862
+ process reads. Repository status and both dashboards report the count,
2863
+ watermarks and whether normal intake is paused. Unset `maxOpenPrs` disables
2864
+ backpressure entirely.
2865
+
2593
2866
  **What holds a slot.** `capacity` counts builds running work. A work build that
2594
2867
  has finished its pipeline (every verify step and every finalize post-step for
2595
2868
  the current spec) holds no slot while it waits for a merge decision, for merge
@@ -2601,10 +2874,13 @@ keeps its branch, workspace and completed phase work. Any other build that has
2601
2874
  not finished keeps its slot, even while paused, blocked on a question, waiting
2602
2875
  for the dispatcher to check a ticket wait, or interrupted between
2603
2876
  `finalize.completed` and its post-steps. When a finished build must restack,
2604
- re-verify or reconcile, or a ticket wait ends, the build is admitted before new
2605
- ticket claims, as a node is: intake reserves a slot for it (`resume` for an
2606
- ended wait), and its wait records nothing, consumes no attempt and raises no
2607
- attention. Abort and pause acknowledgements are not gated. A finished or
2877
+ re-verify, reconcile or run a requested optimization measurement (§13.1.1), an
2878
+ operator reopens it (§15.7), or a ticket wait ends, the build is admitted before normal
2879
+ ticket claims, as a node is (urgent work first: "Slot admission order"): intake reserves a slot for it (`reopen` for a
2880
+ reopened leaf, `resume` for an ended wait), and its wait records nothing,
2881
+ consumes no attempt and raises no attention. A reopened leaf stays a finished
2882
+ build until it settles again, so, like a blocked reconcile, it holds no slot
2883
+ while it waits on a question. Abort and pause acknowledgements are not gated. A finished or
2608
2884
  waiting build keeps its workspace, so retained workspaces can exceed
2609
2885
  `capacity`; running work cannot.
2610
2886
 
@@ -2654,7 +2930,7 @@ The fixed workflow is:
2654
2930
  still-existing unresolved origins. The filing fact and report preserve those
2655
2931
  two provenance sets separately. Creates are rendered to the spec standard
2656
2932
  and filed into `[tickets].proposalState`, Triage by default, with the reserved
2657
- `autobuild:proposal` provenance label.
2933
+ `autobuild:proposal` provenance label and any `[tickets].createLabels`.
2658
2934
  Filing is crash-safe by construction: an idempotency ID is durably reserved
2659
2935
  *before* each external create, so a restart adopts the already-created
2660
2936
  ticket instead of duplicating it, and a partially filed approved set creates
@@ -2813,7 +3089,11 @@ Both are optional and have no default: `backlogState` and `rejectedState` unset
2813
3089
  means the role does not exist, and a state that merely shares the role's name
2814
3090
  holds no role. Neither may share its native state with the ready, claimed, done,
2815
3091
  triage or proposal role, or with each other. The dispatcher never claims from,
2816
- moves into, or files harvest proposals into either. A ticket in the rejected
3092
+ moves into, or files harvest proposals into either, with one exception: it
3093
+ moves the ticket of an optimization attempt that settles with any outcome other
3094
+ than `accepted` into the rejected role (§13.1.1), including an attempt an
3095
+ operator aborts, which never returns to triage. Tickets that are not attempts
3096
+ never move there automatically. A ticket in the rejected
2817
3097
  state never resolves a blocker, and a rejected child no longer keeps its node
2818
3098
  incomplete; a backlog child still does, as triage and ready children do. Moving
2819
3099
  a ticket out of the rejected state restores ordinary behavior. Agents and
@@ -2856,8 +3136,11 @@ unaffected. `ab ticket create` and `update` take `--issues N[:refs],...`;
2856
3136
  operator and MCP ticket requests take `issueLinks`.
2857
3137
 
2858
3138
  **Ticket priority.** A ticket's priority is `urgent` or `normal`; absent means
2859
- normal. Urgent ready work is claimed before normal ready work (§12) and nothing
2860
- else changes. Sources declare support. The file source stores
3139
+ normal. Urgent ready work is claimed before normal ready work, and ahead of
3140
+ normal parked work (§12 "Slot admission order"); a claimed ticket's priority
3141
+ becomes its build's priority, and nothing else changes. A single-ticket start
3142
+ request has its own admission tier (§11); an `urgent` request also makes its
3143
+ build urgent. Sources declare support. The file source stores
2861
3144
  `priority = "urgent"` in its frontmatter, writes no key for normal, and covers
2862
3145
  urgent priority in its revisions; the in-memory fake behaves the same way.
2863
3146
  The hosted source stores priority in the hosted ticket store, covers it in its
@@ -2894,6 +3177,17 @@ is written; their tickets carry no `assignees` field. `ab ticket create` and
2894
3177
  `update` take `--assignees a,b`; operator and MCP ticket requests take
2895
3178
  `assignees`.
2896
3179
 
3180
+ `[tickets].createLabels` lists labels added to every ticket Autobuild creates
3181
+ (`ab ticket create`, operator `tickets.create`, harvest proposals and
3182
+ optimization attempts). The caller unions them after the labels the create
3183
+ names, never replacing them, so a source receives exact draft labels and needs
3184
+ no capability; `ab ticket import` never applies them. They are ordinary labels
3185
+ and count toward `readyLabels` only when also listed there. Parse refuses names
3186
+ a builtin source reserves: on GitHub `autobuild:<state>`, `autobuild-link:` and
3187
+ `node`, on Linear `node`. A retried keyed GitHub create that adopts its issue
3188
+ adds any requested labels it is missing. Hosted publishes the value in the
3189
+ project ticket policy so the service's own operator create applies it.
3190
+
2897
3191
  A build freezes its ticket's links into `build.created` when it claims the
2898
3192
  ticket, from the same sample as the body. Later ticket edits and spec revisions
2899
3193
  never change them. An agent in the build may downgrade one linked `closes`
@@ -3029,12 +3323,14 @@ from its parent's sampled head. Opening intent and acknowledgement are durable;
3029
3323
  the branch is open to targeting tickets immediately, without a PR. Idle integration
3030
3324
  builds use no provisioned workspace, runner, execution lease, or dispatch capacity.
3031
3325
 
3032
- A node requesting reconcile or verification is admitted before new ticket
3033
- claims. The request is durable: a prepared verification cycle or a restack
3034
- conflict, with no runner yet. Until the node holds its slot, intake reserves one
3326
+ A node requesting reconcile, verification or, for an optimization node,
3327
+ propose is admitted before normal ticket claims (urgent work first, §12 "Slot
3328
+ admission order"). The request is durable: a
3329
+ prepared verification cycle, a restack conflict or an open proposal request,
3330
+ with no runner yet. Until the node holds its slot, intake reserves one
3035
3331
  slot for it, and the dispatcher checks its admission every tick regardless of
3036
3332
  idle node polling, so a slot freed in any tick goes to the node, not to a new
3037
- claim. Its candidate occupancy excludes itself and capacity-bearing blocked or
3333
+ normal claim. Its candidate occupancy excludes itself and capacity-bearing blocked or
3038
3334
  paused descendants, following accepted source-qualified build target ancestry.
3039
3335
  Running descendants and unrelated builds still count; ordinary blocked and
3040
3336
  paused work retains its slot for every other admission, except a work build
@@ -3043,8 +3339,10 @@ node occupancy before the runner starts. This exception never raises the budget
3043
3339
  for new claims. Status and both dashboards report actual occupancy, configured
3044
3340
  capacity, effective display capacity and the nodes using descendant-held slots.
3045
3341
  Status, `ab builds` and both dashboards report each node waiting for a slot
3046
- ahead of new ticket claims, and report a finished work build waiting to run
3047
- again the same way. Idle collecting nodes remain free.
3342
+ ahead of normal ticket claims, marking urgent waiters, the pending start
3343
+ requests of each tier and the urgent ticket claims waiting ahead of normal
3344
+ parked work, and report a finished work build waiting to run again the same
3345
+ way. Idle collecting nodes remain free.
3048
3346
 
3049
3347
  An empty node has no PR and reports `integration`, `target`, and `empty`.
3050
3348
  Once it holds commits its current parent lacks, the dispatcher opens or adopts
@@ -3073,7 +3371,13 @@ Merge follows ordered `[[merge]]` rules (§15.7), defaulting to node consent.
3073
3371
  Auto mode authorizes complete, verified nodes; consent mode waits for `ab merge`.
3074
3372
  Merge refuses incomplete nodes and names open children; `ab hold` remains available.
3075
3373
  Node parents and local-git roots receive guarded fast-forwards, preserving one
3076
- commit and identity trailer per contributing build. GitHub shared roots use the
3374
+ commit and identity trailer per contributing build; each verified node-owned
3375
+ hand-pushed commit of the exact verified range lands as pushed, without a trailer.
3376
+ Landing refuses a range that is non-linear, contains a merge commit, gives a
3377
+ commit several or repeated identities, or holds a trailer-less commit the node
3378
+ does not own. A refusal raises operator attention naming the rule and commit
3379
+ instead of retrying; a bare retry answer attempts the same head once more.
3380
+ GitHub shared roots use the
3077
3381
  PR rebase endpoint guarded on verified head, after a final parent freshness read.
3078
3382
  A root node's PR body carries the node's own issue links and its landed
3079
3383
  children's, and is refreshed before landing, so merging it closes them (see
@@ -3090,8 +3394,16 @@ survive completion. Merge gates are never bypassed; unsupported transports defer
3090
3394
  Human forge merges are an explicit escape hatch, even while incomplete, paused
3091
3395
  or unverified. The janitor records human provenance and whether the actual merged
3092
3396
  head had a successful cycle, then completes the node ticket.
3397
+ A recorded landing, kernel or human, ends the node's verification: no new cycle
3398
+ is prepared, and an open one is cancelled. The dispatcher withdraws the running
3399
+ verifier's execution lease; the runner aborts its active check at its next
3400
+ heartbeat and ends open sessions as an operator stop does, without recording
3401
+ results. The janitor completes the node once that execution has ended. A node
3402
+ whose owned range is empty (its head is its parent's, as when the parent was
3403
+ fast-forwarded onto it) never prepares a verification cycle either.
3093
3404
  Closing without merge or aborting closes admission and returns the ticket to
3094
- triage (or ready, when the abort asks for it); children already claimed retain
3405
+ triage (or ready, when the abort asks for it); an optimization attempt's ticket
3406
+ goes to the rejected role instead (§13.1.1). Children already claimed retain
3095
3407
  their frozen base. Nested nodes work.
3096
3408
  A forge plugin needs node branch creation, comparison and
3097
3409
  head-read capabilities to admit node tickets.
@@ -3188,7 +3500,7 @@ Node branches have one writer at a time. A distinct mutable node writer lease
3188
3500
  (serialized independently of runner execution leases) guards both restacks and
3189
3501
  controlled child merges. A revision-checked `node.writer-reserved` fact freezes
3190
3502
  the operation, original expected head, parent snapshot, previous contribution
3191
- boundary, immutable archives, ordered changes, and merge proofs. Expiry permits
3503
+ boundary, retained inputs, ordered changes, and merge proofs. Expiry permits
3192
3504
  recovery of that reservation, never an incompatible operation. Each change has
3193
3505
  prepared, conflicted, or replayed receipts. Resolved objects are retained in the
3194
3506
  BuildStore before their receipts. `node.publish-intended`, `node.rewritten`, and
@@ -3196,7 +3508,8 @@ BuildStore before their receipts. `node.publish-intended`, `node.rewritten`, and
3196
3508
  is authoritative: exact intended-head readback confirms publication, while local
3197
3509
  refs are caches refreshed without CAS. An unconfirmed descendant is contention;
3198
3510
  a durable confirmed receipt can preserve a historical write. Exact
3199
- expected-head replacement and immutable archive refs preserve displaced history;
3511
+ expected-head replacement and best-effort retained history (immutable archive
3512
+ refs, else BuildStore copies, §15.7) preserve displaced history;
3200
3513
  contention retains the previous contribution boundary and retries the complete
3201
3514
  observed contribution. An untagged commit, including an empty commit, is foreign.
3202
3515
  `node.inventory` retains the sampled source boundary without promoting the confirmed
@@ -3204,8 +3517,15 @@ restack base. It reports reachable build identities separately from node-owned
3204
3517
  foreign commits above the durable boundary; inherited foreign history is excluded
3205
3518
  from the owned count.
3206
3519
 
3207
- Only a conflicted replay item attaches the integration build's reconcile runner.
3208
- Its context names the integration owner separately from the original source
3520
+ Only a conflicted replay item attaches the integration build's runner. When
3521
+ every conflicted path of the item is declared in `[[generated]]`, that runner
3522
+ regenerates it as a leaf does, in the node's execution workspace, and records
3523
+ `node.item-regenerated {id, index, base, files, commands, outcome, head?,
3524
+ reason?}`. A resolved item is validated and retained before its fact, then
3525
+ receives an ordinary `node.item-replayed` receipt with no `reconcile.started`
3526
+ or session; a resolved fact without a receipt is completed from the retained
3527
+ head on the next attempt. A skipped or failed item reproduces the original
3528
+ conflict and continues into reconcile. The reconcile runner's context names the integration owner separately from the original source
3209
3529
  build and supplies that source's pinned spec, approved plan and implement-notes.
3210
3530
  Missing source artifacts or invalid identities escalate. Foreign conflicts supply
3211
3531
  commit metadata and a diff, with escalation when intent is unclear. Completion
@@ -3282,6 +3602,636 @@ revision once; equivalent aliases and unchanged values do not. Node demotion
3282
3602
  checks all targeting tickets, including completed work. Legacy plugins without
3283
3603
  integrationTree support read as work with no target and refuse metadata writes.
3284
3604
 
3605
+ #### 13.1.1 Optimization nodes
3606
+
3607
+ An optimization node is a node whose spec declares an objective (RFC 0005 §3,
3608
+ §4). The objective is the only marker: `kind` stays `node`, and ticket sources,
3609
+ labels and forge capabilities are unchanged. The marker makes a node file and
3610
+ dispatch its own work, so the rules below admit no false positive and no silent
3611
+ fallback in either direction. Code is authoritative
3612
+ (`packages/core/src/objective.ts`); the full schema table, with defaults and
3613
+ constraints, is the installed `ab-guide` reference
3614
+ `references/optimization-nodes.md`.
3615
+
3616
+ **Marker.** A node becomes an optimization node only when its spec carries
3617
+ exactly one fenced block whose info string is exactly `autobuild-objective`.
3618
+ The scan follows CommonMark fences. A fence opens on a line indented at most
3619
+ three spaces with three or more backticks or tildes, and closes on a line of the
3620
+ same character, at least as long, carrying no info string. A backtick line whose
3621
+ info string contains a backtick is inline code, not a fence. Only a fence whose
3622
+ trimmed info string equals `autobuild-objective`, case-sensitively, counts. None
3623
+ of these count:
3624
+
3625
+ - a fence nested inside another open fence, so a Markdown example that shows
3626
+ the block never marks the spec that contains it;
3627
+ - a fence line that begins with a blockquote or list marker, or is indented
3628
+ four or more spaces;
3629
+ - a fence inside an HTML block, such as an HTML comment, so a commented-out
3630
+ example never counts;
3631
+ - a heading named "Objective";
3632
+ - a `toml` block, or a fence with any other info string;
3633
+ - prose describing an objective, and inline code.
3634
+
3635
+ A spec with no block is a plain node.
3636
+
3637
+ **Objective.** The block's content is TOML with a required `purpose` and
3638
+ `[metric]`, `[target]` and `[budget]` tables, and optional `[stop]` and
3639
+ `[proposer]` tables. Every table is strict: an unknown key is refused and named.
3640
+ A metric is a `command` (command, direction, samples, harness) or a `panel`
3641
+ (judges, rubric, harness); a panel always maximizes a win rate, so the
3642
+ command-only fields are refused for it and the panel-only fields for a command.
3643
+ Harness entries are path selectors, the grammar `[[merge]]` and verify `paths`
3644
+ use, and a panel's rubric must be a literal path inside the harness. At least
3645
+ one of `budget.maxAttempts` and `budget.maxHours` is required. `stop.mode`
3646
+ defaults to `abort` and `proposer.concurrency` to 1. The normalized objective,
3647
+ defaults applied, is what events store.
3648
+
3649
+ **Refusals.** Each refusal names its reason:
3650
+
3651
+ | Condition | Reason |
3652
+ |---|---|
3653
+ | Two or more blocks | `exactly one autobuild-objective block (found N)` |
3654
+ | A block never closed | `a valid autobuild-objective block: the fence is never closed` |
3655
+ | A TOML syntax error | `a valid autobuild-objective block: TOML syntax error at line L: …` |
3656
+ | A schema failure | `a valid autobuild-objective block: <field>: <message>`, for example `unknown field metric.cmd` or `metric.rubric: must be inside metric.harness` |
3657
+ | No budget limit | `a budget limit in the autobuild-objective block: set budget.maxAttempts or budget.maxHours` |
3658
+ | No rejected role | `a rejected role for optimization attempts: set [tickets].rejectedState` |
3659
+ | A work ticket carrying the block | `no autobuild-objective block in a work ticket: the block marks an optimization node (file it with --kind node)` |
3660
+
3661
+ Ticket preparation checks the ticket body before any spec authoring. A refusal
3662
+ bounces the ticket to Triage with a comment naming every reason, through the
3663
+ same hand-back as a spec-standard bounce, and creates no build, so a node whose
3664
+ block is refused never opens as a plain node. The dispatcher never authors a
3665
+ spec for a body that carries a block, and treats an authored spec that gains
3666
+ one as nonconforming. Dispatch recovery repeats the
3667
+ check before importing the spec; a refusal fails the dispatch and the node never
3668
+ opens.
3669
+
3670
+ **Acceptance.** Opening an optimization node records
3671
+ `optimization.objective-accepted {objective, revision: 1, harnessPin, specRev}`
3672
+ after the node branch exists and before `node.opened`. `harnessPin` is the
3673
+ node's opening commit and `specRev` the spec revision the objective was parsed
3674
+ from. An opened optimization node therefore always has an accepted objective. A
3675
+ retried opening after a crash between the two facts records no second
3676
+ acceptance.
3677
+
3678
+ Every optimization node then measures its opening head against itself and
3679
+ records `optimization.baseline-measured {revision, head, harnessPin, samples,
3680
+ median, spread, report?}`. A command node samples it (see **Measurement**):
3681
+ the starting value is the median of every sample and the spread is the
3682
+ distance between the two sides' medians. A panel node runs one judge panel
3683
+ (see **Judge panels**) of its harness pin against itself and records the
3684
+ self-comparison win rate as `median`, the judge count as `samples`, no
3685
+ `report`, and `|winRate − 0.5|` as `spread`; its starting value is 0.5. The
3686
+ engine decides `measure-baseline` for an opened, unstopped node with no
3687
+ starting value under its current ruler, ahead of integration work and behind
3688
+ escalations, pause, abort and a node reconcile.
3689
+
3690
+ After each accepted attempt a panel node measures its progress: one panel of
3691
+ the head the attempt landed as (the `head` of its `attempt.settled`) against
3692
+ the starting head, recorded as `optimization.progress-measured {revision,
3693
+ head, start, winRate, judges}`. The engine decides `measure-progress {revision,
3694
+ head, start, harnessPin}` for the oldest landed head without a recorded
3695
+ progress, right after `measure-baseline` in precedence and ahead of
3696
+ integration work. It is not gated on a stop, so a draining node still records
3697
+ the progress of an attempt that lands. The dispatcher admits either
3698
+ measurement as it admits a node verification: the node requests a
3699
+ `verification` slot, is provisioned a workspace, and releases that workspace
3700
+ once no measurement, integration cycle, restack or reconcile needs it.
3701
+
3702
+ **Noise check.** When ε in metric units (absolute, or relative × |median|) is
3703
+ strictly smaller than the starting spread, the runner first records advisory
3704
+ `optimization.noise-exceeded {revision, head, harnessPin, median, spread,
3705
+ epsilon, effectiveEpsilon}`, then the starting value. A panel's spread is the
3706
+ self-comparison's distance from 0.5 and its ε is absolute. The fact is default
3707
+ watch attention naming both numbers. The node still opens; raising ε, or
3708
+ `samples` for a command and `judges` for a panel, is the operator's decision. A relative ε over a zero median is 0, so
3709
+ any positive spread exceeds it. Writing the attention first means a crash
3710
+ between the two facts measures and raises again rather than losing it.
3711
+
3712
+ **Spec revisions.** `ab answer <node> --revise-spec`, `--revise-spec-from-ticket`
3713
+ and an escalation answer that revises the spec check the replacement before
3714
+ recording anything. A revision of an optimization node may change any part of
3715
+ the objective, but it cannot remove the block: close the node and open a new
3716
+ one instead. A revision of a plain node or a work build cannot add one. A
3717
+ replacement block that fails to parse or validate is refused, naming the field.
3718
+ After an accepted `spec.revised` on an optimization node, the dispatcher records
3719
+ `optimization.objective-accepted` again with the next revision and the new
3720
+ `specRev`. It pins the harness again at the current node head when the metric
3721
+ changed, or the purpose of a panel, whose judges read it; otherwise the pin is
3722
+ unchanged. Such a change starts a new ruler (§15.5), which clears the starting
3723
+ value, so the node measures the new pin against itself and runs the noise
3724
+ check again.
3725
+
3726
+ **Quick revisions.** `ab objective <node>` shows the effective objective and
3727
+ progress. With any of `--threshold n`, `--epsilon n|n%`, `--max-attempts n`,
3728
+ `--max-hours n`, `--plateau n`, `--stop-mode abort|drain` or `--concurrency n`
3729
+ it records human `optimization.objective-revised {changes, revision}` first;
3730
+ `--epsilon 2` is absolute and `--epsilon 3%` is relative 0.03. The operator tool
3731
+ `optimization.revise` (input `{repo, slug, threshold?, epsilon?, maxAttempts?,
3732
+ maxHours?, plateau?, stopMode?, concurrency?}`, at least one change) records the
3733
+ same fact and returns `{slug, revision, changes}`. Both refuse a build that is
3734
+ not a node, a node with no accepted objective and a terminal node, and both
3735
+ require the effective objective to remain valid. Running attempts are
3736
+ unaffected and nothing is replanned; the dispatcher applies a revised stop rule
3737
+ on its next tick. The metric, harness and purpose change only through a spec
3738
+ revision.
3739
+
3740
+ The effective objective is the kernel's, reduced from events; a quick revision
3741
+ is never written back to the ticket. `ab ticket show` prints the effective
3742
+ objective of an open optimization node and marks each field that differs from
3743
+ the ticket's block `(revised)`. The open build decides this, not the ticket
3744
+ body: when an edit removes the block or leaves it invalid, every field is
3745
+ marked. `ab ticket tree` labels such a ticket
3746
+ `[node, optimization]`, and status labels the build `optimization node`.
3747
+
3748
+ **Progress surfaces.** The shared dashboard projection gives an optimization
3749
+ node an objective row (RFC 0005 §12): the starting and current value against
3750
+ the threshold, with the baseline's noise; accepted, rejected and running
3751
+ attempts; the budget used; and the stop cause once stopped. A panel objective
3752
+ shows win rates. Budget hours stop at the stop time. The terminal dashboard
3753
+ prints the row under the node's progress bar and in its detail view; `ab
3754
+ status` prints it on a continuation line and `ab build status <node>` under
3755
+ the `optimization node` label. `--json` summaries, `builds.list`, `builds.get`
3756
+ and `ab watch --json` records (`state.objective`, with elapsed hours evaluated
3757
+ at the record's own timestamp) carry the same fields under `objective`, and
3758
+ the dashboard row under `objectiveRow`, in the same terms. Each is projected
3759
+ from the digest in the build state the surface already reads. The web app's
3760
+ progress view is a separate design decision.
3761
+
3762
+ **Attempts.** A build is an attempt of node N exactly when its ticket ref
3763
+ appears in a recorded `optimization.attempts-proposed` of N; the commands below
3764
+ recognize it while the attempt is in flight. Both refs are compared through the
3765
+ recorded ticket-migration identity, so a proposal recorded before a
3766
+ ticket-source migration matches a child dispatched after it; continuity that
3767
+ cannot be resolved fails the command closed instead of treating the build as an
3768
+ ordinary child. Children filed any
3769
+ other way are not attempts and follow the ordinary child rules above. An
3770
+ attempt keeps the ordinary work grammar.
3771
+
3772
+ In every phase of an attempt, `ab context` writes a derived `objective.md`
3773
+ and a manifest `attempt` block `{node, proposal, revision, purpose, metric,
3774
+ harness, current?, path}`: the purpose, the measurement command or panel, the
3775
+ pinned harness, ε, any threshold and the node's current, best and starting
3776
+ values. In implement, `ab done` compares the net contribution (`base..head`,
3777
+ without rename detection) with `metric.harness` and refuses a change to any
3778
+ matching path before any deposit or publication, naming the paths (§8.5). No
3779
+ event is written, so code review never sees such a change.
3780
+
3781
+ An attempt's implementer may decline with `ab done --no-improvement
3782
+ "<reason>"`, which records `implement.declined {round, reason, artifact?}`.
3783
+ Declining needs no commits or clean worktree and publishes nothing. The engine
3784
+ then waits (`declined`), so no review, verification, finalize or measurement
3785
+ runs. The dispatcher appends `attempt.settled {outcome: declined, note:
3786
+ reason}` to N's log if the attempt is still in flight, releases the lease and
3787
+ workspace, and completes the attempt `closed-unmerged`. The flag is refused
3788
+ outside implement and in a build that is not an attempt.
3789
+
3790
+ **Measurement.** A measurement runs two heads in one execution, so a number
3791
+ from another machine is never a baseline (RFC 0005 §7.3, §7.4). Code is
3792
+ authoritative (`packages/core/src/kernel/measurement.ts` for the math,
3793
+ `packages/core/src/processes/measurement-runner.ts` for the execution).
3794
+
3795
+ - *Pairing.* Two detached worktrees, one at the candidate and one at the
3796
+ baseline, are created under the workspace's Git common directory (a commit
3797
+ missing locally is fetched from `origin`). Each of `samples` rounds runs the
3798
+ metric command once per side, baseline first in even rounds and candidate
3799
+ first in odd rounds, so monotone drift cancels. A configured
3800
+ `[commands].setup` runs once in each worktree first. The worktrees are
3801
+ removed afterwards, on failure too.
3802
+ - *Harness pinning.* Before any run, every file matched by `metric.harness`
3803
+ (`compilePathSelectors`) is checked out at `harnessPin` in both worktrees,
3804
+ and every matched file the pin lacks is removed, with literal pathspecs.
3805
+ Only blob entries count. Harness changes in the candidate, or arriving
3806
+ through a node restack, therefore never affect a measurement.
3807
+ - *Output contract.* Each run runs `sh -c <command>`, must exit 0, and must
3808
+ print, trimmed, exactly one JSON object whose `value` is a finite number.
3809
+ Every sample run and setup run has a 30-minute timeout.
3810
+ - *Decision.* A side's value is its median (the mean of the two middle values
3811
+ for an even count). The delta is direction-aware (§15.5). ε in metric units
3812
+ is `absolute`, or `relative × |baseline median|`. A delta ≥ ε is `improved`;
3813
+ anything less is `no-improvement`. Significance tests are not applied. One
3814
+ definition of this effective ε serves both the recorded `decision` and the
3815
+ landing gate's classification, so the two cannot disagree on the same
3816
+ measurement. A panel's delta is `winRate − 0.5` with ties counted as half, and its ε is
3817
+ absolute: a win rate ≥ 0.5 + ε is `improved`, compared with a 1e-9 float
3818
+ tolerance so that, for example, 3 of 5 judges meets ε 0.1.
3819
+ - *Attempts.* `attempt.measurement-requested` names the candidate, baseline,
3820
+ harness pin, objective revision and, additively, the node's `metric`, a
3821
+ command or a panel; a panel request also carries the objective `purpose`,
3822
+ which its judges read. The engine decides `run-measurement` for a leaf at `wait
3823
+ awaiting-pr` whose latest request is neither sampled nor measured and whose
3824
+ baseline is still the node head the child last observed, so restack,
3825
+ re-verify and reconcile keep precedence, and the dispatcher admits it as a
3826
+ re-verify (§12). A request whose baseline a later `target.moved` superseded
3827
+ is skipped: it gets no runner and no slot, and the landing gate records a
3828
+ current request once the child is restacked. Samples already running when
3829
+ the head moves are still recorded and decided, and the gate rejects the
3830
+ result as stale. The attempt's runner holds only its own build, so it
3831
+ samples in the attempt's workspace and records kernel `attempt.sampled
3832
+ {request, candidate, baseline, harnessPin, revision, samples, medians,
3833
+ report}`, which carries no decision. A panel request is sampled by one judge
3834
+ panel (**Judge panels**) of the attempt's head against the node head, with
3835
+ panel id `attempt-<request>`: a crash resumes that panel, and after an
3836
+ answered measurement escalation the id becomes `attempt-<request>-a<seq>`,
3837
+ the answer's sequence number, so the answer judges afresh. Its
3838
+ `attempt.sampled` carries `winRate` in place of `medians`, `samples` as the
3839
+ judge count, and a report holding the judgments. When the lease sweep finds a parked
3840
+ leaf whose latest request is sampled and undecided, the dispatcher reads the
3841
+ node's reduced state once, revalidates the request's revision against the
3842
+ node's ruler and its harness pin against the node's pin, and records
3843
+ dispatcher `attempt.measured` with the decision against the node's current ε
3844
+ and its starting spread as `spread`. A quick ε revision made while the
3845
+ samples ran therefore applies. A panel's `attempt.measured` carries the win
3846
+ rate in place of medians; it needs no starting value, and carries `spread`
3847
+ only when the node has one. The dispatcher also refuses a panel request whose
3848
+ judges, rubric, harness or purpose differ from the node's.
3849
+ - *Failures.* A command failure, a timeout, output outside the contract, a
3850
+ worktree or setup failure, a request with no metric, a failed judge panel (a
3851
+ judge that exhausted its attempts, or variants that could not be prepared)
3852
+ or a panel request with no purpose records no value or decision. The kernel raises `escalation.raised {phase:
3853
+ measurement, source: policy, policyCause: measurement-failed}` naming the
3854
+ cause, the sample and the output tail; the build is blocked, and the answer
3855
+ makes the request (or due starting value) pending again, so it is measured
3856
+ again. A request whose ruler or pin was replaced before its decision is
3857
+ refused the same way by the dispatcher, and stays refused after the answer:
3858
+ the attempt needs a fresh request. `measurement` is an escalation target, not
3859
+ a phase: its answers route no guidance into a phase and reset no phase
3860
+ failures.
3861
+ - *Spread and report.* A command's `attempt.measured` carries the node's
3862
+ starting spread beside its delta, and watch prints it. Both measurement facts and
3863
+ `attempt.sampled` reference a `measurement-samples` artifact with the raw
3864
+ per-sample values, or a panel's judgments, deposited with the fact.
3865
+
3866
+ **Landing gate.** Passing verify and finalize is necessary but no longer
3867
+ sufficient for a child of an optimization node: it lands only with a measurement
3868
+ (RFC 0005 §6.3, §6.4). Readiness to land is decided as for any node-target
3869
+ child, independently of measurement. A ready child then needs a result that
3870
+ applies: the latest `attempt.measured` answering the child's latest
3871
+ `attempt.measurement-requested`, whose `candidate` is exactly the child's
3872
+ candidate head, whose `baseline` is exactly the node head it lands on, whose
3873
+ `harnessPin` is the accepted pin, and whose `revision` is at least the ruler
3874
+ revision. A restack changes the candidate and a sibling landing moves the node
3875
+ head, so either makes a result stale by construction and the dispatcher records
3876
+ a new request on the child's log. An unsampled request whose baseline the
3877
+ child has already seen superseded is skipped rather than measured. A clean restack keeps verification; it never
3878
+ keeps a measurement. A request is recorded only once the candidate sits on the
3879
+ observed node head. The node writer is never held during a measurement, and its
3880
+ guarded merge is guarded on the measured baseline: under the writer
3881
+ reservation, the destination snapshot must equal the measured baseline and the
3882
+ source snapshot the measured candidate, or the landing is refused and retried.
3883
+ A reservation recovered after an interrupted landing publishes only while its
3884
+ reserved pair still passes the gate under the current objective; otherwise the
3885
+ writer abandons the reservation and the next poll measures or settles the
3886
+ child. A write that already happened is recovered by readback, never undone.
3887
+
3888
+ The dispatcher classifies a result from its recorded `delta` and the effective
3889
+ ε (relative ε is scaled by |baseline median|); the recorded `decision` is
3890
+ informational. An attempt lands when `delta` ≥ ε. Otherwise it settles
3891
+ `no-improvement`, its PR closes without merging, and no further implement
3892
+ round runs. Any other child lands when `delta` ≥ −ε; a regressing child raises
3893
+ one kernel escalation `landing-regressed-<request>` naming both medians (a
3894
+ panel's win rate), the delta and ε, and an answer requests a fresh
3895
+ measurement. A panel result is classified from its win rate with the same
3896
+ tolerance as its decision: an attempt lands when it reaches 0.5 + ε, any other
3897
+ child when it reaches 0.5 − ε. Its settlement records baseline 0.5 and the
3898
+ win rate as the candidate. `ab watch` and `ab build status <child>` print the
3899
+ recorded measurement: a command's medians or a panel's win rate, the delta and
3900
+ the decision. Such children never
3901
+ settle and count toward neither budget nor plateau.
3902
+
3903
+ An attempt whose candidate head changes a harness path escalates instead of
3904
+ being measured: one kernel escalation `landing-harness-<head>` names the matched
3905
+ paths, and that head is never measured, even after an answer. The check reads
3906
+ the head's recorded changed paths; a head without them waits, as a deferred
3907
+ merge decision does.
3908
+
3909
+ **Turn.** An attempt whose latest request was overtaken three consecutive
3910
+ times (three requests whose baseline differed from the previous request's)
3911
+ holds the node's next turn while it is open, not paused, aborted or closed, and
3912
+ has no open escalation other than a janitor one. While another child holds the
3913
+ turn, a candidate neither requests a measurement nor lands. When several
3914
+ qualify, the first in proposal order holds it.
3915
+
3916
+ **Progress first.** While a panel node's digest holds a landed head that owes
3917
+ a progress panel, a child that would otherwise land waits (`wait-progress`);
3918
+ its measurement may still be requested and run. The node head therefore never
3919
+ moves past an unmeasured accepted head under kernel control.
3920
+
3921
+ **Settlement.** Every attempt settles exactly once, on the node's log, by the
3922
+ dispatcher path that ends it: `accepted` when it merges, with the measurement
3923
+ of the merged head; `no-improvement` at the gate; `aborted` when an operator
3924
+ aborts it or a human closes its PR without merging. An `accepted` settlement
3925
+ records the merged SHA as `head`, the node head it landed as. `declined` is recorded when an implementer declines as described above;
3926
+ `stopped` is recorded by the stopping rules (RFC 0005 §9). The
3927
+ write is conditional on the node log and the attempt still being in flight.
3928
+ Each settlement other than `accepted` and `merged-unmeasured` leaves a pending
3929
+ rejection in the node's digest. Once the attempt has no build or its build is done, the node's janitor
3930
+ poll moves the ticket to the rejected role, comments the outcome, and records
3931
+ `attempt.ticket-rejected {proposal, ticket, state}`. Until then the attempt's
3932
+ own terminal paths skip their triage hand-back, so its ticket never reaches
3933
+ triage. A merged attempt's ticket moves to done as for any child.
3934
+
3935
+ A merge is `accepted` only with a result for exactly the merged head that
3936
+ answers a request of this node. Anything else, typically a forge-side human
3937
+ merge, records `attempt.merged-unmeasured {proposal, ticket, build, sha?,
3938
+ reason, measuredCandidate?}` on the node, once, with one followup observation on
3939
+ the child. The reason is `absent` (no result), `stale-head` (the result
3940
+ measured `measuredCandidate`), `unrelated` (the latest request named another
3941
+ node) or `unresolvable` (the child recorded no merged head, the only case
3942
+ without `sha`). The attempt stays in flight and keeps its concurrency slot;
3943
+ `ab objective`, `ab build status <node>` and the objective row name it and say
3944
+ why the slot is held. On every node tick the dispatcher also reconciles merges
3945
+ that completed with neither record, such as merges from before the marker
3946
+ existed. That pass scans the in-flight entries over the tick's build listing,
3947
+ reads one merged child's reduced facts once, and writes the marker, or
3948
+ `accepted` when that head was measured. An operator releases a marked attempt
3949
+ with `ab objective <node> --settle-unmeasured <proposal|build> --policy
3950
+ release-unmeasured [--note <text>]` or the operator tool
3951
+ `optimization.settle-unmeasured` (input `{repo, slug, attempt, policy,
3952
+ note?}`, receipt `{slug, proposal, build, outcome, policy}`). The policy is
3953
+ required. `release-unmeasured` records `attempt.settled {outcome:
3954
+ merged-unmeasured, policy, mergedSha?}` with a human actor and no
3955
+ measurement. It releases the slot exactly once, counts in
3956
+ `attempts.unmeasured`, and leaves `current`, `best` and `plateau` unchanged.
3957
+ It adds no pending rejection, because the ticket is already done. The action
3958
+ works on a stopped node, revalidates the child's merged head, and refuses
3959
+ settled, unmerged or unmarked attempts, measured heads and terminal nodes.
3960
+
3961
+ A `declined` or `no-improvement` attempt whose build published (it completed
3962
+ an implement round or opened a PR) carries its build branch as
3963
+ `attempt.branch`. The pending rejection keeps it as a cleanup obligation. Once
3964
+ the build is done, the sweep checks the guards first: the branch must be that
3965
+ attempt build's own, the build must target this node, and the branch must be
3966
+ neither the node's branch nor its base. It then deletes the branch through the
3967
+ forge and records `attempt.branch-deleted {proposal, build, branch}`. A branch
3968
+ that is already absent counts as deleted, and a crash before the record repeats
3969
+ the delete. A refused guard or a failed delete records
3970
+ `attempt.branch-cleanup-failed {proposal, build?, branch, error}` once per
3971
+ distinct error. The obligation then stays pending and holds the slot, and the
3972
+ ticket moves to rejected only after the branch is gone. The settlement itself
3973
+ never changes. Cleanup runs even without a configured rejected role.
3974
+ Aborted and stopped attempts keep abort cleanup's own branch deletion.
3975
+
3976
+ | Outcome | Ticket role |
3977
+ |---|---|
3978
+ | `accepted`, `merged-unmeasured` | done |
3979
+ | `no-improvement`, `declined`, `stopped`, `aborted` | rejected |
3980
+
3981
+
3982
+ Starting and progress measurements have precedence over new proposer admission.
3983
+ An open but unstarted proposer request waits while a measurement is owed or running.
3984
+ A proposer already admitted when a measurement becomes due finishes or resumes
3985
+ with its granted allowance, and its deposit is filed normally. Measurement runs
3986
+ next, before another proposer. The node workspace remains held while either a
3987
+ starting or progress measurement or a
3988
+ proposal request or session needs it; neither owner releases the other’s workspace.
3989
+
3990
+ **Proposing.** An optimization node proposes its own attempts in the
3991
+ `propose` phase (§5). The dispatcher appends
3992
+ `optimization.proposal-requested {id, head, room, budgetUsed}` when the
3993
+ selector `proposerAdmissible` holds (§15.5). Room is the smaller of the free
3994
+ concurrency slots and the remaining attempts budget, and zero once the
3995
+ attempts or hours budget is spent. An open request reserves the node's single
3996
+ outstanding proposal round, so no second request is made while it is open; it
3997
+ may be waiting for capacity, running, or awaiting filing after deposit. A
3998
+ running proposer session is identified by its matching started phase and
3999
+ session, not by an open request alone. A node that is
4000
+ paused or blocked, has pending commands, has an active or conflicted node
4001
+ restack, has a landing intent, has a merged or closed PR, or is deferred for
4002
+ runtime compatibility is not requested; the dispatcher instead records
4003
+ `optimization.proposal-deferred {reason}` (`paused`, `blocked`, `command`,
4004
+ `restack`, `integration`, `landing` or `compatibility`), and reconsiders the
4005
+ node only after a fact that can clear the blocker lands on its log. The
4006
+ request is the node's `propose` slot request, admitted ahead of normal ticket
4007
+ claims (§13.1, §12 "Slot admission order"). Before admission the dispatcher re-checks it against current
4008
+ state: a request whose node has stopped, whose hours budget expired, whose
4009
+ room fell to zero or below the recorded room, or whose node has no free
4010
+ concurrency slot, and for which no session has started, records
4011
+ `optimization.proposal-withdrawn {request, reason: stopped|budget|concurrency}`.
4012
+ A withdrawal clears the request and never counts as an empty proposal. A
4013
+ session that already started keeps the room it was granted, and a deposit is
4014
+ never trimmed.
4015
+
4016
+ The dispatcher provisions a workspace at the request head and launches the
4017
+ node runner, which appends `propose.started {round, request}`, checks out the
4018
+ head detached and runs the `ab-propose` skill. `ab context` materializes
4019
+ `objective.json` (the effective objective, revision and revised fields),
4020
+ `progress.json` (starting, current, best and threshold values, attempt counts,
4021
+ attempts in flight, plateau, consecutive empty proposals and the request) and
4022
+ `ledger.json` (settled attempts with near misses flagged, and attempts in
4023
+ flight), with the spec, answered guidance and assets. `ab propose <file>`
4024
+ takes `{proposals: [{id, title, strategy, body}], reason?}`: kebab-case ids
4025
+ unique in the file and never used before by the node, single-line titles and
4026
+ strategies, spec-standard bodies with no `autobuild-objective` block, at most
4027
+ the request's room, and a reason when the list is empty (`ab propose --none
4028
+ <reason>`). It deposits an `attempts` artifact and agent
4029
+ `propose.completed {round, request, proposals, artifact}` atomically. The
4030
+ proposer never creates tickets.
4031
+
4032
+ The dispatcher reads the deposited artifact once and creates one work ticket
4033
+ per proposal, targeting the node, in the source's ready role. Each ticket
4034
+ carries every `readyLabels` entry and, when `[tickets].readyAssignee` is set,
4035
+ is assigned to that user, adopted tickets included, so intake lists it. Each creation
4036
+ carries an idempotency key derived from the repository, the node slug and the
4037
+ proposal id, so a crash between deposit, creation and recording adopts the
4038
+ existing ticket instead of filing a second one. Until the record lands,
4039
+ intake withholds ready tickets whose creation key matches a deposited
4040
+ proposal. When every ticket exists it appends
4041
+ `optimization.attempts-proposed {request, proposals, reason?}` and releases
4042
+ the node's workspace. A source without the integration-tree capability, or an
4043
+ unreadable artifact, raises an escalation on the node in phase `propose`
4044
+ instead of creating anything. Two consecutive empty `attempts-proposed`
4045
+ records stop the node: the dispatcher appends
4046
+ `optimization.stopped {cause: exhausted, mode}` with the objective's stop
4047
+ mode, and admission requests no further proposals. Recording the stop is
4048
+ separate from applying it: aborting or draining attempts in flight under that
4049
+ mode belongs to the stop policy, not to the proposer.
4050
+
4051
+ Discovery reads only build digests. Each build digest carries an
4052
+ `optimization` signal, `false` for a plain node and a bounded summary for an
4053
+ optimization node (stop, measurement, attempts in flight, concurrency,
4054
+ attempt room, empty proposals, opening time, hours budget, the open request
4055
+ and its deposit, and the latest wake and deferral sequences), from which the
4056
+ dispatcher selects nodes to request, file or stop. A store service whose digest
4057
+ lacks the member fails the proposer stage and the creation hold closed with a
4058
+ typed capability error: nothing is proposed and every ready ticket carrying a
4059
+ creation key is withheld that pass. There is no per-node fallback read.
4060
+
4061
+ **Stopping.** An optimization node is done when its number is good enough,
4062
+ when it stops getting better, when its budget runs out, or when an operator
4063
+ takes the progress so far. Every accepted attempt improved the node head, so a
4064
+ stop at any point lands real, verified progress. The node records
4065
+ `optimization.stopped {cause, mode}` once; the first one is kept. The causes:
4066
+
4067
+ - `threshold`: the node head's value (`current`, §15.5) has reached
4068
+ `target.threshold` in the objective's direction;
4069
+ - `plateau`: `stop.plateau.attempts` consecutive `no-improvement` or `declined`
4070
+ settlements;
4071
+ - `budget`: attempts filed reached `budget.maxAttempts`, or the hours since the
4072
+ first acceptance reached `budget.maxHours`;
4073
+ - `exhausted`: recorded by the proposer when it has nothing left to try;
4074
+ - `operator`: recorded by a human through `ab objective <node> --stop` or the
4075
+ operator tool `optimization.stop`.
4076
+
4077
+ The dispatcher checks every open, unpaused optimization node on every tick,
4078
+ independent of janitor backoff and idle polling, from the reduced digest and
4079
+ the current time. It records the first eligible cause in the order threshold,
4080
+ plateau, budget, with the objective's `stop.mode`. The effective objective is
4081
+ the one checked, so a quick revision of the threshold, budget or plateau takes
4082
+ effect on the next tick with no replanning. `ab objective <node> --stop
4083
+ [--drain | --abort]` and `optimization.stop` (input `{repo, slug, mode?}`,
4084
+ receipt `{slug, cause, mode}`) record cause `operator`; without a flag the
4085
+ objective's stop mode applies, and that defaults to `abort`. Both refuse a
4086
+ build that is not a node, a node with no objective, a terminal node and a node
4087
+ that has already stopped. `--stop` does not combine with revision flags. A stop
4088
+ is final: a later revision is recorded but never resumes proposing.
4089
+
4090
+ Every stop, whatever its cause, is enforced the same way on each tick until no
4091
+ attempt is in flight:
4092
+
4093
+ - An attempt with no build, or whose build has not started work, is cancelled in
4094
+ both modes. A queued build receives a dispatcher `build.abort-requested`
4095
+ naming the stop.
4096
+ - In `abort` mode a running attempt receives a dispatcher
4097
+ `build.abort-requested`, and the ordinary abort saga acknowledges and cleans
4098
+ it up.
4099
+ - In `drain` mode a running attempt finishes and faces the landing gate, which
4100
+ settles it.
4101
+ - An attempt cancelled before it has a build settles `stopped` through the stop
4102
+ enforcer. For an aborted build, cleanup is the single settlement writer; the
4103
+ landing gate and stop enforcer never settle it.
4104
+
4105
+ The first recorded `build.abort-requested` fixes the abort's cause. A node-stop
4106
+ request records `origin {kind: optimization-stop, node}`; an operator request has
4107
+ operator origin (no node-stop origin). Abort cleanup alone settles an aborted
4108
+ build: `stopped` for a node-stop request, `aborted` for an operator request.
4109
+ An existing request is never replaced: identical repeats are idempotent and
4110
+ conflicting operator requests are refused. The stop enforcer waits for a pending
4111
+ abort, so an operator abort before a stop remains `aborted`; an operator abort
4112
+ during drain is also `aborted`. Settlement is conditional on the attempt still
4113
+ being in flight, and the existing node sweep alone moves its ticket to rejected.
4114
+
4115
+
4116
+ Dispatch refuses an attempt ticket of a stopped node, whether still in flight or
4117
+ settled `stopped`, with the diagnostic `target optimization node <id> has
4118
+ stopped; attempt <ticket> is cancelled`. Children filed any other way are still
4119
+ admitted. No proposer session is admitted once the node has stopped or any stop
4120
+ cause is eligible. A proposer session that had already started keeps its granted
4121
+ allowance and may finish or resume; its deposited proposals are filed and
4122
+ recorded, and the stopped node's attempt handling cancels and settles those
4123
+ attempts, so no fresh attempt work runs.
4124
+
4125
+ **Completion.** An optimization node is complete when it has stopped, no
4126
+ attempt is running or waiting to land, and its child enumeration satisfies the
4127
+ node completion rule above. It then follows the ordinary node grammar through
4128
+ verify, authorization and merge. Stopping is not consent: `ab merge <node>`
4129
+ refuses an optimization node that has not stopped, or whose attempts are still
4130
+ in flight, naming the reason. To land the progress so far, stop the node, then
4131
+ run `ab merge` once it is ready.
4132
+
4133
+ **Judge panels.** A panel objective is measured by agent judges, because
4134
+ absolute scores drift between sessions and crowd the top of the scale: each
4135
+ judge says which of two variants is better. `BuildRunner.runPanel` runs one
4136
+ panel over two heads, a candidate and a baseline, under one harness pin, and
4137
+ returns the candidate's win rate. The node runner calls it for a panel node's
4138
+ starting measurement and its progress, with panel ids
4139
+ `baseline-<ruler>-<pin>-r<g>` and `progress-<ruler>-<head>-r<g>`; attempt
4140
+ acceptance by win rate is a separate caller that records
4141
+ `attempt.measured.winRate`. A run records `panel.started` with its
4142
+ inputs and no order. For each pending judge it draws an order
4143
+ (`candidate-first` or `baseline-first`) and materializes a fresh judge root in
4144
+ the system temporary directory holding the two variants as plain trees `A/`
4145
+ and `B/` in that order, a brief (judge, purpose, rubric path) and the
4146
+ `ab-judge` skill as regular files. The variants are checked out from scratch
4147
+ indexes in a private bare Git directory over the workspace's objects, with
4148
+ every byte-altering attribute unset, so each tree carries the exact committed
4149
+ blobs; every harness path, the rubric included, carries the harness pin's
4150
+ bytes, and a harness file the pin lacks is absent. The skill is read from the
4151
+ harness pin's `.agents/skills/ab-judge/SKILL.md`, or from the distribution
4152
+ when the pin predates it, so a candidate cannot rewrite its judges'
4153
+ instructions. That Git material lives outside every judge root and is removed
4154
+ before any judge session starts.
4155
+
4156
+ The protected locations are the workspace, its checkout, its Git common
4157
+ directory, the main checkout owning that directory, and a local store. Before
4158
+ any material is written, the runner refuses a temporary directory at or under
4159
+ one of them, or one from which Git discovery (across filesystem boundaries)
4160
+ does not report "not a git repository"; any other discovery result fails
4161
+ closed. After materialization it refuses a root that fails the same checks or
4162
+ holds a checked-out symlink resolving outside the root, and fails the run with
4163
+ that cause, which never names the path. Symlinks that stay inside the root are
4164
+ kept. The judge's `ab` is a self-contained, judge-only bundle written to a
4165
+ launcher directory beside the roots; the run refuses launcher text naming a
4166
+ protected location or the distribution, and refuses to launch when `bun` or
4167
+ the judge runtime's executable resolves only at or under a protected location
4168
+ through the judge's filtered `PATH`. A runtime adapter that would pass a
4169
+ protected path in its own launch arguments refuses the judge's start. Every
4170
+ judge root and the launcher directory are removed when the run ends.
4171
+
4172
+ Each judge's order is recorded in the kernel fact `panel.judge-started` before
4173
+ its session starts, under the `judge` role and the build's profile, with the
4174
+ judge root as working directory; all pending judges run concurrently. The
4175
+ judge's environment and Store authority are those of §8.1. The judge
4176
+ runs `ab judge context` and ends with `ab judge prefer`, which records
4177
+ `panel.preferred {panel, judge, session, preference, reason}` without the
4178
+ order, attributed to the judge session; a local judge's outbox is committed by
4179
+ the runner after the turn with the same atomic check the service applies.
4180
+ After the turn the runner makes one reduced read and, when the session
4181
+ preferred, records `panel.judged {panel, judge, session, order, preference,
4182
+ reason}`, the durable judgment, then `panel.judge-ended` with the outcome and
4183
+ the transcript. A preference for the candidate scores 1, a tie 0.5 and the
4184
+ baseline 0; the win rate is the mean over `panel.judged`.
4185
+
4186
+ A judge launch follows the `judge` role's provider alternates under the §8.4
4187
+ eligibility rules; a credential delegation failure, an expired budget and a
4188
+ shutdown are not eligible. Each target is its own judge session in the same
4189
+ root and order, with its own `panel.judge-started` (its `substitution` naming
4190
+ the failed session), credential, stream and transcript. Each alternate's
4191
+ executable is checked like the primary's before it launches; a refused
4192
+ alternate is not started, ends the chain, and its reason is appended to the
4193
+ failed session's error. A fallback happens only after the failed session's
4194
+ preference is settled and its `panel.judge-ended` is recorded, and never after
4195
+ any preference, saved outbox or unreadable outbox for that judge; a preference that raced that
4196
+ end stops the chain and is completed like any saved preference.
4197
+
4198
+ Nothing Autobuild gives a judge reveals which variant is the candidate: not its
4199
+ context, its environment, its labels, the location or names of its variant
4200
+ worktrees, its store credential, nor any git metadata reachable from its
4201
+ working directory. Nothing under the judge's root links back to the repository
4202
+ it was prepared from, and nothing Autobuild supplies (environment, `PATH`,
4203
+ launcher content, launch arguments, working directory, scratch ancestry) names
4204
+ a protected location, whether by its real path or by a path that reaches it
4205
+ through a symlink, including a path embedded after a prefix such as `-I` or on
4206
+ one line of a multiline value; an inherited path that cannot be resolved is
4207
+ dropped too.
4208
+ This guarantee covers the channels Autobuild provides; a
4209
+ judge process deliberately searching the filesystem outside its root is the
4210
+ shared trust boundary of unconfined local agent sessions, and no general
4211
+ sandbox is claimed.
4212
+
4213
+ A run with the same panel id resumes from its recorded facts and refuses
4214
+ different inputs. A judge session started and never ended is closed as
4215
+ `reclaimed`, after any outbox preference it saved is committed while it is
4216
+ still open; its stream, if any, is closed after that commit and before the
4217
+ `reclaimed` end. A judge with a saved `panel.preferred` and no `panel.judged`
4218
+ is then completed from that preference and its session's recorded order
4219
+ without a new session. Only judges with no preference run again, each with a fresh
4220
+ order. A judge outcome of `no-terminal`, `failed` or `expired` counts as a
4221
+ failure, except a session that a later start's substitution replaced: only a
4222
+ chain's last failure counts; after two counted failures for one judge the run fails, naming the
4223
+ judge and its last outcome. `interrupted` (shutdown) and `reclaimed` do not
4224
+ count. A run that cannot prepare its variants fails with the Git output tail.
4225
+
4226
+ A failed node panel records no value and raises the kernel escalation
4227
+ `node-panel-failed-<panel>` with policy cause `measurement-failed`. The
4228
+ generation `g` in a node panel's id is the number of answered failure
4229
+ escalations for its base, derived from reduced state: a restart before the
4230
+ answer resumes the same run, and an answer starts a new run with no counted
4231
+ judge failures.
4232
+
4233
+
4234
+
3285
4235
 
3286
4236
 
3287
4237
  ## 14. Operator UI
@@ -3367,8 +4317,8 @@ backfill, and migration reruns preserve counters. Hosted reads use one GET
3367
4317
  `/repos/:repo/builds` returns scoped build records. Both routes authorize the
3368
4318
  repository before reading and support repositories with builds but no journal.
3369
4319
 
3370
- Durable operator settings (intake, repository pause, harvest gate) survive
3371
- restarts through the repository journal. Per-merge hold and merge commands
4320
+ Durable operator settings (intake, repository pause, harvest gate) and pending
4321
+ single-ticket start requests survive restarts through the repository journal. Per-merge hold and merge commands
3372
4322
  live in the build log. Merge policy is declarative dispatcher configuration
3373
4323
  (§15.7); there is no writable repository auto-merge default.
3374
4324
 
@@ -3550,9 +4500,10 @@ rejection is `EventValidationError`.
3550
4500
  `Autobuild-Build: <slug>` identifies the build's change across such rewrites
3551
4501
  (RFC 0001 §5). Branch presence is determined by exact parsed trailer values
3552
4502
  in reachable history, not recorded SHA ancestry. Kernel-owned single-change
3553
- replay, durable rewrite facts and immutable forge archive refs preserve
3554
- historical SHAs (§15.7); the original no-rebase rationale does not prohibit
3555
- this archived replay standard.
4503
+ replay, durable rewrite facts and best-effort retained history (immutable
4504
+ forge archive refs, else BuildStore copies) preserve historical SHAs
4505
+ (§15.7); the original no-rebase rationale does not prohibit this retained
4506
+ replay standard.
3556
4507
  5. **Append-only; corrections are new events.**
3557
4508
  6. **Liveness is not history.** Heartbeats and runner leases are mutable
3558
4509
  columns on the `builds` table, never events — they would drown the log.
@@ -3579,22 +4530,25 @@ with illustrative members:
3579
4530
 
3580
4531
  | Family | Examples |
3581
4532
  |---|---|
3582
- | Build lifecycle | `build.created` (carrying `assets`, the claim-time pin, §6.3), `workspace.provisioned`, `workspace.cleanup-required`, `workspace.fenced`, `workspace.commits-preserved`, `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`, `build.completed` |
3583
- | Operator commands [D2] | `build.abort-requested {reason?, to?}` → `build.aborted`; `build.pause-requested` → `build.paused`; `build.discard-requested`; `build.hold-requested`; `build.land-requested` → `landing.command-acknowledged`; `escalation.answered` (optionally carrying a validated `reviewRoundCeiling`, or the `assets` sampled with a revise-from-ticket authorization) |
3584
- | 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` |
3585
- | Spec | `spec.imported`, `spec.authored`, `spec.revised` (either positive `escalation` sequence or exclusive `operator: {user, via?}` provenance for an idle node; optionally carrying `assets`, a re-pin of the ticket's assets, §6.3) |
4533
+ | 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`, `build.completed` |
4534
+ | 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) |
4535
+ | 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}` |
4536
+ | 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) |
3586
4537
  | 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) |
3587
- | Plan/code loops | `plan.started` … `plan-review.verdict`; `implement.started` … `code-review.verdict` |
4538
+ | 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) |
3588
4539
  | 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?}` |
3589
4540
  | Integration attention | Kernel/dispatcher `integration.verification-failed {id, head, parent, steps, guidance}`: one durable failed-cycle notification, recovered from exact verification receipts |
3590
4541
  | 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) |
3591
4542
  | PR attachments | `pr-attachment.designated`, `pr-attachment.hosted`, `pr-attachment.reclaimed`, `pr-attachment.reclaim-failed` |
3592
- | Leaf restacking | `target.moved {branch, sha, lineage?}`, `target.rewritten {branch, previousSha, sha}`, `target.rewrite-cleared {branch, sha, lineage?}`, 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}` |
4543
+ | Leaf restacking | `target.moved {branch, sha, lineage?}`, `target.rewritten {branch, previousSha, sha}`, `target.rewrite-cleared {branch, sha, lineage?}`, 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) |
3593
4544
  | Head path facts | advisory `head.paths-recorded {source, head, destination, mergeBase, total, preview, resolution?, artifact}` |
3594
- | Post-PR [D1] | `pr.merged`, `pr.conflicted`, `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") |
4545
+ | 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) |
4546
+ | 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") |
3595
4547
  | Cross-cutting | `observation.recorded`, `escalation.raised`, `phase.failed`, `session.build-read-failed`, `session.build-read-recovered`, `phase.deferred`, `phase.deferral-escalated` |
3596
4548
  | Ticket waits (§11) | Agent `wait.requested {id, phase, round, tickets, reason, publication?: {branch, base, sha, settlement: published \| requested}}`; dispatcher `wait.published {id, sha}`, `wait.refused {id, cause: unknown-ticket \| own-ticket \| completed \| no-source-ticket \| publication-lost, tickets, message}` and `wait.entered {id, escalation, tickets, reason, question}`; dispatcher, kernel or human `wait.ended {id, cause: operator \| automatic, message}`; dispatcher policy `escalation.raised {policyCause: wait-unresolvable}` ends an open wait whose ticket was rejected or deleted |
3597
- | 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` |
4549
+ | Optimization (§13.1.1) | Dispatcher `optimization.objective-accepted {objective, revision, harnessPin, specRev}`; human `optimization.objective-revised {changes, revision}` (revision ≥ 2; `changes` a nonempty subset of threshold, epsilon, maxAttempts, maxHours, plateau, stopMode, concurrency); `optimization.baseline-measured {revision, head, harnessPin, samples, median, spread, report?}` (a panel records its self-comparison win rate and that rate's distance from 0.5); advisory `optimization.noise-exceeded {revision, head, harnessPin, median, spread, epsilon, effectiveEpsilon}`; dispatcher `optimization.proposal-requested {id, head, room, budgetUsed: {attempts, hours}}`; dispatcher `optimization.proposal-deferred {reason: paused \| blocked \| command \| restack \| integration \| landing \| compatibility}`; dispatcher `optimization.proposal-withdrawn {request, reason: stopped \| budget \| concurrency}`, which clears an undeposited request and never counts as an empty proposal; dispatcher `optimization.attempts-proposed {request, proposals: [{id, ticket, title, strategy}], reason?}`, written after ticket creation, with `reason` required when `proposals` is empty; `attempt.measurement-requested {id, node, candidate, baseline, harnessPin, revision, metric?, purpose?}` (`metric` the node's command or panel metric; `purpose` the objective purpose, required with a panel metric); kernel `attempt.sampled {request, candidate, baseline, harnessPin, revision, samples, medians?: {candidate, baseline}, winRate?, report}` with exactly one of `medians` and `winRate` (`samples` is a panel's judge count); `attempt.measured {request, candidate, baseline, harnessPin, revision, samples, medians?: {candidate, baseline}, winRate?, delta, decision: improved \| no-improvement \| non-regressing \| regressed, spread?, report?}` with exactly one of `medians` and `winRate`; `optimization.progress-measured {revision, head, start, winRate, judges}`; `attempt.settled {attempt: {proposal, ticket, build?, branch?}, outcome: accepted \| no-improvement \| declined \| stopped \| aborted \| merged-unmeasured, measurement?: {revision, baseline, candidate, delta}, policy?: release-unmeasured, mergedSha?, note?, head?}`, with `measurement` required for `accepted` and `no-improvement`, `policy` required and `measurement` forbidden for `merged-unmeasured` (human actor), `policy` and `mergedSha` allowed only with it, `head` (the landed node head) only for `accepted`, and `attempt.branch` only for `declined` and `no-improvement`; `attempt.merged-unmeasured {proposal, ticket, build, sha?, reason: absent \| stale-head \| unrelated \| unresolvable, measuredCandidate?}`, with `sha` absent exactly for `unresolvable`; dispatcher `attempt.ticket-rejected {proposal, ticket, state}`, recording a settled attempt ticket move to rejected; dispatcher `attempt.branch-deleted {proposal, build, branch}` and `attempt.branch-cleanup-failed {proposal, build?, branch, error}` for a settled attempt's branch cleanup obligation; `optimization.stopped {cause: threshold \| plateau \| budget \| exhausted \| operator, mode: abort \| drain}`. `attempt.measurement-requested`, `attempt.sampled` and `attempt.measured` are on the attempt's log; every other member, including `attempt.settled`, is on the node's log. The dispatcher records `exhausted` after two consecutive empty proposals. All are decisive except advisory `optimization.noise-exceeded`. A measurement failure is a kernel or dispatcher `escalation.raised {phase: measurement, source: policy, policyCause: measurement-failed}`. |
4550
+ | 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. |
4551
+ | 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) |
3598
4552
 
3599
4553
  Abort cleanup is a dispatcher-owned ordered saga. While an execution lease is
3600
4554
  live, the janitor defers the saga so it cannot race process-tree teardown. Once
@@ -3611,7 +4565,11 @@ idempotent and the three `abort.*` facts checkpoint projections across crashes;
3611
4565
  `abort.ticket-returned` records the destination, the requested role, the reason
3612
4566
  and the missing parts, so a retry reports exactly what the committed move did
3613
4567
  and never writes the ticket again. Missing Forge capabilities or outages leave
3614
- the remainder due on the next tick.
4568
+ the remainder due on the next tick. An optimization attempt is the exception:
4569
+ its cleanup settles it `aborted` on the node's log and skips the label, the
4570
+ move, the `abort.ticket-returned` checkpoint and the hand-back report, because
4571
+ its node's sweep moves the ticket to the rejected role (§13.1.1). A closed
4572
+ attempt PR likewise records no `build.ticket-returned`.
3615
4573
 
3616
4574
  Every dispatcher hand-back of a claimed or ready ticket other than completion —
3617
4575
  abort, spec-standard bounce, preparation recovery returning a confirmed claim,
@@ -3670,6 +4628,18 @@ complete receipt, retained across crashed implement reruns and guidance rounds.
3670
4628
  Both new event types are decisive under version-tolerant reads, fencing older
3671
4629
  engines while their known event payloads remain valid after projection.
3672
4630
 
4631
+ **Reopen.** The reduced `reopen {seq, ts, user, via?, feedback?, spec?,
4632
+ specPublishedSeq?}` holds the latest `build.reopened` (§15.7); `spec` mirrors the
4633
+ event, keeping `assets` only when the reopen re-pinned them, and
4634
+ `specPublishedSeq` is the seq of the operator `spec.revised` that published that
4635
+ artifact. The reopen is a verify cycle boundary and clears the code loop's human
4636
+ round cap (with a spec, the plan's too); it changes `pinnedAssets` only through
4637
+ that publication. The log index exposes `codeRestartSeq`, the later of the spec
4638
+ restart and the latest reopen, as the code half's boundary. The reopen governs
4639
+ the current spec while it is feedback-only and later than the spec restart, or
4640
+ while its publication is that restart. Until the leaf settles again after it,
4641
+ the leaf asks for a `reopen` slot and landing readiness declines it.
4642
+
3673
4643
 
3674
4644
  **Mixed-version reads.** Within the supported client window, readers that
3675
4645
  implement this contract preserve raw unknown facts and skip them in functional
@@ -3701,7 +4671,9 @@ writer and reader share a release string. Upgrading clears deferral through
3701
4671
  local replay without answering an escalation. Repository unknown counts do
3702
4672
  not invent per-build blockers.
3703
4673
 
3704
- Event-derived caches require both the exact reducer version and a deterministic
4674
+ Reducer versions are derived from a frozen base, append-only revisions, and the
4675
+ versions of a reducer's constituents, so independent revisions sum and versions
4676
+ only increase. Event-derived caches require both the exact reducer version and a deterministic
3705
4677
  read-catalog identity, including build/repository type classifications and a
3706
4678
  read-decoder revision. Named and generic checkpoints use catalog-specific keys;
3707
4679
  legacy/foreign-catalog snapshots are misses and are preserved. Unrecognized
@@ -3749,9 +4721,12 @@ identity without a fabricated finalize completion. All four facts are
3749
4721
  dispatcher-authored. Existing merged/closed PR, abort and completion facts close admission.
3750
4722
 
3751
4723
  Node transaction state reduces `node.writer-reserved`, `node.item-prepared`,
3752
- `node.item-conflicted`, `node.item-replayed`, `node.publish-intended`,
4724
+ `node.item-conflicted`, `node.item-regenerated`, `node.item-replayed`, `node.publish-intended`,
3753
4725
  `node.rewritten`, `node.writer-settled`, and `node.inventory` (§13.1 integration
3754
- restacking). Durable `node.restack-requested` facts retain operator/presence demand,
4726
+ restacking). The decisive kernel or dispatcher `node.history-retained {operation:
4727
+ restack | landing | integration-landing | verify, id, base, store, target,
4728
+ unretained}` records node write history kept outside forge archive refs (§15.7).
4729
+ Durable `node.restack-requested` facts retain operator/presence demand,
3755
4730
  including destination, sampled parent, dependent ticket and required identities.
3756
4731
  Reservations freeze covered request ids; confirmed settlement acknowledges only
3757
4732
  that coverage, and `node.restack-satisfied` records coverage or destination change.
@@ -3778,6 +4753,179 @@ does. CLI status exposes pending/active work, reachable build identities and
3778
4753
  node-owned foreign changes. A node stays `collecting` while its narrow reconcile
3779
4754
  runner is attached; it does not acquire a leaf pipeline.
3780
4755
 
4756
+ **Declined attempts.** `implement.declined` completes the implement phase
4757
+ and sets `declined {round, reason, seq}`. The engine decides
4758
+ `wait/declined` immediately after its aborted and done checks, ahead of
4759
+ pending operator commands, so nothing past implement is ever decided. The
4760
+ dispatcher's settlement completes the build, and `done` then wins.
4761
+
4762
+ **Optimization digest.** Build state embeds `optimization`, a bounded digest of
4763
+ an optimization node's own log, absent until the first
4764
+ `optimization.objective-accepted` (§13.1.1). It holds:
4765
+
4766
+ - the latest acceptance with its time; `openedAt`, the first acceptance's time
4767
+ and the start of the hours budget; the effective `objective`, which is the
4768
+ latest accepted objective with every later quick revision applied in order;
4769
+ `revision`; `revisedFields`, the fields quick-revised since the latest
4770
+ acceptance; and `rulerRevision`;
4771
+ - `starting {value, spread, head}` from `optimization.baseline-measured` under
4772
+ the current ruler. A panel's starting value is 0.5 by definition and its
4773
+ spread comes from the baseline fact;
4774
+ - `current`: for a command, the candidate value of the latest `accepted`
4775
+ settlement under the current ruler, else the starting value; for a panel, the
4776
+ latest `optimization.progress-measured` win rate under the current ruler and
4777
+ against the current starting head,
4778
+ else 0.5. `best` is the best value in the objective's direction under the
4779
+ current ruler;
4780
+ - `progressQueue`, a panel node's landed heads (`attempt.settled.head` of
4781
+ `accepted` settlements) without a `progress-measured` under the current
4782
+ ruler, oldest first, absent when empty. A new ruler clears it. It is
4783
+ bounded: the landing gate holds the node's next child while it is non-empty,
4784
+ so it holds at most one head under kernel control;
4785
+ - `attempts {filed, accepted, rejected, unmeasured}`, where `filed` counts
4786
+ proposed tickets, `rejected` counts `no-improvement`, `declined`, `stopped`
4787
+ and `aborted` settlements, and `unmeasured` counts `merged-unmeasured` ones;
4788
+ `inFlight`, the proposed attempts not yet settled as `{proposal, ticket,
4789
+ unmeasuredMerge?}`, whose length is the running count, with
4790
+ `unmeasuredMerge {build, sha?, reason, measuredCandidate?, at}` folded from
4791
+ `attempt.merged-unmeasured`; `plateau`, the
4792
+ consecutive `no-improvement` or `declined` settlements since the last
4793
+ `accepted` (`stopped` and `aborted` leave it unchanged); `emptyProposals`,
4794
+ consecutive proposals with no attempts; `rejections`, the settled attempts
4795
+ other than `accepted` and `merged-unmeasured` whose ticket has not moved to
4796
+ the rejected role, as `{proposal, ticket, build?, outcome, branch?,
4797
+ branchCleanupError?}`, added only for an attempt that was in flight and
4798
+ removed by `attempt.ticket-rejected` (`branch` is the settlement's cleanup
4799
+ obligation, cleared by `attempt.branch-deleted`, and `branchCleanupError` the
4800
+ latest `attempt.branch-cleanup-failed`); `stopped {cause, mode, at}` from the
4801
+ first `optimization.stopped`; and `stoppedTickets`, the tickets of
4802
+ attempts settled `stopped`, which the dispatch claim gate refuses. Only
4803
+ attempts in flight at the stop settle `stopped`, so it is bounded by the
4804
+ concurrency.
4805
+ - `requests`, the count of `optimization.proposal-requested` facts and the
4806
+ `propose` phase's round counter, and `proposal {id, head, room, requestedAt,
4807
+ round, deposited?: {artifact, ids, at}}`, the open request. A request opens
4808
+ it, `propose.completed` for that request sets `deposited`, and the matching
4809
+ `optimization.attempts-proposed` closes it; `optimization.proposal-withdrawn`
4810
+ closes it only while it is undeposited. At most one request is open.
4811
+
4812
+ Pure selectors over the digest take the current time. Elapsed hours run from
4813
+ `openedAt`. Stop eligibility is computed per cause: threshold when `current` has
4814
+ reached `target.threshold` in the objective's direction (a panel compares its
4815
+ recorded progress, the head's win rate against the starting head, which it
4816
+ maximizes); plateau when `plateau` ≥ `stop.plateau.attempts`;
4817
+ budget when `filed` ≥ `maxAttempts` or elapsed hours ≥ `maxHours`. Admission
4818
+ reports whether the node stopped, the attempts the budget still allows (none
4819
+ without `maxAttempts`), and the concurrency slots held neither by an in-flight
4820
+ attempt nor by a pending rejection. A tracker that keeps refusing the move
4821
+ therefore stalls proposals rather than accumulating pending rejections, and
4822
+ `inFlight` plus `rejections` never exceeds the concurrency through new
4823
+ proposals.
4824
+ The stop cause is the first eligible of threshold, plateau and budget, and none
4825
+ once stopped. A proposer is admissible only when the node has not stopped, no
4826
+ cause is eligible, the budget allows another attempt and a slot is free. An
4827
+ optimization node's completion blocker is `not stopped`, or the attempts still
4828
+ in flight; node completeness requires it to be clear.
4829
+ Attempt identity (§13.1.1) is a lookup in `inFlight` by normalized ticket ref;
4830
+ settled attempts are in the ledger.
4831
+
4832
+ **Attempt measurement.** A leaf's build state embeds `attemptMeasurement`,
4833
+ bounded to the latest `attempt.measurement-requested` (`request`), the latest
4834
+ `attempt.sampled` (`sampled`), the latest `attempt.measured` (`measured
4835
+ {request}`), `refused`, the request whose samples a `measurement-failed`
4836
+ raise refused after sampling, and `observedHead`, the sha of the latest
4837
+ `target.moved` after the latest request (a new request clears it). Pure
4838
+ selectors read it alone: `pendingMeasurementRequest` is the latest request
4839
+ that is neither sampled nor measured on a nonterminal leaf and whose baseline
4840
+ is still `observedHead` when one is recorded, the runner's work; `sampledMeasurement` is the
4841
+ latest request's samples when neither measured nor refused, the dispatcher's
4842
+ work. `baselineMeasurementDue` reads the node digest: opened, no `starting`,
4843
+ not stopped, not terminal, paused or blocked, and no pending command.
4844
+ `progressMeasurementDue` is the first `progressQueue` head of an opened panel
4845
+ node with a `starting` value, under the same conditions except that a stop
4846
+ does not withhold it. `nodeMeasurementDue` is either; slot requests, capacity,
4847
+ cascade admission, workspace release and the runner read it. Engine, capacity
4848
+ and the dispatcher's decision read only these reduced values, so an idle tick reads no event rows; deciding one sampled
4849
+ request costs one reduced read of its node, once.
4850
+ The proposer selectors also read the digest. `proposerRoom` is the smaller of
4851
+ the free concurrency slots and the attempts the budget still allows, and 0
4852
+ once the attempts or hours budget is spent. `proposerAdmissible` holds for an
4853
+ opened, nonterminal optimization node that has not stopped, has a starting
4854
+ measurement, has no open request, has fewer than two consecutive empty
4855
+ proposals and has positive room, and that no non-optimization blocker holds
4856
+ (paused, blocked, pending commands, compatibility deferral, active or
4857
+ conflicted node restack, landing intent, merged or closed PR).
4858
+ `proposalEligible` re-checks an open request against current state: not
4859
+ stopped, hours budget not expired, attempt room and a free concurrency slot
4860
+ remaining, and the request's room no larger than the current room.
4861
+ `proposalWithdrawalDue` names the reason (`stopped`, `budget` or
4862
+ `concurrency`) an undeposited request fails it. `exhaustedStopDue` holds when
4863
+ `emptyProposals` ≥ 2 and the node has not stopped.
4864
+
4865
+ **Judge panel.** A build that runs a judge panel embeds `panel`, bounded to its
4866
+ latest run: the `panel.started` payload and, per judge, every started session
4867
+ with its order, runtime, optional stream and substitution link, every ending
4868
+ outcome, the first `panel.preferred` and the
4869
+ `panel.judged`. Events for any other panel id are ignored, so the value is
4870
+ bounded by 20 judges. Pure selectors over it give the pending judges (no
4871
+ preference), the sessions awaiting reclaim, the saved preferences to complete
4872
+ and each judge's counted failures (excluding sessions named by a later
4873
+ start's substitution). Dashboard facts retain judge session attribution and
4874
+ evidence without the blinded order, and expose it through session rows. The `buildDelegation` service value
4875
+ (version 2) folds `panel.judge-started` and `panel.judge-ended` into its
4876
+ session lifecycle beside `session.started` and `session.ended`, and records
4877
+ which judge sessions preferred, so a judge preference write is decided with
4878
+ one reduced read per conditional-append attempt, at the same cost at any log
4879
+ length.
4880
+
4881
+ **Deltas, revisions and the ruler.** A positive `delta` is an improvement in
4882
+ the objective's direction: `baseline − candidate` when minimizing,
4883
+ `candidate − baseline` when maximizing, and `winRate − 0.5` for a panel.
4884
+ `revision` is one monotonic objective revision across
4885
+ `optimization.objective-accepted` and `optimization.objective-revised`: the
4886
+ first acceptance is 1 and each later accepted or revised fact increments it.
4887
+ Measurement facts carry the revision they ran under. The first acceptance
4888
+ starts a ruler, and so does any later acceptance whose `metric` differs from the
4889
+ previous accepted objective, or whose `purpose` differs when the metric is a
4890
+ panel. Quick revisions never change the ruler. A measurement or settlement
4891
+ whose revision is below `rulerRevision` is history: it stays in the log and the
4892
+ ledger but never feeds `starting`, `current` or `best`.
4893
+
4894
+ **Attempt ledger.** A separate registered build-scoped value folds the node's
4895
+ log into one entry per `attempt.settled`: `{seq, proposal, ticket, build?,
4896
+ title, strategy, outcome, mergedSha?, policy?, delta?, baseline?, candidate?,
4897
+ note?, nearMiss?}`; a `merged-unmeasured` entry carries no measurement.
4898
+ `optimization.attempts-proposed` supplies the pending title and strategy by
4899
+ proposal, dropped once the attempt settles, and the objective facts supply the
4900
+ ε in effect. A near miss is a `no-improvement` settlement with
4901
+ 0 < `delta` < ε; a relative ε is ε × |baseline|.
4902
+
4903
+ **Landing measurement.** Build state embeds `landingMeasurement` for a child
4904
+ of an optimization node, absent until its first request: the latest
4905
+ `attempt.measurement-requested`, the `attempt.measured` answering it (a result
4906
+ for an older request is history), and `overtakes`, the requests whose baseline
4907
+ differed from the previous request's.
4908
+
4909
+ **Pending rejections in the build digest.** The repository build digest folds
4910
+ `attempt.settled` and `attempt.ticket-rejected` into `rejectionsPending`, set
4911
+ while a node has a pending rejection (`accepted` and `merged-unmeasured`
4912
+ settlements add none). Like a pending attachment reclaim, it is a
4913
+ post-terminal duty: a completed node with pending rejections stays in the
4914
+ janitor's work set until the moves commit, and a settlement recorded on an
4915
+ already completed node re-arms it through the node's incrementally advanced
4916
+ digest, with no repository scan.
4917
+
4918
+ **Optimization read cost.** The digest's size does not grow with settled
4919
+ attempts: admission caps `inFlight` plus `rejections` at the objective's concurrency, and
4920
+ settled attempts leave only counters. The dispatcher, the dashboards, status
4921
+ and watch read it from the build state they already reduce, so the stop and
4922
+ admission inputs and the objective row cost the same at 10 and 10,000
4923
+ attempts and read zero event rows while nothing changes. The ledger grows with settled attempts, which `maxAttempts` bounds,
4924
+ and is read only on an explicit history request; it advances from new node rows
4925
+ only. Neither value ever reads an attempt's log, because `attempt.settled`
4926
+ carries the measured delta. The read-budget harness in
4927
+ `packages/core/src/testing/` proves both bounds.
4928
+
3781
4929
  `status ∈ queued | running | collecting | paused | blocked | done | aborted`, plus
3782
4930
  `{phase, round, openEscalations[], reviewRoundCeilings?, pr?, autoMerge,
3783
4931
  lastEvent}`. `blocked` ≡ an open escalation: an `escalation.raised` (or the
@@ -3972,10 +5120,17 @@ Before releasing or replacing a build workspace, the dispatcher confirms a
3972
5120
  non-destructive execution fence for the exact workspace and execution generation.
3973
5121
  It preserves unpublished branch commits and distinct detached producer candidates
3974
5122
  under immutable `refs/autobuild/archive/<build>/<sha>` refs, verifies their exact
3975
- readback, and records `workspace.commits-preserved` before cleanup. Replacement
3976
- provisioning restores those exact refs before starting an agent, reading them
3977
- from the local repository with the local-git forge and fetching each exact ref
3978
- from the remote otherwise. A preserved
5123
+ readback, and records `workspace.commits-preserved` before cleanup. Where the
5124
+ forge refuses an archive ref, the head is kept as a BuildStore copy instead
5125
+ (§15.7) and the receipt is the decisive `workspace.commits-retained`, whose heads
5126
+ each name either `remoteRef` or `storeBase`; a head kept by neither refuses the
5127
+ release. Replacement provisioning restores those exact commits before starting
5128
+ an agent, reading archive refs from the local repository with the local-git forge
5129
+ and fetching each exact ref from the remote otherwise, and restoring store copies
5130
+ through a dispatcher-side callback on any host, so a remote guest never holds
5131
+ store credentials. A runtime from before store-kept heads defers on the decisive
5132
+ receipt instead of misreading it; one that releases before seeing it preserves
5133
+ strictly, as it always did, and at worst refuses the release. A preserved
3979
5134
  branch head that the build's latest 64 replaced heads cover, as the replaced
3980
5135
  head itself or one of its ancestors, is kept only as archived objects: it is
3981
5136
  never preserved or restored as the branch, and provisioning records the skip as
@@ -3986,11 +5141,14 @@ that exists without a provisioned checkout, records `workspace.commits-lost`,
3986
5141
  naming known candidates and explicitly noting that any additional unpublished
3987
5142
  SHAs could not be inspected. An environment that never started executing holds
3988
5143
  no unpublished work: objects its checkout lacks mean nothing to preserve, so
3989
- cleanup records `workspace.commits-preserved` carrying forward earlier preserved
3990
- heads, then releases and replaces it. Unknown fencing, inspection, transport, or
5144
+ cleanup records `workspace.commits-preserved` (or `workspace.commits-retained`)
5145
+ carrying forward earlier preserved heads, then releases and replaces it. Unknown fencing, inspection, transport, or
3991
5146
  receipt-write outcomes leave the workspace and snapshots intact. A workspace
3992
5147
  flagged by `workspace.cleanup-required` is never launched into: the dispatcher
3993
- releases it and provisions the next generation. A preservation or release
5148
+ releases it and provisions the next generation. Provisioning cut off by a
5149
+ recorded dispatcher teardown is the exception: the next invocation asks the
5150
+ provider to verify and finish the same generation, and if it cannot, the
5151
+ replacement consumes no infrastructure attempt. A preservation or release
3994
5152
  failure is recorded against its build, as an infrastructure failure or janitor
3995
5153
  attention, and never stops the dispatcher from advancing other builds.
3996
5154
  Fencing is revalidated after restart; a saved receipt alone never authorizes
@@ -4105,7 +5263,9 @@ boundary. Superseded receipts remain historical evidence.
4105
5263
  `pipeline.settled { cycle }` is advisory capacity evidence. The dispatcher
4106
5264
  appends it once per settlement key (the later of the current verify cycle start
4107
5265
  and the latest `finalize.completed`) when the engine decides `wait awaiting-pr`;
4108
- no pipeline decision reads it (§12).
5266
+ no pipeline decision reads it (§12). A leaf counts as finished when its latest
5267
+ settlement follows the spec restart, or when that restart published its reopen's
5268
+ spec (§15.5).
4109
5269
 
4110
5270
  ### 15.7 Post-PR lifecycle [D1 — confirmed]
4111
5271
 
@@ -4119,8 +5279,78 @@ while an unexpired execution lease exists, so no workspace is released under a
4119
5279
  live process tree. After any terminal outcome it also reclaims every
4120
5280
  pending hosted PR-attachment copy. Reclamation success and failure are durable
4121
5281
  correlated facts; a failed delete remains pending and retries on later ticks,
4122
- including after the build is already done. A merged-PR fixup request is a *new
4123
- ticket*, never a reopened build.
5282
+ including after the build is already done. A fixup request for a merged or
5283
+ closed PR is a *new ticket*, never a reopened build.
5284
+
5285
+ **Reopening a settled leaf.** An operator who wants changes to a leaf that
5286
+ finished its pipeline and waits for its merge decision sends it back with
5287
+ `ab reopen <slug> --feedback <text>`, optionally with `--revise-spec <file>` or
5288
+ `--revise-spec-from-ticket` (the `builds.reopen` tool carries the same request).
5289
+ The control appends one human-attributed, decisive `build.reopened
5290
+ {feedback?, spec?: {artifact, assets?}}` by compare-and-append on a freshly
5291
+ reduced tail, and refuses, writing nothing, for an integration node, an
5292
+ optimization attempt, a queued or terminal build, a merged or closed PR, a leaf
5293
+ that has not settled (still running, conflicted or restacking), a blocked leaf
5294
+ (answer it with `ab answer`), and a pending abort or discard. A paused leaf may
5295
+ be reopened; the engine parks the reopen until resume. Feedback is 1–20000
5296
+ characters after trimming.
5297
+
5298
+ Feedback alone re-enters `implement`. The reopen's seq is the code half's
5299
+ restart boundary (`codeRestartSeq`, the later of it and the spec restart): code
5300
+ loop rounds and verdicts, `implement.completed`, verify and reconcile records,
5301
+ configuration captures, wait-resume restacks, `finalize.completed` and finalize
5302
+ post-steps at or before it no longer count, while the plan stays approved. The
5303
+ engine therefore runs `implement` at the next round, then code review, the
5304
+ verify-entry restack, every verify step, finalize and its post-steps, exactly as
5305
+ a first pass; the review-round count, stall chains and the verify-failure budget
5306
+ restart, and round and attempt numbers continue monotonically. A spec reopen
5307
+ deposits a conforming body first (a from-ticket body re-pins its assets, a file
5308
+ leaves the pins), then the kernel publishes the recorded artifact and assets as
5309
+ the next `spec.revised` in its `operator` form, which restarts from `plan`
5310
+ (§6.3). Every publication attempt re-reads, refuses on a pending abort or
5311
+ discard, an ended PR or a terminal build, and appends only on that tail; until
5312
+ it lands the engine waits on `awaiting-spec`, and a repeated `ab reopen`
5313
+ completes the recorded publication without opening its new arguments.
5314
+
5315
+ The reopen revokes merge consent and its acknowledgement and clears the landing
5316
+ decision, deferral and fallback; a hold stays in force. The leaf keeps its open
5317
+ PR and branch. Its armed native auto-merge stays as applied-state evidence: the
5318
+ janitor finds the leaf no longer ready and cancels it on its next poll, recording
5319
+ `landing.native-applied {enabled: false}`; a forge merge that lands first
5320
+ completes the build as merged and later reopens are refused. The reopened leaf
5321
+ stays a finished leaf for capacity and asks for a `reopen` slot, admitted ahead
5322
+ of new ticket claims like other parked work. Re-finalize adopts the open PR by
5323
+ head, keeping its title and prose, and the new `finalize.completed` is a new
5324
+ landing candidate that settles and needs fresh consent as usual. `ab context`
5325
+ writes `$AB_CONTEXT_DIR/reopen.json` (`{seq, user, via?, at, feedback?,
5326
+ specRev?}`, also the manifest's `reopen` block) for every phase while the
5327
+ reopen governs the current spec; a later reopen replaces it and a later
5328
+ escalation spec revision supersedes it. The epilogue grammar is unchanged: a
5329
+ reopen re-enters the mainline at `implement` or `plan`, and the leaf reaches
5330
+ merge only through `finalize` again.
5331
+
5332
+ **Forge CI on finished leaves.** A clean restack or a change on the base can
5333
+ leave a finished leaf's own CI red on the forge without any local verify step
5334
+ re-running. On the same janitor poll of a finished, open leaf PR (no phase or
5335
+ session running), the dispatcher reads the check runs and commit statuses at the
5336
+ PR's live head through the optional Forge `inspectHeadChecks` capability
5337
+ (GitHub: two ETag-conditional REST reads, so an unchanged head costs two 304s).
5338
+ A failing latest check run (`failure`, `timed_out`) or commit status (`failure`,
5339
+ `error`) records advisory `pr.checks-failed {pr, head, buildHead, checks, total,
5340
+ digest}`: `head` is the live PR head, `buildHead` the build's recorded head,
5341
+ `checks` a 20-entry preview and `digest` the identity of the complete failing
5342
+ set. It is recorded once per `(head, buildHead, digest)` and is default watch
5343
+ attention. Advisory `pr.checks-cleared {pr, head, cause}` records that the head
5344
+ now has no failing checks (`passing`, `pending`) or that the PR moved to another
5345
+ head (`head-changed`); a head change clears the old record on the proof of the
5346
+ PR read alone. CI that cannot be read — a missing capability, an authorization,
5347
+ rate-limit or network failure, a guarded-forge cooldown, or a truncated listing
5348
+ with no visible failure — is unknown: it records nothing, never claims green,
5349
+ never raises red, and never becomes a janitor failure. Status surfaces report a
5350
+ recorded failure only while it still describes the open PR at the build's
5351
+ recorded head, so a reconcile, restack, merge or close hides it at once.
5352
+ Autobuild never re-runs forge CI and never re-enters `implement` on red CI; the
5353
+ operator inspects the PR, re-runs CI on the forge, or reopens the build.
4124
5354
 
4125
5355
  **Merge standard: one change per build, replay at reconcile.**
4126
5356
 
@@ -4137,8 +5367,8 @@ ticket*, never a reopened build.
4137
5367
 
4138
5368
  This reverses the original rebase ban [D1, D3]. Replaying many WIP commits caused
4139
5369
  repeated conflict loops; replaying one net change resolves the conflict once.
4140
- Rewrites used to sever event-recorded SHAs; immutable archives and durable
4141
- rewrite facts retain them. Ordinary per-WIP-commit rebase remains inappropriate.
5370
+ Rewrites used to sever event-recorded SHAs; retained history and durable
5371
+ rewrite facts keep them. Ordinary per-WIP-commit rebase remains inappropriate.
4142
5372
  Existing historical merge reconciliations retain their original replay/display
4143
5373
  semantics and supply the promoted contribution base for a later restack. Resumed
4144
5374
  builds use current engine routing at newly reached replay and merge boundaries;
@@ -4147,20 +5377,88 @@ merge standard. Execution configuration remains pinned, while merge policy
4147
5377
  is live dispatcher configuration. Operators requiring old execution behavior
4148
5378
  should drain work before upgrading rather than run mixed-version writers.
4149
5379
 
4150
- Before branch replacement the kernel publishes Git tips named by retained
4151
- history and rewrite facts, plus both heads and the temporary change, under immutable non-branch refs
4152
- `refs/autobuild/archive/<slug>/<sha>`. Archives must be fetchable by exact ref;
4153
- namespace or permission failures stop publication without a branch/tag fallback. Remote
5380
+ Before a leaf branch replacement (automatic restack, reconcile, or remote
5381
+ publication settlement) the kernel retains every displaced Git tip named by
5382
+ retained history and rewrite facts, plus both heads and the temporary change.
5383
+ Leaf retention is best effort, per commit, in this order:
5384
+
5385
+ 1. **Forge archive ref.** An immutable non-branch ref
5386
+ `refs/autobuild/archive/<slug>/<sha>`, fetchable by exact ref and confirmed by
5387
+ exact readback. A forge-archived commit writes no store copy.
5388
+ 2. **BuildStore copy.** Where the forge refuses the ref, artifact
5389
+ `history-objects-<sha>` holds a thin pack of only the objects `<sha>` reaches
5390
+ that the transaction's frozen target base does not, chunked like
5391
+ `replay-objects-<sha>`. A commit already an ancestor of that base needs no
5392
+ copy and is classified `target`.
5393
+ 3. **Nothing.** Where the copy also fails, the rewrite proceeds. The build
5394
+ records one build-scoped `observation.recorded` followup with fixed id
5395
+ `history-unretained` naming the unretained commits; later attempts in the
5396
+ same build never repeat it.
5397
+
5398
+ The decisive `history.retained {operation: restack | reconcile, id, base, store,
5399
+ target, unretained}` records commits kept as store copies over exclusion base
5400
+ `base`, kept by the target, or kept nowhere; forge-archived commits stay on the
5401
+ rewrite fact's `archives`. Older runtimes treat it as an unknown decisive fact
5402
+ and defer. Retention is never a branch or tag. An immutable ref that already
5403
+ names a different commit is an `ArchiveConflictError`: never retried, never a
5404
+ fallback. Classified transient forge failures still retry rather than fall back.
5405
+
5406
+ Node writes retain the same way. Node restack retains the frozen expected head,
5407
+ previous boundary and parent; node landing retains the destination head and the
5408
+ leaf candidate; integration landing and the node verify head retain the node
5409
+ head. Each store copy excludes the published head the write builds on, and the
5410
+ decisive `node.history-retained {operation: restack | landing |
5411
+ integration-landing | verify, id, base, store, target, unretained}` records the
5412
+ non-forge outcomes; the `history-unretained` warning is shared with leaf
5413
+ retention. A node write whose inputs are kept nowhere still proceeds: they stay
5414
+ reachable from published branches until its guarded update lands. Node recovery
5415
+ (restack recovery, landing recovery, closed-node settlement and node-conflict
5416
+ reconcile) restores its reserved inputs before any Git read of them, from the
5417
+ archive ref, a store copy, or the published branches. An input kept nowhere
5418
+ before the guarded update landed abandons the reservation
5419
+ (`node.writer-settled {outcome: abandoned}`), and the next node transaction
5420
+ reserves again from the published branches.
5421
+
5422
+ Workspace commit preservation (§12 D) is the strict exception: its unpublished
5423
+ commits may exist nowhere else. It tries the forge archive ref, then a
5424
+ `history-objects-<sha>` store copy excluding the preservation base, and never
5425
+ classifies a commit as `target` or proceeds unretained. When both fail, release
5426
+ is refused and cleanup stays pending. A history copy is identified by its head:
5427
+ a later retention of the same commit reuses the existing copy and its saved
5428
+ base. Preservation records that base and, when it is no longer an ancestor of
5429
+ the current preservation base, retains the base itself the same way, to a
5430
+ bounded depth; restoration follows that chain.
5431
+
5432
+ Readers (restack and reconcile preparation, regenerated-restack adoption,
5433
+ candidate recovery) restore a missing commit in the same order: the local
5434
+ repository; the forge archive ref (exact `ls-remote` and exact fetch, where
5435
+ transient transport failures throw and retry); store copies
5436
+ (`reconcile-change-<sha>`, `replay-objects-<sha>`, `history-objects-<sha>`);
5437
+ then a fetch of the published build and target branches. A commit retained
5438
+ nowhere redoes the work: an unpublished transaction is re-prepared from a fresh
5439
+ snapshot of the published branch under id `<id>-redo`, and a candidate that
5440
+ already has a publication request is retired through
5441
+ `publication.candidate-retired` and replays under its replacement identity.
5442
+
5443
+ Remote
4154
5444
  archives also publish commits present only on the remote: GitHub uses create-only
4155
5445
  Git-reference REST creation when the workspace lacks the commit, retaining guarded Git
4156
- pushes for local objects. Exact remote readback confirms publication, then a non-shallow
5446
+ pushes for local objects. When an environment refuses a non-branch Git push of an
5447
+ archive ref (a refusal, not a transient failure), GitHub creates the identical archive
5448
+ ref through the same create-only REST call and holds it to the same exact readback; this
5449
+ is a transport for the same ref, never a branch or tag, never overwrites an archive, and
5450
+ cannot publish a commit that exists only locally, which fails naming both refusals
5451
+ (a refusal that leaf retention absorbs into its BuildStore copy).
5452
+ Vercel Sandbox workspaces push archives through the guest Git transport for candidate
5453
+ recovery, preservation and rewrites; after a refusal the dispatcher makes the same REST
5454
+ call with host-held credentials, and the guest's exact readback still decides. Exact remote readback confirms publication, then a non-shallow
4157
5455
  fetch of only that exact archive ref (without tags, configured refmap expansion or a
4158
5456
  depth limit) restores missing commits and their missing ancestry, writes no shallow
4159
5457
  boundary, leaves an already-shallow repository's existing boundaries unchanged, and
4160
5458
  verifies the commits locally before returning.
4161
5459
  Publication requests and loss records alone are not retained Git history: their
4162
5460
  unpublished objects may have died with a released sandbox. A separately published
4163
- or reviewed tip remains an archive requirement even when an earlier request named
5461
+ or reviewed tip remains a retention requirement even when an earlier request named
4164
5462
  that same SHA.
4165
5463
  Restack and reconcile publication reject tracked modifications with the existing
4166
5464
  clean-worktree error. Nonignored untracked files do not block publication and
@@ -4205,13 +5503,37 @@ Automatic leaf transactions use `restack.*`, independently of reconcile attempt
4205
5503
  numbers. Preparation freezes the trigger, verify-cycle boundary, absorbed target
4206
5504
  observation, old base/head, target base, single-change commit, workspace/local
4207
5505
  branch tips and canonical message. Publication intent precedes guarded replacement;
4208
- `restack.rewritten` retains archives and proven writes even if readback observes a
5506
+ `restack.rewritten` retains confirmed forge archive refs (its `archives`; store and
5507
+ target retention is on `history.retained`) and proven writes even if readback observes a
4209
5508
  later writer. Completion requires confirmed publication. Clean transactions start
4210
5509
  no agent and do not fabricate `reconcile.completed`. A conflicted replay is adopted
4211
- by `reconcile.started {restackId}` without another collapse or target selection.
5510
+ by `reconcile.started {restackId}` without another collapse or target selection,
5511
+ unless it is regenerated.
5512
+
5513
+ **Generated-file regeneration.** `[[generated]]` declares repository paths
5514
+ (path selectors; the first matching entry owns a file) and the shell command
5515
+ that rebuilds them. When every conflicted path of an automatic leaf replay is
5516
+ declared, the runner, before any reconcile attempt, re-establishes the recorded
5517
+ conflict, takes the target's side of each conflicted file, runs each owning
5518
+ command once in the build workspace, stages exactly the regenerated paths, and
5519
+ commits with the change's message and author; cleanly applied edits are
5520
+ committed unchanged. The command may write only declared paths, and no staged
5521
+ content may keep conflict markers. Exactly one `restack.regenerated {id, files,
5522
+ commands, outcome: resolved | failed | skipped, head?, reason?}` records the
5523
+ decision: `head` only when resolved (retained before the fact), `reason`
5524
+ otherwise. The engine routes a conflicted replay to `restack` while its fact is
5525
+ `resolved`, or while declarations exist, no fact is recorded and no reconcile
5526
+ attempt started; otherwise to `reconcile`. The engine never matches paths. A
5527
+ resolved replay publishes like a clean one and records head paths with its
5528
+ resolution; a replacement workspace restores the retained head instead of
5529
+ regenerating. `failed` and `skipped` commit nothing, leave no command output,
5530
+ and restore the recorded conflict for reconcile, whose context names the
5531
+ conflicted generated files with their commands (`generated`) and a failure's
5532
+ `regeneration.reason`, both read from the recorded fact's `commands`, never
5533
+ from the checkout's `autobuild.toml`. Repositories that declare nothing are unaffected.
4212
5534
  Resolver completion links back to the automatic transaction. Retained commit bytes
4213
5535
  and replay object packs recover disposable-workspace objects before publication.
4214
- Replay retention stores thin Git packs in bounded binary chunks, with a fixed-size completion manifest written only after every chunk is acknowledged. Digest-keyed chunks make interrupted writes retryable; incomplete uploads are never restored. Recovery validates all chunk sizes and the pack digest before installation, and requires the base objects (restoring node prefixes in order). Existing single-artifact base64 packs remain readable. Retained replay artifacts are read only when the requested commit is missing locally, never by idle polling.
5536
+ Replay retention (`replay-objects-<sha>`) and leaf history retention (`history-objects-<sha>`) store thin Git packs in bounded binary chunks, with a fixed-size completion manifest written only after every chunk is acknowledged. Digest-keyed chunks make interrupted writes retryable; incomplete uploads are never restored. Recovery validates all chunk sizes and the pack digest before installation, and requires the base objects (restoring node prefixes in order). Existing single-artifact base64 packs remain readable. Retained replay and history artifacts are read only when the requested commit is missing locally, never by idle polling.
4215
5537
 
4216
5538
 
4217
5539
  `reconcile.prepared` records transaction identity, attempt, branch, old head,
@@ -4220,14 +5542,15 @@ Before that fact is appended, the exact temporary commit bytes are deposited as
4220
5542
  SHA-keyed BuildStore artifact. A replacement sandbox restores and verifies the
4221
5543
  same object from those bytes, retaining the original transaction and frozen base
4222
5544
  without requiring prepare-time remote write credentials. Retained trees and
4223
- parents supply the rest of its object graph; trusted publication still archives
4224
- the temporary commit before replacing the branch.
5545
+ parents supply the rest of its object graph; trusted publication still retains
5546
+ the temporary commit, best effort, before replacing the branch.
4225
5547
  `reconcile.replayed` records whether replay conflicted. Notes and the resolved
4226
5548
  head are deposited with `reconcile.publish-intended` before publication.
4227
5549
  `ab done` records a publication request; local kernels wait for the resolver
4228
5550
  session to end and remote kernels wait for guest teardown before replacement;
4229
5551
  `reconcile.rewritten` records old/new heads, old/new change SHAs, frozen base,
4230
- conflict outcome and archive refs after confirmed publication. A successful CAS
5552
+ conflict outcome and confirmed forge archive refs (store and target retention is on
5553
+ `history.retained`) after confirmed publication. A successful CAS
4231
5554
  that is overtaken before readback still records its receipt, with `observedHead`
4232
5555
  naming the later head (or null for deletion). That observed head informs recovery;
4233
5556
  it does not complete reconcile or promote the verification base. Recovery may
@@ -4235,7 +5558,9 @@ consume a durable confirmed write receipt; candidate ancestry alone never proves
4235
5558
  an unconfirmed write. New completion is
4236
5559
  `{headSha, rewriteId, artifact}`; historical `{mergeCommit, artifact}` remains
4237
5560
  valid. Remote requests carry identical transaction inputs and use the provider's
4238
- trusted rewrite/archive capability only after execution teardown. Contention is
5561
+ trusted rewrite/archive capability only after execution teardown; the provider
5562
+ hands each archive to the kernel's `retain` callback over its trusted Git
5563
+ transport, and the callback owns the fallback. Contention is
4239
5564
  recorded durably and uses the existing runner-failure bound, without spending
4240
5565
  unchanged-base no-progress budget before completion. Classified transient publication
4241
5566
  failures instead use the independent durable publication retry budget described
@@ -4255,6 +5580,8 @@ completion. This evidence does not change reduction or display semantics.
4255
5580
 
4256
5581
  A node-target child merge instead fast-forwards its already canonical
4257
5582
  single-change commit, preserving exactly one terminal source-build identity.
5583
+ A child of an optimization node first passes the measurement landing gate
5584
+ (§13.1.1), and its guarded fast-forward is guarded on the measured baseline.
4258
5585
  The guarded destination write is authoritative once confirmed: the durable
4259
5586
  merge receipt, carrying the candidate SHA and identity, is recorded only after
4260
5587
  exact authoritative readback of the destination shows that candidate, or from
@@ -4266,13 +5593,21 @@ best-effort: observe a provider-reported merge, or comment with the merged SHA
4266
5593
  and close a still-open review. Acknowledgement failure never retries or fails
4267
5594
  the merge.
4268
5595
 
4269
- GitHub uses its authoritative viewer squash headline and body with an expected
4270
- head guard. Native auto-merge messages are checked against fresh server defaults
4271
- on eligible polls even after consent acknowledgement, and repaired through
4272
- consent-guarded disable/enable. Repeated polling covers later head or metadata
4273
- changes; it cannot make a future push atomic with an already armed native merge.
4274
- Merge queues ignore message overrides, so identity-aware kernel merge defers
4275
- with `unproven-gate-state` rather than bypassing the queue. Human merges remain
5596
+ GitHub derives the squash headline and body from the PR and the repository's
5597
+ squash title and message settings, read over REST, and lands with an expected
5598
+ head guard. Native auto-merge messages are checked against that derivation on
5599
+ eligible polls even after consent acknowledgement, and repaired through
5600
+ consent-guarded disable/enable. Landing reads use REST only; GraphQL carries
5601
+ just the native enable and disable mutations, preceded by one read-only
5602
+ availability probe per forge instance. A GraphQL refusal that says GraphQL is
5603
+ unavailable (HTTP 403 from an environment such as Claude Code on the web's
5604
+ GitHub proxy) is its own condition, distinct from rate limits, transient
5605
+ failures and permission errors; it suppresses further GraphQL from that
5606
+ process for 30 minutes and never drives forge cooldown. Repeated polling covers later
5607
+ head or metadata changes; it cannot make a future push atomic with an already
5608
+ armed native merge. Merge queues ignore message overrides, so identity-aware
5609
+ kernel merge defers with `unproven-gate-state` rather than bypassing the queue;
5610
+ native enable, repair and direct merge check for a queue, quiet polls do not. Human merges remain
4276
5611
  observable regardless of trailer evidence.
4277
5612
 
4278
5613
  Ordered `[[merge]]` rules in `autobuild.toml` decide authorization. Each rule
@@ -4315,8 +5650,13 @@ is published.
4315
5650
  Policy is live dispatcher configuration, outside the pinned execution pipeline.
4316
5651
 
4317
5652
  `ab hold <slug>` durably suppresses merge and revokes previous consent, even
4318
- before readiness. `ab merge <slug>` requires readiness, clears hold, and consents
4319
- to this build/node merge into its frozen destination. Consent survives head
5653
+ before readiness. `ab hold <slug> --reason <text>` also records why on
5654
+ `build.hold-requested` (1–2000 characters after trimming; a blank reason is
5655
+ refused and nothing is written). The reduced hold carries the reason, and
5656
+ status, merges, builds and both dashboards show it while that hold stands; a
5657
+ later hold replaces it and merge consent clears it. `ab merge <slug>` requires
5658
+ readiness, clears hold, and consents to this build/node merge into its frozen
5659
+ destination. Consent survives head
4320
5660
  replacement, clean restacking, verification and re-finalization until another
4321
5661
  hold or completion. It is consent to the merge, not approval of an immutable diff.
4322
5662
  Consent given under a rule with `paths` or `within` predicates is the exception:
@@ -4329,7 +5669,8 @@ its publication intent, from recorded facts only; no poll derives it. The fact
4329
5669
  removes that consent only, so the build returns to the consent queue for its new
4330
5670
  head and needs fresh consent. Clean restacks record no resolution and keep
4331
5671
  consent, as do reconciles that edit no matched file and consent under rules
4332
- without path predicates. Accepted node reparenting also revokes consent.
5672
+ without path predicates. Accepted node reparenting and reopening a settled leaf
5673
+ (above) also revoke consent.
4333
5674
  The optional `ab merge <slug> --head <sha>` (operator `head`) refuses with
4334
5675
  `head-mismatch`, recording nothing, unless `<sha>` (full or at least seven
4335
5676
  characters) is the current candidate head. The consented head is the head of
@@ -4387,7 +5728,30 @@ gates and the serialized node-writer publication rules remain authoritative.
4387
5728
  **Merge gates are never bypassed.** Merge authorization comes from recorded
4388
5729
  policy or explicit consent. For root-target leaves, whenever the base branch has
4389
5730
  any real merge-blocking gate, authorization is applied as GitHub-native auto-merge, so the
4390
- forge's own checks decide when the PR merges. Only when the forge
5731
+ forge's own checks decide when the PR merges. When GitHub GraphQL is unavailable,
5732
+ native auto-merge cannot be armed and the root leaf lands by polling instead
5733
+ (`landing.polling-selected`, once per candidate, decision and command). On a
5734
+ tick where GitHub reports the PR clear to merge (`clean`, `unstable` or
5735
+ `has_hooks`, with `mergeable` true) at the verified candidate head, the
5736
+ dispatcher rechecks consent and calls a guarded squash that re-reads that state
5737
+ fresh at the exact head, rechecks consent immediately before the merge request,
5738
+ and sends the head guard. Every other state, including `blocked`, `behind`,
5739
+ `dirty`, `unknown`, `draft` and any unrecognized value, never merges, so the
5740
+ gate is never bypassed even by a credential that could; Autobuild never relies
5741
+ on the forge refusing a premature merge. A quiet polling tick costs one
5742
+ conditional PR read, no GraphQL, queue or consent read, and appends nothing.
5743
+ The landing settles once as awaiting a human merge
5744
+ (`landing.human-merge-required`) when GitHub exposes a merge queue for the base
5745
+ over REST (a ruleset `merge_queue` rule, or `merge_queue_merge` activity GitHub
5746
+ reports for the base branch, checked on the candidate's first evaluation and
5747
+ before every merge) or refuses the guarded squash of a PR it had just reported
5748
+ clear; the refusal message is recorded and shown. A settled landing makes no
5749
+ further landing call for that candidate; a human merge on the forge is recorded
5750
+ like any other. A classic-protection merge queue that GitHub does not expose
5751
+ over REST and that has no recorded activity cannot be detected: a PR GitHub
5752
+ keeps reporting blocked there stays polling and never merges. Polling lands
5753
+ only while a dispatcher runs, so native auto-merge stays primary wherever
5754
+ GraphQL works. Only when the forge
4391
5755
  authoritatively reports no gate may the janitor perform a normal,
4392
5756
  head-guarded squash itself — never admin, force, or rebase — and only after
4393
5757
  all verification and finalize work is complete. GitHub's exact documented
@@ -4551,6 +5915,41 @@ execution settings; each ready candidate retains its immutable `landing.decided`
4551
5915
  rule snapshot and mode after config edits. Historical `build.auto-merge-requested`
4552
5916
  and default-attribution fields remain replay-compatible but are not new controls.
4553
5917
 
5918
+ `[hooks.<name>]` declares an observe-only hook with exactly one target, a
5919
+ `command` or a `url`, plus optional `events` globs with `ab watch --event`
5920
+ grammar and catalog validation (absent means `ab watch`'s default attention
5921
+ filter) and `timeoutSeconds` (default 30). A `url` must be `https`, or `http`
5922
+ only to a loopback host, without credentials or a fragment; it requires
5923
+ `secretEnv`, the name of a dispatcher environment variable holding the signing
5924
+ secret, which must be set and nonblank. Bad names, duplicates, missing or doubled
5925
+ targets, bad URLs, a missing `secretEnv`, an unset or blank secret variable and
5926
+ globs matching no catalog event are rejected naming the hook, at startup and on
5927
+ reload; errors name the variable, never its value. The hosted dispatcher rejects
5928
+ command hooks as a config error and delivers url hooks. The lease-holding
5929
+ dispatcher feeds each hook an in-process watch feed from durable per-hook
5930
+ progress (a retention-managed `hook-progress.<name>` repository artifact) and
5931
+ delivers each record, the exact `ab watch --json` line with its stable `id`.
5932
+ A command runs once per record with the line on stdin; exit 0 within the timeout
5933
+ is success. A url receives one `POST` per record whose `application/json` body
5934
+ is that line without its newline, with headers `Autobuild-Hook` (the hook name),
5935
+ `Autobuild-Delivery` (the record `id`), `Autobuild-Timestamp` (Unix seconds, per
5936
+ attempt) and `Autobuild-Signature: v1=<hex HMAC-SHA256 of
5937
+ "<timestamp>.<body>" keyed by the secret>`; a 2xx response within the timeout is
5938
+ success, and any other status, a redirect (never followed), a timeout or a
5939
+ connection error is a failure. The secret never appears in events, status, logs
5940
+ or errors. Delivery is at-least-once, ordered per hook, one invocation at a
5941
+ time, outside the dispatch tick; no decision path reads a hook's outcome. A
5942
+ one-pass dispatch delivers until its first failure and stops in-flight
5943
+ deliveries at its deadline for redelivery next pass. A new hook name starts when
5944
+ first loaded; progress survives restarts, hot upgrades and reloads. Failures
5945
+ retry with increasing delay; five minutes of continuous failure records
5946
+ `hook.failing` once per episode, the next success `hook.recovered`, and
5947
+ unretrievable history `hook.skipped` with the skipped ranges. Feeds discover
5948
+ builds from the `ticket-preparation` announcements in the repository journal and
5949
+ never list the build population on a pass; idle passes read no event rows. `ab
5950
+ repository status` lists each hook's last success, backlog and failure; its JSON
5951
+ also carries the hook's `command` or `url`.
5952
+
4554
5953
 
4555
5954
  ```toml
4556
5955
  baseBranch = "main"
@@ -4562,6 +5961,12 @@ plugins = ["./plugins/local.ts", "@acme/autobuild-plugin"]
4562
5961
  [upgrade]
4563
5962
  automatic = true # immediate/60-second target checks; false requires manual restart
4564
5963
 
5964
+ #[hooks.notify] # optional observe-only hook; exactly one of command or url
5965
+ #command = "./tools/notify.sh" # one ab watch --json record on stdin per invocation; local dispatchers only
5966
+ #url = "https://hooks.example.com/autobuild" # or: one signed JSON POST per record
5967
+ #secretEnv = "NOTIFY_HOOK_SECRET" # required with url; names the signing-secret variable
5968
+ #events = ["escalation.*"] # optional; default is the watch attention set
5969
+
4565
5970
  #[workspace] # optional; default provider = "git-worktree"
4566
5971
  #provider = "vercel-sandbox" # shipped remote provider, or plugin name
4567
5972
  #[workspace.config]
@@ -4582,6 +5987,10 @@ typecheck = "bun run type-check"
4582
5987
  test = "bun run test"
4583
5988
  publish = "bun run publish"
4584
5989
 
5990
+ [[generated]] # optional: files a command rebuilds; restack
5991
+ paths = ["src/schema.json"] # conflicts only in these are regenerated
5992
+ command = "bun run gen:schema" # sh -c from the workspace root
5993
+
4585
5994
  [verify]
4586
5995
  steps = ["types", "unit", "acceptance"]
4587
5996
  [verify.types]
@@ -4631,6 +6040,9 @@ maxReconcileAttempts = 3
4631
6040
  maxReviewRounds = 6
4632
6041
  harvestThreshold = 5 # observation-count pressure in dispatch
4633
6042
  harvestMaxDrift = 3 # merged builds since oldest observation; 0 disables
6043
+ # maxOpenPrs = 12 # open root PRs that pause normal claims; unset disables
6044
+ # resumeOpenPrs = 9 # resume at or below; default maxOpenPrs - 1
6045
+ # excludeHeldOpenPrs = false # leave held PRs out of the count
4634
6046
 
4635
6047
  [tickets]
4636
6048
  source = "file"
@@ -4674,7 +6086,7 @@ decide where a build's effective configuration is composed from:
4674
6086
  | Class | Sections | Source at deposit |
4675
6087
  |---|---|---|
4676
6088
  | Build-owned (pinned) | `[verify]` and `[verify.<step>]`, `[finalize]` and `[finalize.<step>]`, `[commands]`, `[workspace]` (provider and config, including `provisioning` and `runtimeProvisioning`) | The execution checkout at each verification cycle; launch deposits use the branch head or recorded workspace base until a cycle capture exists. The exact commit is recorded once per deposit in the effective-config artifact metadata — except in checkout mode when the worktree read cannot be attributed to the branch-head commit: because the worktree file has uncommitted edits, because the clean/dirty comparison could not be performed (non-git workspace or a transient git error), or because the branch head never carried the file. The deposit then records the source `worktree-dirty` and no commit, because no commit claims the worktree bytes (the build still runs them). |
4677
- | Deployment-owned (live) | `[roles]` (runtime, model, args, alternates, per-role `sessionBudgetSeconds`), `[profiles]` (label-selected role overlays) and `[policy]` (budgets, retry bounds, stall and harvest knobs) | The dispatcher's live snapshot; an accepted reload delivers these to active builds. |
6089
+ | Deployment-owned (live) | `[roles]` (runtime, model, args, alternates, per-role `sessionBudgetSeconds`), `[profiles]` (label-selected role overlays), `[policy]` (budgets, retry bounds, stall and harvest knobs) and `[[generated]]` (restack regeneration declarations) | The dispatcher's live snapshot; an accepted reload delivers these to active builds. |
4678
6090
  | Dispatcher-owned | `baseBranch`, `capacity`, `ticketScanIntervalSeconds`, `forge`, `plugins`, `pr`, `tickets`, `orchestrator`, `merge`, `upgrade` | The dispatcher's live snapshot; the build runner never interprets them. |
4679
6091
 
4680
6092
  Dispatcher lease sweeps may reuse parsed effective-config pins in a disposable
@@ -4753,6 +6165,10 @@ resolving to the ordinary `skipped` outcome so exclusions stay queryable:
4753
6165
  reconcile, so upstream-merged work is not attributed to the build). No
4754
6166
  match skips without launching anything; a Git failure is infrastructure and
4755
6167
  fails closed, never a synthetic skip.
6168
+ - **Verify base for checks.** A `check` command runs with `AB_VERIFY_BASE`
6169
+ set to that same durable base, or to a node's integration cycle parent, so
6170
+ a check can judge the change relative to it; the variable is absent when no
6171
+ base exists.
4756
6172
 
4757
6173
 
4758
6174
  #### Post-reconcile verification policy
@@ -4781,8 +6197,9 @@ is not re-verified, so breakage that only exists in the combination can merge.
4781
6197
 
4782
6198
  ### 16.3 Skill installation: vendored, namespaced, editable [D11]
4783
6199
 
4784
- This project ships 11 canonical default skills for the fixed phases, the
4785
- non-phase surfaces (`spec`, `tickets`, and `guide`), and the outer-loop skills.
6200
+ This project ships 14 canonical default skills for the fixed phases, the
6201
+ optimization node's `propose` phase, the non-phase surfaces (`spec`,
6202
+ `tickets`, and `guide`), and the outer-loop skills.
4786
6203
  Repository setup guidance ships as `guide/references/setup.md`, not as a skill;
4787
6204
  each repository authors its own acceptance-check skill. No generic verifier
4788
6205
  skill ships. `ab init` installs into a repo:
@@ -4793,7 +6210,7 @@ skill ships. `ab init` installs into a repo:
4793
6210
  Existing config is never overwritten, even with `--force`.
4794
6211
  - **An agent-driven setup handoff.** Init probes every registered runtime and
4795
6212
  reports each usable/unusable result, then chooses an interactive setup agent
4796
- using the product-fixed `claude`, `codex`, `pi` preference order. The launcher
6213
+ using the product-fixed `claude`, `codex`, `pi`, `antigravity` preference order. The launcher
4797
6214
  choice does not constrain the pipeline's final roles or models. On an
4798
6215
  interactive terminal, init starts that coding-agent CLI directly in the
4799
6216
  target repository with inherited terminal I/O, no `AB_*` session identity,
@@ -4807,7 +6224,7 @@ skill ships. `ab init` installs into a repo:
4807
6224
  setup reference in an older or partial distribution does not fail init. On
4808
6225
  rerun, the prompt asks the agent to review and improve the preserved existing
4809
6226
  config.
4810
- - **Copies** of the 11 default skills into the project skills directory,
6227
+ - **Copies** of the 14 default skills into the project skills directory,
4811
6228
  namespaced `ab-*`. Copies, not references — per-repo customization is the
4812
6229
  point: this repo's code-review standards and setup reference live in the
4813
6230
  vendored trees. Harness-specific discovery paths are symlinks to the one
@@ -4959,7 +6376,7 @@ or installs releases in the foreground or background.
4959
6376
  2. **[OPEN] Retention/archival policy** — the pilot's archival gap, now a store
4960
6377
  config concern rather than a repo problem. Needs a default (e.g. prune
4961
6378
  blobs for merged builds after N months, keep events). Immutable reconcile
4962
- archive refs are retained indefinitely for now; their retention policy is
6379
+ archive refs and `history-objects-<sha>` copies are retained indefinitely; their retention policy is
4963
6380
  part of this open thread.
4964
6381
  3. **[OPEN] Global capacity** — per-repo capacity is the top-level `capacity`
4965
6382
  scalar (§16.1); whether a cross-repo global cap is needed, and where it
@@ -5101,12 +6518,13 @@ The web dashboard consumes shared terminology without introducing a tree surface
5101
6518
  same deterministic, repository-scoped ready consent/held candidates. A recorded
5102
6519
  current decision is required; auto-authorized and consented candidates are absent.
5103
6520
  Queue entries and build status show the current candidate head and the head
5104
- consent was given at (null without consent).
6521
+ consent was given at (null without consent), and a current forge CI failure
6522
+ (`ciFailure`, §15.7) in the shared vocabulary.
5105
6523
  Source `ab ticket tree` / `tickets.tree` enumerate all ticket states with listing
5106
6524
  diagnostics; effective build targets remain frozen independently of source metadata.
5107
6525
 
5108
6526
  Default watch attention includes `integration.verification-failed`, `integration.landed`, `node.item-conflicted`,
5109
- `landing.consent-revoked`, and conflicted `restack.replayed`. Derived `build.consent-ready` observations
6527
+ `landing.consent-revoked`, `pr.checks-failed`, `optimization.noise-exceeded`, and conflicted `restack.replayed`. Derived `build.consent-ready` observations
5110
6528
  carry target, branch, candidate and the durable readiness entry position in the
5111
6529
  existing cursor envelope. Cursor identities retain readiness episodes across
5112
6530
  restart; a new candidate or exit/re-entry can wake again. Explicit event globs
@@ -5156,12 +6574,18 @@ polls read no receipts or event rows.
5156
6574
 
5157
6575
  A historical `publication.lost` does not prove that every copy of its candidate
5158
6576
  is gone. Recovery checks the exact branch and private archive refs and retained
5159
- replay objects first. An available candidate continues guarded publication.
5160
- A genuinely missing reconcile or automatic restack candidate records
6577
+ store copies first. Replay copies are read in either format (the chunked manifest
6578
+ or a legacy base64 pack); when a thin pack's base is missing, recovery fetches the
6579
+ published target first and applies the pack with `git index-pack --fix-thin`. An
6580
+ available candidate is retained best effort, in the leaf order above, before
6581
+ guarded publication continues; a refused archive does not block it, and a remote
6582
+ provider's `recoverCandidate` reports the candidate available even when archiving
6583
+ is refused. A commit retained nowhere redoes the work from the published branch,
6584
+ as above. A genuinely missing reconcile or automatic restack candidate records
5161
6585
  `publication.candidate-retired`, abandons its obsolete request, and replays the
5162
6586
  producing operation with a fresh transaction identity. Its frozen target,
5163
6587
  reconcile occurrence or automatic trigger, cycle, and message survive. The
5164
- retired candidate is excluded from archive requirements unless independently
6588
+ retired candidate is excluded from retention requirements unless independently
5165
6589
  required by proven history. This reconstruction consumes no infrastructure
5166
6590
  attempt and no additional conflict occurrence; it needs no operator guidance.
5167
6591
  A bare retry also clears an existing infrastructure-limit escalation through
@@ -5211,6 +6635,11 @@ clears the attention, closes the escalation unanswered and the build continues.
5211
6635
  Answering it with a bare retry makes the janitor attempt on its next tick. An
5212
6636
  episode raises at most one escalation; a new episode after recovery can raise
5213
6637
  another. `policy.janitorBackoffMaxSeconds` sets the positive integer cap.
6638
+ A pending control the janitor can act on wakes it during backoff: an abort, a
6639
+ pause, a resume of a paused build, a queued discard or an unacknowledged landing
6640
+ command. A leaf's resume that only cancelled a never-acknowledged pause is not
6641
+ one and waits out the backoff; a node's janitor acknowledges every pending
6642
+ control itself, so any node command wakes it.
5214
6643
  A dispatcher that cannot execute Git for kernel node work (a missing or
5215
6644
  unloadable `git` for the bare clone) records no janitor failures. It records
5216
6645
  one durable `dispatcher.kernel-git-unavailable` repository condition, node work
@@ -5219,6 +6648,25 @@ succeeds.
5219
6648
 
5220
6649
  A rate limit the dispatcher classifies on its own authenticated request
5221
6650
  records repository degradation with `resetAt`.
6651
+ The built-in GitHub forge also treats a successful response, 304 included,
6652
+ that reports `x-ratelimit-remaining: 0` with a future reset at most 65 minutes
6653
+ away (one hour plus five minutes of clock skew) as that quota's limit.
6654
+ The response keeps its result, and the process's next
6655
+ request for the same quota (`core`, `graphql`, …) fails as that rate limit
6656
+ without being sent, so cooldown follows the rules here without an avoidable
6657
+ refusal. Other quotas are unaffected. A missing, malformed, past or
6658
+ implausible reset enters no cooldown, and no later response clears one early:
6659
+ only the reset passing, or an explicit `forge-clear`, does. After a clear, the
6660
+ next request goes to GitHub as a probe, and an actual limit restores the
6661
+ cooldown.
6662
+ The first limit of an episode records an ordinary `dispatcher.forge-degraded`,
6663
+ which wakes `ab watch` once. A later reset inside the unexpired episode extends
6664
+ the cooldown durably as a degradation marked `continued` that wakes nothing; an
6665
+ equal or earlier reset writes nothing. A limit after the reset has passed, or
6666
+ after recovery, opens a new episode. A rate-limited or unreadable response on
6667
+ landing, gate inspection or PR polling is a typed forge failure or an unproven
6668
+ state, never "no checks", "ungated", "closed" or "merged"; merge-freshness
6669
+ inspection defers instead of recording best-effort evidence.
5222
6670
  Forge work waits during cooldown; passing the deadline permits a recovery
5223
6671
  request; a successful probe records automatic recovery. An authorized operator
5224
6672
  may explicitly override erroneous recorded state with
@@ -5272,7 +6720,15 @@ using exact-resource ETags; authenticated 304s spare the REST primary quota.
5272
6720
  Adapter caches are bounded and restart/eviction falls back to fresh reads.
5273
6721
  Writes, including Git publication and rewrites, invalidate observations before
5274
6722
  attempting the mutation so acknowledgement reads remain fresh. Leaf PR polling
5275
- keeps its existing cadence. Readiness and merge inspections remain fresh.
6723
+ keeps its existing cadence. Gate branch and rules reads, merge-freshness
6724
+ protection and rulesets, landing, retarget and auto-merge PR reads, commit and
6725
+ history reads, merge-queue activity, summary-comment listing and branch
6726
+ existence revalidate the same way. Both caches hold the raw representation and
6727
+ every caller validates it with its own schema, so consumers of one resource
6728
+ share one request and one ETag; a representation that fails validation loses
6729
+ its ETag. Reads that must be fresh, including merge inspections, still reach
6730
+ GitHub every time, conditionally when an ETag is cached. Readiness diagnostics
6731
+ and post-mutation readbacks stay unconditional.
5276
6732
 
5277
6733
  Opened integration nodes poll every tick until their durable activity has been
5278
6734
  quiet for `policy.nodeIdleAfterSeconds` (default 600 seconds), then poll every
@@ -5300,6 +6756,18 @@ primary quota, REST 304s and GraphQL calls. Transport failures and historical or
5300
6756
  legacy observations can remain unclassified; absent fields never imply zero.
5301
6757
  Shared requests are attributed to their first requester; cache hits count zero.
5302
6758
 
6759
+ An adapter may also report the primary rate-limit headers a response carried
6760
+ (`resource`, `limit`, `remaining`, `resetAt`), including on 304s and limited
6761
+ failures; GitHub does. No extra `/rate_limit` request is made. Tick telemetry's
6762
+ optional `rateLimits` carries the latest reading per resource with its
6763
+ `observedAt`, at most eight resources and none older than a day, across ticks
6764
+ and dispatcher restarts, so a cooldown tick with no requests still reports the
6765
+ last known quota. Secondary limits carry no headers and appear only as the
6766
+ degradation. `ab repository status` shows them as `forgeRateLimit`: each
6767
+ reading, `stale` once its window has reset (current quota unknown), and
6768
+ `paused`/`pausedUntil` while the dispatcher's rate-limit cooldown holds forge
6769
+ landing and polling. Absent fields mean unknown, never full quota.
6770
+
5303
6771
  ## Integration verification attention
5304
6772
 
5305
6773
  A failed node verification cycle records `integration.verification-failed` with its prepared cycle id, failed steps, exact head and parent, and guidance to file a repair child targeting the node. The kernel reports durable failed receipts; dispatcher housekeeping recovers missing reports for the current cycle using a per-cycle CAS guard. Superseded cycles are never backfilled with repair instructions: recovery requires the latest prepared cycle to match the node’s observed head and parent. This fact is decisive evidence and bookkeeping, and does not change verification or leaf routing.