@defrex/autobuild 1.9.0 → 1.11.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 (537) hide show
  1. package/README.md +3 -3
  2. package/SPEC.md +2232 -175
  3. package/bin/ab-dispatch-generation.ts +5 -1
  4. package/docs/accounts.md +2 -1
  5. package/docs/agent-runtimes.md +30 -3
  6. package/docs/answering-blocked-builds.md +35 -7
  7. package/docs/architecture.md +436 -63
  8. package/docs/build-store.md +10 -7
  9. package/docs/builds.md +5 -0
  10. package/docs/cli.md +40 -2
  11. package/docs/configuration-overview.md +5 -1
  12. package/docs/configuration.md +649 -74
  13. package/docs/dispatcher.md +79 -6
  14. package/docs/forges.md +8 -1
  15. package/docs/getting-started.md +1 -1
  16. package/docs/integration-overview.md +4 -2
  17. package/docs/integration-tree.md +102 -11
  18. package/docs/merge-policy.md +30 -14
  19. package/docs/migration-1.0.md +2 -1
  20. package/docs/operating.md +36 -6
  21. package/docs/operator-api.md +251 -20
  22. package/docs/operator-surfaces.md +85 -0
  23. package/docs/optimization-nodes.md +1100 -0
  24. package/docs/overview.md +1 -1
  25. package/docs/plugin-authoring.md +83 -13
  26. package/docs/remote-store-protocol.md +137 -17
  27. package/docs/remote-ticket-protocol.md +90 -2
  28. package/docs/restacking.md +119 -15
  29. package/docs/seams.md +2 -2
  30. package/docs/setup.md +27 -4
  31. package/docs/skills.md +4 -2
  32. package/docs/spec-standard.md +2 -1
  33. package/docs/ticket-dependencies.md +15 -3
  34. package/docs/ticket-migration.md +4 -2
  35. package/docs/ticket-sources.md +54 -14
  36. package/docs/tickets.md +21 -6
  37. package/docs/troubleshooting.md +11 -2
  38. package/docs/verification.md +15 -3
  39. package/docs/workspaces.md +6 -1
  40. package/package.json +9 -5
  41. package/packages/core/src/accounts/chatgpt-oauth.ts +7 -5
  42. package/packages/core/src/cli/accounts.ts +7 -2
  43. package/packages/core/src/cli/attempt.ts +103 -0
  44. package/packages/core/src/cli/attention.ts +11 -2
  45. package/packages/core/src/cli/binary-direct.ts +54 -1
  46. package/packages/core/src/cli/binary-lifecycle.ts +2 -1
  47. package/packages/core/src/cli/binary.ts +5 -3
  48. package/packages/core/src/cli/build-control.ts +407 -67
  49. package/packages/core/src/cli/context.ts +272 -15
  50. package/packages/core/src/cli/dashboard/detail.ts +26 -2
  51. package/packages/core/src/cli/dashboard/facts.ts +89 -56
  52. package/packages/core/src/cli/dashboard/header.ts +101 -0
  53. package/packages/core/src/cli/dashboard/integration-detail.ts +7 -2
  54. package/packages/core/src/cli/dashboard/landing-display.ts +15 -2
  55. package/packages/core/src/cli/dashboard/model.ts +133 -66
  56. package/packages/core/src/cli/dashboard/objective-row.ts +221 -0
  57. package/packages/core/src/cli/dashboard/poll.ts +178 -76
  58. package/packages/core/src/cli/dashboard/render.ts +172 -227
  59. package/packages/core/src/cli/dashboard/reopen-display.ts +39 -0
  60. package/packages/core/src/cli/dashboard/row-text.ts +538 -0
  61. package/packages/core/src/cli/dashboard/timeline.ts +288 -0
  62. package/packages/core/src/cli/dashboard/tree.ts +12 -1
  63. package/packages/core/src/cli/dashboard/vocabulary.ts +188 -0
  64. package/packages/core/src/cli/dispatch-args.ts +44 -1
  65. package/packages/core/src/cli/dispatch-frontend.ts +29 -30
  66. package/packages/core/src/cli/dispatch-launch-stop.ts +73 -0
  67. package/packages/core/src/cli/dispatch-launcher.ts +41 -46
  68. package/packages/core/src/cli/dispatch-repository-feed.ts +1 -1
  69. package/packages/core/src/cli/dispatch-web.ts +155 -0
  70. package/packages/core/src/cli/dispatch.ts +216 -38
  71. package/packages/core/src/cli/env.ts +42 -0
  72. package/packages/core/src/cli/help.ts +293 -12
  73. package/packages/core/src/cli/init-agent.ts +4 -1
  74. package/packages/core/src/cli/init-readiness-remote.ts +3 -2
  75. package/packages/core/src/cli/init-validation.ts +5 -5
  76. package/packages/core/src/cli/init.ts +3 -2
  77. package/packages/core/src/cli/judge-entry.ts +82 -0
  78. package/packages/core/src/cli/judge.ts +233 -0
  79. package/packages/core/src/cli/landings.ts +3 -2
  80. package/packages/core/src/cli/main.ts +481 -148
  81. package/packages/core/src/cli/mcp.ts +35 -3
  82. package/packages/core/src/cli/measurement-text.ts +19 -0
  83. package/packages/core/src/cli/objective.ts +154 -0
  84. package/packages/core/src/cli/operator-preference.ts +57 -0
  85. package/packages/core/src/cli/publication-settlement.ts +106 -22
  86. package/packages/core/src/cli/repo-lease.ts +3 -0
  87. package/packages/core/src/cli/repo-state.ts +56 -6
  88. package/packages/core/src/cli/repository-status.ts +205 -56
  89. package/packages/core/src/cli/status.ts +275 -16
  90. package/packages/core/src/cli/store-opening.ts +4 -0
  91. package/packages/core/src/cli/terminal-restore.ts +32 -7
  92. package/packages/core/src/cli/terminals.ts +205 -8
  93. package/packages/core/src/cli/ticket-start.ts +53 -0
  94. package/packages/core/src/cli/ticket.ts +166 -38
  95. package/packages/core/src/cli/upgrade-agent.ts +12 -8
  96. package/packages/core/src/cli/wait.ts +22 -8
  97. package/packages/core/src/cli/watch.ts +361 -95
  98. package/packages/core/src/cli/web.ts +139 -0
  99. package/packages/core/src/config/create-labels.ts +23 -0
  100. package/packages/core/src/config/live.ts +101 -14
  101. package/packages/core/src/config/load.ts +61 -20
  102. package/packages/core/src/config/local.ts +212 -0
  103. package/packages/core/src/config/pipeline-source.ts +3 -3
  104. package/packages/core/src/config/reference.ts +18 -0
  105. package/packages/core/src/config/roles.ts +182 -73
  106. package/packages/core/src/config/schema.ts +157 -19
  107. package/packages/core/src/events/catalog.ts +43 -3
  108. package/packages/core/src/events/compatibility.ts +7 -1
  109. package/packages/core/src/events/payloads.ts +685 -1
  110. package/packages/core/src/events/policy.ts +63 -0
  111. package/packages/core/src/events/repository.ts +153 -27
  112. package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +1797 -199
  113. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/017d8dd5bb6dd80b.json.gz +0 -0
  114. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/0ab2a90d0305dc9d.json.gz +0 -0
  115. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/10a4657408d4e121.json.gz +0 -0
  116. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/1152a2e97ee81728.json.gz +0 -0
  117. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/13ca84752c5f8b54.json.gz +0 -0
  118. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/1411d1cdbdd9911e.json.gz +0 -0
  119. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/1444fe1fa7fc802c.json.gz +0 -0
  120. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/1491ac0600349391.json.gz +0 -0
  121. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/178e12f1759b7552.json.gz +0 -0
  122. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/1921f86f752428c9.json.gz +0 -0
  123. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/1972c1d66008ef6b.json.gz +0 -0
  124. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/19e8e43e7f3f1a06.json.gz +0 -0
  125. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/20a85c143c3e8164.json.gz +0 -0
  126. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/21ce2c0bf58318e1.json.gz +0 -0
  127. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/293dcb3a94fb3470.json.gz +0 -0
  128. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/2ab7436356267118.json.gz +0 -0
  129. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/2d084641735caaff.json.gz +0 -0
  130. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/3237bcecf68e5db9.json.gz +0 -0
  131. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/33d0cc593610e56f.json.gz +0 -0
  132. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/3451ed2136dcc356.json.gz +0 -0
  133. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/358ec8693f2237e6.json.gz +0 -0
  134. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/35cf9ccc4478b2d2.json.gz +0 -0
  135. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/3649e7bd1203f154.json.gz +0 -0
  136. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/378da6dece82202a.json.gz +0 -0
  137. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/38c75099d9191471.json.gz +0 -0
  138. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/398952f1f01db1a3.json.gz +0 -0
  139. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/3b64d352d56c9121.json.gz +0 -0
  140. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/3dc486226c05372d.json.gz +0 -0
  141. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/431c9bb2ee8838e0.json.gz +0 -0
  142. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/4400dffca929e2f0.json.gz +0 -0
  143. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/49064fc079964a5c.json.gz +0 -0
  144. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/4932c70a2af97faf.json.gz +0 -0
  145. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/4edded75f17742f4.json.gz +0 -0
  146. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/4f00c0f2c8afd159.json.gz +0 -0
  147. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/516a5a7aadf97587.json.gz +0 -0
  148. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/516dc6ea85d67cd7.json.gz +0 -0
  149. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/536085773daf6b58.json.gz +0 -0
  150. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/584e2ba74608e051.json.gz +0 -0
  151. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/59ffaa6974094c72.json.gz +0 -0
  152. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/5bb43afb121674c6.json.gz +0 -0
  153. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/5f0ca42af862c4ee.json.gz +0 -0
  154. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/6118031132db9bfc.json.gz +0 -0
  155. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/63107a8d58776b63.json.gz +0 -0
  156. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/63546b08d4d6fa11.json.gz +0 -0
  157. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/643d70429ce03dad.json.gz +0 -0
  158. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/677ea92572c29082.json.gz +0 -0
  159. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/6ae5bf60504d6467.json.gz +0 -0
  160. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/6bd6275061aaffa5.json.gz +0 -0
  161. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/6efdc8defc75fccb.json.gz +0 -0
  162. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/71c53d33f09d8204.json.gz +0 -0
  163. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/7267ca2757cffba7.json.gz +0 -0
  164. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/76b7d4244082b3f9.json.gz +0 -0
  165. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/7749f918c6f10968.json.gz +0 -0
  166. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/7833e42d16301424.json.gz +0 -0
  167. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/7d4edad0614adaf1.json.gz +0 -0
  168. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/837365898d04f45a.json.gz +0 -0
  169. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/85f9f0c921b8b5bb.json.gz +0 -0
  170. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/8879f57a24733897.json.gz +0 -0
  171. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/88cb9e71bdec972d.json.gz +0 -0
  172. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/89625654b02e9ac1.json.gz +0 -0
  173. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/8a0cd6dd06cc155e.json.gz +0 -0
  174. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/8aa9ca8609dc051d.json.gz +0 -0
  175. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/8c8640255bd61658.json.gz +0 -0
  176. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/8cc15eb1807c0157.json.gz +0 -0
  177. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/8ced97c44bc0af3a.json.gz +0 -0
  178. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/8d4144004720b9f8.json.gz +0 -0
  179. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/8db633ead1807f8b.json.gz +0 -0
  180. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/8e42cdbd0994ab0c.json.gz +0 -0
  181. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/9011d0f6ff955ef9.json.gz +0 -0
  182. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/916ebc5433801c41.json.gz +0 -0
  183. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/9539b995af5c54a9.json.gz +0 -0
  184. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/95f391bfd7b7dbd7.json.gz +0 -0
  185. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/9613e8fa568a9281.json.gz +0 -0
  186. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/9a68f8753bd9038d.json.gz +0 -0
  187. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/9b25e58227080094.json.gz +0 -0
  188. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/9ee3919fbd4f9458.json.gz +0 -0
  189. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/a04a34cc2717147b.json.gz +0 -0
  190. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/a0b32c12e4e6edb6.json.gz +0 -0
  191. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/a55218252707bdd3.json.gz +0 -0
  192. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/a732fd08b31522a6.json.gz +0 -0
  193. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/a98af134be2da8a9.json.gz +0 -0
  194. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/a9d206a01f9039e5.json.gz +0 -0
  195. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/abf7fe3c92c82f2d.json.gz +0 -0
  196. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/ac928b04842c00db.json.gz +0 -0
  197. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/af953392d81911da.json.gz +0 -0
  198. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/b0d877c44810ecb0.json.gz +0 -0
  199. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/b0f7c6ebb2db57fc.json.gz +0 -0
  200. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/b905c22ec17eed31.json.gz +0 -0
  201. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/bce0c54e865f4b79.json.gz +0 -0
  202. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/c68b7ee2e2610f30.json.gz +0 -0
  203. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/c7f7e0378aeea237.json.gz +0 -0
  204. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/c98cb1659eb142b6.json.gz +0 -0
  205. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/ca830adf06ed55a1.json.gz +0 -0
  206. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/cb3a219f33e437ca.json.gz +0 -0
  207. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/cf1e0c0d82567e0c.json.gz +0 -0
  208. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/d008d86d9ff77b30.json.gz +0 -0
  209. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/d1432a819d8e48c5.json.gz +0 -0
  210. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/d185ed6aa9192aff.json.gz +0 -0
  211. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/d5d5ccca80a893d8.json.gz +0 -0
  212. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/d873fad29d6c7e55.json.gz +0 -0
  213. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/db84b12316e2da4a.json.gz +0 -0
  214. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/ddf6dc967d898767.json.gz +0 -0
  215. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/dfc64de6e7bfc0a0.json.gz +0 -0
  216. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/e2f18fa32fe1f6d0.json.gz +0 -0
  217. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/e37393fed29e84c5.json.gz +0 -0
  218. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/e6a8585e2a054ff6.json.gz +0 -0
  219. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/e7e9e327baca6903.json.gz +0 -0
  220. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/e86447af0571672c.json.gz +0 -0
  221. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/ea819202d22122e5.json.gz +0 -0
  222. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/eb4535585f2e84f6.json.gz +0 -0
  223. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/eb7ddd5319d09e27.json.gz +0 -0
  224. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/eca4959b2b87ae15.json.gz +0 -0
  225. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/ee10d7959ec4843c.json.gz +0 -0
  226. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/ef1b68347966ab26.json.gz +0 -0
  227. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/f3e55425cc41f230.json.gz +0 -0
  228. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/f40042c1cdb9fd43.json.gz +0 -0
  229. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/f48466215c790a3f.json.gz +0 -0
  230. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/f5b9ace9b59351e7.json.gz +0 -0
  231. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/f8155387eb5f375c.json.gz +0 -0
  232. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/fa8f1475a55be935.json.gz +0 -0
  233. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/fb21116a15d0b1f1.json.gz +0 -0
  234. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/fe95444fbeabe592.json.gz +0 -0
  235. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/09bf0a1611d07363.json +984 -0
  236. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/10eac4988d66e161.json +1067 -0
  237. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/1a436b5fb45aee3e.json +1116 -0
  238. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/249db6f7a41f90e2.json +161 -0
  239. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/25dcb2fb6eaa83f4.json +858 -0
  240. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/2e1bdc763924616f.json +4932 -0
  241. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/30e9dabce3c4263d.json +399 -0
  242. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/3c27f918b194e3b3.json +465 -0
  243. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/4898ef339c68fa36.json +83 -0
  244. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/51816c0ffa62af6e.json +417 -0
  245. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/561bf45320062a44.json +83 -0
  246. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/5672d0233085d050.json +84 -0
  247. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/5e39f42cbdbf35ef.json +163 -0
  248. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/7771a7a2250f9964.json +868 -0
  249. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/79f0e0f4ccd43ba2.json +455 -0
  250. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/859c09edac738823.json +1086 -0
  251. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/881c491321bec99a.json +1074 -0
  252. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/965f25c3af1d2cdc.json +160 -0
  253. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/9b76d89da575ca90.json +20 -0
  254. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/9eb485320a72a9ff.json +233 -0
  255. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/a283c1f3462b1cc1.json +81 -0
  256. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/a60448c01016135e.json +18 -0
  257. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/a6584fb61b6679bd.json +97 -0
  258. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/a6e570fb126991ff.json +36 -0
  259. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/a8acf22c968b6e3d.json +81 -0
  260. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/ba7b85895bf6698e.json +1153 -0
  261. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/c88365c25b3186d3.json +543 -0
  262. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/e8f0481b23f90056.json +711 -0
  263. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/ee55782ed40ebbac.json +110 -0
  264. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/fc5082fac8167f3d.json +98 -0
  265. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/fc66408cde0b6b04.json +637 -0
  266. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/fd55c329cfe921cc.json +1069 -0
  267. package/packages/core/src/kernel/attempt-creation-key.ts +20 -0
  268. package/packages/core/src/kernel/attempt-settlement.ts +125 -0
  269. package/packages/core/src/kernel/auto-merge-default.ts +1 -3
  270. package/packages/core/src/kernel/auto-merge.ts +1 -3
  271. package/packages/core/src/kernel/build-roster.ts +230 -0
  272. package/packages/core/src/kernel/dispatch-capacity.ts +316 -40
  273. package/packages/core/src/kernel/dispatch-placement.ts +1 -1
  274. package/packages/core/src/kernel/dispatch-settings.ts +1 -4
  275. package/packages/core/src/kernel/dispatch-status.ts +3 -5
  276. package/packages/core/src/kernel/dispatch-upgrade.ts +1 -1
  277. package/packages/core/src/kernel/engine.ts +152 -18
  278. package/packages/core/src/kernel/execution-intervals.ts +61 -0
  279. package/packages/core/src/kernel/forge-checks.ts +140 -0
  280. package/packages/core/src/kernel/forge-health.ts +2 -2
  281. package/packages/core/src/kernel/generated-files.ts +43 -0
  282. package/packages/core/src/kernel/generated-regeneration.ts +254 -0
  283. package/packages/core/src/kernel/generators/build-log.ts +30 -2
  284. package/packages/core/src/kernel/generators/optimization-log.ts +679 -0
  285. package/packages/core/src/kernel/generators/panel-log.ts +133 -0
  286. package/packages/core/src/kernel/generators/repository-journals.ts +13 -0
  287. package/packages/core/src/kernel/guarded-forge.ts +76 -11
  288. package/packages/core/src/kernel/harvest.ts +1 -4
  289. package/packages/core/src/kernel/head-paths.ts +4 -1
  290. package/packages/core/src/kernel/history-retention.ts +337 -0
  291. package/packages/core/src/kernel/incremental-fixtures.ts +6 -0
  292. package/packages/core/src/kernel/incremental.ts +14 -4
  293. package/packages/core/src/kernel/integration-landing.ts +64 -13
  294. package/packages/core/src/kernel/integration-stack.ts +123 -20
  295. package/packages/core/src/kernel/integration-state.ts +39 -2
  296. package/packages/core/src/kernel/janitor-failure.ts +2 -0
  297. package/packages/core/src/kernel/kernel-git.ts +1 -1
  298. package/packages/core/src/kernel/landing-measurement.ts +275 -0
  299. package/packages/core/src/kernel/landing-readiness.ts +2 -0
  300. package/packages/core/src/kernel/landing-state.ts +20 -1
  301. package/packages/core/src/kernel/leaf-restack-base.ts +33 -7
  302. package/packages/core/src/kernel/leaf-restack-state.ts +99 -4
  303. package/packages/core/src/kernel/log-index-value.ts +2 -0
  304. package/packages/core/src/kernel/log-index.ts +100 -3
  305. package/packages/core/src/kernel/measurement.ts +406 -0
  306. package/packages/core/src/kernel/mixed-version.ts +6 -3
  307. package/packages/core/src/kernel/node-landing.ts +92 -18
  308. package/packages/core/src/kernel/node-restack-state.ts +27 -1
  309. package/packages/core/src/kernel/node-restack-transaction.ts +80 -23
  310. package/packages/core/src/kernel/node-verification-context.ts +14 -4
  311. package/packages/core/src/kernel/open-pr-backpressure-state.ts +24 -0
  312. package/packages/core/src/kernel/open-pr-backpressure.ts +133 -0
  313. package/packages/core/src/kernel/optimization-admission.ts +490 -0
  314. package/packages/core/src/kernel/optimization.ts +953 -0
  315. package/packages/core/src/kernel/panel.ts +225 -0
  316. package/packages/core/src/kernel/phase-failures.ts +121 -0
  317. package/packages/core/src/kernel/phases.ts +42 -6
  318. package/packages/core/src/kernel/pr-attachments.ts +4 -16
  319. package/packages/core/src/kernel/pr-summary.ts +2 -2
  320. package/packages/core/src/kernel/published-branch-head.ts +60 -0
  321. package/packages/core/src/kernel/read-deferrals.ts +2 -2
  322. package/packages/core/src/kernel/read-facts.ts +69 -31
  323. package/packages/core/src/kernel/reconcile-restack.ts +352 -103
  324. package/packages/core/src/kernel/reducer-identity.ts +659 -0
  325. package/packages/core/src/kernel/reducer-registry.ts +62 -9
  326. package/packages/core/src/kernel/reducer-revisions.ts +75 -0
  327. package/packages/core/src/kernel/reducer.ts +269 -11
  328. package/packages/core/src/kernel/reopen-state.ts +48 -0
  329. package/packages/core/src/kernel/reopen.ts +143 -0
  330. package/packages/core/src/kernel/replay-retention.ts +208 -39
  331. package/packages/core/src/kernel/repository-attention.ts +1 -1
  332. package/packages/core/src/kernel/rollup.ts +61 -0
  333. package/packages/core/src/kernel/service-facts.ts +19 -7
  334. package/packages/core/src/kernel/setup-streak.ts +38 -0
  335. package/packages/core/src/kernel/step-durations.ts +257 -0
  336. package/packages/core/src/kernel/target-observation.ts +6 -1
  337. package/packages/core/src/kernel/target-rewrite-recovery.ts +116 -0
  338. package/packages/core/src/kernel/terminal-guard.ts +13 -5
  339. package/packages/core/src/kernel/ticket-handbacks.ts +1 -1
  340. package/packages/core/src/kernel/ticket-migrations.ts +1 -1
  341. package/packages/core/src/kernel/ticket-preparation.ts +1 -1
  342. package/packages/core/src/kernel/ticket-source-health.ts +1 -1
  343. package/packages/core/src/kernel/ticket-starts.ts +118 -0
  344. package/packages/core/src/kernel/ticket-wait.ts +37 -2
  345. package/packages/core/src/kernel/verify-diff-base.ts +67 -0
  346. package/packages/core/src/kernel/verify-stage-state.ts +1 -0
  347. package/packages/core/src/kernel/verify-stages.ts +51 -1
  348. package/packages/core/src/objective.ts +532 -0
  349. package/packages/core/src/ontology.ts +54 -6
  350. package/packages/core/src/operator/agent-context-serve.ts +631 -0
  351. package/packages/core/src/operator/annotations.ts +105 -4
  352. package/packages/core/src/operator/attention.ts +470 -0
  353. package/packages/core/src/operator/canonical-skills.ts +35 -0
  354. package/packages/core/src/operator/cli-equivalents.ts +270 -0
  355. package/packages/core/src/operator/context-prompts.ts +61 -0
  356. package/packages/core/src/operator/control.ts +2 -1
  357. package/packages/core/src/operator/index.ts +61 -1
  358. package/packages/core/src/operator/landings.ts +28 -19
  359. package/packages/core/src/operator/optimization.ts +314 -0
  360. package/packages/core/src/operator/protocol.ts +33 -1
  361. package/packages/core/src/operator/query.ts +137 -73
  362. package/packages/core/src/operator/read-view.ts +5 -2
  363. package/packages/core/src/operator/registry.ts +625 -59
  364. package/packages/core/src/operator/requests.ts +45 -20
  365. package/packages/core/src/operator/sandbox-host.ts +107 -11
  366. package/packages/core/src/operator/sandbox-resolver.ts +253 -0
  367. package/packages/core/src/operator/sandbox.ts +778 -82
  368. package/packages/core/src/operator/ticket-asset-list.ts +77 -0
  369. package/packages/core/src/operator/ticket-assets.ts +167 -0
  370. package/packages/core/src/operator/ticket-start.ts +152 -0
  371. package/packages/core/src/operator/tickets.ts +36 -4
  372. package/packages/core/src/plugin-sdk/index.ts +24 -0
  373. package/packages/core/src/plugins/manifest.ts +1 -1
  374. package/packages/core/src/plugins/registry.ts +1 -0
  375. package/packages/core/src/ports/forge/contract.ts +9 -0
  376. package/packages/core/src/ports/forge/fake.ts +114 -2
  377. package/packages/core/src/ports/forge/git-blob.ts +15 -0
  378. package/packages/core/src/ports/forge/git-rewrite.ts +6 -4
  379. package/packages/core/src/ports/forge/github-readiness.ts +1 -1
  380. package/packages/core/src/ports/forge/github-transport.ts +156 -1
  381. package/packages/core/src/ports/forge/github.ts +388 -100
  382. package/packages/core/src/ports/forge/local-git.ts +61 -1
  383. package/packages/core/src/ports/forge/readiness.ts +15 -3
  384. package/packages/core/src/ports/forge-failure.ts +46 -0
  385. package/packages/core/src/ports/forge-request-context.ts +23 -1
  386. package/packages/core/src/ports/forge-telemetry.ts +16 -0
  387. package/packages/core/src/ports/runner/antigravity-test.fixture.ts +149 -0
  388. package/packages/core/src/ports/runner/antigravity.ts +1071 -0
  389. package/packages/core/src/ports/runner/claude-test.fixture.ts +71 -0
  390. package/packages/core/src/ports/runner/claude.ts +6 -1
  391. package/packages/core/src/ports/runner/codex-test.fixture.ts +63 -0
  392. package/packages/core/src/ports/runner/codex.ts +11 -2
  393. package/packages/core/src/ports/runner/contract.ts +25 -1
  394. package/packages/core/src/ports/runner/fake.ts +2 -2
  395. package/packages/core/src/ports/runner/native-cli-fixture.ts +40 -5
  396. package/packages/core/src/ports/runner/native-process-fixture.ts +4 -1
  397. package/packages/core/src/ports/runner/pi.ts +23 -7
  398. package/packages/core/src/ports/runner/production.ts +19 -2
  399. package/packages/core/src/ports/runner/session-env.ts +65 -5
  400. package/packages/core/src/ports/runner/start-prompt.ts +6 -4
  401. package/packages/core/src/ports/tickets/contract.ts +75 -2
  402. package/packages/core/src/ports/tickets/fake.ts +11 -0
  403. package/packages/core/src/ports/tickets/file.ts +18 -0
  404. package/packages/core/src/ports/tickets/github-fake.ts +136 -4
  405. package/packages/core/src/ports/tickets/github.ts +407 -35
  406. package/packages/core/src/ports/tickets/hosted-index.ts +16 -1
  407. package/packages/core/src/ports/tickets/labels.ts +21 -0
  408. package/packages/core/src/ports/tickets/linear.ts +163 -0
  409. package/packages/core/src/ports/tickets/migration.ts +2 -0
  410. package/packages/core/src/ports/tickets/priority.ts +20 -0
  411. package/packages/core/src/ports/tickets/remote-protocol.ts +105 -6
  412. package/packages/core/src/ports/tickets/remote.ts +203 -17
  413. package/packages/core/src/ports/tickets/search.ts +139 -0
  414. package/packages/core/src/ports/tickets/tree.ts +17 -4
  415. package/packages/core/src/ports/types.ts +202 -6
  416. package/packages/core/src/ports/workspace/builtin-capabilities.ts +16 -4
  417. package/packages/core/src/ports/workspace/commit-preservation.ts +182 -64
  418. package/packages/core/src/ports/workspace/create.ts +18 -1
  419. package/packages/core/src/ports/workspace/fake.ts +340 -12
  420. package/packages/core/src/ports/workspace/git-worktree.ts +846 -43
  421. package/packages/core/src/ports/workspace/operator-sandbox.ts +129 -12
  422. package/packages/core/src/ports/workspace/process-group.ts +48 -0
  423. package/packages/core/src/ports/workspace/vercel-sandbox.ts +1539 -221
  424. package/packages/core/src/processes/agent-context-assemble.ts +576 -0
  425. package/packages/core/src/processes/agent-context.ts +469 -0
  426. package/packages/core/src/processes/build-execution-state.ts +1 -3
  427. package/packages/core/src/processes/build-runner.ts +1982 -528
  428. package/packages/core/src/processes/dispatch-failure-budget.ts +1 -1
  429. package/packages/core/src/processes/dispatcher-selectors.ts +15 -13
  430. package/packages/core/src/processes/dispatcher.ts +3003 -308
  431. package/packages/core/src/processes/execution-no-progress.ts +40 -1
  432. package/packages/core/src/processes/execution-settlement.ts +2 -6
  433. package/packages/core/src/processes/harvest-execution-state.ts +2 -6
  434. package/packages/core/src/processes/harvest-runner.ts +7 -2
  435. package/packages/core/src/processes/infrastructure-failure-budget.ts +1 -3
  436. package/packages/core/src/processes/judge-launcher.ts +38 -0
  437. package/packages/core/src/processes/measurement-runner.ts +235 -0
  438. package/packages/core/src/processes/optimization-activity.ts +120 -0
  439. package/packages/core/src/processes/optimization-merges.ts +101 -0
  440. package/packages/core/src/processes/optimization-stop.ts +179 -0
  441. package/packages/core/src/processes/panel-runner.ts +756 -0
  442. package/packages/core/src/processes/phase-failure-budget.ts +2 -0
  443. package/packages/core/src/processes/publication-state.ts +1 -4
  444. package/packages/core/src/processes/repo-view.ts +154 -6
  445. package/packages/core/src/processes/sandbox-state.ts +54 -10
  446. package/packages/core/src/processes/tick-publication.ts +2 -0
  447. package/packages/core/src/processes/tick-state.ts +1 -3
  448. package/packages/core/src/processes/workspace-preparation.ts +76 -0
  449. package/packages/core/src/processes/workspace-preservation.ts +67 -9
  450. package/packages/core/src/scenarios/harness.ts +19 -13
  451. package/packages/core/src/store/account-redaction.ts +1 -0
  452. package/packages/core/src/store/adapter.ts +52 -1
  453. package/packages/core/src/store/agent-context.ts +432 -0
  454. package/packages/core/src/store/build-feed.ts +291 -0
  455. package/packages/core/src/store/build-scope.ts +19 -1
  456. package/packages/core/src/store/contract.ts +955 -14
  457. package/packages/core/src/store/digest.ts +104 -9
  458. package/packages/core/src/store/histogram.ts +113 -0
  459. package/packages/core/src/store/judge-authority.ts +161 -0
  460. package/packages/core/src/store/local/schema.ts +62 -0
  461. package/packages/core/src/store/local/store.ts +628 -22
  462. package/packages/core/src/store/local/ticket-asset-heads.ts +23 -0
  463. package/packages/core/src/store/memory.ts +461 -69
  464. package/packages/core/src/store/open-builds.ts +19 -0
  465. package/packages/core/src/store/phase-session.ts +256 -6
  466. package/packages/core/src/store/reduced-reads.ts +24 -4
  467. package/packages/core/src/store/reducer-value-shapes.json +18023 -11824
  468. package/packages/core/src/store/reducer-values.ts +6 -1
  469. package/packages/core/src/store/remote/client.ts +220 -4
  470. package/packages/core/src/store/remote/compatibility.ts +1 -1
  471. package/packages/core/src/store/remote/credentials.ts +31 -1
  472. package/packages/core/src/store/remote/index.ts +41 -0
  473. package/packages/core/src/store/remote/protocol.ts +107 -0
  474. package/packages/core/src/store/remote/released-clients.json +22 -0
  475. package/packages/core/src/store/remote/released-reducer-values/1.10.0.json +34439 -0
  476. package/packages/core/src/store/remote/released-reducer-values/1.11.0.json +35680 -0
  477. package/packages/core/src/store/remote/released-reducer-values/index.ts +20 -16
  478. package/packages/core/src/store/remote/token.ts +13 -4
  479. package/packages/core/src/store/repo-state-events.ts +6 -8
  480. package/packages/core/src/store/retention.ts +23 -1
  481. package/packages/core/src/store/rollups.ts +337 -0
  482. package/packages/core/src/store/session-handle.ts +20 -2
  483. package/packages/core/src/store/session-reducer.ts +1 -4
  484. package/packages/core/src/store/snapshots.ts +10 -0
  485. package/packages/core/src/store/ticket-assets.ts +1 -3
  486. package/packages/core/src/store/types.ts +117 -9
  487. package/packages/core/src/testing/dispatch-read-budget.ts +1162 -2
  488. package/packages/core/src/testing/git-config-isolation.ts +27 -0
  489. package/packages/core/src/testing/index.ts +40 -0
  490. package/packages/core/src/testing/memory-operator-sandbox.ts +346 -0
  491. package/packages/core/src/testing/reduced-read-budget.ts +5349 -153
  492. package/packages/core/src/web/analytics-source.ts +303 -0
  493. package/packages/core/src/web/assets/Atkinson-OFL.txt +93 -0
  494. package/packages/core/src/web/assets/AtkinsonHyperlegibleNext.latin.woff2 +0 -0
  495. package/packages/core/src/web/assets/JetBrains-OFL.txt +93 -0
  496. package/packages/core/src/web/assets/JetBrainsMono.latin.woff2 +0 -0
  497. package/packages/core/src/web/assets/app.css +1 -0
  498. package/packages/core/src/web/assets/app.js +9 -0
  499. package/packages/core/src/web/assets/manifest.json +31 -0
  500. package/packages/core/src/web/assets/theme.js +1 -0
  501. package/packages/core/src/web/bounded.ts +31 -0
  502. package/packages/core/src/web/http.ts +315 -0
  503. package/packages/core/src/web/hub.ts +160 -0
  504. package/packages/core/src/web/options.ts +38 -0
  505. package/packages/core/src/web/overview-source.ts +322 -0
  506. package/packages/core/src/web/page.ts +56 -0
  507. package/packages/core/src/web/protocol.ts +151 -0
  508. package/packages/core/src/web/read-only.ts +23 -0
  509. package/packages/core/src/web/repository-source.ts +35 -0
  510. package/packages/core/src/web/server.ts +97 -0
  511. package/skills/code-review/SKILL.md +26 -2
  512. package/skills/finalize/SKILL.md +10 -4
  513. package/skills/guide/SKILL.md +743 -123
  514. package/skills/guide/references/accounts.md +2 -1
  515. package/skills/guide/references/integration-tree.md +102 -11
  516. package/skills/guide/references/merge-policy.md +30 -14
  517. package/skills/guide/references/migration-1.0.md +2 -1
  518. package/skills/guide/references/operator-api.md +251 -20
  519. package/skills/guide/references/optimization-nodes.md +1100 -0
  520. package/skills/guide/references/plugin-authoring.md +83 -13
  521. package/skills/guide/references/remote-store-protocol.md +137 -17
  522. package/skills/guide/references/remote-ticket-protocol.md +90 -2
  523. package/skills/guide/references/restacking.md +119 -15
  524. package/skills/guide/references/setup.md +27 -4
  525. package/skills/guide/references/spec-standard.md +2 -1
  526. package/skills/guide/references/ticket-dependencies.md +15 -3
  527. package/skills/guide/references/ticket-migration.md +4 -2
  528. package/skills/implement/SKILL.md +74 -5
  529. package/skills/judge/SKILL.md +43 -0
  530. package/skills/operate/SKILL.md +374 -57
  531. package/skills/plan/SKILL.md +28 -4
  532. package/skills/plan-review/SKILL.md +24 -3
  533. package/skills/propose/SKILL.md +121 -0
  534. package/skills/reconcile/SKILL.md +21 -2
  535. package/skills/spec/SKILL.md +63 -11
  536. package/skills/tickets/SKILL.md +94 -9
  537. 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,13 +93,14 @@ 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 |
95
100
  | `BuildStore` | per-build streams plus repository journals: events, artifacts, transcripts, leases (see §7) | local; remote HTTP |
96
101
 
97
102
  Ticket sources may optionally provide native `listPage(criteria, page)` windows with a matching total. Paged operator reads use it when present, otherwise slice the exhaustive listing; unpaged and dispatcher reads remain exhaustive.
103
+ Ticket sources may optionally provide `search(query)`: title/body term matching with state/label filters, returning compact hits and an opaque cursor. Callers refuse sources without it and never fall back to listing.
98
104
  Integration-tree sources may optionally provide `listTargeting(nodeId)`, every ticket targeting one node in every state, equal to the exhaustive listing filtered by target. Integration observation uses it when present, otherwise `listAll`.
99
105
 
100
106
  #### 3.2.1 In-process adapter plugins
@@ -126,8 +132,8 @@ Relative, absolute, and `file:` specifiers resolve from the repository root
126
132
  whose config is being read; in a scoped build CLI process, that is the
127
133
  immutable build worktree. Bare package specifiers and package export maps
128
134
  resolve first from the consuming repository's main checkout, so they use that
129
- repository's installed dependencies and remain available when a local store
130
- places linked worktrees outside the checkout's package ancestry; a package the
135
+ repository's installed dependencies and remain available although linked
136
+ worktrees sit outside the checkout's package ancestry; a package the
131
137
  repository lacks then resolves from the Autobuild installation the CLI runs
132
138
  from as a fallback. Install extensions as repository development dependencies
133
139
  with `bun add -d --exact @defrex/autobuild-<extension>`. A
@@ -184,12 +190,17 @@ environment-only.
184
190
 
185
191
  Forge readiness is an optional read-only port capability, inspected on the host
186
192
  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
193
+ It reports squash/rebase merge methods and kernel build/node publication
194
+ permissions as hard requirements, and archive-ref publication, protected-target
195
+ linear history and root freshness as recommendations. Archive refs are optional
196
+ forge-side backup of displaced leaf and node history and of unpublished
197
+ workspace commits: where the forge refuses them, rewrites and node writes keep a
198
+ BuildStore copy or warn and proceed, and workspace preservation keeps a
199
+ BuildStore copy or refuses the release (§15.7). Results are pass, fail, or unknown; incomplete
190
200
  inspection never proves permission. Local Git passes trivially; legacy plugins
191
201
  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
202
+ `dispatcher.forge-readiness-failed` repository fact per run/check; historical
203
+ facts naming `archive-refs` still decode. They do not
193
204
  add a dispatch admission gate. Repository attention watches (`ab watch`), dashboard
194
205
  warnings, and operator queries expose all failures and remediation for the run;
195
206
  `ab wait` remains build-only. No setting is changed and no probe ref is pushed.
@@ -285,6 +296,8 @@ The versioned v1 launch contract consists of argv, a consumed one-shot
285
296
  `AB_DISPATCH_GENERATION` marker, graceful signals and exit reasons `stopped`,
286
297
  `handoff`, `failed`. Public invocations discard inherited markers. No private
287
298
  operational channel exists; work outcomes still come only from durable state.
299
+ For `--web` without a fixed port, the launcher rewrites that argv once to pin a
300
+ reserved `--port`; it still opens no store.
288
301
  The runtime-owned `--read-upgrade` reader supports an optional independently
289
302
  versioned conditional environment exchange, preserving full v1 answers for old
290
303
  peers. The launcher retains only its current successful answer and pre-read
@@ -303,7 +316,9 @@ cached answers too. Legacy peers remain functional with full reads.
303
316
  The launcher observes presentation stop/continue liveness so Ctrl-Z returns the
304
317
  shell prompt and `fg` resumes only the presentation; the kernel keeps running.
305
318
  Terminal restoration by the launcher is a fallback for abnormal termination,
306
- never a second alternate-screen exit after a clean generation stop.
319
+ never a second alternate-screen exit after a clean generation stop. A
320
+ generation that exits from the stop signal the launcher itself received is a
321
+ clean stop, and in `--plain` mode the launcher restores no terminal mode.
307
322
  Automatic upgrades default on (`[upgrade] automatic = true`). The resident
308
323
  kernel checks immediately and every 60 seconds independently of dispatch ticks.
309
324
  It resolves the root manifest and Bun lock from a single authoritative base
@@ -534,6 +549,79 @@ clock is therefore consulted only once that window ends, at most one scan
534
549
  interval after the recorded measurement; the dispatcher then treats it as a
535
550
  clock rollback, rescans, and resets the cache to the current clock.
536
551
 
552
+ **Single-ticket start requests.** An operator can ask the running dispatcher,
553
+ local or hosted, to start one named ticket whether or not intake is on:
554
+ `ab start <ticket-id> [--priority manual|urgent|normal]`, the operator tool
555
+ `tickets.start {priority?}`, or HTTP `POST …/tickets/{id}/start` with an
556
+ optional `{priority}` body. The priority is the request's slot-admission tier
557
+ (§12 "Slot admission order") and defaults to `manual`. The request
558
+ canonicalizes the id through the configured source's `get` (refusing an
559
+ unknown ticket) and appends one human-attributed repository
560
+ `ticket.start-requested {ticket, priority}` naming the canonical ref. A pending
561
+ request with the same priority makes it a no-op; one with another priority is
562
+ updated by the new event, keeping the first request's sequence, so settlement
563
+ and cancellation still name one request. `ab start --cancel`
564
+ (`tickets.start {cancel: true}`, `POST …/tickets/{id}/start/cancel`), which
565
+ takes no priority, appends
566
+ `ticket.start-cancelled` for the pending request, and nothing when none is
567
+ pending. A reduced `ticketStarts` part of the repository read facts holds the
568
+ pending requests and the eight most recent settlements; a settlement or
569
+ cancellation applies only to the request sequence it names.
570
+
571
+ Each tick evaluates pending requests in two passes, at most eight per pass,
572
+ each in tier order and then oldest first, and claims nothing else for them:
573
+ `manual` and `urgent` requests after node admission and before ordinary
574
+ intake, and `normal` requests after ordinary intake and the deferred normal
575
+ parked admissions, so that urgent claims and normal parked work found in the
576
+ same tick go first. Each request belongs to one pass. With none pending a pass
577
+ reads nothing; otherwise it makes one targeted `get` per request. Every tier
578
+ bypasses intake off, and open-PR backpressure, without enabling intake for any
579
+ other ticket. A request whose ticket has an active build settles
580
+ `started` when that build was created after the request (its own claim whose
581
+ settlement was lost) and `already-building` otherwise; a ticket outside the
582
+ configured ready state settles `terminal` when it is done, resolved or rejected
583
+ and `not-ready` otherwise; a missing ticket settles `missing`. Dispatch labels
584
+ and the ready assignee are not applied, because the operator named the ticket.
585
+ The rest is admitted through the ordinary dispatch path in a targeted mode that
586
+ skips the ready listing, the scan checkpoint and the standing queue report but
587
+ keeps every gate: creation holds, profile conflicts, node targets, dependency
588
+ verdicts, the spec-standard quality gate and its bounce, the claim and its
589
+ preparation journal, capacity, repository pause, accounts and forge health.
590
+ A claimed build's priority (§13) is `urgent` when the request's priority was
591
+ `urgent`, even on a source without the priority capability, and otherwise its
592
+ ticket's own; `manual` is admission-only and never a build priority.
593
+ Outcomes are `started` with the slug, `invalid` for a bounce (with the missing
594
+ parts) or a profile conflict, `blocked` for unresolved blockers or an
595
+ unavailable target, and `claim-refused` for a refused claim. A pause, no free
596
+ slot, a creation hold, an in-flight preparation, a failed dependency read, a
597
+ ticket-source error or the tick budget leaves the request pending for the next
598
+ tick. Each settlement is one dispatcher `ticket.start-settled` carrying the
599
+ request's priority, after a journal refresh confirms the request is still
600
+ pending, and it is default watch attention. There is no force: capacity is
601
+ respected and nothing is preempted.
602
+ The claim itself proceeds only after a journal refresh confirms the request is
603
+ still pending, so a cancellation that lands while a pass is reading the ticket
604
+ prevents it. The stage measures capacity, for a wait and for an admission
605
+ alike, from the build facts the same tick's janitor, dispatch recovery, lease
606
+ sweep and mixed-version deferral check have already read, and the stage's own
607
+ deferral checks serve those reads too. A build is read again only when the tick skipped it,
608
+ or wrote to it after reading it, unless it is a leaf provisioning a runner,
609
+ which holds its slot whatever its state. So a pending request adds no per-build
610
+ read on a fresh dispatcher process or a long-lived one, and a write by another
611
+ process during the tick is seen on the next tick, as it is by intake. The
612
+ admission pass runs when that measurement shows a free slot in a request's
613
+ tier, or for a node or a blocked target not yet checked. A claim spends only
614
+ its own tier's slot: lower tiers already reserved it while it was pending.
615
+
616
+ Hosted active builds may record a legacy ticket alias. While a request is
617
+ pending, the dispatcher resolves the canonical identity of each active hosted
618
+ build without one, at most 16 per tick, and saves it durably in an advisory
619
+ `ticket.identity-recorded`, which also releases builds that are no longer
620
+ active. Each build is resolved once in its life. Matching is then a
621
+ case-insensitive comparison over recorded and projected identities with no
622
+ source read, and a hosted request is neither admitted nor settled as building
623
+ until every active hosted build has an identity.
624
+
537
625
 
538
626
  ### 3.4 The event log spine
539
627
 
@@ -620,12 +708,31 @@ the bare phase names throughout.
620
708
 
621
709
  Work builds retain the fixed grammar below. Integration builds instead follow
622
710
  `spec → branch opening → collecting → complete → verify:* → authorization → merge → close`.
711
+ An optimization node (§13.1.1) follows
712
+ `spec → branch opening → starting measurement → (propose → collecting)* → complete → verify:* → authorization → merge → close`;
713
+ a plain node keeps the plain grammar.
623
714
  Authorization follows ordered merge policy: nodes default to explicit consent,
624
715
  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
716
+ Nodes never enter plan, implement, code-review or finalize; they enter
717
+ reconcile, and optimization nodes also enter `propose`. A node conflict uses
626
718
  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.
719
+ reconcile, verification and propose use descendant-sensitive execution
720
+ capacity (§12). Empty nodes have no PR.
721
+
722
+ The **propose** phase is an optimization node's own agent phase. The
723
+ dispatcher requests it (`optimization.proposal-requested`) only when the node
724
+ is open with an accepted objective, has not stopped, has a starting
725
+ measurement under the current ruler, has no open request, and has fewer than
726
+ two consecutive empty proposals, and when its room is positive. Room is the
727
+ smaller of the free concurrency slots (`proposer.concurrency` minus attempts
728
+ queued or running) and the remaining attempts budget, and is zero once the
729
+ attempts or hours budget is spent. A paused, blocked or otherwise held node
730
+ is deferred instead. The request takes a slot ahead of normal ticket claims,
731
+ like node reconcile and verification (§12 "Slot admission order"), and is re-checked against current state
732
+ before it is admitted. The session runs the `ab-propose` skill on the node
733
+ head's tree and ends with `ab propose <file>`, `ab propose --none <reason>` or
734
+ `ab escalate`; `ab done` and `ab verdict` are refused. The proposer only
735
+ deposits proposals: the dispatcher files each as an attempt ticket (§13.1.1).
629
736
 
630
737
  ```
631
738
  spec → plan ⇄ plan-review → implement ⇄ code-review → verify:* → finalize (+ finalize:*)
@@ -708,13 +815,16 @@ This is kernel work within the fixed grammar, not another phase. A verify failur
708
815
  returns to implementation; its new commits append to the canonical change, and
709
816
  the next approved cycle collapses and restacks again. A build resuming from a
710
817
  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
818
+ when the target moved, so the resumed phase sees the merged blockers. When the
819
+ wait was declared in `verify:*` or `finalize`, a clean wait-resume restack opens
820
+ a new verification cycle: verification re-runs from the first step on the
821
+ restacked base, and earlier results satisfy neither finalize nor landing. While
712
822
  waiting to merge after finalize and its post-steps, an observed target move
713
823
  also schedules a restack.
714
824
  For a node-targeted leaf, published finalize-step commits also schedule one
715
825
  waiting restack, even when the target SHA is unchanged, so guarded merge
716
826
  preserves one canonical build identity.
717
- Clean waiting restacks retain existing verification when build-owned config is
827
+ Clean awaiting-merge restacks retain existing verification when build-owned config is
718
828
  unchanged (§16.1), including when replay replaces the pin commit's ancestry.
719
829
  Conflicts use reconcile and its captured post-reconcile policy. A conflict before initial verification,
720
830
  including one at a wait resume, cannot skip initial checks through that policy.
@@ -767,15 +877,19 @@ to a deterministic title-derived name, so a failed proposal never prevents
767
877
  build creation. The dispatcher then deduplicates the base with `-2`, `-3`, …
768
878
  suffixes against the store and, when the forge can answer, against `ab/` or
769
879
  `ab-node/` build branches already on the remote, so a build never takes a
770
- branch another store owns. That check is not best effort: if a remote branch
771
- lookup fails, or the base and its `-2` … `-100` candidates are all taken, the
880
+ branch another store owns. When the workspace provider creates branches in
881
+ the dispatcher's local checkout, a candidate whose branch already exists
882
+ there locally is skipped the same way, so a stale local branch left by an
883
+ earlier build never becomes a new build's branch. That check is not best
884
+ effort: if a remote or local branch lookup fails, or the base and its `-2` … `-100` candidates are all taken, the
772
885
  claim fails at the naming stage, no build is created, and the ticket returns
773
886
  to configured Ready under the dispatcher's preparation recovery contract
774
887
  (§3.3). The slug and its `ab/<slug>` (or `ab-node/<slug>` for a node) branch
775
888
  are recorded once and never renamed.
776
889
 
777
890
  **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
891
+ explicit operator revision protocol (leaf escalation, a settled leaf's reopen
892
+ (§15.7), or the node exception below). Every downstream reviewer approves
779
893
  conformance *to it*; a drifting spec silently converts approvals into
780
894
  approvals-of-something-else. A phase discovering the spec itself is wrong
781
895
  raises an `escalation`; the operator agent or a human answers with
@@ -802,7 +916,8 @@ pending controls, merge intent and ended PRs refuse the no-escalation path.
802
916
  A concurrent state change refuses publication with a retry explanation;
803
917
  uncited artifacts are inert. Leaves still require an open escalation and
804
918
  restart from `plan` after any unfinished reconcile resumes under the revised
805
- spec and its publication is confirmed.
919
+ spec and its publication is confirmed. A settled, unmerged leaf awaiting merge
920
+ revises without an escalation through `ab reopen`.
806
921
 
807
922
  Caught preparation failures before an established build follow the durable
808
923
  claim recovery contract in §5; incomplete hosted snapshots never launch a build.
@@ -943,7 +1058,9 @@ sandbox tools, credential isolation, archive cleanup and dispatcher idle
943
1058
  settlement. New config rejects the removed `model`, `invocationBudgetSeconds`,
944
1059
  `approvals` and repository-default `wake` keys. Immutable historical effective
945
1060
  config artifacts discard only those obsolete keys during validation; stored
946
- bytes are unchanged and other unknown or malformed settings still fail.
1061
+ bytes are unchanged and other unknown or malformed settings still fail. An
1062
+ unset `enabled` resolves per host: enabled when a hosted deployment serves the
1063
+ project, disabled for local `ab mcp`, dispatch and init; an explicit value wins.
947
1064
 
948
1065
  #### 7.1.3 Ticket assets
949
1066
 
@@ -991,14 +1108,19 @@ validation alone, so the client enforces the advertised limit before uploading.
991
1108
  ### 7.2 Interface and adapters
992
1109
 
993
1110
  Deliberately narrow: build runners need `append(event)`, `putArtifact`,
994
- `getArtifact`, `getEvents(since)`; operator UIs add `listBuilds`, `subscribe`.
1111
+ `getArtifact`, `getEvents(since)`; operator UIs add `listBuilds`, `listOpenBuilds`,
1112
+ `subscribe`.
995
1113
  A build stream also exposes `appendIfCurrent(expectedSeq, event)`: one atomic
996
1114
  compare-and-append that returns no event when the stream has advanced. It is a
997
1115
  narrow coordination primitive for deterministic event-log deduplication under
998
1116
  concurrent processors; the event stream remains authoritative, with no
999
1117
  snapshot or side ledger. Sequence 0 names an empty stream, candidates receive
1000
1118
  ordinary event validation, unknown builds reject, and a comparison miss leaves
1001
- the log and build timestamps untouched.
1119
+ the log and build timestamps untouched. The repository journal exposes the
1120
+ same primitive as `appendRepoIfCurrent(repo, expectedSeq, event)`, and a
1121
+ session log as `appendSessionEventIfCurrent`; the operator sandbox service
1122
+ records a background attempt's outcome through the repository form so that
1123
+ exactly one process records it.
1002
1124
  Node branch writers use separate `claimNodeWriter`, `renewNodeWriter`, and
1003
1125
  `releaseNodeWriter` operations. Claim permits an absent, expired, or same-holder
1004
1126
  lease; renewal requires the same unexpired holder, and release is holder-checked.
@@ -1026,15 +1148,56 @@ through `GET /builds/:slug/ticket-assets`. `createBuild` optionally takes the
1026
1148
  build's initial `build.created` event and appends it as seq 1 in the same atomic
1027
1149
  step as the record on every adapter. This guard applies identically to every adapter; remote tokens
1028
1150
  carry the same authority over the wire as defense in depth rather than creating
1029
- it. Two implementations of one contract (`packages/core/src/store/contract.ts` is the shared
1151
+ it.
1152
+
1153
+ Repository change positions are ordered, so the contract answers two
1154
+ cross-build questions at a cost proportional to the answer.
1155
+ `listBuildsChangedSince(repo, position)` returns the builds whose latest change
1156
+ position is greater than `position`, ascending by position, each once at its
1157
+ latest position, together with the repository head read in the same snapshot.
1158
+ It reads no event rows, and with nothing changed it does constant work.
1159
+ `listBuildsPage(repo, { cursor?, limit?, kind?, outcome?, activeSince? })`
1160
+ returns one page of builds newest first by creation (slug descending breaks
1161
+ ties), with records identical to `listBuildsForRepo` and an opaque,
1162
+ adapter-issued `next` cursor that continues only a request with the same
1163
+ filters. The optional filters are `kind` (`leaf` or `node`), `outcome: merged`
1164
+ and `activeSince` (an ISO instant with a zone). Each is answered from per-build
1165
+ listing facts written in the same transaction as the write that changes them,
1166
+ never from events or reduced values: `node` from `build.created`'s kind (any
1167
+ other kind is a leaf), merged from the latest `build.completed` and cleared by
1168
+ `build.reopened`, and a mirror of the build's `updatedAt`, which every write
1169
+ bumps. A `kind` or `outcome` page is the filtered subsequence of the creation
1170
+ order. An `activeSince` page holds builds whose `updatedAt` is at or after it,
1171
+ ordered by `updatedAt` then slug, both descending, with an `(updatedAt, slug)`
1172
+ cursor. A span never ends later than its build's latest event, so the matches
1173
+ are a superset of builds whose span overlaps the window. Because `updatedAt`
1174
+ moves, a build written between two page requests can appear twice in one
1175
+ traversal or be skipped once; consumers dedupe by slug. Every filter
1176
+ combination is one bounded range scan: a page reads at most `limit + 1`
1177
+ listing entries whatever the build count or the number of matches. Limits run
1178
+ from 1 to 100 (default 25). Malformed positions, cursors, filters and limits
1179
+ reject, as does a cursor issued for the other order. Unknown repositories
1180
+ answer empty without creating state. A remote server that cannot filter
1181
+ fails a filtered request with `BuildFeedUnsupportedError`; the client never
1182
+ filters an unfiltered page itself. Scoped build and session handles reject both
1183
+ methods. The feed is what derived reducers advance by (§7.7). Two implementations of one contract (`packages/core/src/store/contract.ts` is the shared
1030
1184
  conformance suite):
1031
1185
 
1032
1186
  1. **Local** — one self-contained state tree at `<main-repo>/.autobuild/` by
1033
- default: database, content-addressed blobs, Git worktrees, and the file
1034
- ticket source's default directory. The main checkout is derived from Git's
1187
+ default: database, content-addressed blobs, and the file ticket source's
1188
+ default directory. Build Git worktrees go to a destination outside the
1189
+ checkout's package ancestry: the state tree's own `worktrees/` when it
1190
+ resolves outside the checkout, else a per-checkout root under the host state
1191
+ home (`$XDG_STATE_HOME`, default `~/.local/state`). The destination is
1192
+ validated on real paths before each fresh provision: it must not resolve
1193
+ inside the checkout, and no directory from it up to `/` may hold
1194
+ `node_modules`. When none qualifies, fresh provisioning fails explicitly per
1195
+ build and dispatch shows a startup notice; recorded workspaces still resume
1196
+ and release, and registrations at the legacy in-checkout `worktrees/` are
1197
+ adopted in place. The main checkout is derived from Git's
1035
1198
  repository/worktree topology, so a command run inside a linked worktree
1036
- resolves the same state. There is no home-directory fallback or
1037
- machine-global state. Store selection is uniform: explicit `--store` >
1199
+ resolves the same state. Store state has no home-directory fallback or
1200
+ machine-global location. Store selection is uniform: explicit `--store` >
1038
1201
  nonempty `AB_STORE` > repository default. When a phase or Harvest CLI
1039
1202
  process reopens this store, a handle wrapper derives exact build-or-repository
1040
1203
  authority and agent-event session attribution from its validated ambient
@@ -1082,18 +1245,36 @@ headers, or available backend.
1082
1245
  `subscribe` is specced in the interface; the current implementation is polling
1083
1246
  `getEvents(since)`. True push comes later.
1084
1247
 
1085
- Operator UIs additionally have a repository-scoped batch read,
1086
- `getRepoBuildDigests(repo)`: the projection of every build's log onto its
1248
+ The dispatcher and harvest runner additionally have a repository-scoped batch
1249
+ read, `getRepoBuildDigests(repo)`: the projection of every build's log onto its
1087
1250
  terminal fact, its `observation.recorded` occurrences with their event
1088
1251
  timestamps, and the ts of its latest `pr.merged`, derived from the event log on
1089
- each call. It lets a dashboard snapshot gate rows without reading the full
1090
- history of finished builds (§16.1), and it backs the harvest-launch pressure gate (dispatcher and harvest runner alike): launch
1252
+ each call. It backs the harvest-launch pressure gate (dispatcher and harvest runner alike): launch
1091
1253
  decisions evaluate from digests and the repository journal alone, so
1092
1254
  gate-evaluation cost is flat in accumulated build history, with the full
1093
1255
  per-build scan paid only when a gate actually trips and a scan packet is built.
1094
1256
  The digest also carries the build's node targets, every node its target or
1095
1257
  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.
1258
+ digests and reads full facts only for builds that name that node. Optimization
1259
+ nodes add an `optimization` signal from which the dispatcher's proposer stage
1260
+ selects work (§13.1.1).
1261
+
1262
+ Operator reads of active work use `listOpenBuilds(repo)` instead: the records
1263
+ and persisted digests of the repository's open builds, ordered by creation
1264
+ time and slug. A build is open while its latest terminal fact is not
1265
+ `build.completed`, so the set holds queued, running, paused, blocked and
1266
+ settled-awaiting-merge builds, plus aborted builds whose cleanup saga has not
1267
+ finished. Every adapter maintains the set in the transaction that inserts a
1268
+ build or appends its `build.completed`, `build.aborted` or `build.reopened`;
1269
+ the SQL adapters use triggers, so every append path and every older binary
1270
+ writing the same database keeps it exact. A database that predates the set is
1271
+ backfilled once, when its migration creates it; no read path backfills.
1272
+ `builds.list` (active and queued), `merges.list`, the dashboard snapshot
1273
+ (§16.1) and `repository.status` capacity read it, so their cost follows open
1274
+ builds and never settled history. `builds.list --all` is an explicit history
1275
+ read and still lists every build. A remote server without the operation
1276
+ answers a typed capability failure, and the client never falls back to
1277
+ listing every build or the digest batch.
1097
1278
 
1098
1279
  Stateless repository-level readers also have a bounded journal read,
1099
1280
  `getRepoStateEvents(repo)` (AUT-489): every durable, slow-growing event type
@@ -1220,7 +1401,22 @@ The base-selection invariants make this safe with Git:
1220
1401
  fetched origin tip of the configured base branch (fetched into a
1221
1402
  build-scoped internal ref so concurrent dispatches cannot clobber each
1222
1403
  other or the user's refs). If the remote is unavailable, creation falls
1223
- back to the local base and records the diagnostic.
1404
+ back to the local base and records the diagnostic. The recorded base is
1405
+ the commit the workspace actually checked out, read back from its HEAD
1406
+ after checkout; a provider that reuses a completed environment from a
1407
+ failed attempt records that environment's checkout, never a target head
1408
+ read separately. A target that moved since is a restack concern.
1409
+ - **A first provision never adopts a branch it did not create.** A leaf
1410
+ build with no prior provision cuts from the base even when a branch of its
1411
+ name already exists. A node is exempt: the kernel opens its branch before
1412
+ any provision, and that branch holds the node's merged children. Creation is proven only by the provider's own receipt,
1413
+ written atomically with the build's branch write once nothing foreign
1414
+ holds the branch; ancestry is never evidence. A local provider sets the
1415
+ old tip aside under `refs/autobuild/displaced/<branch>/<sha>` and cuts
1416
+ from the base. A worktree that has the foreign branch checked out is
1417
+ detached in place, and is moved under `.displaced/` when it occupies the
1418
+ build's own path; its files are kept. Resume after a prior provision is
1419
+ unchanged.
1224
1420
  - **Re-provisioning resumes; eligible restacks rewrite.** Provisioning alone
1225
1421
  resumes the published branch. The kernel collapses and restacks at verify
1226
1422
  entry, at a ticket-wait resume, and after target moves while awaiting merge. The first
@@ -1257,8 +1453,10 @@ The base-selection invariants make this safe with Git:
1257
1453
  publication promotes the contribution/path base, as does a wait-resume
1258
1454
  fast-forward (`restack.advanced`). Every new verify start and
1259
1455
  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.
1456
+ frozen throughout the cycle and survive clean awaiting-merge restacks; a clean
1457
+ wait-resume restack after a `verify:*` or `finalize` wait starts a fresh cycle
1458
+ that cites the restacked base and head. Historical facts without citations
1459
+ remain readable. Upstream-only paths are excluded.
1262
1460
  - **Work distance is advisory durable telemetry.** Each admitted work target poll
1263
1461
  samples destination-only commits (`BUILD..TARGET`), even when only the build
1264
1462
  head changed. `target.distance` pins branch, target SHA, nullable build head
@@ -1267,8 +1465,11 @@ The base-selection invariants make this safe with Git:
1267
1465
  Sampling never provisions a workspace, renders Git reads, or gates restacking.
1268
1466
  - **Observation never mutates a running workspace.** `target.moved` records an
1269
1467
  accepted remote head, even during a session. Non-descendant observations without
1270
- indexed kernel publication lineage record `target.rewritten` and attention
1271
- without changing the accepted target. Transactions freeze their target;
1468
+ indexed kernel publication lineage record `target.rewritten` without changing
1469
+ the accepted target. A node waits with attention once per episode; a leaf's
1470
+ next runner reprovisions it from the target when it has no work of its own,
1471
+ else raises one `policy/target-rewritten` escalation that `--accept-target`
1472
+ or abort resolves (see "Forge failure recovery"). Transactions freeze their target;
1272
1473
  later observations coalesce into one follow-on transaction for the newest
1273
1474
  snapshot at the next eligible point. Session and execution settlement fence
1274
1475
  rewrites, and trusted publication waits for remote guest teardown.
@@ -1448,6 +1649,138 @@ Explicit harvest history uses reverse indexed filtered pages rather than a
1448
1649
  journal replay. See `docs/remote-store-protocol.md` for the wire contract,
1449
1650
  initial migration bootstrap and generation-retirement recovery.
1450
1651
 
1652
+ ### 7.7 Derived reducers
1653
+
1654
+ A derived reducer answers a question across builds, such as P90 plan time over
1655
+ the last week, without reading every build's history on every request. It has
1656
+ three parts:
1657
+
1658
+ 1. **A build reducer**: a registered build-scope named value, saved per build
1659
+ and advanced by delta like any other.
1660
+ 2. **A contribution function**: pure, from that build's slug and finished
1661
+ value to its share of the rollup.
1662
+ 3. **A rollup**: a repository accumulator with `add` and `subtract`. Its value
1663
+ is the sum of the contributions of every build it has absorbed.
1664
+
1665
+ **Contributions must be invertible.** When a build changes again (a new closed
1666
+ segment, a reopen), the rollup subtracts the contribution it absorbed from that
1667
+ build last time and adds the new one. Counts, sums and histograms invert;
1668
+ minimum and maximum are expressed through histograms.
1669
+
1670
+ **Scope and arguments.** A rollup is requested through `getReducerValue` with
1671
+ the scope `{kind: 'rollup', repo}`. Rollups live in `ROLLUPS` beside
1672
+ `REDUCERS` in the registry and version through the revision ledger; a rollup's
1673
+ version adds its build reducer's, so a build-reducer revision changes the
1674
+ rollup's key too. Key arguments (`args`) are parsed with their defaults before
1675
+ hashing, so each distinct combination is its own rollup with its own
1676
+ accumulator. Read-time arguments (`read`) shape only the finished value and
1677
+ never create a key; named reducers reject a request that carries them.
1678
+
1679
+ **Advance.** The saved rollup holds its accumulator and the repository change
1680
+ position it reflects.
1681
+
1682
+ - A read whose saved position equals the repository head, and whose
1683
+ accumulator holds nothing retention drops, returns the saved value: two
1684
+ constant reads, no event rows and no feed query.
1685
+ - Otherwise the reader asks `listBuildsChangedSince` for builds changed since
1686
+ the saved position, reads each changed build's saved build-reducer value,
1687
+ reads that build's **absorbed contribution** for this rollup key, subtracts
1688
+ old and adds new. It commits the accumulator, the feed's snapshot head and
1689
+ every changed absorbed contribution together.
1690
+ - An answer with no changed builds but a moved head (repository events and
1691
+ creations move the position too) saves only the position.
1692
+ - A saved value holding an expired day is pruned and saved at the same
1693
+ position, with no feed query and no event read.
1694
+
1695
+ Every advance is serialized per rollup key, across store instances and
1696
+ processes, from the re-read of the saved row through the commit, and the
1697
+ commit is conditional on the row the advance read. Two readers never count a
1698
+ build twice; a reader whose commit loses returns the winner's value. Memory
1699
+ serializes with a per-key mutex, SQLite with a lease row every instance
1700
+ contends on (expiry by the store clock, renewal after every 16 build reads,
1701
+ commit conditioned on still holding it), and Postgres with one transaction
1702
+ holding a transaction-scoped advisory lock on which every query of the advance
1703
+ runs.
1704
+
1705
+ **First computation.** With no valid saved row (a new key, a version change, a
1706
+ corrupt row, or a saved position above the head, which means the repository was
1707
+ reset) the rollup starts empty at position `0`, so the feed lists every build
1708
+ once; existing absorbed contributions for the key are overwritten, never
1709
+ subtracted. A build whose build-reducer value is already saved costs one value
1710
+ read; otherwise its log is reduced once and saved. That is the once-per-key
1711
+ reduction: serialized, saved durably, and never repeated.
1712
+
1713
+ **Storage.** Rollup rows and absorbed contributions sit in the private
1714
+ `value.` namespace of the reduced-value storage: the rollup row under the
1715
+ rollup scope at `value.rollup.v1.<digest>`, each absorbed contribution under its
1716
+ build's scope at `value.absorbed.v1.<digest>`. The public snapshot API refuses
1717
+ both. An unknown repository answers the empty value and creates nothing.
1718
+
1719
+ **Remote.** The server's rollup value is canonical. A client sends one
1720
+ `POST /repos/:repo/rollup-values` and never rebuilds the value from events, the
1721
+ feed or build values. Rollups have no released projection catalog, so a client
1722
+ requires the server's version to equal its own: a different version, an absent
1723
+ route, an older server's `400 validation` refusal of a rollup name it does not
1724
+ know, or a value outside the rollup's schema fails with
1725
+ `ReducerValueIncompatibilityError`. A rollup revision therefore makes older
1726
+ clients fail with that typed error until they upgrade.
1727
+
1728
+ #### `stepDurations`
1729
+
1730
+ The first rollup folds every build's `buildTimeline` (§15.5) into duration
1731
+ histograms per step and UTC day.
1732
+
1733
+ - **Contribution:** each closed segment adds its `durationMs` to the histogram
1734
+ for its step on the UTC day it ended. Open and abandoned segments add
1735
+ nothing. A merged segment adds its occurrence count at the bucket of its mean
1736
+ occurrence, so count and total stay exact.
1737
+ - **Histogram:** bucket `i` covers `[1000·1.1^i, 1000·1.1^(i+1))` ms, 140
1738
+ buckets from 1 second to about 7 days; shorter and longer durations clamp to
1739
+ the end buckets. Buckets are sparse and each keeps a count and an exact sum.
1740
+ Percentiles use nearest rank and the geometric midpoint of the bucket, within
1741
+ 5% of exact; the clamping end buckets answer their mean.
1742
+ - **Key arguments:** `outcome` is `merged` (default; the latest
1743
+ `build.completed` outcome is `merged`) or `all`. `kind` is `leaf` (default;
1744
+ any build whose kind is not `node`), `node` or `all`.
1745
+ - **Read-time argument:** `window` is `24h`, `7d` (default), `30d` or `all`. A
1746
+ window selects every UTC day it overlaps.
1747
+ - **Retention:** days before the UTC day 400 days ago are dropped, at
1748
+ contribution time and from the accumulator; a later reopen subtracts nothing
1749
+ for a dropped day. The saved row is bounded by 400 days × steps × 140
1750
+ buckets, a few megabytes for a busy repository, read only on explicit
1751
+ requests.
1752
+ - **Answer:** `{position, window, steps: [{step, count, meanMs, p50Ms, p90Ms,
1753
+ p99Ms, totalMs}]}`, with `cursor: 0`. Steps run in pipeline order (phases,
1754
+ `verify:*` by name, finalize, reconcile, then waits) and zero-count steps are
1755
+ omitted. Its size grows with steps, not with retained history.
1756
+
1757
+ #### `buildRoster`
1758
+
1759
+ The roster folds every build's `buildRosterEntry` (§15.5) into the
1760
+ repository's live builds and its most recently finished ones.
1761
+
1762
+ - **Contribution:** a finished build (its build-reducer status is `done` or
1763
+ `aborted`) contributes `{slug, kind, outcome, completedAt}`, where `outcome`
1764
+ is `merged`, `closed` (any other `build.completed` outcome) or `aborted`, and
1765
+ `completedAt` is the latest terminal event's timestamp. Any other build
1766
+ contributes `{slug, kind, createdAt}`. The terminal rule is the build
1767
+ reducer's: `build.completed` and `build.aborted` overwrite each other in log
1768
+ order, latest wins, and nothing else clears them.
1769
+ - **History:** the accumulator keeps every live entry and the newest 50
1770
+ finished entries, newest completion first (slug breaks ties). A completion
1771
+ beyond the cap prunes the oldest. A build that leaves the history, by
1772
+ becoming live again or by an older completion being pruned, is not replaced:
1773
+ the history never back-fills from older builds, so after many such moves
1774
+ without new completions the answer can show fewer than 10 finished builds.
1775
+ - **Arguments:** none, so each repository has one roster key.
1776
+ - **Answer:** `{position, live: [{slug, kind, createdAt?}], finished: [{slug,
1777
+ kind, outcome, completedAt}]}`, with `cursor: 0`. `live` lists every live
1778
+ build, oldest `createdAt` first (missing first), then by slug; `finished`
1779
+ holds up to 10 of the retained entries, newest first.
1780
+ - **Cost:** a read with nothing changed is the two constant reads, and the
1781
+ saved row is O(live builds + 50) bytes however many builds the repository
1782
+ has ever had.
1783
+
1451
1784
  ## 8. The `ab` CLI
1452
1785
 
1453
1786
  The **only** channel between agents and the store — and the enforcement
@@ -1487,8 +1820,21 @@ AB_TOKEN # signed credential for this exact phase session (remote store)
1487
1820
  ```
1488
1821
 
1489
1822
  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.
1823
+ of `synthesize@N` or `review@N`. A judge session of a judge panel (§13.1.1)
1824
+ carries only `AB_JUDGE` (`<build>:<panel>:<judge>`), `AB_SESSION`,
1825
+ `AB_CONTEXT_DIR` and, for a remote store only, `AB_STORE` and `AB_TOKEN`; it
1826
+ has no `AB_BUILD` and no `AB_PHASE`, no inherited `AB_*`, `GIT_*`, `PWD` or
1827
+ `OLDPWD` value, no inherited value naming a protected location (§13.1.1), and
1828
+ its `PATH` starts with its own scratch launcher directory instead of the
1829
+ distribution's. A judge session has no read authority. With a remote store its
1830
+ Store handle appends exactly one `panel.preferred` for its own panel, judge
1831
+ and session while that session is open and refuses every other operation.
1832
+ With a local store it holds no Store and never learns the store's path:
1833
+ `ab judge prefer` saves its preference to an outbox in its root, which the
1834
+ runner commits. Any read command run with `AB_JUDGE` set fails before opening
1835
+ a Store. The AgentRunner
1836
+ invocation argument is opaque: a build skill receives its slug; a harvest skill
1837
+ receives its run id; a judge skill receives its panel id.
1492
1838
  The CLI resolves identity from ambient auth. Every build process holds an
1493
1839
  interface-enforced build-scoped Store handle. At the phase CLI opening boundary,
1494
1840
  both local and remote handles are wrapped with authority over exactly
@@ -1552,7 +1898,17 @@ that build, and harvest mutations target only the prepared run and execution,
1552
1898
  its artifacts and streams, with heartbeat authority for its adopted lease holder.
1553
1899
  Phase grants also enforce agent session attribution. They cannot create builds or
1554
1900
  operator sessions, administer repositories, invoke operator routes, or delegate.
1555
- A runner can delegate only to a recorded session within its own authority.
1901
+ A runner can delegate only to a recorded session within its own authority. A
1902
+ build runner alone may also issue a `build-judge` grant for a recorded
1903
+ `panel.judge-started` session, binding its panel and judge. That grant is
1904
+ write-only: the service refuses every read, and admits only one
1905
+ `panel.preferred` for its exact panel, judge and session while the session is
1906
+ open and has not already preferred. The service decides that write and
1907
+ appends it in one conditional step (`appendIfCurrent` at the delegation
1908
+ value's cursor, retried a bounded number of times), so concurrent requests from
1909
+ one judge session record at most one preference; the loser is refused like a
1910
+ sequential retry, and sustained contention is a 409 `conflict`. It retires 60
1911
+ seconds after `panel.judge-ended`.
1556
1912
 
1557
1913
  Delegated grants have no fixed wall-clock expiry. The service checks signed
1558
1914
  bindings against authoritative durable lifecycle facts on every request and
@@ -1598,7 +1954,7 @@ sessions need no separate global installation.
1598
1954
  | `ab artifact get <kind>[@rev]` | fetch an artifact within own build | no |
1599
1955
  | `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
1956
  | `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** |
1957
+ | `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
1958
  | `ab verdict <approve\|revise\|escalate\|pass\|fail\|skip> …` | complete a review/verify phase | **yes** |
1603
1959
  | `ab escalate <question>` | park the build for external judgment | **yes** |
1604
1960
  | `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 +1986,7 @@ A phase-scoped hydration into the gitignored scratch dir:
1630
1986
  contributions/ # node verify: <build>/spec.md
1631
1987
  plan.md # per phase needs (see table)
1632
1988
  findings.json # current feedback, when round > 1
1989
+ reopen.json # an operator's reopen of a settled leaf (§15.7), every phase
1633
1990
  history/ # prior-round artifacts where the phase needs them
1634
1991
  verify/ # failure reports routed back to implement
1635
1992
  assets/ # the ticket assets the build froze (§6.3), every phase:
@@ -1664,12 +2021,16 @@ terminals:
1664
2021
  |---|---|---|
1665
2022
  | `plan` | ticket, spec; prior plan rev + findings (round > 1) | `done` (requires `plan` artifact) |
1666
2023
  | `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) |
2024
+ | `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
2025
  | `code-review` | spec, plan, commit range `{base, head}`, prior findings, implement-notes | `verdict` |
1669
2026
  | `verify:<step>` (agent) | spec (acceptance criteria), step config, commit range; node contribution specs and provenance | `verdict pass` \| `verdict fail --report` \| `verdict skip --reason` |
1670
2027
  | `finalize` | spec, plan, verify reports, PR template config | `done` (requires `pr-description` artifact) |
1671
2028
  | `reconcile` | spec, plan, implement-notes, conflict `{baseSha}` and kernel-prepared replay transaction | `done` (requires one replayed commit on the frozen base) |
1672
2029
 
2030
+ Every phase also accepts `escalate`. In a work build every phase additionally
2031
+ accepts `wait-on` (§11), and the manifest's `allowedTerminals` lists it; a node
2032
+ build's manifest omits `wait-on`, and `ab wait-on` refuses there.
2033
+
1673
2034
  In node `verify:*` context, `nodeVerification` in the manifest identifies the frozen
1674
2035
  `range`, `indexPath`, `contributions`, `handPushedCommits` and `unattributedCommits`. Each contribution
1675
2036
  has `build`, its preparation-time stored `ticket` identity, `spec: {kind: 'spec', rev}`,
@@ -1753,9 +2114,15 @@ or `escalate`, or in a work build `wait-on`, which declares a ticket wait
1753
2114
  (§11). The CLI rejects a second terminal call, and each terminal
1754
2115
  validates its preconditions before emitting the phase event (no `done`
1755
2116
  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.
2117
+ `implement`, except an optimization attempt's `done --no-improvement`). A
2118
+ normally completed turn that ends **without** any terminal call is an infra
2119
+ failure: the runner emits
2120
+ `phase.failed {error: "no-terminal"}` and applies retry policy. A judge
2121
+ session is not a phase: it ends with exactly one `ab judge prefer`, which
2122
+ refuses a blank reason, an unknown preference and a second call, concurrent
2123
+ calls included; a judge turn without it, or whose saved outbox preference
2124
+ cannot be committed, records `panel.judge-ended {outcome: "no-terminal"}`
2125
+ under the panel's failure policy (§13.1.1).
1759
2126
 
1760
2127
  Provider/runtime-declared turn failures are a separate `AgentRunner` result
1761
2128
  (§9), never conflated with agent silence. When the selected role has declared
@@ -1820,7 +2187,7 @@ the exact validated SHA and confirms forge readback before recording that head a
1820
2187
  A no-op step has no push. Agents only ever commit locally. Consequences: forge
1821
2188
  credentials **never enter the sandbox** (load-bearing once builds run on
1822
2189
  remote sandboxes), ordinary implementation history is extended and reconcile
1823
- uses exact expected-head guarded rewrites with archived evidence, and the
2190
+ uses exact expected-head guarded rewrites with retained evidence, and the
1824
2191
  push-at-boundary rule from [D3] is enforced by construction rather than
1825
2192
  convention. The same rule bounds an external operator's small fixes: an operator
1826
2193
  sandbox publishes work only through the `sandbox.publish` tool, whose push and
@@ -1875,14 +2242,15 @@ implementer: ab context (findings.json now materialized) → …
1875
2242
  ### 8.8 Outer-loop namespace
1876
2243
 
1877
2244
  Human/pre-build ticket grooming uses one configured-source namespace
1878
- (`ab ticket create|update|block|unblock|list|show|move`, plus the ticket-asset
2245
+ (`ab ticket create|update|block|unblock|list|search|show|move`, plus the ticket-asset
1879
2246
  forms below). Migration adds `ab ticket export <dir>` and
1880
2247
  `ab ticket import <dir> [--states <state,…>]`,
1881
2248
  plus `ab ticket migration record <dir>`
1882
2249
  (see [Ticket source migration](#ticket-source-migration)). These commands are
1883
2250
  sessionless, source-agnostic, and never available as a mid-build spec
1884
2251
  mutation path. The CRUD subcommands accept `--json` and then writes exactly one
1885
- bare value: `list` emits `Ticket[]`; every other form emits the complete
2252
+ bare value: `list` emits `Ticket[]`; `search` emits
2253
+ `{tickets, cursor?, diagnostics}`; every other form emits the complete
1886
2254
  created, read, or post-mutation `Ticket`. Human-readable confirmations are not
1887
2255
  a data format and callers must not parse ids from them.
1888
2256
 
@@ -1918,15 +2286,35 @@ selected BuildStore:
1918
2286
  assets; revisions a build has pinned stay retrievable.
1919
2287
  - `ab ticket show <id>` lists the current assets (kind/name, revision, size);
1920
2288
  with `--json` the `Ticket` is extended with an `assets` array.
2289
+ - The agent tool registry (§8.9) offers `tickets.asset.attach`,
2290
+ `tickets.asset.get` and `tickets.asset.remove` with the same rules, limits
2291
+ and notes, carrying bytes as base64, and `tickets.get` carries the same
2292
+ `assets` array.
1921
2293
 
1922
2294
  Observation harvest uses a separate typed, repository-scoped namespace
1923
2295
  (`ab harvest context|submit|verdict|status`), mirroring the build session
1924
2296
  commands: context hydration, a producer terminal, a reviewer terminal, and a
1925
2297
  sessionless read-only status projection.
1926
2298
 
2299
+ A judge session (§13.1.1) uses `ab judge context|prefer`. `ab judge context
2300
+ [--json]` writes `purpose.md`, `rubric.md` and `context.json` (`{judge,
2301
+ variants: {A, B}, purpose, rubric, allowedTerminals: ["prefer"]}`) into
2302
+ `$AB_CONTEXT_DIR` from the brief in the judge's root and the rubric under `A/`;
2303
+ it makes no Store read. `ab judge prefer <A|B|tie> (--reason <text> |
2304
+ --reason-file <file>)` is the judge's terminal: with a remote store it appends
2305
+ `panel.preferred` through the write-only grant; with a local store it creates
2306
+ `$AB_CONTEXT_DIR/preference.json` exclusively, so only one call succeeds, and
2307
+ the runner records it. Inside a judge session `ab` is the judge-only launcher,
2308
+ which runs these two commands and refuses every other.
2309
+
1927
2310
  `ab repository status [--json] [--store <ref>]` is the sessionless read-only
1928
- projection of the repository journal's dispatcher controls: ticket intake, the
1929
- repository-wide pause, and the harvest gate. It uses the same
2311
+ projection of the repository journal's dispatcher controls. Its shared
2312
+ `dispatcherRunning` boolean is true for a holder, expired holder or unfinished
2313
+ handoff naming a draining predecessor, even with an empty drain map. It uses
2314
+ existing projections and adds no reads; only durable retirement clears evidence.
2315
+ The controls include: ticket intake, the
2316
+ repository-wide pause, and the harvest gate, plus pending and recently settled
2317
+ single-ticket start requests with their priority (`ticketStarts`, present when either is nonempty). It uses the same
1930
2318
  dispatch-settings reducer as dispatcher decisions and the dashboard. An absent
1931
2319
  repository stream reduces as an empty journal and reports intake on, repository
1932
2320
  pause off; the query does not create that stream,
@@ -1995,6 +2383,47 @@ be narrowed to the ambient build — and `--repo` constrains every call to one
1995
2383
  repository. Mutating tools attribute their writes to the sessionless operator
1996
2384
  identity, exactly as the other operator commands do.
1997
2385
 
2386
+ The hosted `/mcp` binding advertises exactly the table the hosted operator
2387
+ server dispatches: a filtered tool is neither advertised nor served. Its
2388
+ repo-gated `sandbox.*` tools are listed when the deployment can host operator
2389
+ sandboxes, and each call is refused with a typed reason when the repository's
2390
+ latest deposited effective config does not enable them.
2391
+
2392
+ The registry's `repository.attention` digest is a connected agent's first read
2393
+ of each operator round. It composes the operator services the dedicated tools
2394
+ call — the open escalations `builds.get` reports, the `merges.list` consent
2395
+ queue, the attention page of `repository.events` and the `repository.status`
2396
+ projection — adds the builds waiting on operator action (paused, stalled,
2397
+ failing node verification or forge CI), and names a resolving registry tool per
2398
+ item. It takes the `repository.events` cursor, never waits, reads only open
2399
+ builds, and reads zero event rows when nothing changed since the cursor.
2400
+
2401
+ Each registered project also has a per-repository binding at
2402
+ `<resource>/<host><path>`, derived from its identity. It serves the same table
2403
+ for that one repository: its tool schemas omit `repo`, it offers no
2404
+ `repositories.list`, and it lists `sandbox.*` only when that repository's
2405
+ latest deposited effective config enables `[orchestrator]`, with one bounded
2406
+ latest-artifact read per listing. Its tokens are bound to their RFC 8707
2407
+ resource: it accepts only tokens issued for it or for `/mcp`.
2408
+
2409
+ Connected agents discover how to work from the captured agent context (§12)
2410
+ through the registry's `context.list` and `context.read` tools, so every
2411
+ binding serves it. The index names the skills with descriptions, the agent
2412
+ instructions with scopes, and which to load before operating and before ticket
2413
+ work. A read returns one file, found by path or by a relative link from another
2414
+ file. Each skill file that mentions `ab` commands starts with a generated
2415
+ preamble that maps every command to the tool that performs it, or marks it as
2416
+ build-session only, runnable in the sandbox, or a host task. The mapping comes
2417
+ from a checked-in CLI-equivalence table that a test holds to the registry and
2418
+ the help catalog. Agent instructions get a preamble framing them as the
2419
+ repository's own file, written for a checkout, whose conventions bind tickets,
2420
+ specs and answers and which win over Autobuild skills. Each binding also offers
2421
+ one MCP prompt per skill, with the same text, and appends the context to its
2422
+ server instructions. Hosted endpoints build those instructions only for an
2423
+ `initialize` request, at one latest-revision record read per repository in
2424
+ scope. A repository with no captured record is served the canonical skills
2425
+ bundled with the serving Autobuild, and the index and every preamble say so.
2426
+
1998
2427
  ### 8.10 Hosted project connection
1999
2428
 
2000
2429
  `ab connect <service-url>` requests owner browser approval for the normalized
@@ -2120,14 +2549,17 @@ non-resumable), used for slug naming (§6.3) and vendored-skill conflict
2120
2549
  resolution (§16.3). A runtime without it is valid; each caller owns its
2121
2550
  deterministic fail-safe.
2122
2551
 
2123
- - **Adapters:** three builtins sit behind the interface: the locally installed
2552
+ - **Adapters:** four builtins sit behind the interface: the locally installed
2124
2553
  Claude Code CLI in headless mode for Claude models; the locally installed
2125
- Codex CLI for unqualified `gpt-*` models; and the locally installed pi CLI
2554
+ Codex CLI for unqualified `gpt-*` models; the locally installed pi CLI
2126
2555
  (minimum version 0.84.3), driven headlessly through `--mode rpc`, for every
2127
- provider-qualified model that installation resolves. Each adapter uses its
2128
- CLI's local authenticated login; pi also owns its local model catalog and
2129
- keeps one persistent RPC process alive across review-loop continuations. All
2130
- three provide tool-free one-shot completion. Plugins may register additional
2556
+ provider-qualified model that installation resolves; and the locally
2557
+ installed Antigravity CLI (`agy`) for `gemini-`, `claude-` and `gpt-` slugs,
2558
+ using ambient agy auth and `--conversation` native resume. Each adapter uses
2559
+ its CLI's local authenticated login; pi also owns its local model catalog and
2560
+ keeps one persistent RPC process alive across review-loop continuations.
2561
+ Claude, Codex and Pi provide tool-free one-shot completion; Antigravity omits
2562
+ it because agy cannot guarantee tool-free execution. Plugins may register additional
2131
2563
  adapters, each under a *distinct runtime name*, never
2132
2564
  as a mode flag on an existing one. Plugin adapters must pass the exported
2133
2565
  AgentRunner contract suite.
@@ -2171,7 +2603,9 @@ deterministic fail-safe.
2171
2603
  that concrete role's effective primary axes and is resolved and validated
2172
2604
  eagerly with indexed problems in the aggregate startup error.
2173
2605
  4. A **declared** key that nothing ever requests is resolved, validated, and
2174
- then never used. `ab dispatch` reports it at startup as a warning.
2606
+ then never used. `ab dispatch` reports it at startup as a warning. This
2607
+ includes `[profiles.<name>.roles.<role>]` entries, reported under that
2608
+ header.
2175
2609
 
2176
2610
  Each `args` string is one argv token, preserved in order and appended to
2177
2611
  every phase and tool-free one-shot invocation for that role. Adapters reject
@@ -2205,7 +2639,7 @@ deterministic fail-safe.
2205
2639
  the failed conversation. Selection is non-sticky: every later phase, loop
2206
2640
  continuation, and retry starts from the primary. The final failure controls
2207
2641
  retry/permanent behavior. This applies to core phases, agent verify/finalize,
2208
- and Harvest, but not tool-free one-shots. Every selected runtime/model/args
2642
+ Harvest and judge sessions (§13.1.1), but not tool-free one-shots. Every selected runtime/model/args
2209
2643
  tuple is recorded on `session.started`; fallback starts cite the preceding target and
2210
2644
  verbatim error, while exhausted `phase.failed`/`harvest.failed` facts carry
2211
2645
  the complete ordered attempt list.
@@ -2241,13 +2675,16 @@ deterministic fail-safe.
2241
2675
  session boundary, like `[roles]`, so an edit reaches the in-flight builds that
2242
2676
  selected the profile at their next session and no other build. Every agent
2243
2677
  session of the build resolves through it — plan, plan review, implement,
2244
- code review, agent verify and finalize steps, and reconcile — and
2245
- `session.started.profile` records `{ name, configured }`. When a reload
2678
+ code review, agent verify and finalize steps, reconcile, and the `judge`
2679
+ sessions of a panel run on the build — and `session.started.profile`
2680
+ records `{ name, configured }`. When a reload
2246
2681
  removes the profile, later sessions use the repository roles with
2247
2682
  `configured: false`, and `ab build status` says the recorded profile is no
2248
2683
  longer configured. A resumed session keeps its recorded target as before.
2249
2684
  Sessions outside a build (`slug`, `upgrade`, `harvest`, `harvest-review`)
2250
- never use a profile.
2685
+ never use a profile, so a profile entry on one of those keys is unconsumed.
2686
+ Dispatch applies the unconsumed, deprecated skill-name and `extensions`
2687
+ warnings to profile entries as it does to `[roles]`.
2251
2688
  - **Transcripts come back through the interface**, not scraped from disk, so
2252
2689
  every adapter must produce one whenever its owning runner reaches the session
2253
2690
  end boundary, including turns rejected by a provider after a handle exists.
@@ -2274,7 +2711,10 @@ deterministic fail-safe.
2274
2711
  `{ kind: 'repo', repo }` instead of build-scoped, `harvest.session.started`
2275
2712
  carries the returned stream id, `phase` is spelled `harvest:<step>`, each
2276
2713
  revise round is its own bracket and its own stream, and a closed stream
2277
- finalizes onto the repository scope. Harvest journal events
2714
+ finalizes onto the repository scope. A judge session (§13.1.1) streams the
2715
+ same way on the build scope: its `phase` is spelled `judge:<panel>:<judge>`,
2716
+ `panel.judge-started` carries the stream id, and the stream closes before
2717
+ `panel.judge-ended`. Harvest journal events
2278
2718
  (`harvest.step.*`, `harvest.proposals.submitted`, `harvest.review.verdict`,
2279
2719
  and their kin) are deliberately not translated into parts — they are typed
2280
2720
  journal facts, observable via `ab watch --repository`, not harness output.
@@ -2403,7 +2843,7 @@ the matching phase and `round`; a missing round cannot broaden either cause.
2403
2843
  `review-round-limit` retains the same matching-round effect.
2404
2844
  `verify-failure-limit` is the explicit phase-level case and re-arms every
2405
2845
  phase-runner failure round for its verify target. `reconcile-no-progress`,
2406
- `setup-failure-limit` and `wait-unresolvable` have no phase-runner failure-budget effect (setup's own
2846
+ `setup-failure-limit`, `wait-unresolvable`, `measurement-failed` and `target-rewritten` have no phase-runner failure-budget effect (setup's own
2407
2847
  answer/retry accounting remains separate). Agent and stall raises, and
2408
2848
  cause-less historical policy raises, retain the legacy shape rule: a matching
2409
2849
  round resets that round and an absent round resets all rounds for the target.
@@ -2470,7 +2910,12 @@ diagnostic and is retried on the next tick.
2470
2910
 
2471
2911
  An entered wait opens an escalation with id `escalation`, the declaring phase
2472
2912
  and round, `source: agent`, the declaring session and the waited tickets as
2473
- `refs`; its question begins `Waiting on`. The build is `blocked`. A work build
2913
+ `refs`; its question begins `Waiting on`. The build is `blocked`. An
2914
+ escalation whose sole cause is an open ticket wait is not operator attention:
2915
+ `ab wait --for attention` and other build-attention reads ignore it, as
2916
+ default `ab watch` ignores `wait.entered` and `wait.ended`; any other open
2917
+ escalation, including a `wait-unresolvable` raise, is attention. Waiting stays
2918
+ visible through status surfaces. A work build
2474
2919
  whose only open escalation is its wait, and which has no runner working, holds
2475
2920
  no capacity slot and keeps its branch, workspace and completed phase work
2476
2921
  (§12 "What holds a slot"). A wait ends at its first end fact: an
@@ -2519,8 +2964,8 @@ nothing, reports a diagnostic and is retried on the next tick. Hosted clients
2519
2964
  read `ticketWait` from the digest wire answer; an older service that omits it
2520
2965
  yields no automatic release, and operators still end waits by answering.
2521
2966
 
2522
- An ended wait requests a `resume` slot and is admitted before new ticket
2523
- claims, as a parked finished build is; a `revise-spec` answer instead waits for
2967
+ An ended wait requests a `resume` slot and is admitted before normal ticket
2968
+ claims, as a parked finished build is (§12 "Slot admission order"); a `revise-spec` answer instead waits for
2524
2969
  the revision. The dispatcher observes the leaf's target when it launches the
2525
2970
  resume. Before the declaring phase resumes, and ahead of the plan and code
2526
2971
  loops, the engine decides a `restack` with trigger `wait-resume` and cycle
@@ -2529,7 +2974,17 @@ work sits on. When the target has not moved, no restack runs. A build with
2529
2974
  published work replays it through the guarded automatic restack (`restack.*`
2530
2975
  facts carry the `wait-resume` trigger); a conflict runs `reconcile` for that
2531
2976
  transaction, which counts as initial verification, and the declaring phase
2532
- resumes after `restack.completed`. A build with nothing published, whose local
2977
+ resumes after `restack.completed`. That conflicted path re-verifies in full
2978
+ because `reconcile.completed` opens a new verify cycle. A clean
2979
+ `restack.completed` for a wait declared in `verify:*` or `finalize` is itself a
2980
+ verify cycle boundary: results at or before it describe the old base and
2981
+ satisfy neither finalize nor landing, verification re-runs from the first
2982
+ configured step at a new attempt, and its facts cite the restacked base and
2983
+ head. The boundary is not a replay boundary, so the verify-entry restack does
2984
+ not run again. Clean is decided from facts already in the log: a
2985
+ reconcile-linked completion carries the `reconcile.completed` seq as its cycle,
2986
+ a clean one the wait end's. Waits declared in earlier phases add no boundary,
2987
+ because the code loop's next approval opens a new cycle. A build with nothing published, whose local
2533
2988
  branch has no commits the target lacks and whose workspace has no uncommitted
2534
2989
  tracked changes (plan, plan-review, implement before its first commit),
2535
2990
  fast-forwards its local branch to the fresh target snapshot and records `restack.advanced
@@ -2552,13 +3007,19 @@ target, or none when the replay is clean. With the target unchanged the same
2552
3007
  attempt resumes with its replay intact.
2553
3008
 
2554
3009
  The engine's ordinary rules then re-run the declaring phase: a
2555
- producer at the same round, a reviewer at the same review round, an agent
2556
- verifier at the same step and attempt, and finalize or reconcile. Guidance
3010
+ producer at the same round, a reviewer at the same review round, and
3011
+ reconcile. An agent verifier resumes at the same step and attempt, and finalize
3012
+ or its post-step resumes directly, only when the target was unchanged. After a
3013
+ clean wait-resume restack, a verifier or finalize wait re-verifies from the
3014
+ first step in the new cycle; finalize, or the remaining post-steps of a
3015
+ post-step wait, run once that cycle passes. Guidance
2557
3016
  reaches the session through its usual carrier, and its
2558
3017
  `$AB_CONTEXT_DIR/guidance.json` gains a `wait` block — `{id, tickets, reason,
2559
3018
  outcome: refused | ended, cause, message}` — whenever the guidance is the
2560
3019
  wait's refusal or answer (including the answer to its `wait-unresolvable`
2561
- escalation), or when the wait ended without guidance text. A
3020
+ escalation), or when the wait ended without guidance text. The block goes only
3021
+ to the declaring phase at its declaring round or attempt: a verifier re-run at
3022
+ a new attempt receives the answer as guidance without it. A
2562
3023
  review phase's wait resumes that review round and never feeds the next
2563
3024
  producer. `ab build status` shows a requested, open, or ended-but-not-resumed
2564
3025
  wait and the tickets it names. Node builds cannot declare waits.
@@ -2595,6 +3056,83 @@ creation holds, capacity, intake off and repository pause — so a blocked urgen
2595
3056
  ticket never holds back normal work. Priority never preempts: an urgent ticket
2596
3057
  does not stop, pause or displace a running build.
2597
3058
 
3059
+ **Slot admission order.** Free slots are admitted in five tiers:
3060
+
3061
+ 1. `manual` single-ticket start requests (the `ab start` default, §11);
3062
+ 2. urgent parked work (nodes and parked leaves waiting for verification,
3063
+ reconcile, resume or propose);
3064
+ 3. urgent ticket claims: `urgent` start requests, then ordinary urgent ready
3065
+ tickets while intake is on;
3066
+ 4. normal parked work;
3067
+ 5. normal ticket claims: `normal` start requests, then ordinary normal ready
3068
+ tickets while intake is on.
3069
+
3070
+ An optimization attempt's ready ticket claims in its node's tier: the node's
3071
+ current build priority, decided at claim. Nothing is reserved for attempts,
3072
+ and they never jump ahead of other work in their tier.
3073
+
3074
+ Each tier keeps its own order: start requests oldest first, parked leaves in
3075
+ the tick's visit order, nodes in slug order, tickets in the source's listing
3076
+ order. Start requests bypass intake off and open-PR backpressure; ordinary
3077
+ ready tickets do not. A build's
3078
+ priority is frozen from its claimed ticket on `build.created` (`priority:
3079
+ urgent`; omitted for normal and in historical logs) and changed by the
3080
+ human-authored advisory `build.priority-set {priority: urgent | normal}`
3081
+ (`ab priority <slug> urgent|normal`, the operator `builds.control` action
3082
+ `priority`); a later ticket priority edit does not reach an existing build.
3083
+ Absent priority reads as normal. Admission is arithmetic over reduced facts: a
3084
+ waiter is admitted when the slots occupied by every other build plus the
3085
+ slots reserved ahead of it are below `capacity`. Pending start requests are
3086
+ durable demand: the reduced `ticketStarts` counts them by tier, whatever
3087
+ intake says, and nothing while the repository is paused. Each reserves one slot
3088
+ ahead of the tiers below it until it settles or is cancelled, and never
3089
+ preempts. Only `manual` requests are reserved ahead of urgent parked work.
3090
+ Ahead of normal parked work are the `manual` and `urgent` requests, the urgent
3091
+ waiters' slot reservations and the urgent claim demand of the latest admission
3092
+ scan:
3093
+ `dispatcher.ticket-scan-completed` records `urgentWaiting`, the urgent non-node
3094
+ ready tickets that passed every intake gate except capacity (omitted when
3095
+ none; counted only while intake is on and the repository unpaused). An
3096
+ `urgent` start request waits for urgent reservations and `manual` requests; an
3097
+ ordinary urgent claim also for `urgent` requests. A `normal` start request
3098
+ waits for every waiter, the `manual` and `urgent` requests and the urgent claim
3099
+ demand; an ordinary normal claim waits for every waiter and every pending start
3100
+ request. Because demand discovered by an earlier scan can be stale,
3101
+ the dispatcher also defers, within a tick, any normal parked admission into a
3102
+ free slot while ticket claims can run (the source supports priority, intake is
3103
+ on, the repository is unpaused, accounts are present and the forge is not
3104
+ cooling down). A deferral writes nothing and keeps the build's reservation
3105
+ against normal claims; it makes that tick's admission scan due, and the
3106
+ deferred admissions are retried after the tick's dispatch only when that scan
3107
+ completed its urgent decision (its claim loop ran to the end, or it proved no
3108
+ urgent ticket ready). Otherwise they are decided again on a later tick. A
3109
+ forced scan is bounded per deferral state: an unchanged set of deferred builds
3110
+ and occupancy lists again only when a scan is due on its own. Only gate-passing
3111
+ urgent tickets count, so an urgent ticket blocked on a dependency never holds
3112
+ back normal parked work. Free slots only: priority never interrupts a running
3113
+ build or session.
3114
+
3115
+ **Open-PR backpressure.** When `[policy].maxOpenPrs` is set, the dispatcher
3116
+ counts open unmerged root PRs: nonterminal builds with an open or conflicted
3117
+ PR and no integration-node target, root leaves and root integration nodes
3118
+ alike. Children targeting a node do not count. A PR whose active landing
3119
+ command is `hold` counts unless `excludeHeldOpenPrs = true`. Backpressure
3120
+ engages when the count reaches `maxOpenPrs` and stays engaged until the count
3121
+ drops to or below `resumeOpenPrs` (default `maxOpenPrs - 1`). Reaching
3122
+ `maxOpenPrs` takes precedence, so with `resumeOpenPrs = maxOpenPrs` intake
3123
+ stays paused at that count and resumes once it falls below. While engaged,
3124
+ the dispatcher claims no new `normal`-priority ticket; `urgent` claims,
3125
+ in-flight builds, parked-build admission, reconciles, verification and
3126
+ landings continue, and capacity accounting is unchanged. The count is derived
3127
+ from the reduced build facts each tick already holds. The dispatcher records
3128
+ `dispatcher.open-pr-backpressure-engaged` and
3129
+ `dispatcher.open-pr-backpressure-cleared` repository facts only on
3130
+ transitions (a cleared fact names `drained`, or `disabled` when the key is
3131
+ removed while engaged); the engaged fact is the hysteresis memory a fresh
3132
+ process reads. Repository status and both dashboards report the count,
3133
+ watermarks and whether normal intake is paused. Unset `maxOpenPrs` disables
3134
+ backpressure entirely.
3135
+
2598
3136
  **What holds a slot.** `capacity` counts builds running work. A work build that
2599
3137
  has finished its pipeline (every verify step and every finalize post-step for
2600
3138
  the current spec) holds no slot while it waits for a merge decision, for merge
@@ -2606,10 +3144,13 @@ keeps its branch, workspace and completed phase work. Any other build that has
2606
3144
  not finished keeps its slot, even while paused, blocked on a question, waiting
2607
3145
  for the dispatcher to check a ticket wait, or interrupted between
2608
3146
  `finalize.completed` and its post-steps. When a finished build must restack,
2609
- re-verify or reconcile, or a ticket wait ends, the build is admitted before new
2610
- ticket claims, as a node is: intake reserves a slot for it (`resume` for an
2611
- ended wait), and its wait records nothing, consumes no attempt and raises no
2612
- attention. Abort and pause acknowledgements are not gated. A finished or
3147
+ re-verify, reconcile or run a requested optimization measurement (§13.1.1), an
3148
+ operator reopens it (§15.7), or a ticket wait ends, the build is admitted before normal
3149
+ ticket claims, as a node is (urgent work first: "Slot admission order"): intake reserves a slot for it (`reopen` for a
3150
+ reopened leaf, `resume` for an ended wait), and its wait records nothing,
3151
+ consumes no attempt and raises no attention. A reopened leaf stays a finished
3152
+ build until it settles again, so, like a blocked reconcile, it holds no slot
3153
+ while it waits on a question. Abort and pause acknowledgements are not gated. A finished or
2613
3154
  waiting build keeps its workspace, so retained workspaces can exceed
2614
3155
  `capacity`; running work cannot.
2615
3156
 
@@ -2659,7 +3200,7 @@ The fixed workflow is:
2659
3200
  still-existing unresolved origins. The filing fact and report preserve those
2660
3201
  two provenance sets separately. Creates are rendered to the spec standard
2661
3202
  and filed into `[tickets].proposalState`, Triage by default, with the reserved
2662
- `autobuild:proposal` provenance label.
3203
+ `autobuild:proposal` provenance label and any `[tickets].createLabels`.
2663
3204
  Filing is crash-safe by construction: an idempotency ID is durably reserved
2664
3205
  *before* each external create, so a restart adopts the already-created
2665
3206
  ticket instead of duplicating it, and a partially filed approved set creates
@@ -2722,6 +3263,38 @@ event-level mechanics live in the repository catalog and reducer tests):
2722
3263
  closed-unmerged PRs must still merge where the next tick will not reclaim
2723
3264
  them — a bounce filed into Ready is claimed and bounced again forever.
2724
3265
 
3266
+
3267
+ **Repository agent context.** At the end of every tick that still has budget
3268
+ and repository authority, the dispatcher keeps one repository-level record of
3269
+ the agent context at the base-branch head. It covers every skill directory
3270
+ under `.agents/skills/` and `.claude/skills/` with all its files (deduplicated
3271
+ by real directory and by identical content), every root and nested `AGENTS.md`
3272
+ and `CLAUDE.md`, and the files those import by `@path`, captured as separate
3273
+ entries. The record names its base commit. Both checkout and origin mode read
3274
+ the tree through the forge (`readTree`, `readBlob`), so they record identical
3275
+ content for one commit.
3276
+
3277
+ - **Artifacts.** The `agent-context` repository artifact holds the record as
3278
+ gzip JSON, with a new revision only when its content digest changes. A small
3279
+ `agent-context-head` pointer names the last base head handled, the input
3280
+ fingerprint and any standing diagnostic. `agent-context-cache.<i>` slots hold
3281
+ blob bytes an interrupted capture already fetched, so a later invocation
3282
+ resumes rather than refetching. All three are retention-managed.
3283
+ - **Cost.** Each process reads the base head at most once a minute, always on
3284
+ its first tick. An unchanged head then costs one pointer read per process.
3285
+ Nothing else is read, and no repository event is read or written. A failed
3286
+ capture is retried after five minutes, or as soon as the head moves. A head
3287
+ change reads the tree; only a changed input fingerprint reads the latest
3288
+ record and the blobs it lacks. Readers take the latest revision only.
3289
+ - **Bounds.** The encoded record may not exceed 2.25 MiB (`oversize`), and the
3290
+ record may not exceed 32 MiB uncompressed (`raw-oversize`), the same ceiling
3291
+ every reader decodes to. Both diagnostics name the bound and the largest
3292
+ contributors, keep the last good revision, and appear in the tick report
3293
+ once per base head.
3294
+
3295
+ Connected agents read the record through the context tools, prompts and server
3296
+ instructions of §8.9.
3297
+
2725
3298
  ## 13. Ticket source policy
2726
3299
 
2727
3300
  **Hosted tickets are project-scoped.** A project credential selects one registered
@@ -2752,7 +3325,13 @@ state, or a fixed `not-planned` state, never ready and never resolving a
2752
3325
  blocker, when no rejected role is configured. Reopening an issue on GitHub
2753
3326
  returns it to triage, and the adapter strips a stale pre-reopen state label the
2754
3327
  first time it reads the issue. Blockers are GitHub's native issue dependencies,
2755
- and a blocker in another repository never resolves. Assets live in the
3328
+ and a blocker in another repository never resolves. Because GitHub's
3329
+ dependency summary lags the edges, reads that feed a claim decision read the
3330
+ dependency list, and claim re-reads it fresh, refusing without a write any
3331
+ unresolved blocker the dispatcher's dependency check did not evaluate; the
3332
+ dispatcher counts that ticket as dependency-blocked for the tick. A create into
3333
+ the ready state with blockers opens in triage and moves to ready only after
3334
+ every blocker is recorded. Assets live in the
2756
3335
  BuildStore, with notes posted as issue comments, and `get` carries no comment
2757
3336
  history; export and import read it explicitly. A ticket's own issue is an implicit `closes` link. A node is an issue
2758
3337
  with the exact `node` label, and a ticket targets a node by being a sub-issue
@@ -2818,7 +3397,11 @@ Both are optional and have no default: `backlogState` and `rejectedState` unset
2818
3397
  means the role does not exist, and a state that merely shares the role's name
2819
3398
  holds no role. Neither may share its native state with the ready, claimed, done,
2820
3399
  triage or proposal role, or with each other. The dispatcher never claims from,
2821
- moves into, or files harvest proposals into either. A ticket in the rejected
3400
+ moves into, or files harvest proposals into either, with one exception: it
3401
+ moves the ticket of an optimization attempt that settles with any outcome other
3402
+ than `accepted` into the rejected role (§13.1.1), including an attempt an
3403
+ operator aborts, which never returns to triage. Tickets that are not attempts
3404
+ never move there automatically. A ticket in the rejected
2822
3405
  state never resolves a blocker, and a rejected child no longer keeps its node
2823
3406
  incomplete; a backlog child still does, as triage and ready children do. Moving
2824
3407
  a ticket out of the rejected state restores ordinary behavior. Agents and
@@ -2861,8 +3444,18 @@ unaffected. `ab ticket create` and `update` take `--issues N[:refs],...`;
2861
3444
  operator and MCP ticket requests take `issueLinks`.
2862
3445
 
2863
3446
  **Ticket priority.** A ticket's priority is `urgent` or `normal`; absent means
2864
- normal. Urgent ready work is claimed before normal ready work (§12) and nothing
2865
- else changes. Sources declare support. The file source stores
3447
+ normal. Urgent ready work is claimed before normal ready work, and ahead of
3448
+ normal parked work (§12 "Slot admission order"); a claimed ticket's priority
3449
+ becomes its build's priority, and nothing else changes. A single-ticket start
3450
+ request has its own admission tier (§11); an `urgent` request also makes its
3451
+ build urgent. An optimization attempt (§13.1.1) is the exception: an in-flight
3452
+ attempt of an open, unstopped optimization node claims at the node's current
3453
+ build priority, whatever its ticket says and whether or not its source stores
3454
+ priority. `ab priority <node> urgent|normal` therefore reaches the node's
3455
+ attempts claimed afterwards; an attempt already claimed keeps its build's
3456
+ priority, as any build does. No slot is reserved for attempts, they preempt
3457
+ nothing, and within a tier the source's order applies. Sources declare
3458
+ support. The file source stores
2866
3459
  `priority = "urgent"` in its frontmatter, writes no key for normal, and covers
2867
3460
  urgent priority in its revisions; the in-memory fake behaves the same way.
2868
3461
  The hosted source stores priority in the hosted ticket store, covers it in its
@@ -2899,6 +3492,17 @@ is written; their tickets carry no `assignees` field. `ab ticket create` and
2899
3492
  `update` take `--assignees a,b`; operator and MCP ticket requests take
2900
3493
  `assignees`.
2901
3494
 
3495
+ `[tickets].createLabels` lists labels added to every ticket Autobuild creates
3496
+ (`ab ticket create`, operator `tickets.create`, harvest proposals and
3497
+ optimization attempts). The caller unions them after the labels the create
3498
+ names, never replacing them, so a source receives exact draft labels and needs
3499
+ no capability; `ab ticket import` never applies them. They are ordinary labels
3500
+ and count toward `readyLabels` only when also listed there. Parse refuses names
3501
+ a builtin source reserves: on GitHub `autobuild:<state>`, `autobuild-link:` and
3502
+ `node`, on Linear `node`. A retried keyed GitHub create that adopts its issue
3503
+ adds any requested labels it is missing. Hosted publishes the value in the
3504
+ project ticket policy so the service's own operator create applies it.
3505
+
2902
3506
  A build freezes its ticket's links into `build.created` when it claims the
2903
3507
  ticket, from the same sample as the body. Later ticket edits and spec revisions
2904
3508
  never change them. An agent in the build may downgrade one linked `closes`
@@ -3034,12 +3638,14 @@ from its parent's sampled head. Opening intent and acknowledgement are durable;
3034
3638
  the branch is open to targeting tickets immediately, without a PR. Idle integration
3035
3639
  builds use no provisioned workspace, runner, execution lease, or dispatch capacity.
3036
3640
 
3037
- A node requesting reconcile or verification is admitted before new ticket
3038
- claims. The request is durable: a prepared verification cycle or a restack
3039
- conflict, with no runner yet. Until the node holds its slot, intake reserves one
3641
+ A node requesting reconcile, verification or, for an optimization node,
3642
+ propose is admitted before normal ticket claims (urgent work first, §12 "Slot
3643
+ admission order"). The request is durable: a
3644
+ prepared verification cycle, a restack conflict or an open proposal request,
3645
+ with no runner yet. Until the node holds its slot, intake reserves one
3040
3646
  slot for it, and the dispatcher checks its admission every tick regardless of
3041
3647
  idle node polling, so a slot freed in any tick goes to the node, not to a new
3042
- claim. Its candidate occupancy excludes itself and capacity-bearing blocked or
3648
+ normal claim. Its candidate occupancy excludes itself and capacity-bearing blocked or
3043
3649
  paused descendants, following accepted source-qualified build target ancestry.
3044
3650
  Running descendants and unrelated builds still count; ordinary blocked and
3045
3651
  paused work retains its slot for every other admission, except a work build
@@ -3048,8 +3654,10 @@ node occupancy before the runner starts. This exception never raises the budget
3048
3654
  for new claims. Status and both dashboards report actual occupancy, configured
3049
3655
  capacity, effective display capacity and the nodes using descendant-held slots.
3050
3656
  Status, `ab builds` and both dashboards report each node waiting for a slot
3051
- ahead of new ticket claims, and report a finished work build waiting to run
3052
- again the same way. Idle collecting nodes remain free.
3657
+ ahead of normal ticket claims, marking urgent waiters, the pending start
3658
+ requests of each tier and the urgent ticket claims waiting ahead of normal
3659
+ parked work, and report a finished work build waiting to run again the same
3660
+ way. Idle collecting nodes remain free.
3053
3661
 
3054
3662
  An empty node has no PR and reports `integration`, `target`, and `empty`.
3055
3663
  Once it holds commits its current parent lacks, the dispatcher opens or adopts
@@ -3078,7 +3686,13 @@ Merge follows ordered `[[merge]]` rules (§15.7), defaulting to node consent.
3078
3686
  Auto mode authorizes complete, verified nodes; consent mode waits for `ab merge`.
3079
3687
  Merge refuses incomplete nodes and names open children; `ab hold` remains available.
3080
3688
  Node parents and local-git roots receive guarded fast-forwards, preserving one
3081
- commit and identity trailer per contributing build. GitHub shared roots use the
3689
+ commit and identity trailer per contributing build; each verified node-owned
3690
+ hand-pushed commit of the exact verified range lands as pushed, without a trailer.
3691
+ Landing refuses a range that is non-linear, contains a merge commit, gives a
3692
+ commit several or repeated identities, or holds a trailer-less commit the node
3693
+ does not own. A refusal raises operator attention naming the rule and commit
3694
+ instead of retrying; a bare retry answer attempts the same head once more.
3695
+ GitHub shared roots use the
3082
3696
  PR rebase endpoint guarded on verified head, after a final parent freshness read.
3083
3697
  A root node's PR body carries the node's own issue links and its landed
3084
3698
  children's, and is refreshed before landing, so merging it closes them (see
@@ -3095,8 +3709,16 @@ survive completion. Merge gates are never bypassed; unsupported transports defer
3095
3709
  Human forge merges are an explicit escape hatch, even while incomplete, paused
3096
3710
  or unverified. The janitor records human provenance and whether the actual merged
3097
3711
  head had a successful cycle, then completes the node ticket.
3712
+ A recorded landing, kernel or human, ends the node's verification: no new cycle
3713
+ is prepared, and an open one is cancelled. The dispatcher withdraws the running
3714
+ verifier's execution lease; the runner aborts its active check at its next
3715
+ heartbeat and ends open sessions as an operator stop does, without recording
3716
+ results. The janitor completes the node once that execution has ended. A node
3717
+ whose owned range is empty (its head is its parent's, as when the parent was
3718
+ fast-forwarded onto it) never prepares a verification cycle either.
3098
3719
  Closing without merge or aborting closes admission and returns the ticket to
3099
- triage (or ready, when the abort asks for it); children already claimed retain
3720
+ triage (or ready, when the abort asks for it); an optimization attempt's ticket
3721
+ goes to the rejected role instead (§13.1.1). Children already claimed retain
3100
3722
  their frozen base. Nested nodes work.
3101
3723
  A forge plugin needs node branch creation, comparison and
3102
3724
  head-read capabilities to admit node tickets.
@@ -3193,7 +3815,7 @@ Node branches have one writer at a time. A distinct mutable node writer lease
3193
3815
  (serialized independently of runner execution leases) guards both restacks and
3194
3816
  controlled child merges. A revision-checked `node.writer-reserved` fact freezes
3195
3817
  the operation, original expected head, parent snapshot, previous contribution
3196
- boundary, immutable archives, ordered changes, and merge proofs. Expiry permits
3818
+ boundary, retained inputs, ordered changes, and merge proofs. Expiry permits
3197
3819
  recovery of that reservation, never an incompatible operation. Each change has
3198
3820
  prepared, conflicted, or replayed receipts. Resolved objects are retained in the
3199
3821
  BuildStore before their receipts. `node.publish-intended`, `node.rewritten`, and
@@ -3201,7 +3823,8 @@ BuildStore before their receipts. `node.publish-intended`, `node.rewritten`, and
3201
3823
  is authoritative: exact intended-head readback confirms publication, while local
3202
3824
  refs are caches refreshed without CAS. An unconfirmed descendant is contention;
3203
3825
  a durable confirmed receipt can preserve a historical write. Exact
3204
- expected-head replacement and immutable archive refs preserve displaced history;
3826
+ expected-head replacement and best-effort retained history (immutable archive
3827
+ refs, else BuildStore copies, §15.7) preserve displaced history;
3205
3828
  contention retains the previous contribution boundary and retries the complete
3206
3829
  observed contribution. An untagged commit, including an empty commit, is foreign.
3207
3830
  `node.inventory` retains the sampled source boundary without promoting the confirmed
@@ -3209,8 +3832,15 @@ restack base. It reports reachable build identities separately from node-owned
3209
3832
  foreign commits above the durable boundary; inherited foreign history is excluded
3210
3833
  from the owned count.
3211
3834
 
3212
- Only a conflicted replay item attaches the integration build's reconcile runner.
3213
- Its context names the integration owner separately from the original source
3835
+ Only a conflicted replay item attaches the integration build's runner. When
3836
+ every conflicted path of the item is declared in `[[generated]]`, that runner
3837
+ regenerates it as a leaf does, in the node's execution workspace, and records
3838
+ `node.item-regenerated {id, index, base, files, commands, outcome, head?,
3839
+ reason?}`. A resolved item is validated and retained before its fact, then
3840
+ receives an ordinary `node.item-replayed` receipt with no `reconcile.started`
3841
+ or session; a resolved fact without a receipt is completed from the retained
3842
+ head on the next attempt. A skipped or failed item reproduces the original
3843
+ conflict and continues into reconcile. The reconcile runner's context names the integration owner separately from the original source
3214
3844
  build and supplies that source's pinned spec, approved plan and implement-notes.
3215
3845
  Missing source artifacts or invalid identities escalate. Foreign conflicts supply
3216
3846
  commit metadata and a diff, with escalation when intent is unclear. Completion
@@ -3287,6 +3917,705 @@ revision once; equivalent aliases and unchanged values do not. Node demotion
3287
3917
  checks all targeting tickets, including completed work. Legacy plugins without
3288
3918
  integrationTree support read as work with no target and refuse metadata writes.
3289
3919
 
3920
+ #### 13.1.1 Optimization nodes
3921
+
3922
+ An optimization node is a node whose spec declares an objective (RFC 0005 §3,
3923
+ §4). The objective is the only marker: `kind` stays `node`, and ticket sources,
3924
+ labels and forge capabilities are unchanged. The marker makes a node file and
3925
+ dispatch its own work, so the rules below admit no false positive and no silent
3926
+ fallback in either direction. Code is authoritative
3927
+ (`packages/core/src/objective.ts`); the full schema table, with defaults and
3928
+ constraints, is the installed `ab-guide` reference
3929
+ `references/optimization-nodes.md`.
3930
+
3931
+ **Marker.** A node becomes an optimization node only when its spec carries
3932
+ exactly one fenced block whose info string is exactly `autobuild-objective`.
3933
+ The scan follows CommonMark fences. A fence opens on a line indented at most
3934
+ three spaces with three or more backticks or tildes, and closes on a line of the
3935
+ same character, at least as long, carrying no info string. A backtick line whose
3936
+ info string contains a backtick is inline code, not a fence. Only a fence whose
3937
+ trimmed info string equals `autobuild-objective`, case-sensitively, counts. None
3938
+ of these count:
3939
+
3940
+ - a fence nested inside another open fence, so a Markdown example that shows
3941
+ the block never marks the spec that contains it;
3942
+ - a fence line that begins with a blockquote or list marker, or is indented
3943
+ four or more spaces;
3944
+ - a fence inside an HTML block, such as an HTML comment, so a commented-out
3945
+ example never counts;
3946
+ - a heading named "Objective";
3947
+ - a `toml` block, or a fence with any other info string;
3948
+ - prose describing an objective, and inline code.
3949
+
3950
+ A spec with no block is a plain node.
3951
+
3952
+ **Objective.** The block's content is TOML with a required `purpose` and
3953
+ `[metric]`, `[target]` and `[budget]` tables, and optional `[stop]` and
3954
+ `[proposer]` tables. Every table is strict: an unknown key is refused and named.
3955
+ A metric is a `command` (command, direction, samples, harness) or a `panel`
3956
+ (judges, rubric, harness); a panel always maximizes a win rate, so the
3957
+ command-only fields are refused for it and the panel-only fields for a command.
3958
+ Harness entries are path selectors, the grammar `[[merge]]` and verify `paths`
3959
+ use, and a panel's rubric must be a literal path inside the harness. At least
3960
+ one of `budget.maxAttempts` and `budget.maxHours` is required. `stop.mode`
3961
+ defaults to `abort` and `proposer.concurrency` to 1. The normalized objective,
3962
+ defaults applied, is what events store.
3963
+
3964
+ **Refusals.** Each refusal names its reason:
3965
+
3966
+ | Condition | Reason |
3967
+ |---|---|
3968
+ | Two or more blocks | `exactly one autobuild-objective block (found N)` |
3969
+ | A block never closed | `a valid autobuild-objective block: the fence is never closed` |
3970
+ | A TOML syntax error | `a valid autobuild-objective block: TOML syntax error at line L: …` |
3971
+ | A schema failure | `a valid autobuild-objective block: <field>: <message>`, for example `unknown field metric.cmd` or `metric.rubric: must be inside metric.harness` |
3972
+ | No budget limit | `a budget limit in the autobuild-objective block: set budget.maxAttempts or budget.maxHours` |
3973
+ | No rejected role | `a rejected role for optimization attempts: set [tickets].rejectedState` |
3974
+ | 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)` |
3975
+
3976
+ Ticket preparation checks the ticket body before any spec authoring. A refusal
3977
+ bounces the ticket to Triage with a comment naming every reason, through the
3978
+ same hand-back as a spec-standard bounce, and creates no build, so a node whose
3979
+ block is refused never opens as a plain node. The dispatcher never authors a
3980
+ spec for a body that carries a block, and treats an authored spec that gains
3981
+ one as nonconforming. Dispatch recovery repeats the
3982
+ check before importing the spec; a refusal fails the dispatch and the node never
3983
+ opens.
3984
+
3985
+ **Acceptance.** Opening an optimization node records
3986
+ `optimization.objective-accepted {objective, revision: 1, harnessPin, specRev}`
3987
+ after the node branch exists and before `node.opened`. `harnessPin` is the
3988
+ node's opening commit and `specRev` the spec revision the objective was parsed
3989
+ from. An opened optimization node therefore always has an accepted objective. A
3990
+ retried opening after a crash between the two facts records no second
3991
+ acceptance.
3992
+
3993
+ Every optimization node then measures its opening head against itself and
3994
+ records `optimization.baseline-measured {revision, head, harnessPin, samples,
3995
+ median, spread, report?}`. A command node samples it (see **Measurement**):
3996
+ the starting value is the median of every sample and the spread is the
3997
+ distance between the two sides' medians. A panel node runs one judge panel
3998
+ (see **Judge panels**) of its harness pin against itself and records the
3999
+ self-comparison win rate as `median`, the judge count as `samples`, no
4000
+ `report`, and `|winRate − 0.5|` as `spread`; its starting value is 0.5. The
4001
+ engine decides `measure-baseline` for an opened, unstopped node with no
4002
+ starting value under its current ruler, ahead of integration work and behind
4003
+ escalations, pause, abort and a node reconcile.
4004
+
4005
+ After each accepted attempt a panel node measures its progress: one panel of
4006
+ the head the attempt landed as (the `head` of its `attempt.settled`) against
4007
+ the starting head, recorded as `optimization.progress-measured {revision,
4008
+ head, start, winRate, judges}`. The engine decides `measure-progress {revision,
4009
+ head, start, harnessPin}` for the oldest landed head without a recorded
4010
+ progress, right after `measure-baseline` in precedence and ahead of
4011
+ integration work. It is not gated on a stop, so a draining node still records
4012
+ the progress of an attempt that lands. The dispatcher admits either
4013
+ measurement as it admits a node verification: the node requests a
4014
+ `verification` slot, is provisioned a workspace, and releases that workspace
4015
+ once no measurement, integration cycle, restack or reconcile needs it.
4016
+
4017
+ **Noise check.** When ε in metric units (absolute, or relative × |median|) is
4018
+ strictly smaller than the starting spread, the runner first records advisory
4019
+ `optimization.noise-exceeded {revision, head, harnessPin, median, spread,
4020
+ epsilon, effectiveEpsilon}`, then the starting value. A panel's spread is the
4021
+ self-comparison's distance from 0.5 and its ε is absolute. The fact is default
4022
+ watch attention naming both numbers. The node still opens; raising ε, or
4023
+ `samples` for a command and `judges` for a panel, is the operator's decision. A relative ε over a zero median is 0, so
4024
+ any positive spread exceeds it. Writing the attention first means a crash
4025
+ between the two facts measures and raises again rather than losing it.
4026
+
4027
+ **Spec revisions.** `ab answer <node> --revise-spec`, `--revise-spec-from-ticket`
4028
+ and an escalation answer that revises the spec check the replacement before
4029
+ recording anything. A revision of an optimization node may change any part of
4030
+ the objective, but it cannot remove the block: close the node and open a new
4031
+ one instead. A revision of a plain node or a work build cannot add one. A
4032
+ replacement block that fails to parse or validate is refused, naming the field.
4033
+ After an accepted `spec.revised` on an optimization node, the dispatcher records
4034
+ `optimization.objective-accepted` again with the next revision and the new
4035
+ `specRev`. It pins the harness again at the current node head when the metric
4036
+ changed, or the purpose of a panel, whose judges read it; otherwise the pin is
4037
+ unchanged. Such a change starts a new ruler (§15.5), which clears the starting
4038
+ value, so the node measures the new pin against itself and runs the noise
4039
+ check again.
4040
+
4041
+ **Quick revisions.** `ab objective <node>` shows the effective objective and
4042
+ progress. With any of `--threshold n`, `--epsilon n|n%`, `--max-attempts n`,
4043
+ `--max-hours n`, `--plateau n`, `--stop-mode abort|drain` or `--concurrency n`
4044
+ it records human `optimization.objective-revised {changes, revision}` first;
4045
+ `--epsilon 2` is absolute and `--epsilon 3%` is relative 0.03. The operator tool
4046
+ `optimization.revise` (input `{repo, slug, threshold?, epsilon?, maxAttempts?,
4047
+ maxHours?, plateau?, stopMode?, concurrency?}`, at least one change) records the
4048
+ same fact and returns `{slug, revision, changes}`. Both refuse a build that is
4049
+ not a node, a node with no accepted objective and a terminal node, and both
4050
+ require the effective objective to remain valid. Running attempts are
4051
+ unaffected and nothing is replanned; the dispatcher applies a revised stop rule
4052
+ on its next tick. The metric, harness and purpose change only through a spec
4053
+ revision.
4054
+
4055
+ The effective objective is the kernel's, reduced from events; a quick revision
4056
+ is never written back to the ticket. `ab ticket show` prints the effective
4057
+ objective of an open optimization node and marks each field that differs from
4058
+ the ticket's block `(revised)`. The open build decides this, not the ticket
4059
+ body: when an edit removes the block or leaves it invalid, every field is
4060
+ marked. `ab ticket tree` labels such a ticket
4061
+ `[node, optimization]`, and status labels the build `optimization node`.
4062
+
4063
+ **Progress surfaces.** The shared dashboard projection gives an optimization
4064
+ node an objective row (RFC 0005 §12): the starting and current value against
4065
+ the threshold, with the baseline's noise; accepted, rejected and running
4066
+ attempts; the budget used; and the stop cause once stopped. A panel objective
4067
+ shows win rates. Budget hours are active hours, and they stop growing at the
4068
+ stop; a stopped node whose clock is not yet settled says `settling`. The terminal dashboard
4069
+ prints the row under the node's progress bar and in its detail view; `ab
4070
+ status` prints it on a continuation line and `ab build status <node>` under
4071
+ the `optimization node` label. `--json` summaries, `builds.list`, `builds.get`
4072
+ and `ab watch --json` records (`state.objective`, with active hours evaluated
4073
+ at the record's own timestamp) carry the same fields under `objective`, and
4074
+ the dashboard row under `objectiveRow`, in the same terms. Each is projected
4075
+ from the digest in the build state the surface already reads. The web app's
4076
+ progress view is a separate design decision.
4077
+
4078
+ **Attempts.** A build is an attempt of node N exactly when its ticket ref
4079
+ appears in a recorded `optimization.attempts-proposed` of N; the commands below
4080
+ recognize it while the attempt is in flight. Both refs are compared through the
4081
+ recorded ticket-migration identity, so a proposal recorded before a
4082
+ ticket-source migration matches a child dispatched after it; continuity that
4083
+ cannot be resolved fails the command closed instead of treating the build as an
4084
+ ordinary child. Children filed any
4085
+ other way are not attempts and follow the ordinary child rules above. An
4086
+ attempt keeps the ordinary work grammar.
4087
+
4088
+ In every phase of an attempt, `ab context` writes a derived `objective.md`
4089
+ and a manifest `attempt` block `{node, proposal, revision, purpose, metric,
4090
+ harness, current?, path}`: the purpose, the measurement command or panel, the
4091
+ pinned harness, ε, any threshold and the node's current, best and starting
4092
+ values. In implement, `ab done` compares the net contribution (`base..head`,
4093
+ without rename detection) with `metric.harness` and refuses a change to any
4094
+ matching path before any deposit or publication, naming the paths (§8.5). No
4095
+ event is written, so code review never sees such a change.
4096
+
4097
+ An attempt's implementer may decline with `ab done --no-improvement
4098
+ "<reason>"`, which records `implement.declined {round, reason, artifact?}`.
4099
+ Declining needs no commits or clean worktree and publishes nothing. The engine
4100
+ then waits (`declined`), so no review, verification, finalize or measurement
4101
+ runs. The dispatcher appends `attempt.settled {outcome: declined, note:
4102
+ reason}` to N's log if the attempt is still in flight, releases the lease and
4103
+ workspace, and completes the attempt `closed-unmerged`. The flag is refused
4104
+ outside implement and in a build that is not an attempt.
4105
+
4106
+ **Measurement.** A measurement runs two heads in one execution, so a number
4107
+ from another machine is never a baseline (RFC 0005 §7.3, §7.4). Code is
4108
+ authoritative (`packages/core/src/kernel/measurement.ts` for the math,
4109
+ `packages/core/src/processes/measurement-runner.ts` for the execution).
4110
+
4111
+ - *Pairing.* Two detached worktrees, one at the candidate and one at the
4112
+ baseline, are created under the workspace's Git common directory (a commit
4113
+ missing locally is fetched from `origin`). Each of `samples` rounds runs the
4114
+ metric command once per side, baseline first in even rounds and candidate
4115
+ first in odd rounds, so monotone drift cancels. A configured
4116
+ `[commands].setup` runs once in each worktree first. The worktrees are
4117
+ removed afterwards, on failure too.
4118
+ - *Harness pinning.* Before any run, every file matched by `metric.harness`
4119
+ (`compilePathSelectors`) is checked out at `harnessPin` in both worktrees,
4120
+ and every matched file the pin lacks is removed, with literal pathspecs.
4121
+ Only blob entries count. Harness changes in the candidate, or arriving
4122
+ through a node restack, therefore never affect a measurement.
4123
+ - *Output contract.* Each run runs `sh -c <command>`, must exit 0, and must
4124
+ print, trimmed, exactly one JSON object whose `value` is a finite number.
4125
+ Every sample run and setup run has a 30-minute timeout.
4126
+ - *Decision.* A side's value is its median (the mean of the two middle values
4127
+ for an even count). The delta is direction-aware (§15.5). ε in metric units
4128
+ is `absolute`, or `relative × |baseline median|`. A delta ≥ ε is `improved`;
4129
+ anything less is `no-improvement`. Significance tests are not applied. One
4130
+ definition of this effective ε serves both the recorded `decision` and the
4131
+ landing gate's classification, so the two cannot disagree on the same
4132
+ measurement. A panel's delta is `winRate − 0.5` with ties counted as half, and its ε is
4133
+ absolute: a win rate ≥ 0.5 + ε is `improved`, compared with a 1e-9 float
4134
+ tolerance so that, for example, 3 of 5 judges meets ε 0.1.
4135
+ - *Attempts.* `attempt.measurement-requested` names the candidate, baseline,
4136
+ harness pin, objective revision and, additively, the node's `metric`, a
4137
+ command or a panel; a panel request also carries the objective `purpose`,
4138
+ which its judges read. The engine decides `run-measurement` for a leaf at `wait
4139
+ awaiting-pr` whose latest request is neither sampled nor measured and whose
4140
+ baseline is still the node head the child last observed, so restack,
4141
+ re-verify and reconcile keep precedence, and the dispatcher admits it as a
4142
+ re-verify (§12). A request whose baseline a later `target.moved` superseded
4143
+ is skipped: it gets no runner and no slot, and the landing gate records a
4144
+ current request once the child is restacked. Samples already running when
4145
+ the head moves are still recorded and decided, and the gate rejects the
4146
+ result as stale. The attempt's runner holds only its own build, so it
4147
+ samples in the attempt's workspace and records kernel `attempt.sampled
4148
+ {request, candidate, baseline, harnessPin, revision, samples, medians,
4149
+ report}`, which carries no decision. A panel request is sampled by one judge
4150
+ panel (**Judge panels**) of the attempt's head against the node head, with
4151
+ panel id `attempt-<request>`: a crash resumes that panel, and after an
4152
+ answered measurement escalation the id becomes `attempt-<request>-a<seq>`,
4153
+ the answer's sequence number, so the answer judges afresh. Its
4154
+ `attempt.sampled` carries `winRate` in place of `medians`, `samples` as the
4155
+ judge count, and a report holding the judgments. When the lease sweep finds a parked
4156
+ leaf whose latest request is sampled and undecided, the dispatcher reads the
4157
+ node's reduced state once, revalidates the request's revision against the
4158
+ node's ruler and its harness pin against the node's pin, and records
4159
+ dispatcher `attempt.measured` with the decision against the node's current ε
4160
+ and its starting spread as `spread`. A quick ε revision made while the
4161
+ samples ran therefore applies. A panel's `attempt.measured` carries the win
4162
+ rate in place of medians; it needs no starting value, and carries `spread`
4163
+ only when the node has one. The dispatcher also refuses a panel request whose
4164
+ judges, rubric, harness or purpose differ from the node's.
4165
+ - *Failures.* A command failure, a timeout, output outside the contract, a
4166
+ worktree or setup failure, a request with no metric, a failed judge panel (a
4167
+ judge that exhausted its attempts, or variants that could not be prepared)
4168
+ or a panel request with no purpose records no value or decision. The kernel raises `escalation.raised {phase:
4169
+ measurement, source: policy, policyCause: measurement-failed}` naming the
4170
+ cause, the sample and the output tail; the build is blocked, and the answer
4171
+ makes the request (or due starting value) pending again, so it is measured
4172
+ again. A request whose ruler or pin was replaced before its decision is
4173
+ refused the same way by the dispatcher, and stays refused after the answer:
4174
+ the attempt needs a fresh request. `measurement` is an escalation target, not
4175
+ a phase: its answers route no guidance into a phase and reset no phase
4176
+ failures.
4177
+ - *Spread and report.* A command's `attempt.measured` carries the node's
4178
+ starting spread beside its delta, and watch prints it. Both measurement facts and
4179
+ `attempt.sampled` reference a `measurement-samples` artifact with the raw
4180
+ per-sample values, or a panel's judgments, deposited with the fact.
4181
+
4182
+ **Landing gate.** Passing verify and finalize is necessary but no longer
4183
+ sufficient for a child of an optimization node: it lands only with a measurement
4184
+ (RFC 0005 §6.3, §6.4). Readiness to land is decided as for any node-target
4185
+ child, independently of measurement. A ready child then needs a result that
4186
+ applies: the latest `attempt.measured` answering the child's latest
4187
+ `attempt.measurement-requested`, whose `candidate` is exactly the child's
4188
+ candidate head, whose `baseline` is exactly the node head it lands on, whose
4189
+ `harnessPin` is the accepted pin, and whose `revision` is at least the ruler
4190
+ revision. A restack changes the candidate and a sibling landing moves the node
4191
+ head, so either makes a result stale by construction and the dispatcher records
4192
+ a new request on the child's log. An unsampled request whose baseline the
4193
+ child has already seen superseded is skipped rather than measured. A clean restack keeps verification; it never
4194
+ keeps a measurement. A request is recorded only once the candidate sits on the
4195
+ observed node head. The node writer is never held during a measurement, and its
4196
+ guarded merge is guarded on the measured baseline: under the writer
4197
+ reservation, the destination snapshot must equal the measured baseline and the
4198
+ source snapshot the measured candidate, or the landing is refused and retried.
4199
+ A reservation recovered after an interrupted landing publishes only while its
4200
+ reserved pair still passes the gate under the current objective; otherwise the
4201
+ writer abandons the reservation and the next poll measures or settles the
4202
+ child. A write that already happened is recovered by readback, never undone.
4203
+
4204
+ The dispatcher classifies a result from its recorded `delta` and the effective
4205
+ ε (relative ε is scaled by |baseline median|); the recorded `decision` is
4206
+ informational. An attempt lands when `delta` ≥ ε. Otherwise it settles
4207
+ `no-improvement`, its PR closes without merging, and no further implement
4208
+ round runs. Any other child lands when `delta` ≥ −ε; a regressing child raises
4209
+ one kernel escalation `landing-regressed-<request>` naming both medians (a
4210
+ panel's win rate), the delta and ε, and an answer requests a fresh
4211
+ measurement. A panel result is classified from its win rate with the same
4212
+ tolerance as its decision: an attempt lands when it reaches 0.5 + ε, any other
4213
+ child when it reaches 0.5 − ε. Its settlement records baseline 0.5 and the
4214
+ win rate as the candidate. `ab watch` and `ab build status <child>` print the
4215
+ recorded measurement: a command's medians or a panel's win rate, the delta and
4216
+ the decision. Such children never
4217
+ settle and count toward neither budget nor plateau.
4218
+
4219
+ An attempt whose candidate head changes a harness path escalates instead of
4220
+ being measured: one kernel escalation `landing-harness-<head>` names the matched
4221
+ paths, and that head is never measured, even after an answer. The check reads
4222
+ the head's recorded changed paths; a head without them waits, as a deferred
4223
+ merge decision does.
4224
+
4225
+ **Turn.** An attempt whose latest request was overtaken three consecutive
4226
+ times (three requests whose baseline differed from the previous request's)
4227
+ holds the node's next turn while it is open, not paused, aborted or closed, and
4228
+ has no open escalation other than a janitor one. While another child holds the
4229
+ turn, a candidate neither requests a measurement nor lands. When several
4230
+ qualify, the first in proposal order holds it.
4231
+
4232
+ **Progress first.** While a panel node's digest holds a landed head that owes
4233
+ a progress panel, a child that would otherwise land waits (`wait-progress`);
4234
+ its measurement may still be requested and run. The node head therefore never
4235
+ moves past an unmeasured accepted head under kernel control.
4236
+
4237
+ **Settlement.** Every attempt settles exactly once, on the node's log, by the
4238
+ dispatcher path that ends it: `accepted` when it merges, with the measurement
4239
+ of the merged head; `no-improvement` at the gate; `aborted` when an operator
4240
+ aborts it or a human closes its PR without merging. An `accepted` settlement
4241
+ records the merged SHA as `head`, the node head it landed as. `declined` is recorded when an implementer declines as described above;
4242
+ `stopped` is recorded by the stopping rules (RFC 0005 §9). The
4243
+ write is conditional on the node log and the attempt still being in flight.
4244
+ Each settlement other than `accepted` and `merged-unmeasured` leaves a pending
4245
+ rejection in the node's digest. Once the attempt has no build or its build is done, the node's janitor
4246
+ poll moves the ticket to the rejected role, comments the outcome, and records
4247
+ `attempt.ticket-rejected {proposal, ticket, state}`. Until then the attempt's
4248
+ own terminal paths skip their triage hand-back, so its ticket never reaches
4249
+ triage. A merged attempt's ticket moves to done as for any child.
4250
+
4251
+ A merge is `accepted` only with a result for exactly the merged head that
4252
+ answers a request of this node. Anything else, typically a forge-side human
4253
+ merge, records `attempt.merged-unmeasured {proposal, ticket, build, sha?,
4254
+ reason, measuredCandidate?}` on the node, once, with one followup observation on
4255
+ the child. The reason is `absent` (no result), `stale-head` (the result
4256
+ measured `measuredCandidate`), `unrelated` (the latest request named another
4257
+ node) or `unresolvable` (the child recorded no merged head, the only case
4258
+ without `sha`). The attempt stays in flight and keeps its concurrency slot;
4259
+ `ab objective`, `ab build status <node>` and the objective row name it and say
4260
+ why the slot is held. On every node tick the dispatcher also reconciles merges
4261
+ that completed with neither record, such as merges from before the marker
4262
+ existed. That pass scans the in-flight entries over the tick's build listing,
4263
+ reads one merged child's reduced facts once, and writes the marker, or
4264
+ `accepted` when that head was measured. An operator releases a marked attempt
4265
+ with `ab objective <node> --settle-unmeasured <proposal|build> --policy
4266
+ release-unmeasured [--note <text>]` or the operator tool
4267
+ `optimization.settle-unmeasured` (input `{repo, slug, attempt, policy,
4268
+ note?}`, receipt `{slug, proposal, build, outcome, policy}`). The policy is
4269
+ required. `release-unmeasured` records `attempt.settled {outcome:
4270
+ merged-unmeasured, policy, mergedSha?}` with a human actor and no
4271
+ measurement. It releases the slot exactly once, counts in
4272
+ `attempts.unmeasured`, and leaves `current`, `best` and `plateau` unchanged.
4273
+ It adds no pending rejection, because the ticket is already done. The action
4274
+ works on a stopped node, revalidates the child's merged head, and refuses
4275
+ settled, unmerged or unmarked attempts, measured heads and terminal nodes.
4276
+
4277
+ A `declined` or `no-improvement` attempt whose build published (it completed
4278
+ an implement round or opened a PR) carries its build branch as
4279
+ `attempt.branch`. The pending rejection keeps it as a cleanup obligation. Once
4280
+ the build is done, the sweep checks the guards first: the branch must be that
4281
+ attempt build's own, the build must target this node, and the branch must be
4282
+ neither the node's branch nor its base. It then deletes the branch through the
4283
+ forge and records `attempt.branch-deleted {proposal, build, branch}`. A branch
4284
+ that is already absent counts as deleted, and a crash before the record repeats
4285
+ the delete. A refused guard or a failed delete records
4286
+ `attempt.branch-cleanup-failed {proposal, build?, branch, error}` once per
4287
+ distinct error. The obligation then stays pending and holds the slot, and the
4288
+ ticket moves to rejected only after the branch is gone. The settlement itself
4289
+ never changes. Cleanup runs even without a configured rejected role.
4290
+ Aborted and stopped attempts keep abort cleanup's own branch deletion.
4291
+
4292
+ | Outcome | Ticket role |
4293
+ |---|---|
4294
+ | `accepted`, `merged-unmeasured` | done |
4295
+ | `no-improvement`, `declined`, `stopped`, `aborted` | rejected |
4296
+
4297
+
4298
+ Starting and progress measurements have precedence over new proposer admission.
4299
+ An open but unstarted proposer request waits while a measurement is owed or running.
4300
+ A proposer already admitted when a measurement becomes due finishes or resumes
4301
+ with its granted allowance, and its deposit is filed normally. Measurement runs
4302
+ next, before another proposer. The node workspace remains held while either a
4303
+ starting or progress measurement or a
4304
+ proposal request or session needs it; neither owner releases the other’s workspace.
4305
+
4306
+ **Proposing.** An optimization node proposes its own attempts in the
4307
+ `propose` phase (§5). The dispatcher appends
4308
+ `optimization.proposal-requested {id, head, room, budgetUsed}` when the
4309
+ selector `proposerAdmissible` holds (§15.5). Room is the smaller of the free
4310
+ concurrency slots and the remaining attempts budget, and zero once the
4311
+ attempts or hours budget is spent. An open request reserves the node's single
4312
+ outstanding proposal round, so no second request is made while it is open; it
4313
+ may be waiting for capacity, running, or awaiting filing after deposit. A
4314
+ running proposer session is identified by its matching started phase and
4315
+ session, not by an open request alone. A node that is
4316
+ paused or blocked, has pending commands, has an active or conflicted node
4317
+ restack, has a landing intent, has a merged or closed PR, or is deferred for
4318
+ runtime compatibility is not requested; the dispatcher instead records
4319
+ `optimization.proposal-deferred {reason}` (`paused`, `blocked`, `command`,
4320
+ `restack`, `integration`, `landing` or `compatibility`), and reconsiders the
4321
+ node only after a fact that can clear the blocker lands on its log. The
4322
+ request is the node's `propose` slot request, admitted ahead of normal ticket
4323
+ claims (§13.1, §12 "Slot admission order"). Before admission the dispatcher re-checks it against current
4324
+ state: a request whose node has stopped, whose active-hours budget is spent,
4325
+ whose room fell to zero or below the recorded room, or whose node has no free
4326
+ concurrency slot, and for which no session has started, records
4327
+ `optimization.proposal-withdrawn {request, reason: stopped|budget|concurrency}`.
4328
+ A withdrawal clears the request and never counts as an empty proposal. A
4329
+ session that already started keeps the room it was granted, and a deposit is
4330
+ never trimmed.
4331
+
4332
+ The dispatcher provisions a workspace at the request head and launches the
4333
+ node runner, which appends `propose.started {round, request}`, checks out the
4334
+ head detached and runs the `ab-propose` skill. `ab context` materializes
4335
+ `objective.json` (the effective objective, revision and revised fields),
4336
+ `progress.json` (starting, current, best and threshold values, attempt counts,
4337
+ attempts in flight, plateau, consecutive empty proposals and the request) and
4338
+ `ledger.json` (settled attempts with near misses flagged, and attempts in
4339
+ flight), with the spec, answered guidance and assets. `ab propose <file>`
4340
+ takes `{proposals: [{id, title, strategy, body}], reason?}`: kebab-case ids
4341
+ unique in the file and never used before by the node, single-line titles and
4342
+ strategies, spec-standard bodies with no `autobuild-objective` block, at most
4343
+ the request's room, and a reason when the list is empty (`ab propose --none
4344
+ <reason>`). It deposits an `attempts` artifact and agent
4345
+ `propose.completed {round, request, proposals, artifact}` atomically. The
4346
+ proposer never creates tickets.
4347
+
4348
+ The dispatcher reads the deposited artifact once and creates one work ticket
4349
+ per proposal, targeting the node, in the source's ready role. Each ticket
4350
+ carries every `readyLabels` entry and, when `[tickets].readyAssignee` is set,
4351
+ is assigned to that user, adopted tickets included, so intake lists it. Each creation
4352
+ carries an idempotency key derived from the repository, the node slug and the
4353
+ proposal id, so a crash between deposit, creation and recording adopts the
4354
+ existing ticket instead of filing a second one. Until the record lands,
4355
+ intake withholds ready tickets whose creation key matches a deposited
4356
+ proposal. When every ticket exists it appends
4357
+ `optimization.attempts-proposed {request, proposals, reason?}` and releases
4358
+ the node's workspace. A source without the integration-tree capability, or an
4359
+ unreadable artifact, raises an escalation on the node in phase `propose`
4360
+ instead of creating anything. Two consecutive empty `attempts-proposed`
4361
+ records stop the node: the dispatcher appends
4362
+ `optimization.stopped {cause: exhausted, mode}` with the objective's stop
4363
+ mode, and admission requests no further proposals. Recording the stop is
4364
+ separate from applying it: aborting or draining attempts in flight under that
4365
+ mode belongs to the stop policy, not to the proposer.
4366
+
4367
+ Discovery reads only build digests. Each build digest carries an
4368
+ `optimization` signal, `false` for a plain node and a bounded summary for an
4369
+ optimization node (stop, measurement, attempts in flight, concurrency,
4370
+ attempt room, empty proposals, opening time, hours budget, the active-hours
4371
+ `clock` view, the open request and its deposit, and the latest wake and
4372
+ deferral sequences), from which the dispatcher selects nodes to request, file
4373
+ or stop. Every build digest also carries `executionFacts`, the count of its
4374
+ `execution.started` and `execution.ended` facts. A service whose digest lacks
4375
+ the `clock` view skips the hours condition of a proposal request, which the
4376
+ build read then confirms; one whose digest lacks `executionFacts` fails the
4377
+ activity pass closed with the same typed capability error. A store service whose digest
4378
+ lacks the member fails the proposer stage and the creation hold closed with a
4379
+ typed capability error: nothing is proposed and every ready ticket carrying a
4380
+ creation key is withheld that pass. There is no per-node fallback read.
4381
+
4382
+ **Stopping.** An optimization node is done when its number is good enough,
4383
+ when it stops getting better, when its budget runs out, or when an operator
4384
+ takes the progress so far. Every accepted attempt improved the node head, so a
4385
+ stop at any point lands real, verified progress. The node records
4386
+ `optimization.stopped {cause, mode}` once; the first one is kept. The causes:
4387
+
4388
+ - `threshold`: the node head's value (`current`, §15.5) has reached
4389
+ `target.threshold` in the objective's direction;
4390
+ - `plateau`: `stop.plateau.attempts` consecutive `no-improvement` or `declined`
4391
+ settlements;
4392
+ - `budget`: attempts filed reached `budget.maxAttempts`, or the node's active
4393
+ hours reached `budget.maxHours`;
4394
+ - `exhausted`: recorded by the proposer when it has nothing left to try;
4395
+ - `operator`: recorded by a human through `ab objective <node> --stop` or the
4396
+ operator tool `optimization.stop`.
4397
+
4398
+ The dispatcher checks every open, unpaused optimization node on every tick,
4399
+ independent of janitor backoff and idle polling, from the reduced digest and
4400
+ the current time. It records the first eligible cause in the order threshold,
4401
+ plateau, budget, with the objective's `stop.mode`. The effective objective is
4402
+ the one checked, so a quick revision of the threshold, budget or plateau takes
4403
+ effect on the next tick with no replanning. `ab objective <node> --stop
4404
+ [--drain | --abort]` and `optimization.stop` (input `{repo, slug, mode?}`,
4405
+ receipt `{slug, cause, mode}`) record cause `operator`; without a flag the
4406
+ objective's stop mode applies, and that defaults to `abort`. Both refuse a
4407
+ build that is not a node, a node with no objective, a terminal node and a node
4408
+ that has already stopped. `--stop` does not combine with revision flags. A stop
4409
+ is final: a later revision is recorded but never resumes proposing.
4410
+
4411
+ **Active hours.** `budget.maxHours` counts the time the node's optimization
4412
+ work actually runs, never wall-clock time since opening. The clock runs while
4413
+ at least one of the node's attempts is executing, or while the node runs its
4414
+ proposer or a measurement; overlapping runs count once. Executing means an
4415
+ execution is open: from its `execution.started` to its `execution.ended`. A
4416
+ queued attempt has no build, and a runner ends its execution on every wait
4417
+ (paused, blocked on an escalation, a ticket wait, awaiting merge), so time
4418
+ spent queued, parked or paused is never charged.
4419
+
4420
+ The value is an exact union of execution intervals, kept in the node digest's
4421
+ `clock` (§15.5):
4422
+
4423
+ - The node's own `execution.started` counts when, at that moment, the node has
4424
+ an undeposited proposal, has no starting value, or has a panel head waiting
4425
+ for its progress panel. Its matching end closes the interval. Other node
4426
+ runs, such as a branch reconcile, are not counted.
4427
+ - Attempt runs reach the node in dispatcher batches,
4428
+ `optimization.activity-recorded`. Every build has an `executionIntervals`
4429
+ reduced value holding its execution facts no node has acknowledged yet, each
4430
+ numbered from 1. On every tick the dispatcher compares each relevant attempt
4431
+ build's digest `executionFacts` with the count the node's clock has
4432
+ accounted, reads the value only for a build whose count grew, and records
4433
+ the new facts. After the node's batch lands it appends the advisory
4434
+ `execution.accounted {count}` to the build, whose value then drops those
4435
+ facts. An idle tick reads and writes nothing.
4436
+ - Relevant builds are each in-flight attempt's newest build and the builds the
4437
+ clock tracks. The dispatcher's first pass over a node writes a batch with
4438
+ `starts: true`, before the node can file an attempt. From then on a build is
4439
+ tracked from its first batch, or from its attempt's `attempt.settled`, so an
4440
+ attempt that ends and settles between two ticks is still charged to its
4441
+ real end. The
4442
+ dispatcher releases a tracked build once no in-flight attempt runs on it, it
4443
+ has no open execution, and every fact is accounted.
4444
+ - Closed activity before a batch's watermark is compacted into a running
4445
+ total, so the clock stays bounded. Each build's digest is read on its own,
4446
+ so a pass can miss a fact on one build that is stamped before a fact it saw
4447
+ on another. The watermark is therefore not the batch's latest fact but the
4448
+ store time the node recorded its previous batch: that pass wrote it before
4449
+ this one read any digest, so every fact stamped before it is visible. Facts
4450
+ may follow the watermark. Compaction also never passes the start of an open
4451
+ interval, so an end that a pass missed still unions exactly with the spans
4452
+ recorded after it.
4453
+
4454
+ `optimization.stopped` records the stop time `T` and closes the node's own
4455
+ open interval there. From then on every surface evaluates active hours at
4456
+ `min(now, T)`, so the value never grows after a stop. The next dispatcher pass
4457
+ over a stopped node reads every relevant build's value once and writes a
4458
+ final batch, `settles: true`, with every unaccounted fact at or before `T`;
4459
+ an interval still open at `T` ends there. A settlement too large for one event
4460
+ is chunked: earlier chunks add their pre-stop facts, as any batch after a stop
4461
+ does, and only the last chunk settles. The clock ignores everything after
4462
+ that settlement. Until it lands, which is normally the next tick, a surface
4463
+ shows the value as `settling`: it may change once more, by attempt runs from
4464
+ before the stop the node had not yet accounted.
4465
+
4466
+ A node opened before active hours keeps a defined budget. Its log reduces once
4467
+ under the revised fold, so its own past proposer and measurement runs count.
4468
+ Its in-flight attempts' builds enter tracking when the upgraded dispatcher
4469
+ first sees them, with their whole execution history; attempts that settled
4470
+ before its clock's starting batch are not charged. A stopped node that has not completed
4471
+ gets one settlement, which adds its still in-flight attempts' runs up to its
4472
+ stop. A node that already completed reports its own runs, clipped at its stop.
4473
+
4474
+ Every stop, whatever its cause, is enforced the same way on each tick until no
4475
+ attempt is in flight:
4476
+
4477
+ - An attempt with no build, or whose build has not started work, is cancelled in
4478
+ both modes. A queued build receives a dispatcher `build.abort-requested`
4479
+ naming the stop.
4480
+ - In `abort` mode a running attempt receives a dispatcher
4481
+ `build.abort-requested`, and the ordinary abort saga acknowledges and cleans
4482
+ it up.
4483
+ - In `drain` mode a running attempt finishes and faces the landing gate, which
4484
+ settles it.
4485
+ - An attempt cancelled before it has a build settles `stopped` through the stop
4486
+ enforcer. For an aborted build, cleanup is the single settlement writer; the
4487
+ landing gate and stop enforcer never settle it.
4488
+
4489
+ The first recorded `build.abort-requested` fixes the abort's cause. A node-stop
4490
+ request records `origin {kind: optimization-stop, node}`; an operator request has
4491
+ operator origin (no node-stop origin). Abort cleanup alone settles an aborted
4492
+ build: `stopped` for a node-stop request, `aborted` for an operator request.
4493
+ An existing request is never replaced: identical repeats are idempotent and
4494
+ conflicting operator requests are refused. The stop enforcer waits for a pending
4495
+ abort, so an operator abort before a stop remains `aborted`; an operator abort
4496
+ during drain is also `aborted`. Settlement is conditional on the attempt still
4497
+ being in flight, and the existing node sweep alone moves its ticket to rejected.
4498
+
4499
+
4500
+ Dispatch refuses an attempt ticket of a stopped node, whether still in flight or
4501
+ settled `stopped`, with the diagnostic `target optimization node <id> has
4502
+ stopped; attempt <ticket> is cancelled`. Children filed any other way are still
4503
+ admitted. No proposer session is admitted once the node has stopped or any stop
4504
+ cause is eligible. A proposer session that had already started keeps its granted
4505
+ allowance and may finish or resume; its deposited proposals are filed and
4506
+ recorded, and the stopped node's attempt handling cancels and settles those
4507
+ attempts, so no fresh attempt work runs.
4508
+
4509
+ **Completion.** An optimization node is complete when it has stopped, no
4510
+ attempt is running or waiting to land, and its child enumeration satisfies the
4511
+ node completion rule above. It then follows the ordinary node grammar through
4512
+ verify, authorization and merge. Stopping is not consent: `ab merge <node>`
4513
+ refuses an optimization node that has not stopped, or whose attempts are still
4514
+ in flight, naming the reason. To land the progress so far, stop the node, then
4515
+ run `ab merge` once it is ready.
4516
+
4517
+ **Judge panels.** A panel objective is measured by agent judges, because
4518
+ absolute scores drift between sessions and crowd the top of the scale: each
4519
+ judge says which of two variants is better. `BuildRunner.runPanel` runs one
4520
+ panel over two heads, a candidate and a baseline, under one harness pin, and
4521
+ returns the candidate's win rate. The node runner calls it for a panel node's
4522
+ starting measurement and its progress, with panel ids
4523
+ `baseline-<ruler>-<pin>-r<g>` and `progress-<ruler>-<head>-r<g>`; attempt
4524
+ acceptance by win rate is a separate caller that records
4525
+ `attempt.measured.winRate`. A run records `panel.started` with its
4526
+ inputs and no order. For each pending judge it draws an order
4527
+ (`candidate-first` or `baseline-first`) and materializes a fresh judge root in
4528
+ the system temporary directory holding the two variants as plain trees `A/`
4529
+ and `B/` in that order, a brief (judge, purpose, rubric path) and the
4530
+ `ab-judge` skill as regular files. The variants are checked out from scratch
4531
+ indexes in a private bare Git directory over the workspace's objects, with
4532
+ every byte-altering attribute unset, so each tree carries the exact committed
4533
+ blobs; every harness path, the rubric included, carries the harness pin's
4534
+ bytes, and a harness file the pin lacks is absent. The skill is read from the
4535
+ harness pin's `.agents/skills/ab-judge/SKILL.md`, or from the distribution
4536
+ when the pin predates it, so a candidate cannot rewrite its judges'
4537
+ instructions. That Git material lives outside every judge root and is removed
4538
+ before any judge session starts.
4539
+
4540
+ The protected locations are the workspace, its checkout, its Git common
4541
+ directory, the main checkout owning that directory, and a local store. Before
4542
+ any material is written, the runner refuses a temporary directory at or under
4543
+ one of them, or one from which Git discovery (across filesystem boundaries)
4544
+ does not report "not a git repository"; any other discovery result fails
4545
+ closed. After materialization it refuses a root that fails the same checks or
4546
+ holds a checked-out symlink resolving outside the root, and fails the run with
4547
+ that cause, which never names the path. Symlinks that stay inside the root are
4548
+ kept. The judge's `ab` is a self-contained, judge-only bundle written to a
4549
+ launcher directory beside the roots; the run refuses launcher text naming a
4550
+ protected location or the distribution, and refuses to launch when `bun` or
4551
+ the judge runtime's executable resolves only at or under a protected location
4552
+ through the judge's filtered `PATH`. A runtime adapter that would pass a
4553
+ protected path in its own launch arguments refuses the judge's start. Every
4554
+ judge root and the launcher directory are removed when the run ends.
4555
+
4556
+ Each judge's order is recorded in the kernel fact `panel.judge-started` before
4557
+ its session starts, under the `judge` role and the build's profile, with the
4558
+ judge root as working directory; all pending judges run concurrently. The
4559
+ judge's environment and Store authority are those of §8.1. The judge
4560
+ runs `ab judge context` and ends with `ab judge prefer`, which records
4561
+ `panel.preferred {panel, judge, session, preference, reason}` without the
4562
+ order, attributed to the judge session; a local judge's outbox is committed by
4563
+ the runner after the turn with the same atomic check the service applies.
4564
+ After the turn the runner makes one reduced read and, when the session
4565
+ preferred, records `panel.judged {panel, judge, session, order, preference,
4566
+ reason}`, the durable judgment, then `panel.judge-ended` with the outcome and
4567
+ the transcript. A preference for the candidate scores 1, a tie 0.5 and the
4568
+ baseline 0; the win rate is the mean over `panel.judged`.
4569
+
4570
+ A judge launch follows the `judge` role's provider alternates under the §8.4
4571
+ eligibility rules; a credential delegation failure, an expired budget and a
4572
+ shutdown are not eligible. Each target is its own judge session in the same
4573
+ root and order, with its own `panel.judge-started` (its `substitution` naming
4574
+ the failed session), credential, stream and transcript. Each alternate's
4575
+ executable is checked like the primary's before it launches; a refused
4576
+ alternate is not started, ends the chain, and its reason is appended to the
4577
+ failed session's error. A fallback happens only after the failed session's
4578
+ preference is settled and its `panel.judge-ended` is recorded, and never after
4579
+ any preference, saved outbox or unreadable outbox for that judge; a preference that raced that
4580
+ end stops the chain and is completed like any saved preference.
4581
+
4582
+ Nothing Autobuild gives a judge reveals which variant is the candidate: not its
4583
+ context, its environment, its labels, the location or names of its variant
4584
+ worktrees, its store credential, nor any git metadata reachable from its
4585
+ working directory. Nothing under the judge's root links back to the repository
4586
+ it was prepared from, and nothing Autobuild supplies (environment, `PATH`,
4587
+ launcher content, launch arguments, working directory, scratch ancestry) names
4588
+ a protected location, whether by its real path or by a path that reaches it
4589
+ through a symlink, including a path embedded after a prefix such as `-I` or on
4590
+ one line of a multiline value; an inherited path that cannot be resolved is
4591
+ dropped too.
4592
+ This guarantee covers the channels Autobuild provides; a
4593
+ judge process deliberately searching the filesystem outside its root is the
4594
+ shared trust boundary of unconfined local agent sessions, and no general
4595
+ sandbox is claimed.
4596
+
4597
+ A run with the same panel id resumes from its recorded facts and refuses
4598
+ different inputs. A judge session started and never ended is closed as
4599
+ `reclaimed`, after any outbox preference it saved is committed while it is
4600
+ still open; its stream, if any, is closed after that commit and before the
4601
+ `reclaimed` end. A judge with a saved `panel.preferred` and no `panel.judged`
4602
+ is then completed from that preference and its session's recorded order
4603
+ without a new session. Only judges with no preference run again, each with a fresh
4604
+ order. A judge outcome of `no-terminal`, `failed` or `expired` counts as a
4605
+ failure, except a session that a later start's substitution replaced: only a
4606
+ chain's last failure counts; after two counted failures for one judge the run fails, naming the
4607
+ judge and its last outcome. `interrupted` (shutdown) and `reclaimed` do not
4608
+ count. A run that cannot prepare its variants fails with the Git output tail.
4609
+
4610
+ A failed node panel records no value and raises the kernel escalation
4611
+ `node-panel-failed-<panel>` with policy cause `measurement-failed`. The
4612
+ generation `g` in a node panel's id is the number of answered failure
4613
+ escalations for its base, derived from reduced state: a restart before the
4614
+ answer resumes the same run, and an answer starts a new run with no counted
4615
+ judge failures.
4616
+
4617
+
4618
+
3290
4619
 
3291
4620
 
3292
4621
  ## 14. Operator UI
@@ -3296,8 +4625,117 @@ events, render, send commands** — commands being events appended to the
3296
4625
  applicable build or repository log (§15.2.7). The event vocabulary *is* the
3297
4626
  UI API; forge mutation remains kernel/dispatcher plumbing. Anything a UI
3298
4627
  displays is a reduction of the logs, and anything it does is an event — so
3299
- every frontend (terminal today, web later) is the same adapter pattern
3300
- against the same store, and a dead runner still receives commands on resume.
4628
+ every frontend (the terminal dashboard and the web UIs) is the same adapter
4629
+ pattern against the same store, and a dead runner still receives commands on
4630
+ resume.
4631
+
4632
+ The standalone web UI, `ab web`, is a store-only, read-only frontend. It binds
4633
+ loopback by default and refuses a request whose `Host` is not the bound
4634
+ address, `localhost` or `127.0.0.1`; `--host` widens the bind with a warning
4635
+ that the server has no access control. Every page carries the CSP
4636
+ `default-src 'self'` with a fresh per-response style nonce, and the page loads
4637
+ only a client bundle prebuilt from `packages/ui` and committed with the
4638
+ package, so serving it adds no runtime dependency. One refresh loop, alive
4639
+ only while at least one browser is subscribed, fans each changed model out
4640
+ over one server-sent event stream. It appends nothing, takes no lease and
4641
+ registers no presence.
4642
+
4643
+ Its frame is the repository header and notice plus the overview. A fresh
4644
+ process starts the overview from the `buildRoster` rollup (§7.7) and targeted
4645
+ reads of its live builds, then advances it by the changed-builds feed. Its
4646
+ recurring reads, made only while a browser is subscribed:
4647
+
4648
+ | Occurrence | Reads | Cost |
4649
+ |---|---|---|
4650
+ | Every tick | `getRepoChangePosition` | 1 call, 0 event rows |
4651
+ | Position moved | `repositoryReadFacts` (with `getRepo`), `listBuildsChangedSince` | 3 calls; the feed returns only builds changed since the last poll |
4652
+ | Per changed build | `getBuild`, `buildReadFacts`, and while the build is visible `listStreams` and its pinned effective-config artifact | 4 calls, that build's new rows |
4653
+ | A changed build started, finished, aborted or is done | `buildRoster` | 1 call per poll |
4654
+ | New effective-config ref | `getRepoArtifact` | 1 call per ref |
4655
+ | Cold start: first read, repository reset | `buildRoster`, the per-build reads for each live build and each aborted entry among the roster's newest finished builds | O(live builds), independent of history |
4656
+
4657
+ No read grows with history, build count or tab count, and nothing is read
4658
+ while no browser is connected. The overview never lists builds, analytics
4659
+ requests read one listing page, and nothing reads events. A
4660
+ remote store that lacks the roster or the feed fails the read with its typed
4661
+ error and never falls back to either. Until the dispatcher records an
4662
+ effective configuration the frame has no `overview` and makes no build read.
4663
+ The web protocol's overview and rows carry the shared dashboard projection's
4664
+ terms: status, phase, attention, waits, step timers, finished outcomes, the
4665
+ dispatcher mode and the attention list. The terminal dashboard renders the
4666
+ same values. For `ab web` the dispatcher mode is `running`, `stopped` or
4667
+ `handoff`, never `viewer`.
4668
+
4669
+ The UI has three pages. The overview at `/` shows the dispatcher mode,
4670
+ capacity, the attention list, and the active, queued and recently finished
4671
+ build rows. The build page at `/builds/<slug>` shows one build's header,
4672
+ ticket, phase, steps and attention, then its timeline. The analytics page at
4673
+ `/analytics` shows where build time goes (RFC 0007 §7): a Gantt of builds,
4674
+ one row per build coloured by phase and wait, and a step-duration table with
4675
+ each step's mean, P50, P90 and P99 per run, or its total time. A window (24
4676
+ hours, 7 days by default, 30 days, or all retained history) and filters for
4677
+ outcome (merged by default, or all) and kind (leaf by default, node or all)
4678
+ apply to both charts. The overview and build page render the frame's shared
4679
+ projection values and update from the event stream. The page HTML carries the hub's current frame as
4680
+ a layout hint, which the page renders masked as its loading skeleton, never as
4681
+ facts. A page request reads nothing while the hub holds a frame; otherwise it
4682
+ waits for the hub's one shared read to deliver its first frame, data or a
4683
+ failure notice, bounded at 10 s. Live changes never move on-screen content:
4684
+ reserved slots take timer ticks and step changes, and any other change fades
4685
+ out, relayouts and fades back in from its first changed block.
4686
+
4687
+ Analytics and build timelines are explicit reads, never pushed or polled
4688
+ (RFC 0007 §9.3). Two read-only JSON routes serve them:
4689
+ `GET /api/analytics?window=&outcome=&kind=&page=` answers both charts for
4690
+ one query, and `GET /api/builds/<slug>/timeline` answers one build's
4691
+ `buildTimeline` value. Every frame carries the repository change position it
4692
+ was read at; the page fetches on load and on every query change, and fetches
4693
+ again only when a frame's position differs from the one its last answer was
4694
+ asked at. An unknown value answers 400, an unknown build 404, a server
4695
+ without an open store 503, and a store failure, including a remote server too
4696
+ old to filter the listing, 502 with its message; nothing falls back to an
4697
+ unfiltered listing or to events.
4698
+
4699
+ The Gantt's page is 25 builds matching the filters that the store wrote to
4700
+ during the window (`listBuildsPage` with `activeSince`), most recently active
4701
+ first. That set includes builds whose only write in the window was not an
4702
+ event, such as an artifact or a lease release. The window starts where the
4703
+ step-duration rollup's read does: UTC midnight of the first day the window
4704
+ overlaps, or the retention cutoff for all retained history. One analytics
4705
+ source per server process serializes requests and keeps settled timelines in
4706
+ memory, so its reads are:
4707
+
4708
+ | Occurrence | Reads | Cost |
4709
+ |---|---|---|
4710
+ | Every request | `getRepoChangePosition` | 1 call, 0 event rows |
4711
+ | Position moved since the last request | `listBuildsChangedSince` | 1 call; the builds it names leave the timeline cache |
4712
+ | New query, page or UTC day | the `stepDurations` rollup value, one `listBuildsPage` | 2 calls, at most 26 index entries, 0 event rows |
4713
+ | Per listed build not in memory | its saved `buildTimeline` value | at most 25 per page, that build's new rows only |
4714
+ | Timeline request, build not in memory | `getBuild`, its saved `buildTimeline` value | 2 calls |
4715
+
4716
+ A repeated request on the same UTC day while nothing changed costs one
4717
+ `getRepoChangePosition`.
4718
+
4719
+ `ab dispatch --web` serves the same server from the dispatcher process, in
4720
+ push mode: the hub owns no refresh loop. Its frames carry the repository
4721
+ header, notice and change position, not the overview. Frames from the
4722
+ dashboard frontend carry the position its refresh already sampled and add no
4723
+ store reads. A kernel-only dispatcher's journal refresh samples none, so
4724
+ while a browser is connected each of its frames reads one
4725
+ `getRepoChangePosition`, and nothing while none is. Analytics and timeline
4726
+ requests are explicit reads once its store is open, and answer 503 before. It shows the
4727
+ repository facts that a refresh the dispatcher already makes has read: the
4728
+ frontend's refresh loop under a TTY, the kernel's repository-view journal
4729
+ refreshes in plain mode (so frames update at the dispatcher's tick cadence),
4730
+ and the viewer loop for `--viewer`. A TTY keeps the terminal dashboard;
4731
+ under `--plain` or without a TTY the web UI is the only presentation. The
4732
+ server binds before the repository lease, so a taken port fails dispatch
4733
+ before it claims anything. For `--web` without a fixed port, the launcher
4734
+ reserves a free port once and pins `--port` into every generation's argv. A
4735
+ generation closes its server before it appends `dispatcher.terminal-released`,
4736
+ and its successor, which already holds the lease, rebinds the same port, so
4737
+ the URL survives automatic runtime upgrades. Only a first generation announces
4738
+ the URL, so it is printed once.
3301
4739
 
3302
4740
  Within the immutable generation, interactive `ab dispatch` owns the terminal in a frontend process and supervises
3303
4741
  one private child containing the dispatcher, build runners, Harvest, config and
@@ -3322,9 +4760,11 @@ sampling. Repository polling advances from the last observed sequence rather
3322
4760
  than replaying the growing journal on every frame. SIGINT, SIGHUP, SIGQUIT, and
3323
4761
  SIGTERM restore terminal modes immediately and ask the child to stop; repeated
3324
4762
  signals remain graceful while a dispatcher tick is crossing the ticket-claim
3325
- boundary. The frontend reaps the child before finishing, and for SIGHUP,
3326
- SIGQUIT, or SIGTERM only then restores the default disposition by re-signalling
3327
- itself. A child also stops when its terminal-owning parent dies. A timed-out
4763
+ boundary. The frontend reaps the child before finishing, and for SIGHUP or
4764
+ SIGTERM it only then restores the default disposition by re-signalling itself.
4765
+ A drained SIGQUIT stop instead exits with status 131 (128 + 3), because
4766
+ SIGQUIT's default action dumps core. A launcher-supervised generation reports
4767
+ that stop through its stopped exit and leaves the 131 to the launcher. A child also stops when its terminal-owning parent dies. A timed-out
3328
4768
  child is terminated unless such a tick is open, in which case that tick first
3329
4769
  reaches a recoverable durable boundary. The run-stopped fact and frontend result
3330
4770
  distinguish a graceful drain, an actual forced termination requested by the
@@ -3349,12 +4789,16 @@ reporting even when no frame painted, with synchronous process restoration for
3349
4789
  catchable faults. Plain, non-TTY, and once runs never enable focus reporting.
3350
4790
 
3351
4791
  Interactive frames first read `BuildStore.getRepoChangePosition(repo)`, a canonical
3352
- unsigned decimal string used only for invalidation. Unknown repositories return
4792
+ unsigned decimal string. Unknown repositories return
3353
4793
  `"0"` without creating state. Each repository's durable position advances in the
3354
4794
  same transaction as build creation, build/repository event insertion (including
3355
4795
  artifact-backed and tick writes), or a stored dispatcher lease holder transition.
3356
4796
  Other repositories, failed writes, denied claims, same-holder renewals, heartbeats,
3357
4797
  and passive expiry do not advance it. It is separate from journal sequence cursors.
4798
+ Positions are ordered: a later advancing write yields a strictly greater value,
4799
+ compared numerically. Build creation and every build event also record the new
4800
+ position as that build's latest change position, in the same transaction, which
4801
+ the changed-builds feed (§7.2) reads.
3358
4802
  Unchanged positions reuse the complete presentation snapshot; an ordinary refresh, focused or unfocused,
3359
4803
  then makes exactly one store request. Discovery uses required exact-repo
3360
4804
  `listBuildsForRepo(repo)`, never a global listing. Initial hydration, position or
@@ -3366,14 +4810,23 @@ independently; kernel ticks and watch/wait retain their existing reads.
3366
4810
  SQLite installs an additive counter table and transactional triggers on open.
3367
4811
  PostgreSQL installs the corresponding additive table/functions/triggers through
3368
4812
  explicit migration before deploying the new service; the core schema version
3369
- and checksum stay unchanged. Existing data starts at zero, with no replay or
3370
- backfill, and migration reruns preserve counters. Hosted reads use one GET
3371
- `/repos/:repo/change-position` returning only `{ position: string }`, and
3372
- `/repos/:repo/builds` returns scoped build records. Both routes authorize the
3373
- repository before reading and support repositories with builds but no journal.
3374
-
3375
- Durable operator settings (intake, repository pause, harvest gate) survive
3376
- restarts through the repository journal. Per-merge hold and merge commands
4813
+ and checksum stay unchanged. Existing counters start at zero, with no replay,
4814
+ and migration reruns preserve counters. The per-build positions live in a
4815
+ separate additive table. When it is first created, in the same transaction,
4816
+ each repository with builds advances by one and every existing build is
4817
+ recorded at that new head, so the feed reports pre-existing builds once and
4818
+ never misses one. The paged listing's per-build facts live in another
4819
+ additive, trigger-maintained table, backfilled once from each build's latest
4820
+ relevant events when it is first created. Later opens and migrations cost one
4821
+ catalog lookup. Hosted reads use one GET `/repos/:repo/change-position`
4822
+ returning only `{ position: string }`; `/repos/:repo/builds` returns scoped
4823
+ build records; `/repos/:repo/changed-builds?since=` and
4824
+ `/repos/:repo/build-page?limit=&cursor=&kind=&outcome=&activeSince=` serve the
4825
+ feed and the paged listing. All four routes authorize the repository
4826
+ before reading and support repositories with builds but no journal.
4827
+
4828
+ Durable operator settings (intake, repository pause, harvest gate) and pending
4829
+ single-ticket start requests survive restarts through the repository journal. Per-merge hold and merge commands
3377
4830
  live in the build log. Merge policy is declarative dispatcher configuration
3378
4831
  (§15.7); there is no writable repository auto-merge default.
3379
4832
 
@@ -3384,15 +4837,54 @@ build workspace and exposed to operator agents only through those tools. The
3384
4837
  typed tools are the only route to state from inside it — the environment
3385
4838
  receives no store, forge, ticket-provider, or model credential, and
3386
4839
  `[orchestrator].sandbox.environmentVariables` may never name one. Its lifecycle
3387
- is repository-journal fact: provisioned/resumed/activity/stopped/released facts
3388
- bracket one deterministic environment per session owner × repository, the
3389
- dispatcher tick's idle settlement stops an environment whose evidence is
3390
- stale (settling an orphan exactly as harvest executions are settled), and
3391
- `ab repository status` reports each session owner's sandbox. A session owner's work
4840
+ is repository-journal fact: provisioning/provisioned/resumed/provision-failed/
4841
+ activity/refreshed/stopped/closed/released facts bracket one deterministic
4842
+ environment per session owner × repository, the dispatcher tick's idle
4843
+ settlement stops an environment whose evidence is stale (settling an orphan
4844
+ exactly as harvest executions are settled), and `ab repository status` reports
4845
+ each session owner's sandbox. `sandbox.open` returns at once and starts
4846
+ provisioning or resuming in the background of the serving process, journaling
4847
+ `provisioning` and then the attempt's outcome; every other tool refuses typed
4848
+ `sandbox-not-ready`, naming the state, until the environment is live, and
4849
+ never provisions. `sandbox.status` is a bounded poll: one reduced repository
4850
+ read plus one provider probe. Its only write records a finished background
4851
+ attempt's outcome the journal still lacks, exactly once across processes,
4852
+ through the repository compare-and-append; a `provisioning` journal whose
4853
+ provider reports no environment, with no attempt in the serving process, is
4854
+ failed once its grace period passes. Failure evidence in the provider is
4855
+ destroyed only after the journal records the failure: `sandbox.open` probes
4856
+ first and records a reported failure before the provider may replace the
4857
+ environment, refusing with nothing discarded when it cannot.
4858
+
4859
+ On `vercel-sandbox` the provisioning state lives in the guest, so any
4860
+ process can read it with one probe. `sandbox.open` returns after a lookup, at
4861
+ most one probe and one update. The short host-driven phase (create, checkout,
4862
+ credential scrub, Bun, system provisioning, distribution) runs in the serving
4863
+ process's background seam (`waitUntil`, Next's `after()` on a hosted
4864
+ deployment); the slow tail (dependency install, runtimes, setup, marker) runs
4865
+ as one detached guest command, bounded by the session timer rather than the
4866
+ function limit. The sandbox is created and resumed with a provider timeout of
4867
+ `[orchestrator.sandbox].idleMinutes`, and every tool call extends it, so the
4868
+ provider's own timer stops an idle sandbox with no dispatcher tick; the
4869
+ dispatcher's idle settlement remains a second stop. A timer-stopped sandbox
4870
+ refuses tools as `stopped` until `sandbox.open` resumes it with its committed
4871
+ and uncommitted state intact; `sandbox.status` never resumes one. A failed
4872
+ environment is kept, stopped by its timer or by `sandbox.close`, until the
4873
+ next `sandbox.open` records the failure and replaces it, or until
4874
+ `sandbox.reset` or release.
4875
+
4876
+ `sandbox.close` stops
4877
+ the environment and keeps its checkout (`closed`); `sandbox.refresh`
4878
+ fast-forwards a clean checkout to the current base head (`refreshed`, which
4879
+ moves the publication base) and refuses a dirty or diverged one unchanged. A session owner's work
3392
4880
  leaves the sandbox only through `sandbox.publish`, which takes the checkout's
3393
4881
  head (or an explicit commit) to a deterministic operator branch and a pull
3394
4882
  request against the base branch and records published/publish-failed journal
3395
- facts.
4883
+ facts. On a hosted deployment only the `vercel-sandbox` provider can host the
4884
+ environment, so a project with any other workspace provider gets it from the
4885
+ deployment's Vercel Sandbox provider, cloned in the guest with the deployment's
4886
+ forge token placed only in the host-side upload-pack egress transform; without
4887
+ those deployment credentials the tools refuse `sandbox-credentials-missing`.
3396
4888
 
3397
4889
  Successful dispatcher ticks with no effects, counters, diagnostics, queue change,
3398
4890
  sampled triage-count change, or attention transition append no tick boundary
@@ -3555,9 +5047,10 @@ rejection is `EventValidationError`.
3555
5047
  `Autobuild-Build: <slug>` identifies the build's change across such rewrites
3556
5048
  (RFC 0001 §5). Branch presence is determined by exact parsed trailer values
3557
5049
  in reachable history, not recorded SHA ancestry. Kernel-owned single-change
3558
- replay, durable rewrite facts and immutable forge archive refs preserve
3559
- historical SHAs (§15.7); the original no-rebase rationale does not prohibit
3560
- this archived replay standard.
5050
+ replay, durable rewrite facts and best-effort retained history (immutable
5051
+ forge archive refs, else BuildStore copies) preserve historical SHAs
5052
+ (§15.7); the original no-rebase rationale does not prohibit this retained
5053
+ replay standard.
3561
5054
  5. **Append-only; corrections are new events.**
3562
5055
  6. **Liveness is not history.** Heartbeats and runner leases are mutable
3563
5056
  columns on the `builds` table, never events — they would drown the log.
@@ -3584,22 +5077,25 @@ with illustrative members:
3584
5077
 
3585
5078
  | Family | Examples |
3586
5079
  |---|---|
3587
- | 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` |
3588
- | 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) |
5080
+ | 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` |
5081
+ | 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) |
3589
5082
  | 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}` |
3590
- | 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) |
5083
+ | 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) |
3591
5084
  | 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) |
3592
- | Plan/code loops | `plan.started` … `plan-review.verdict`; `implement.started` … `code-review.verdict` |
5085
+ | 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) |
3593
5086
  | 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?}` |
3594
5087
  | Integration attention | Kernel/dispatcher `integration.verification-failed {id, head, parent, steps, guidance}`: one durable failed-cycle notification, recovered from exact verification receipts |
3595
5088
  | 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) |
3596
5089
  | PR attachments | `pr-attachment.designated`, `pr-attachment.hosted`, `pr-attachment.reclaimed`, `pr-attachment.reclaim-failed` |
3597
- | 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}` |
5090
+ | Leaf restacking | `target.moved {branch, sha, lineage?}`, `target.rewritten {branch, previousSha, sha}`, `target.rewrite-cleared {branch, sha, lineage?}`, kernel `target.rewrite-reprovision-prepared {branch, previousSha, base, from, sha}` and `target.rewrite-recovered {branch, previousSha, sha, base, recovery: reprovisioned \| accepted, escalation?, pendingLocal?}`, advisory `target.distance {branch, sha, head, count}`, `restack.prepared`, `restack.replayed`, `restack.publish-intended`, `restack.rewritten`, `restack.contended`, `restack.completed` (trigger `verify-entry`, `wait-resume` or `awaiting-landing`), `restack.advanced {trigger: wait-resume, cycle, observation, branch, from, to}`, kernel `restack.regenerated {id, files, commands, outcome, head?, reason?}`, kernel or dispatcher decisive `history.retained {operation: restack \| reconcile, id, base, store, target, unretained}` (leaf restacks and reconciles, §15.7) |
3598
5091
  | Head path facts | advisory `head.paths-recorded {source, head, destination, mergeBase, total, preview, resolution?, artifact}` |
3599
- | 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") |
5092
+ | 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) |
5093
+ | 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") |
3600
5094
  | Cross-cutting | `observation.recorded`, `escalation.raised`, `phase.failed`, `session.build-read-failed`, `session.build-read-recovered`, `phase.deferred`, `phase.deferral-escalated` |
3601
5095
  | 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 |
3602
- | 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`; configured hook health `hook.failing`, `hook.recovered` and `hook.skipped` (advisory attention, §16.1) |
5096
+ | 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}}` (`hours` is active 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}`; dispatcher `optimization.activity-recorded {facts: [{build, n, instance, kind: started \| ended, at}], accounted, released?, watermark, starts?, settles?}`, at most 200 facts sorted by `at`, with `watermark` the bound through which the clock compacts, which records attempt execution facts into the active-hours clock; dispatcher `execution.accounted {count}`, advisory, acknowledging that a node accounted a build's first `count` execution facts. `execution.accounted`, `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` and `execution.accounted`. A measurement failure is a kernel or dispatcher `escalation.raised {phase: measurement, source: policy, policyCause: measurement-failed}`. |
5097
+ | 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. |
5098
+ | 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) |
3603
5099
 
3604
5100
  Abort cleanup is a dispatcher-owned ordered saga. While an execution lease is
3605
5101
  live, the janitor defers the saga so it cannot race process-tree teardown. Once
@@ -3616,7 +5112,11 @@ idempotent and the three `abort.*` facts checkpoint projections across crashes;
3616
5112
  `abort.ticket-returned` records the destination, the requested role, the reason
3617
5113
  and the missing parts, so a retry reports exactly what the committed move did
3618
5114
  and never writes the ticket again. Missing Forge capabilities or outages leave
3619
- the remainder due on the next tick.
5115
+ the remainder due on the next tick. An optimization attempt is the exception:
5116
+ its cleanup settles it `aborted` on the node's log and skips the label, the
5117
+ move, the `abort.ticket-returned` checkpoint and the hand-back report, because
5118
+ its node's sweep moves the ticket to the rejected role (§13.1.1). A closed
5119
+ attempt PR likewise records no `build.ticket-returned`.
3620
5120
 
3621
5121
  Every dispatcher hand-back of a claimed or ready ticket other than completion —
3622
5122
  abort, spec-standard bounce, preparation recovery returning a confirmed claim,
@@ -3675,6 +5175,18 @@ complete receipt, retained across crashed implement reruns and guidance rounds.
3675
5175
  Both new event types are decisive under version-tolerant reads, fencing older
3676
5176
  engines while their known event payloads remain valid after projection.
3677
5177
 
5178
+ **Reopen.** The reduced `reopen {seq, ts, user, via?, feedback?, spec?,
5179
+ specPublishedSeq?}` holds the latest `build.reopened` (§15.7); `spec` mirrors the
5180
+ event, keeping `assets` only when the reopen re-pinned them, and
5181
+ `specPublishedSeq` is the seq of the operator `spec.revised` that published that
5182
+ artifact. The reopen is a verify cycle boundary and clears the code loop's human
5183
+ round cap (with a spec, the plan's too); it changes `pinnedAssets` only through
5184
+ that publication. The log index exposes `codeRestartSeq`, the later of the spec
5185
+ restart and the latest reopen, as the code half's boundary. The reopen governs
5186
+ the current spec while it is feedback-only and later than the spec restart, or
5187
+ while its publication is that restart. Until the leaf settles again after it,
5188
+ the leaf asks for a `reopen` slot and landing readiness declines it.
5189
+
3678
5190
 
3679
5191
  **Mixed-version reads.** Within the supported client window, readers that
3680
5192
  implement this contract preserve raw unknown facts and skip them in functional
@@ -3706,7 +5218,9 @@ writer and reader share a release string. Upgrading clears deferral through
3706
5218
  local replay without answering an escalation. Repository unknown counts do
3707
5219
  not invent per-build blockers.
3708
5220
 
3709
- Event-derived caches require both the exact reducer version and a deterministic
5221
+ Reducer versions are derived from a frozen base, append-only revisions, and the
5222
+ versions of a reducer's constituents, so independent revisions sum and versions
5223
+ only increase. Event-derived caches require both the exact reducer version and a deterministic
3710
5224
  read-catalog identity, including build/repository type classifications and a
3711
5225
  read-decoder revision. Named and generic checkpoints use catalog-specific keys;
3712
5226
  legacy/foreign-catalog snapshots are misses and are preserved. Unrecognized
@@ -3734,8 +5248,8 @@ records the header identity sent by each published client. Remote clients never
3734
5248
  reconstruct named answers from event logs. Catalog identity travels in response
3735
5249
  header `x-autobuild-catalog-identity`; strict JSON bodies remain exactly
3736
5250
  `{version, cursor, value}`. Missing/malformed headers do not reject an answer.
3737
- Repository digest batches are also canonical, with no client discovery or
3738
- per-build fallback.
5251
+ Repository digest batches and open-build listings are also canonical, with no
5252
+ client discovery or per-build fallback.
3739
5253
  A service omits identity for a backend without one. This guarantee excludes
3740
5254
  readers predating this contract and does not widen the supported client window.
3741
5255
 
@@ -3754,9 +5268,12 @@ identity without a fabricated finalize completion. All four facts are
3754
5268
  dispatcher-authored. Existing merged/closed PR, abort and completion facts close admission.
3755
5269
 
3756
5270
  Node transaction state reduces `node.writer-reserved`, `node.item-prepared`,
3757
- `node.item-conflicted`, `node.item-replayed`, `node.publish-intended`,
5271
+ `node.item-conflicted`, `node.item-regenerated`, `node.item-replayed`, `node.publish-intended`,
3758
5272
  `node.rewritten`, `node.writer-settled`, and `node.inventory` (§13.1 integration
3759
- restacking). Durable `node.restack-requested` facts retain operator/presence demand,
5273
+ restacking). The decisive kernel or dispatcher `node.history-retained {operation:
5274
+ restack | landing | integration-landing | verify, id, base, store, target,
5275
+ unretained}` records node write history kept outside forge archive refs (§15.7).
5276
+ Durable `node.restack-requested` facts retain operator/presence demand,
3760
5277
  including destination, sampled parent, dependent ticket and required identities.
3761
5278
  Reservations freeze covered request ids; confirmed settlement acknowledges only
3762
5279
  that coverage, and `node.restack-satisfied` records coverage or destination change.
@@ -3783,6 +5300,186 @@ does. CLI status exposes pending/active work, reachable build identities and
3783
5300
  node-owned foreign changes. A node stays `collecting` while its narrow reconcile
3784
5301
  runner is attached; it does not acquire a leaf pipeline.
3785
5302
 
5303
+ **Declined attempts.** `implement.declined` completes the implement phase
5304
+ and sets `declined {round, reason, seq}`. The engine decides
5305
+ `wait/declined` immediately after its aborted and done checks, ahead of
5306
+ pending operator commands, so nothing past implement is ever decided. The
5307
+ dispatcher's settlement completes the build, and `done` then wins.
5308
+
5309
+ **Optimization digest.** Build state embeds `optimization`, a bounded digest of
5310
+ an optimization node's own log, absent until the first
5311
+ `optimization.objective-accepted` (§13.1.1). It holds:
5312
+
5313
+ - the latest acceptance with its time; `openedAt`, the first acceptance's
5314
+ time; `clock`, the active-hours clock (§13.1.1 "Active hours"): `activeMs`,
5315
+ the union of activity before its `watermark`; `recordedAt`, when the node
5316
+ recorded its latest batch; `spans`, the closed active spans since, sorted
5317
+ and disjoint; `open`, the running executions, the node's
5318
+ own under `''` and each attempt's under its build slug; `builds`, the tracked
5319
+ attempt builds with the execution facts accounted of each; and, once
5320
+ stopped, `stoppedAt` and `settled`; the effective `objective`, which is the
5321
+ latest accepted objective with every later quick revision applied in order;
5322
+ `revision`; `revisedFields`, the fields quick-revised since the latest
5323
+ acceptance; and `rulerRevision`;
5324
+ - `starting {value, spread, head}` from `optimization.baseline-measured` under
5325
+ the current ruler. A panel's starting value is 0.5 by definition and its
5326
+ spread comes from the baseline fact;
5327
+ - `current`: for a command, the candidate value of the latest `accepted`
5328
+ settlement under the current ruler, else the starting value; for a panel, the
5329
+ latest `optimization.progress-measured` win rate under the current ruler and
5330
+ against the current starting head,
5331
+ else 0.5. `best` is the best value in the objective's direction under the
5332
+ current ruler;
5333
+ - `progressQueue`, a panel node's landed heads (`attempt.settled.head` of
5334
+ `accepted` settlements) without a `progress-measured` under the current
5335
+ ruler, oldest first, absent when empty. A new ruler clears it. It is
5336
+ bounded: the landing gate holds the node's next child while it is non-empty,
5337
+ so it holds at most one head under kernel control;
5338
+ - `attempts {filed, accepted, rejected, unmeasured}`, where `filed` counts
5339
+ proposed tickets, `rejected` counts `no-improvement`, `declined`, `stopped`
5340
+ and `aborted` settlements, and `unmeasured` counts `merged-unmeasured` ones;
5341
+ `inFlight`, the proposed attempts not yet settled as `{proposal, ticket,
5342
+ unmeasuredMerge?}`, whose length is the running count, with
5343
+ `unmeasuredMerge {build, sha?, reason, measuredCandidate?, at}` folded from
5344
+ `attempt.merged-unmeasured`; `plateau`, the
5345
+ consecutive `no-improvement` or `declined` settlements since the last
5346
+ `accepted` (`stopped` and `aborted` leave it unchanged); `emptyProposals`,
5347
+ consecutive proposals with no attempts; `rejections`, the settled attempts
5348
+ other than `accepted` and `merged-unmeasured` whose ticket has not moved to
5349
+ the rejected role, as `{proposal, ticket, build?, outcome, branch?,
5350
+ branchCleanupError?}`, added only for an attempt that was in flight and
5351
+ removed by `attempt.ticket-rejected` (`branch` is the settlement's cleanup
5352
+ obligation, cleared by `attempt.branch-deleted`, and `branchCleanupError` the
5353
+ latest `attempt.branch-cleanup-failed`); `stopped {cause, mode, at}` from the
5354
+ first `optimization.stopped`; and `stoppedTickets`, the tickets of
5355
+ attempts settled `stopped`, which the dispatch claim gate refuses. Only
5356
+ attempts in flight at the stop settle `stopped`, so it is bounded by the
5357
+ concurrency.
5358
+ - `requests`, the count of `optimization.proposal-requested` facts and the
5359
+ `propose` phase's round counter, and `proposal {id, head, room, requestedAt,
5360
+ round, deposited?: {artifact, ids, at}}`, the open request. A request opens
5361
+ it, `propose.completed` for that request sets `deposited`, and the matching
5362
+ `optimization.attempts-proposed` closes it; `optimization.proposal-withdrawn`
5363
+ closes it only while it is undeposited. At most one request is open.
5364
+
5365
+ Pure selectors over the digest take the current time. Active hours at `now`
5366
+ are `activeMs` plus the length of the union of `spans` and the open intervals,
5367
+ each running to `now`, everything clipped at `stoppedAt`. Stop eligibility is computed per cause: threshold when `current` has
5368
+ reached `target.threshold` in the objective's direction (a panel compares its
5369
+ recorded progress, the head's win rate against the starting head, which it
5370
+ maximizes); plateau when `plateau` ≥ `stop.plateau.attempts`;
5371
+ budget when `filed` ≥ `maxAttempts` or active hours ≥ `maxHours`. Admission
5372
+ reports whether the node stopped, the attempts the budget still allows (none
5373
+ without `maxAttempts`), and the concurrency slots held neither by an in-flight
5374
+ attempt nor by a pending rejection. A tracker that keeps refusing the move
5375
+ therefore stalls proposals rather than accumulating pending rejections, and
5376
+ `inFlight` plus `rejections` never exceeds the concurrency through new
5377
+ proposals.
5378
+ The stop cause is the first eligible of threshold, plateau and budget, and none
5379
+ once stopped. A proposer is admissible only when the node has not stopped, no
5380
+ cause is eligible, the budget allows another attempt and a slot is free. An
5381
+ optimization node's completion blocker is `not stopped`, or the attempts still
5382
+ in flight; node completeness requires it to be clear.
5383
+ Attempt identity (§13.1.1) is a lookup in `inFlight` by normalized ticket ref;
5384
+ settled attempts are in the ledger.
5385
+
5386
+ **Attempt measurement.** A leaf's build state embeds `attemptMeasurement`,
5387
+ bounded to the latest `attempt.measurement-requested` (`request`), the latest
5388
+ `attempt.sampled` (`sampled`), the latest `attempt.measured` (`measured
5389
+ {request}`), `refused`, the request whose samples a `measurement-failed`
5390
+ raise refused after sampling, and `observedHead`, the sha of the latest
5391
+ `target.moved` after the latest request (a new request clears it). Pure
5392
+ selectors read it alone: `pendingMeasurementRequest` is the latest request
5393
+ that is neither sampled nor measured on a nonterminal leaf and whose baseline
5394
+ is still `observedHead` when one is recorded, the runner's work; `sampledMeasurement` is the
5395
+ latest request's samples when neither measured nor refused, the dispatcher's
5396
+ work. `baselineMeasurementDue` reads the node digest: opened, no `starting`,
5397
+ not stopped, not terminal, paused or blocked, and no pending command.
5398
+ `progressMeasurementDue` is the first `progressQueue` head of an opened panel
5399
+ node with a `starting` value, under the same conditions except that a stop
5400
+ does not withhold it. `nodeMeasurementDue` is either; slot requests, capacity,
5401
+ cascade admission, workspace release and the runner read it. Engine, capacity
5402
+ and the dispatcher's decision read only these reduced values, so an idle tick reads no event rows; deciding one sampled
5403
+ request costs one reduced read of its node, once.
5404
+ The proposer selectors also read the digest. `proposerRoom` is the smaller of
5405
+ the free concurrency slots and the attempts the budget still allows, and 0
5406
+ once the attempts or hours budget is spent. `proposerAdmissible` holds for an
5407
+ opened, nonterminal optimization node that has not stopped, has a starting
5408
+ measurement, has no open request, has fewer than two consecutive empty
5409
+ proposals and has positive room, and that no non-optimization blocker holds
5410
+ (paused, blocked, pending commands, compatibility deferral, active or
5411
+ conflicted node restack, landing intent, merged or closed PR).
5412
+ `proposalEligible` re-checks an open request against current state: not
5413
+ stopped, active-hours budget not spent, attempt room and a free concurrency slot
5414
+ remaining, and the request's room no larger than the current room.
5415
+ `proposalWithdrawalDue` names the reason (`stopped`, `budget` or
5416
+ `concurrency`) an undeposited request fails it. `exhaustedStopDue` holds when
5417
+ `emptyProposals` ≥ 2 and the node has not stopped.
5418
+
5419
+ **Judge panel.** A build that runs a judge panel embeds `panel`, bounded to its
5420
+ latest run: the `panel.started` payload and, per judge, every started session
5421
+ with its order, runtime, optional stream and substitution link, every ending
5422
+ outcome, the first `panel.preferred` and the
5423
+ `panel.judged`. Events for any other panel id are ignored, so the value is
5424
+ bounded by 20 judges. Pure selectors over it give the pending judges (no
5425
+ preference), the sessions awaiting reclaim, the saved preferences to complete
5426
+ and each judge's counted failures (excluding sessions named by a later
5427
+ start's substitution). Dashboard facts retain judge session attribution and
5428
+ evidence without the blinded order, and expose it through session rows. The `buildDelegation` service value
5429
+ (version 2) folds `panel.judge-started` and `panel.judge-ended` into its
5430
+ session lifecycle beside `session.started` and `session.ended`, and records
5431
+ which judge sessions preferred, so a judge preference write is decided with
5432
+ one reduced read per conditional-append attempt, at the same cost at any log
5433
+ length.
5434
+
5435
+ **Deltas, revisions and the ruler.** A positive `delta` is an improvement in
5436
+ the objective's direction: `baseline − candidate` when minimizing,
5437
+ `candidate − baseline` when maximizing, and `winRate − 0.5` for a panel.
5438
+ `revision` is one monotonic objective revision across
5439
+ `optimization.objective-accepted` and `optimization.objective-revised`: the
5440
+ first acceptance is 1 and each later accepted or revised fact increments it.
5441
+ Measurement facts carry the revision they ran under. The first acceptance
5442
+ starts a ruler, and so does any later acceptance whose `metric` differs from the
5443
+ previous accepted objective, or whose `purpose` differs when the metric is a
5444
+ panel. Quick revisions never change the ruler. A measurement or settlement
5445
+ whose revision is below `rulerRevision` is history: it stays in the log and the
5446
+ ledger but never feeds `starting`, `current` or `best`.
5447
+
5448
+ **Attempt ledger.** A separate registered build-scoped value folds the node's
5449
+ log into one entry per `attempt.settled`: `{seq, proposal, ticket, build?,
5450
+ title, strategy, outcome, mergedSha?, policy?, delta?, baseline?, candidate?,
5451
+ note?, nearMiss?}`; a `merged-unmeasured` entry carries no measurement.
5452
+ `optimization.attempts-proposed` supplies the pending title and strategy by
5453
+ proposal, dropped once the attempt settles, and the objective facts supply the
5454
+ ε in effect. A near miss is a `no-improvement` settlement with
5455
+ 0 < `delta` < ε; a relative ε is ε × |baseline|.
5456
+
5457
+ **Landing measurement.** Build state embeds `landingMeasurement` for a child
5458
+ of an optimization node, absent until its first request: the latest
5459
+ `attempt.measurement-requested`, the `attempt.measured` answering it (a result
5460
+ for an older request is history), and `overtakes`, the requests whose baseline
5461
+ differed from the previous request's.
5462
+
5463
+ **Pending rejections in the build digest.** The repository build digest folds
5464
+ `attempt.settled` and `attempt.ticket-rejected` into `rejectionsPending`, set
5465
+ while a node has a pending rejection (`accepted` and `merged-unmeasured`
5466
+ settlements add none). Like a pending attachment reclaim, it is a
5467
+ post-terminal duty: a completed node with pending rejections stays in the
5468
+ janitor's work set until the moves commit, and a settlement recorded on an
5469
+ already completed node re-arms it through the node's incrementally advanced
5470
+ digest, with no repository scan.
5471
+
5472
+ **Optimization read cost.** The digest's size does not grow with settled
5473
+ attempts: admission caps `inFlight` plus `rejections` at the objective's concurrency, and
5474
+ settled attempts leave only counters. The dispatcher, the dashboards, status
5475
+ and watch read it from the build state they already reduce, so the stop and
5476
+ admission inputs and the objective row cost the same at 10 and 10,000
5477
+ attempts and read zero event rows while nothing changes. The ledger grows with settled attempts, which `maxAttempts` bounds,
5478
+ and is read only on an explicit history request; it advances from new node rows
5479
+ only. Neither value ever reads an attempt's log, because `attempt.settled`
5480
+ carries the measured delta. The read-budget harness in
5481
+ `packages/core/src/testing/` proves both bounds.
5482
+
3786
5483
  `status ∈ queued | running | collecting | paused | blocked | done | aborted`, plus
3787
5484
  `{phase, round, openEscalations[], reviewRoundCeilings?, pr?, autoMerge,
3788
5485
  lastEvent}`. `blocked` ≡ an open escalation: an `escalation.raised` (or the
@@ -3824,6 +5521,55 @@ append-only log. Separate reducers
3824
5521
  derive dispatcher settings and harvest state from the repository journal; each
3825
5522
  ignores the other's facts.
3826
5523
 
5524
+ #### Build timeline: segments and steps
5525
+
5526
+ `buildTimeline` is a registered build-scope value: the build's **segments** of
5527
+ phase and wait time, for Gantt rows and the `stepDurations` rollup (§7.7).
5528
+ Phase segments pair the same start and terminal events the dashboard's phase
5529
+ intervals pair.
5530
+
5531
+ | Category | Opens | Closes |
5532
+ |---|---|---|
5533
+ | `plan`, `plan-review`, `implement`, `code-review` | `*.started` | `plan.completed`, `*.verdict`, `implement.completed` |
5534
+ | `verify:<step>` | `verify.started` | `verify.completed`, `verify.cancelled` |
5535
+ | `finalize`, `reconcile` | `*.started` | `*.completed` |
5536
+ | `queued` | `build.created` | first `execution.started`; never reopens |
5537
+ | `escalated` | first `escalation.raised` while none is open | the `escalation.answered` that leaves no raised escalation unanswered |
5538
+ | `paused` | `build.paused` | `build.resumed` |
5539
+ | `ticket-wait` | `wait.entered` | `wait.ended`, or `escalation.answered` for the wait's escalation |
5540
+ | `awaiting-merge` | `pr.opened` or `finalize.completed`, whichever first | `pr.merged`, `pr.closed`, `build.completed`, `build.aborted` |
5541
+
5542
+ - A phase start while that category is open replaces the open start; the
5543
+ replaced attempt leaves no segment. A wait opening while its category is open
5544
+ is ignored, so waits never lose time.
5545
+ - Each segment carries `category`, `start`, `end` (absent while open),
5546
+ `durationMs`, the `opened` and `closed` events (`{type, seq}`), `round` or
5547
+ `attempt` from the opening payload, `state` (`open`, `closed` or
5548
+ `abandoned`) and, when merged, `merged`.
5549
+ - At `build.completed` or `build.aborted`, every other open segment closes as
5550
+ `abandoned` at the terminal event: the row stops growing, and abandoned
5551
+ segments contribute nothing to step durations.
5552
+ - The value also carries the build's `kind` (`work` or `node`), its `outcome`
5553
+ (the latest `build.completed` outcome, cleared by `build.reopened`) and
5554
+ `createdAt`. Segments are ordered by opening seq.
5555
+ - **Cap.** At most 200 closed segments. Past it, the earliest segment that has
5556
+ a later segment of the same category and state absorbs that segment: it keeps
5557
+ its own start, takes the later end and close, adds the durations and counts
5558
+ the merged occurrences. The list is bounded by max(200, distinct
5559
+ category-state pairs), so a retry loop cannot grow it without limit.
5560
+
5561
+ A **step** is a category; durations are per step. Waits are steps too and may
5562
+ overlap phases: an escalation raised during implement counts in both.
5563
+ Uncovered time between segments is idle and is not a segment.
5564
+
5565
+ #### Build roster entry
5566
+
5567
+ `buildRosterEntry` is a registered build-scope value for the `buildRoster`
5568
+ rollup (§7.7): the build's `kind` (from `build.created`, default `work`), its
5569
+ `createdAt` (the first event's timestamp) and, once terminal, `finished:
5570
+ {outcome, completedAt}`. It applies the build reducer's terminal rule, so
5571
+ `finished` is present exactly when the build's status is `done` or `aborted`.
5572
+
3827
5573
  ### 15.6 Walkthroughs
3828
5574
 
3829
5575
  **Happy path** (elided: `session.started/ended` brackets around every agent
@@ -3899,9 +5645,12 @@ round-matched rule. A bare retry reruns the verifier with no feedback.
3899
5645
  verdict's finding marks `persists: [f1]` → round 3 again → kernel:
3900
5646
  `escalation.raised {source: "stall", refs: [chain]}`; status → `blocked`.
3901
5647
  `escalation.answered` uses the resolution vocabulary `guidance`,
3902
- `dismiss-finding`, `revise-spec`, `abort`, or `retry`. Operators produce
3903
- `dismiss-finding` and `revise-spec` through `ab answer`; a `revise-spec` answer
3904
- names the exact replacement artifact it authorizes. `guidance` feeds the answer
5648
+ `dismiss-finding`, `revise-spec`, `abort`, `retry`, or `accept-target`. Operators produce
5649
+ `dismiss-finding`, `revise-spec` and `accept-target` through `ab answer`; a `revise-spec` answer
5650
+ names the exact replacement artifact it authorizes. `accept-target` answers only
5651
+ a leaf's `policy/target-rewritten` escalation (§7.4): it waives the rejected base
5652
+ and restacks the build's own commits onto the current target; other answer forms
5653
+ skip that escalation. `guidance` feeds the answer
3905
5654
  into the next producer round as authoritative feedback; `dismiss-finding`
3906
5655
  marks the chain human-resolved and the next reviewer round is told so. Engine-routed
3907
5656
  guidance is latest-only per destination (`plan`, `code`, or one exact agent
@@ -3967,6 +5716,17 @@ however, a runner honors an engine-selected pause or abort acknowledgement befor
3967
5716
  setup-failure gating, even while that escalation is open. This control-only path
3968
5717
  executes no setup, appends no `runner.attached`, and starts no phase or session.
3969
5718
  Resume and all decisions that use the workspace still require successful setup.
5719
+ Setup is keyed to the base the runner prepared: when a restack, wait-resume
5720
+ advance or completed reconcile moves the build's verify diff base (a node's
5721
+ integration cycle parent) inside one runner process, the runner reruns setup
5722
+ before the next workspace-using decision (a non-reconcile phase, check, verify
5723
+ stage, finalize step or measurement). Every base move counts as a dependency
5724
+ change, because the kernel cannot see which files setup reads; agent commits do
5725
+ not move the base, and a reconcile replay in progress is not prepared. A
5726
+ post-restack failure follows the same path as an attach failure: it appends
5727
+ `runner.setup-failed` with the next attempt, counts toward
5728
+ `policy.maxSetupAttempts`, ends the runner unattached, and only a later
5729
+ successful setup's `runner.attached {resumedFromSeq}` clears it.
3970
5730
  The setup target belongs only to escalation metadata and is not a pipeline `Phase`.
3971
5731
 
3972
5732
  **D — runner loss and sandbox death:** local git-worktrees first attempt the
@@ -3977,10 +5737,17 @@ Before releasing or replacing a build workspace, the dispatcher confirms a
3977
5737
  non-destructive execution fence for the exact workspace and execution generation.
3978
5738
  It preserves unpublished branch commits and distinct detached producer candidates
3979
5739
  under immutable `refs/autobuild/archive/<build>/<sha>` refs, verifies their exact
3980
- readback, and records `workspace.commits-preserved` before cleanup. Replacement
3981
- provisioning restores those exact refs before starting an agent, reading them
3982
- from the local repository with the local-git forge and fetching each exact ref
3983
- from the remote otherwise. A preserved
5740
+ readback, and records `workspace.commits-preserved` before cleanup. Where the
5741
+ forge refuses an archive ref, the head is kept as a BuildStore copy instead
5742
+ (§15.7) and the receipt is the decisive `workspace.commits-retained`, whose heads
5743
+ each name either `remoteRef` or `storeBase`; a head kept by neither refuses the
5744
+ release. Replacement provisioning restores those exact commits before starting
5745
+ an agent, reading archive refs from the local repository with the local-git forge
5746
+ and fetching each exact ref from the remote otherwise, and restoring store copies
5747
+ through a dispatcher-side callback on any host, so a remote guest never holds
5748
+ store credentials. A runtime from before store-kept heads defers on the decisive
5749
+ receipt instead of misreading it; one that releases before seeing it preserves
5750
+ strictly, as it always did, and at worst refuses the release. A preserved
3984
5751
  branch head that the build's latest 64 replaced heads cover, as the replaced
3985
5752
  head itself or one of its ancestors, is kept only as archived objects: it is
3986
5753
  never preserved or restored as the branch, and provisioning records the skip as
@@ -3991,11 +5758,14 @@ that exists without a provisioned checkout, records `workspace.commits-lost`,
3991
5758
  naming known candidates and explicitly noting that any additional unpublished
3992
5759
  SHAs could not be inspected. An environment that never started executing holds
3993
5760
  no unpublished work: objects its checkout lacks mean nothing to preserve, so
3994
- cleanup records `workspace.commits-preserved` carrying forward earlier preserved
3995
- heads, then releases and replaces it. Unknown fencing, inspection, transport, or
5761
+ cleanup records `workspace.commits-preserved` (or `workspace.commits-retained`)
5762
+ carrying forward earlier preserved heads, then releases and replaces it. Unknown fencing, inspection, transport, or
3996
5763
  receipt-write outcomes leave the workspace and snapshots intact. A workspace
3997
5764
  flagged by `workspace.cleanup-required` is never launched into: the dispatcher
3998
- releases it and provisions the next generation. A preservation or release
5765
+ releases it and provisions the next generation. Provisioning cut off by a
5766
+ recorded dispatcher teardown is the exception: the next invocation asks the
5767
+ provider to verify and finish the same generation, and if it cannot, the
5768
+ replacement consumes no infrastructure attempt. A preservation or release
3999
5769
  failure is recorded against its build, as an infrastructure failure or janitor
4000
5770
  attention, and never stops the dispatcher from advancing other builds.
4001
5771
  Fencing is revalidated after restart; a saved receipt alone never authorizes
@@ -4110,7 +5880,9 @@ boundary. Superseded receipts remain historical evidence.
4110
5880
  `pipeline.settled { cycle }` is advisory capacity evidence. The dispatcher
4111
5881
  appends it once per settlement key (the later of the current verify cycle start
4112
5882
  and the latest `finalize.completed`) when the engine decides `wait awaiting-pr`;
4113
- no pipeline decision reads it (§12).
5883
+ no pipeline decision reads it (§12). A leaf counts as finished when its latest
5884
+ settlement follows the spec restart, or when that restart published its reopen's
5885
+ spec (§15.5).
4114
5886
 
4115
5887
  ### 15.7 Post-PR lifecycle [D1 — confirmed]
4116
5888
 
@@ -4124,8 +5896,78 @@ while an unexpired execution lease exists, so no workspace is released under a
4124
5896
  live process tree. After any terminal outcome it also reclaims every
4125
5897
  pending hosted PR-attachment copy. Reclamation success and failure are durable
4126
5898
  correlated facts; a failed delete remains pending and retries on later ticks,
4127
- including after the build is already done. A merged-PR fixup request is a *new
4128
- ticket*, never a reopened build.
5899
+ including after the build is already done. A fixup request for a merged or
5900
+ closed PR is a *new ticket*, never a reopened build.
5901
+
5902
+ **Reopening a settled leaf.** An operator who wants changes to a leaf that
5903
+ finished its pipeline and waits for its merge decision sends it back with
5904
+ `ab reopen <slug> --feedback <text>`, optionally with `--revise-spec <file>` or
5905
+ `--revise-spec-from-ticket` (the `builds.reopen` tool carries the same request).
5906
+ The control appends one human-attributed, decisive `build.reopened
5907
+ {feedback?, spec?: {artifact, assets?}}` by compare-and-append on a freshly
5908
+ reduced tail, and refuses, writing nothing, for an integration node, an
5909
+ optimization attempt, a queued or terminal build, a merged or closed PR, a leaf
5910
+ that has not settled (still running, conflicted or restacking), a blocked leaf
5911
+ (answer it with `ab answer`), and a pending abort or discard. A paused leaf may
5912
+ be reopened; the engine parks the reopen until resume. Feedback is 1–20000
5913
+ characters after trimming.
5914
+
5915
+ Feedback alone re-enters `implement`. The reopen's seq is the code half's
5916
+ restart boundary (`codeRestartSeq`, the later of it and the spec restart): code
5917
+ loop rounds and verdicts, `implement.completed`, verify and reconcile records,
5918
+ configuration captures, wait-resume restacks, `finalize.completed` and finalize
5919
+ post-steps at or before it no longer count, while the plan stays approved. The
5920
+ engine therefore runs `implement` at the next round, then code review, the
5921
+ verify-entry restack, every verify step, finalize and its post-steps, exactly as
5922
+ a first pass; the review-round count, stall chains and the verify-failure budget
5923
+ restart, and round and attempt numbers continue monotonically. A spec reopen
5924
+ deposits a conforming body first (a from-ticket body re-pins its assets, a file
5925
+ leaves the pins), then the kernel publishes the recorded artifact and assets as
5926
+ the next `spec.revised` in its `operator` form, which restarts from `plan`
5927
+ (§6.3). Every publication attempt re-reads, refuses on a pending abort or
5928
+ discard, an ended PR or a terminal build, and appends only on that tail; until
5929
+ it lands the engine waits on `awaiting-spec`, and a repeated `ab reopen`
5930
+ completes the recorded publication without opening its new arguments.
5931
+
5932
+ The reopen revokes merge consent and its acknowledgement and clears the landing
5933
+ decision, deferral and fallback; a hold stays in force. The leaf keeps its open
5934
+ PR and branch. Its armed native auto-merge stays as applied-state evidence: the
5935
+ janitor finds the leaf no longer ready and cancels it on its next poll, recording
5936
+ `landing.native-applied {enabled: false}`; a forge merge that lands first
5937
+ completes the build as merged and later reopens are refused. The reopened leaf
5938
+ stays a finished leaf for capacity and asks for a `reopen` slot, admitted ahead
5939
+ of new ticket claims like other parked work. Re-finalize adopts the open PR by
5940
+ head, keeping its title and prose, and the new `finalize.completed` is a new
5941
+ landing candidate that settles and needs fresh consent as usual. `ab context`
5942
+ writes `$AB_CONTEXT_DIR/reopen.json` (`{seq, user, via?, at, feedback?,
5943
+ specRev?}`, also the manifest's `reopen` block) for every phase while the
5944
+ reopen governs the current spec; a later reopen replaces it and a later
5945
+ escalation spec revision supersedes it. The epilogue grammar is unchanged: a
5946
+ reopen re-enters the mainline at `implement` or `plan`, and the leaf reaches
5947
+ merge only through `finalize` again.
5948
+
5949
+ **Forge CI on finished leaves.** A clean restack or a change on the base can
5950
+ leave a finished leaf's own CI red on the forge without any local verify step
5951
+ re-running. On the same janitor poll of a finished, open leaf PR (no phase or
5952
+ session running), the dispatcher reads the check runs and commit statuses at the
5953
+ PR's live head through the optional Forge `inspectHeadChecks` capability
5954
+ (GitHub: two ETag-conditional REST reads, so an unchanged head costs two 304s).
5955
+ A failing latest check run (`failure`, `timed_out`) or commit status (`failure`,
5956
+ `error`) records advisory `pr.checks-failed {pr, head, buildHead, checks, total,
5957
+ digest}`: `head` is the live PR head, `buildHead` the build's recorded head,
5958
+ `checks` a 20-entry preview and `digest` the identity of the complete failing
5959
+ set. It is recorded once per `(head, buildHead, digest)` and is default watch
5960
+ attention. Advisory `pr.checks-cleared {pr, head, cause}` records that the head
5961
+ now has no failing checks (`passing`, `pending`) or that the PR moved to another
5962
+ head (`head-changed`); a head change clears the old record on the proof of the
5963
+ PR read alone. CI that cannot be read — a missing capability, an authorization,
5964
+ rate-limit or network failure, a guarded-forge cooldown, or a truncated listing
5965
+ with no visible failure — is unknown: it records nothing, never claims green,
5966
+ never raises red, and never becomes a janitor failure. Status surfaces report a
5967
+ recorded failure only while it still describes the open PR at the build's
5968
+ recorded head, so a reconcile, restack, merge or close hides it at once.
5969
+ Autobuild never re-runs forge CI and never re-enters `implement` on red CI; the
5970
+ operator inspects the PR, re-runs CI on the forge, or reopens the build.
4129
5971
 
4130
5972
  **Merge standard: one change per build, replay at reconcile.**
4131
5973
 
@@ -4142,8 +5984,8 @@ ticket*, never a reopened build.
4142
5984
 
4143
5985
  This reverses the original rebase ban [D1, D3]. Replaying many WIP commits caused
4144
5986
  repeated conflict loops; replaying one net change resolves the conflict once.
4145
- Rewrites used to sever event-recorded SHAs; immutable archives and durable
4146
- rewrite facts retain them. Ordinary per-WIP-commit rebase remains inappropriate.
5987
+ Rewrites used to sever event-recorded SHAs; retained history and durable
5988
+ rewrite facts keep them. Ordinary per-WIP-commit rebase remains inappropriate.
4147
5989
  Existing historical merge reconciliations retain their original replay/display
4148
5990
  semantics and supply the promoted contribution base for a later restack. Resumed
4149
5991
  builds use current engine routing at newly reached replay and merge boundaries;
@@ -4152,24 +5994,88 @@ merge standard. Execution configuration remains pinned, while merge policy
4152
5994
  is live dispatcher configuration. Operators requiring old execution behavior
4153
5995
  should drain work before upgrading rather than run mixed-version writers.
4154
5996
 
4155
- Before branch replacement the kernel publishes Git tips named by retained
4156
- history and rewrite facts, plus both heads and the temporary change, under immutable non-branch refs
4157
- `refs/autobuild/archive/<slug>/<sha>`. Archives must be fetchable by exact ref;
4158
- namespace or permission failures stop publication without a branch/tag fallback. Remote
5997
+ Before a leaf branch replacement (automatic restack, reconcile, or remote
5998
+ publication settlement) the kernel retains every displaced Git tip named by
5999
+ retained history and rewrite facts, plus both heads and the temporary change.
6000
+ Leaf retention is best effort, per commit, in this order:
6001
+
6002
+ 1. **Forge archive ref.** An immutable non-branch ref
6003
+ `refs/autobuild/archive/<slug>/<sha>`, fetchable by exact ref and confirmed by
6004
+ exact readback. A forge-archived commit writes no store copy.
6005
+ 2. **BuildStore copy.** Where the forge refuses the ref, artifact
6006
+ `history-objects-<sha>` holds a thin pack of only the objects `<sha>` reaches
6007
+ that the transaction's frozen target base does not, chunked like
6008
+ `replay-objects-<sha>`. A commit already an ancestor of that base needs no
6009
+ copy and is classified `target`.
6010
+ 3. **Nothing.** Where the copy also fails, the rewrite proceeds. The build
6011
+ records one build-scoped `observation.recorded` followup with fixed id
6012
+ `history-unretained` naming the unretained commits; later attempts in the
6013
+ same build never repeat it.
6014
+
6015
+ The decisive `history.retained {operation: restack | reconcile, id, base, store,
6016
+ target, unretained}` records commits kept as store copies over exclusion base
6017
+ `base`, kept by the target, or kept nowhere; forge-archived commits stay on the
6018
+ rewrite fact's `archives`. Older runtimes treat it as an unknown decisive fact
6019
+ and defer. Retention is never a branch or tag. An immutable ref that already
6020
+ names a different commit is an `ArchiveConflictError`: never retried, never a
6021
+ fallback. Classified transient forge failures still retry rather than fall back.
6022
+
6023
+ Node writes retain the same way. Node restack retains the frozen expected head,
6024
+ previous boundary and parent; node landing retains the destination head and the
6025
+ leaf candidate; integration landing and the node verify head retain the node
6026
+ head. Each store copy excludes the published head the write builds on, and the
6027
+ decisive `node.history-retained {operation: restack | landing |
6028
+ integration-landing | verify, id, base, store, target, unretained}` records the
6029
+ non-forge outcomes; the `history-unretained` warning is shared with leaf
6030
+ retention. A node write whose inputs are kept nowhere still proceeds: they stay
6031
+ reachable from published branches until its guarded update lands. Node recovery
6032
+ (restack recovery, landing recovery, closed-node settlement and node-conflict
6033
+ reconcile) restores its reserved inputs before any Git read of them, from the
6034
+ archive ref, a store copy, or the published branches. An input kept nowhere
6035
+ before the guarded update landed abandons the reservation
6036
+ (`node.writer-settled {outcome: abandoned}`), and the next node transaction
6037
+ reserves again from the published branches.
6038
+
6039
+ Workspace commit preservation (§12 D) is the strict exception: its unpublished
6040
+ commits may exist nowhere else. It tries the forge archive ref, then a
6041
+ `history-objects-<sha>` store copy excluding the preservation base, and never
6042
+ classifies a commit as `target` or proceeds unretained. When both fail, release
6043
+ is refused and cleanup stays pending. A history copy is identified by its head:
6044
+ a later retention of the same commit reuses the existing copy and its saved
6045
+ base. Preservation records that base and, when it is no longer an ancestor of
6046
+ the current preservation base, retains the base itself the same way, to a
6047
+ bounded depth; restoration follows that chain.
6048
+
6049
+ Readers (restack and reconcile preparation, regenerated-restack adoption,
6050
+ candidate recovery) restore a missing commit in the same order: the local
6051
+ repository; the forge archive ref (exact `ls-remote` and exact fetch, where
6052
+ transient transport failures throw and retry); store copies
6053
+ (`reconcile-change-<sha>`, `replay-objects-<sha>`, `history-objects-<sha>`);
6054
+ then a fetch of the published build and target branches. A commit retained
6055
+ nowhere redoes the work: an unpublished transaction is re-prepared from a fresh
6056
+ snapshot of the published branch under id `<id>-redo`, and a candidate that
6057
+ already has a publication request is retired through
6058
+ `publication.candidate-retired` and replays under its replacement identity.
6059
+
6060
+ Remote
4159
6061
  archives also publish commits present only on the remote: GitHub uses create-only
4160
6062
  Git-reference REST creation when the workspace lacks the commit, retaining guarded Git
4161
6063
  pushes for local objects. When an environment refuses a non-branch Git push of an
4162
6064
  archive ref (a refusal, not a transient failure), GitHub creates the identical archive
4163
6065
  ref through the same create-only REST call and holds it to the same exact readback; this
4164
6066
  is a transport for the same ref, never a branch or tag, never overwrites an archive, and
4165
- cannot publish a commit that exists only locally, which fails naming both refusals. Exact remote readback confirms publication, then a non-shallow
6067
+ cannot publish a commit that exists only locally, which fails naming both refusals
6068
+ (a refusal that leaf retention absorbs into its BuildStore copy).
6069
+ Vercel Sandbox workspaces push archives through the guest Git transport for candidate
6070
+ recovery, preservation and rewrites; after a refusal the dispatcher makes the same REST
6071
+ call with host-held credentials, and the guest's exact readback still decides. Exact remote readback confirms publication, then a non-shallow
4166
6072
  fetch of only that exact archive ref (without tags, configured refmap expansion or a
4167
6073
  depth limit) restores missing commits and their missing ancestry, writes no shallow
4168
6074
  boundary, leaves an already-shallow repository's existing boundaries unchanged, and
4169
6075
  verifies the commits locally before returning.
4170
6076
  Publication requests and loss records alone are not retained Git history: their
4171
6077
  unpublished objects may have died with a released sandbox. A separately published
4172
- or reviewed tip remains an archive requirement even when an earlier request named
6078
+ or reviewed tip remains a retention requirement even when an earlier request named
4173
6079
  that same SHA.
4174
6080
  Restack and reconcile publication reject tracked modifications with the existing
4175
6081
  clean-worktree error. Nonignored untracked files do not block publication and
@@ -4214,13 +6120,37 @@ Automatic leaf transactions use `restack.*`, independently of reconcile attempt
4214
6120
  numbers. Preparation freezes the trigger, verify-cycle boundary, absorbed target
4215
6121
  observation, old base/head, target base, single-change commit, workspace/local
4216
6122
  branch tips and canonical message. Publication intent precedes guarded replacement;
4217
- `restack.rewritten` retains archives and proven writes even if readback observes a
6123
+ `restack.rewritten` retains confirmed forge archive refs (its `archives`; store and
6124
+ target retention is on `history.retained`) and proven writes even if readback observes a
4218
6125
  later writer. Completion requires confirmed publication. Clean transactions start
4219
6126
  no agent and do not fabricate `reconcile.completed`. A conflicted replay is adopted
4220
- by `reconcile.started {restackId}` without another collapse or target selection.
6127
+ by `reconcile.started {restackId}` without another collapse or target selection,
6128
+ unless it is regenerated.
6129
+
6130
+ **Generated-file regeneration.** `[[generated]]` declares repository paths
6131
+ (path selectors; the first matching entry owns a file) and the shell command
6132
+ that rebuilds them. When every conflicted path of an automatic leaf replay is
6133
+ declared, the runner, before any reconcile attempt, re-establishes the recorded
6134
+ conflict, takes the target's side of each conflicted file, runs each owning
6135
+ command once in the build workspace, stages exactly the regenerated paths, and
6136
+ commits with the change's message and author; cleanly applied edits are
6137
+ committed unchanged. The command may write only declared paths, and no staged
6138
+ content may keep conflict markers. Exactly one `restack.regenerated {id, files,
6139
+ commands, outcome: resolved | failed | skipped, head?, reason?}` records the
6140
+ decision: `head` only when resolved (retained before the fact), `reason`
6141
+ otherwise. The engine routes a conflicted replay to `restack` while its fact is
6142
+ `resolved`, or while declarations exist, no fact is recorded and no reconcile
6143
+ attempt started; otherwise to `reconcile`. The engine never matches paths. A
6144
+ resolved replay publishes like a clean one and records head paths with its
6145
+ resolution; a replacement workspace restores the retained head instead of
6146
+ regenerating. `failed` and `skipped` commit nothing, leave no command output,
6147
+ and restore the recorded conflict for reconcile, whose context names the
6148
+ conflicted generated files with their commands (`generated`) and a failure's
6149
+ `regeneration.reason`, both read from the recorded fact's `commands`, never
6150
+ from the checkout's `autobuild.toml`. Repositories that declare nothing are unaffected.
4221
6151
  Resolver completion links back to the automatic transaction. Retained commit bytes
4222
6152
  and replay object packs recover disposable-workspace objects before publication.
4223
- 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.
6153
+ 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.
4224
6154
 
4225
6155
 
4226
6156
  `reconcile.prepared` records transaction identity, attempt, branch, old head,
@@ -4229,14 +6159,15 @@ Before that fact is appended, the exact temporary commit bytes are deposited as
4229
6159
  SHA-keyed BuildStore artifact. A replacement sandbox restores and verifies the
4230
6160
  same object from those bytes, retaining the original transaction and frozen base
4231
6161
  without requiring prepare-time remote write credentials. Retained trees and
4232
- parents supply the rest of its object graph; trusted publication still archives
4233
- the temporary commit before replacing the branch.
6162
+ parents supply the rest of its object graph; trusted publication still retains
6163
+ the temporary commit, best effort, before replacing the branch.
4234
6164
  `reconcile.replayed` records whether replay conflicted. Notes and the resolved
4235
6165
  head are deposited with `reconcile.publish-intended` before publication.
4236
6166
  `ab done` records a publication request; local kernels wait for the resolver
4237
6167
  session to end and remote kernels wait for guest teardown before replacement;
4238
6168
  `reconcile.rewritten` records old/new heads, old/new change SHAs, frozen base,
4239
- conflict outcome and archive refs after confirmed publication. A successful CAS
6169
+ conflict outcome and confirmed forge archive refs (store and target retention is on
6170
+ `history.retained`) after confirmed publication. A successful CAS
4240
6171
  that is overtaken before readback still records its receipt, with `observedHead`
4241
6172
  naming the later head (or null for deletion). That observed head informs recovery;
4242
6173
  it does not complete reconcile or promote the verification base. Recovery may
@@ -4244,7 +6175,9 @@ consume a durable confirmed write receipt; candidate ancestry alone never proves
4244
6175
  an unconfirmed write. New completion is
4245
6176
  `{headSha, rewriteId, artifact}`; historical `{mergeCommit, artifact}` remains
4246
6177
  valid. Remote requests carry identical transaction inputs and use the provider's
4247
- trusted rewrite/archive capability only after execution teardown. Contention is
6178
+ trusted rewrite/archive capability only after execution teardown; the provider
6179
+ hands each archive to the kernel's `retain` callback over its trusted Git
6180
+ transport, and the callback owns the fallback. Contention is
4248
6181
  recorded durably and uses the existing runner-failure bound, without spending
4249
6182
  unchanged-base no-progress budget before completion. Classified transient publication
4250
6183
  failures instead use the independent durable publication retry budget described
@@ -4264,6 +6197,8 @@ completion. This evidence does not change reduction or display semantics.
4264
6197
 
4265
6198
  A node-target child merge instead fast-forwards its already canonical
4266
6199
  single-change commit, preserving exactly one terminal source-build identity.
6200
+ A child of an optimization node first passes the measurement landing gate
6201
+ (§13.1.1), and its guarded fast-forward is guarded on the measured baseline.
4267
6202
  The guarded destination write is authoritative once confirmed: the durable
4268
6203
  merge receipt, carrying the candidate SHA and identity, is recorded only after
4269
6204
  exact authoritative readback of the destination shows that candidate, or from
@@ -4332,8 +6267,13 @@ is published.
4332
6267
  Policy is live dispatcher configuration, outside the pinned execution pipeline.
4333
6268
 
4334
6269
  `ab hold <slug>` durably suppresses merge and revokes previous consent, even
4335
- before readiness. `ab merge <slug>` requires readiness, clears hold, and consents
4336
- to this build/node merge into its frozen destination. Consent survives head
6270
+ before readiness. `ab hold <slug> --reason <text>` also records why on
6271
+ `build.hold-requested` (1–2000 characters after trimming; a blank reason is
6272
+ refused and nothing is written). The reduced hold carries the reason, and
6273
+ status, merges, builds and both dashboards show it while that hold stands; a
6274
+ later hold replaces it and merge consent clears it. `ab merge <slug>` requires
6275
+ readiness, clears hold, and consents to this build/node merge into its frozen
6276
+ destination. Consent survives head
4337
6277
  replacement, clean restacking, verification and re-finalization until another
4338
6278
  hold or completion. It is consent to the merge, not approval of an immutable diff.
4339
6279
  Consent given under a rule with `paths` or `within` predicates is the exception:
@@ -4346,7 +6286,8 @@ its publication intent, from recorded facts only; no poll derives it. The fact
4346
6286
  removes that consent only, so the build returns to the consent queue for its new
4347
6287
  head and needs fresh consent. Clean restacks record no resolution and keep
4348
6288
  consent, as do reconciles that edit no matched file and consent under rules
4349
- without path predicates. Accepted node reparenting also revokes consent.
6289
+ without path predicates. Accepted node reparenting and reopening a settled leaf
6290
+ (above) also revoke consent.
4350
6291
  The optional `ab merge <slug> --head <sha>` (operator `head`) refuses with
4351
6292
  `head-mismatch`, recording nothing, unless `<sha>` (full or at least seven
4352
6293
  characters) is the current candidate head. The consented head is the head of
@@ -4576,6 +6517,43 @@ The dispatcher emits an actionable operator notice without repeating it for the
4576
6517
  same failure. Restoring a valid `autobuild.toml` clears the rejection and
4577
6518
  ordinary boundary reload resumes.
4578
6519
 
6520
+ **Local overrides.** A checkout may carry an uncommitted `.autobuild/local.toml`
6521
+ beside `autobuild.toml`. Every process that reads configuration from that
6522
+ checkout, including a checkout-mode dispatcher's startup and every reload,
6523
+ layers it over the committed file: the raw TOML tables merge key by key (scalars
6524
+ and arrays replace whole) before schema validation, so defaults and
6525
+ cross-validation run on the merged input and an invalid local value gets the
6526
+ committed file's message naming the local file. Every root key carries an
6527
+ exhaustive local-override classification. Only `capacity`,
6528
+ `ticketScanIntervalSeconds`, `[upgrade]`, `[hooks]`, `[roles]`, `[accounts]` and
6529
+ `[operator]` are local; every other key, including the build-owned sections, is
6530
+ committed-only, and a local file that sets one is a rejected candidate under the
6531
+ rules above. The dispatcher reads both files as one candidate with the same
6532
+ hot/restart treatment per field. It records the dotted settings it took from the
6533
+ local file as `localOverrides` in the metadata of its effective-config artifact,
6534
+ which `ab repository status` reports. Build-owned sections still come from the
6535
+ build's own branch, and origin-mode and hosted dispatchers never read a local
6536
+ file.
6537
+
6538
+ **Local dispatcher ownership preference.**
6539
+
6540
+ `[operator] dispatcher = "human" | "agent"` is optional with no default and is
6541
+ local-only: committed input rejects even an empty `[operator]` with advice to use
6542
+ `.autobuild/local.toml`. Effective configuration and artifacts accept it. Changes
6543
+ are hot and do not command a dispatcher. `ab operator dispatcher [human|agent]
6544
+ [--json]` reads or saves only that preference, without a store or event write;
6545
+ phase authority cannot save it. Saving validates existing and candidate config,
6546
+ preserves other settings semantically and atomically replaces the local file.
6547
+
6548
+ Operator agents check fresh `dispatcherRunning` and never start while it is true
6549
+ or unknown. With none running they honor repository instructions and the saved
6550
+ preference, or ask and offer to save it. Human ownership means instructions and
6551
+ waiting; agent ownership uses `ab dispatch --web --plain --json` under managed
6552
+ background lifetime and shares the URL. Only a dispatcher this session started
6553
+ may be stopped, on request, with a clean drain. Another session's process cannot
6554
+ be adopted, restarted or killed. `ab web` is always permitted as a read-only
6555
+ surface, including while dispatch runs.
6556
+
4579
6557
  Merge policy is an ordered `[[merge]]` array. Each rule requires
4580
6558
  `mode = "auto" | "consent"` and may match `into = "root" | "node" | <node-ticket-id>`,
4581
6559
  `from = "leaf" | "node"`, an exact, case-sensitive `label`, and changed-path
@@ -4658,11 +6636,15 @@ automatic = true # immediate/60-second target checks; false requi
4658
6636
  #releaseId = 123456
4659
6637
 
4660
6638
  [commands] # deterministic verbs the kernel may run
4661
- setup = "bun install" # after provision / sandbox rehydrate (§15.6-C)
6639
+ setup = "bun install" # at attach, and after a restack moves the base (§15.6-C)
4662
6640
  typecheck = "bun run type-check"
4663
6641
  test = "bun run test"
4664
6642
  publish = "bun run publish"
4665
6643
 
6644
+ [[generated]] # optional: files a command rebuilds; restack
6645
+ paths = ["src/schema.json"] # conflicts only in these are regenerated
6646
+ command = "bun run gen:schema" # sh -c from the workspace root
6647
+
4666
6648
  [verify]
4667
6649
  steps = ["types", "unit", "acceptance"]
4668
6650
  [verify.types]
@@ -4712,6 +6694,9 @@ maxReconcileAttempts = 3
4712
6694
  maxReviewRounds = 6
4713
6695
  harvestThreshold = 5 # observation-count pressure in dispatch
4714
6696
  harvestMaxDrift = 3 # merged builds since oldest observation; 0 disables
6697
+ # maxOpenPrs = 12 # open root PRs that pause normal claims; unset disables
6698
+ # resumeOpenPrs = 9 # resume at or below; default maxOpenPrs - 1
6699
+ # excludeHeldOpenPrs = false # leave held PRs out of the count
4715
6700
 
4716
6701
  [tickets]
4717
6702
  source = "file"
@@ -4755,7 +6740,7 @@ decide where a build's effective configuration is composed from:
4755
6740
  | Class | Sections | Source at deposit |
4756
6741
  |---|---|---|
4757
6742
  | 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). |
4758
- | 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. |
6743
+ | 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. |
4759
6744
  | Dispatcher-owned | `baseBranch`, `capacity`, `ticketScanIntervalSeconds`, `forge`, `plugins`, `pr`, `tickets`, `orchestrator`, `merge`, `upgrade` | The dispatcher's live snapshot; the build runner never interprets them. |
4760
6745
 
4761
6746
  Dispatcher lease sweeps may reuse parsed effective-config pins in a disposable
@@ -4834,6 +6819,10 @@ resolving to the ordinary `skipped` outcome so exclusions stay queryable:
4834
6819
  reconcile, so upstream-merged work is not attributed to the build). No
4835
6820
  match skips without launching anything; a Git failure is infrastructure and
4836
6821
  fails closed, never a synthetic skip.
6822
+ - **Verify base for checks.** A `check` command runs with `AB_VERIFY_BASE`
6823
+ set to that same durable base, or to a node's integration cycle parent, so
6824
+ a check can judge the change relative to it; the variable is absent when no
6825
+ base exists.
4837
6826
 
4838
6827
 
4839
6828
  #### Post-reconcile verification policy
@@ -4862,8 +6851,9 @@ is not re-verified, so breakage that only exists in the combination can merge.
4862
6851
 
4863
6852
  ### 16.3 Skill installation: vendored, namespaced, editable [D11]
4864
6853
 
4865
- This project ships 11 canonical default skills for the fixed phases, the
4866
- non-phase surfaces (`spec`, `tickets`, and `guide`), and the outer-loop skills.
6854
+ This project ships 14 canonical default skills for the fixed phases, the
6855
+ optimization node's `propose` phase, the non-phase surfaces (`spec`,
6856
+ `tickets`, and `guide`), and the outer-loop skills.
4867
6857
  Repository setup guidance ships as `guide/references/setup.md`, not as a skill;
4868
6858
  each repository authors its own acceptance-check skill. No generic verifier
4869
6859
  skill ships. `ab init` installs into a repo:
@@ -4874,7 +6864,7 @@ skill ships. `ab init` installs into a repo:
4874
6864
  Existing config is never overwritten, even with `--force`.
4875
6865
  - **An agent-driven setup handoff.** Init probes every registered runtime and
4876
6866
  reports each usable/unusable result, then chooses an interactive setup agent
4877
- using the product-fixed `claude`, `codex`, `pi` preference order. The launcher
6867
+ using the product-fixed `claude`, `codex`, `pi`, `antigravity` preference order. The launcher
4878
6868
  choice does not constrain the pipeline's final roles or models. On an
4879
6869
  interactive terminal, init starts that coding-agent CLI directly in the
4880
6870
  target repository with inherited terminal I/O, no `AB_*` session identity,
@@ -4888,7 +6878,7 @@ skill ships. `ab init` installs into a repo:
4888
6878
  setup reference in an older or partial distribution does not fail init. On
4889
6879
  rerun, the prompt asks the agent to review and improve the preserved existing
4890
6880
  config.
4891
- - **Copies** of the 11 default skills into the project skills directory,
6881
+ - **Copies** of the 14 default skills into the project skills directory,
4892
6882
  namespaced `ab-*`. Copies, not references — per-repo customization is the
4893
6883
  point: this repo's code-review standards and setup reference live in the
4894
6884
  vendored trees. Harness-specific discovery paths are symlinks to the one
@@ -5040,7 +7030,7 @@ or installs releases in the foreground or background.
5040
7030
  2. **[OPEN] Retention/archival policy** — the pilot's archival gap, now a store
5041
7031
  config concern rather than a repo problem. Needs a default (e.g. prune
5042
7032
  blobs for merged builds after N months, keep events). Immutable reconcile
5043
- archive refs are retained indefinitely for now; their retention policy is
7033
+ archive refs and `history-objects-<sha>` copies are retained indefinitely; their retention policy is
5044
7034
  part of this open thread.
5045
7035
  3. **[OPEN] Global capacity** — per-repo capacity is the top-level `capacity`
5046
7036
  scalar (§16.1); whether a cross-repo global cap is needed, and where it
@@ -5182,12 +7172,13 @@ The web dashboard consumes shared terminology without introducing a tree surface
5182
7172
  same deterministic, repository-scoped ready consent/held candidates. A recorded
5183
7173
  current decision is required; auto-authorized and consented candidates are absent.
5184
7174
  Queue entries and build status show the current candidate head and the head
5185
- consent was given at (null without consent).
7175
+ consent was given at (null without consent), and a current forge CI failure
7176
+ (`ciFailure`, §15.7) in the shared vocabulary.
5186
7177
  Source `ab ticket tree` / `tickets.tree` enumerate all ticket states with listing
5187
7178
  diagnostics; effective build targets remain frozen independently of source metadata.
5188
7179
 
5189
7180
  Default watch attention includes `integration.verification-failed`, `integration.landed`, `node.item-conflicted`,
5190
- `landing.consent-revoked`, and conflicted `restack.replayed`. Derived `build.consent-ready` observations
7181
+ `landing.consent-revoked`, `pr.checks-failed`, `optimization.noise-exceeded`, and conflicted `restack.replayed`. Derived `build.consent-ready` observations
5191
7182
  carry target, branch, candidate and the durable readiness entry position in the
5192
7183
  existing cursor envelope. Cursor identities retain readiness episodes across
5193
7184
  restart; a new candidate or exit/re-entry can wake again. Explicit event globs
@@ -5211,10 +7202,26 @@ heads require immutable commit ancestry proof against the accepted target and
5211
7202
  the destination base already used by replay. Missing capability or failed proof
5212
7203
  defers new replay. A non-descendant without kernel lineage records
5213
7204
  `target.rewritten` with branch,
5214
- previous SHA and observed SHA, retains the accepted target, and raises watch/wait
5215
- attention. Repeated rewrite pairs are deduplicated. Returning to a safe target
5216
- clears attention (`target.rewrite-cleared` when the accepted tip is unchanged).
5217
- Upstream force-pushes are never adopted automatically. Accepted node reparenting
7205
+ previous SHA and observed SHA, and retains the accepted target. Repeated rewrite
7206
+ pairs are deduplicated. Returning to a safe target clears the wait
7207
+ (`target.rewrite-cleared` when the accepted tip is unchanged). Upstream
7208
+ force-pushes are never adopted on top of existing work automatically:
7209
+
7210
+ - A leaf with no work of its own (no published head, no PR, no commits beyond
7211
+ its base in use) is reprovisioned from the current target by its next runner,
7212
+ without operator action: `target.rewrite-reprovision-prepared`, a branch
7213
+ reset, then `target.rewrite-recovered` (`reprovisioned`). A runner that dies
7214
+ mid-reset completes it forward.
7215
+ - A leaf with work raises one `policy/target-rewritten` escalation per episode
7216
+ (a run of rewrites of the same rejected base), naming that base, the new
7217
+ target head and its own commits. `ab answer <slug> --accept-target` waives
7218
+ the rejected base (`target.rewrite-recovered`, `accepted`) and restacks its
7219
+ own commits onto the target at the next replay boundary; `ab abort` is the
7220
+ other way out.
7221
+ - A node waits, and raises watch/wait attention once per episode.
7222
+
7223
+ `ab build status` names a leaf's recovery state, and the base when the build's
7224
+ first provision adopted it from a pre-existing branch. Accepted node reparenting
5218
7225
  starts a new branch scope; frozen transactions recover their retained inputs.
5219
7226
 
5220
7227
  Kernel restacks of a node are admitted through durable guarded publication
@@ -5237,12 +7244,18 @@ polls read no receipts or event rows.
5237
7244
 
5238
7245
  A historical `publication.lost` does not prove that every copy of its candidate
5239
7246
  is gone. Recovery checks the exact branch and private archive refs and retained
5240
- replay objects first. An available candidate continues guarded publication.
5241
- A genuinely missing reconcile or automatic restack candidate records
7247
+ store copies first. Replay copies are read in either format (the chunked manifest
7248
+ or a legacy base64 pack); when a thin pack's base is missing, recovery fetches the
7249
+ published target first and applies the pack with `git index-pack --fix-thin`. An
7250
+ available candidate is retained best effort, in the leaf order above, before
7251
+ guarded publication continues; a refused archive does not block it, and a remote
7252
+ provider's `recoverCandidate` reports the candidate available even when archiving
7253
+ is refused. A commit retained nowhere redoes the work from the published branch,
7254
+ as above. A genuinely missing reconcile or automatic restack candidate records
5242
7255
  `publication.candidate-retired`, abandons its obsolete request, and replays the
5243
7256
  producing operation with a fresh transaction identity. Its frozen target,
5244
7257
  reconcile occurrence or automatic trigger, cycle, and message survive. The
5245
- retired candidate is excluded from archive requirements unless independently
7258
+ retired candidate is excluded from retention requirements unless independently
5246
7259
  required by proven history. This reconstruction consumes no infrastructure
5247
7260
  attempt and no additional conflict occurrence; it needs no operator guidance.
5248
7261
  A bare retry also clears an existing infrastructure-limit escalation through
@@ -5292,6 +7305,11 @@ clears the attention, closes the escalation unanswered and the build continues.
5292
7305
  Answering it with a bare retry makes the janitor attempt on its next tick. An
5293
7306
  episode raises at most one escalation; a new episode after recovery can raise
5294
7307
  another. `policy.janitorBackoffMaxSeconds` sets the positive integer cap.
7308
+ A pending control the janitor can act on wakes it during backoff: an abort, a
7309
+ pause, a resume of a paused build, a queued discard or an unacknowledged landing
7310
+ command. A leaf's resume that only cancelled a never-acknowledged pause is not
7311
+ one and waits out the backoff; a node's janitor acknowledges every pending
7312
+ control itself, so any node command wakes it.
5295
7313
  A dispatcher that cannot execute Git for kernel node work (a missing or
5296
7314
  unloadable `git` for the bare clone) records no janitor failures. It records
5297
7315
  one durable `dispatcher.kernel-git-unavailable` repository condition, node work
@@ -5300,6 +7318,25 @@ succeeds.
5300
7318
 
5301
7319
  A rate limit the dispatcher classifies on its own authenticated request
5302
7320
  records repository degradation with `resetAt`.
7321
+ The built-in GitHub forge also treats a successful response, 304 included,
7322
+ that reports `x-ratelimit-remaining: 0` with a future reset at most 65 minutes
7323
+ away (one hour plus five minutes of clock skew) as that quota's limit.
7324
+ The response keeps its result, and the process's next
7325
+ request for the same quota (`core`, `graphql`, …) fails as that rate limit
7326
+ without being sent, so cooldown follows the rules here without an avoidable
7327
+ refusal. Other quotas are unaffected. A missing, malformed, past or
7328
+ implausible reset enters no cooldown, and no later response clears one early:
7329
+ only the reset passing, or an explicit `forge-clear`, does. After a clear, the
7330
+ next request goes to GitHub as a probe, and an actual limit restores the
7331
+ cooldown.
7332
+ The first limit of an episode records an ordinary `dispatcher.forge-degraded`,
7333
+ which wakes `ab watch` once. A later reset inside the unexpired episode extends
7334
+ the cooldown durably as a degradation marked `continued` that wakes nothing; an
7335
+ equal or earlier reset writes nothing. A limit after the reset has passed, or
7336
+ after recovery, opens a new episode. A rate-limited or unreadable response on
7337
+ landing, gate inspection or PR polling is a typed forge failure or an unproven
7338
+ state, never "no checks", "ungated", "closed" or "merged"; merge-freshness
7339
+ inspection defers instead of recording best-effort evidence.
5303
7340
  Forge work waits during cooldown; passing the deadline permits a recovery
5304
7341
  request; a successful probe records automatic recovery. An authorized operator
5305
7342
  may explicitly override erroneous recorded state with
@@ -5353,7 +7390,15 @@ using exact-resource ETags; authenticated 304s spare the REST primary quota.
5353
7390
  Adapter caches are bounded and restart/eviction falls back to fresh reads.
5354
7391
  Writes, including Git publication and rewrites, invalidate observations before
5355
7392
  attempting the mutation so acknowledgement reads remain fresh. Leaf PR polling
5356
- keeps its existing cadence. Readiness and merge inspections remain fresh.
7393
+ keeps its existing cadence. Gate branch and rules reads, merge-freshness
7394
+ protection and rulesets, landing, retarget and auto-merge PR reads, commit and
7395
+ history reads, merge-queue activity, summary-comment listing and branch
7396
+ existence revalidate the same way. Both caches hold the raw representation and
7397
+ every caller validates it with its own schema, so consumers of one resource
7398
+ share one request and one ETag; a representation that fails validation loses
7399
+ its ETag. Reads that must be fresh, including merge inspections, still reach
7400
+ GitHub every time, conditionally when an ETag is cached. Readiness diagnostics
7401
+ and post-mutation readbacks stay unconditional.
5357
7402
 
5358
7403
  Opened integration nodes poll every tick until their durable activity has been
5359
7404
  quiet for `policy.nodeIdleAfterSeconds` (default 600 seconds), then poll every
@@ -5381,6 +7426,18 @@ primary quota, REST 304s and GraphQL calls. Transport failures and historical or
5381
7426
  legacy observations can remain unclassified; absent fields never imply zero.
5382
7427
  Shared requests are attributed to their first requester; cache hits count zero.
5383
7428
 
7429
+ An adapter may also report the primary rate-limit headers a response carried
7430
+ (`resource`, `limit`, `remaining`, `resetAt`), including on 304s and limited
7431
+ failures; GitHub does. No extra `/rate_limit` request is made. Tick telemetry's
7432
+ optional `rateLimits` carries the latest reading per resource with its
7433
+ `observedAt`, at most eight resources and none older than a day, across ticks
7434
+ and dispatcher restarts, so a cooldown tick with no requests still reports the
7435
+ last known quota. Secondary limits carry no headers and appear only as the
7436
+ degradation. `ab repository status` shows them as `forgeRateLimit`: each
7437
+ reading, `stale` once its window has reset (current quota unknown), and
7438
+ `paused`/`pausedUntil` while the dispatcher's rate-limit cooldown holds forge
7439
+ landing and polling. Absent fields mean unknown, never full quota.
7440
+
5384
7441
  ## Integration verification attention
5385
7442
 
5386
7443
  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.