@defrex/autobuild 1.8.1 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (429) hide show
  1. package/README.md +3 -3
  2. package/SPEC.md +1602 -134
  3. package/bin/ab-dispatch-generation.ts +2 -0
  4. package/docs/agent-runtimes.md +30 -3
  5. package/docs/answering-blocked-builds.md +15 -7
  6. package/docs/architecture.md +320 -53
  7. package/docs/builds.md +5 -0
  8. package/docs/cli.md +7 -1
  9. package/docs/configuration-overview.md +1 -0
  10. package/docs/configuration.md +515 -49
  11. package/docs/dispatcher-hosting.md +4 -0
  12. package/docs/dispatcher.md +17 -3
  13. package/docs/forges.md +1 -1
  14. package/docs/getting-started.md +1 -1
  15. package/docs/integration-overview.md +4 -2
  16. package/docs/integration-tree.md +102 -11
  17. package/docs/merge-policy.md +70 -14
  18. package/docs/migration-1.0.md +2 -1
  19. package/docs/operating.md +53 -4
  20. package/docs/operator-api.md +128 -16
  21. package/docs/optimization-nodes.md +1042 -0
  22. package/docs/overview.md +1 -1
  23. package/docs/plugin-authoring.md +50 -13
  24. package/docs/remote-store-protocol.md +46 -7
  25. package/docs/remote-ticket-protocol.md +50 -2
  26. package/docs/restacking.md +102 -10
  27. package/docs/seams.md +2 -2
  28. package/docs/setup.md +16 -3
  29. package/docs/skills.md +4 -2
  30. package/docs/spec-standard.md +2 -1
  31. package/docs/ticket-dependencies.md +5 -0
  32. package/docs/ticket-migration.md +4 -2
  33. package/docs/ticket-sources.md +30 -12
  34. package/docs/tickets.md +15 -6
  35. package/docs/troubleshooting.md +3 -2
  36. package/docs/verification.md +18 -6
  37. package/docs/workspaces.md +3 -1
  38. package/package.json +4 -3
  39. package/packages/core/src/accounts/chatgpt-oauth.ts +7 -5
  40. package/packages/core/src/cli/attempt.ts +103 -0
  41. package/packages/core/src/cli/attention.ts +11 -1
  42. package/packages/core/src/cli/binary-direct.ts +52 -1
  43. package/packages/core/src/cli/binary.ts +5 -3
  44. package/packages/core/src/cli/build-control.ts +328 -66
  45. package/packages/core/src/cli/context.ts +268 -15
  46. package/packages/core/src/cli/dashboard/detail.ts +26 -2
  47. package/packages/core/src/cli/dashboard/facts.ts +40 -3
  48. package/packages/core/src/cli/dashboard/integration-detail.ts +7 -2
  49. package/packages/core/src/cli/dashboard/landing-display.ts +24 -3
  50. package/packages/core/src/cli/dashboard/model.ts +127 -33
  51. package/packages/core/src/cli/dashboard/objective-row.ts +189 -0
  52. package/packages/core/src/cli/dashboard/render.ts +49 -3
  53. package/packages/core/src/cli/dashboard/reopen-display.ts +39 -0
  54. package/packages/core/src/cli/dashboard/tree.ts +12 -1
  55. package/packages/core/src/cli/dispatch-frontend.ts +9 -1
  56. package/packages/core/src/cli/dispatch-launch-stop.ts +55 -0
  57. package/packages/core/src/cli/dispatch-launcher.ts +26 -44
  58. package/packages/core/src/cli/dispatch-repository-feed.ts +1 -1
  59. package/packages/core/src/cli/dispatch.ts +136 -5
  60. package/packages/core/src/cli/env.ts +42 -0
  61. package/packages/core/src/cli/help.ts +212 -11
  62. package/packages/core/src/cli/init-agent.ts +4 -1
  63. package/packages/core/src/cli/init-readiness-remote.ts +3 -2
  64. package/packages/core/src/cli/init-validation.ts +2 -2
  65. package/packages/core/src/cli/init.ts +3 -2
  66. package/packages/core/src/cli/judge-entry.ts +82 -0
  67. package/packages/core/src/cli/judge.ts +233 -0
  68. package/packages/core/src/cli/landings.ts +3 -2
  69. package/packages/core/src/cli/main.ts +412 -143
  70. package/packages/core/src/cli/measurement-text.ts +19 -0
  71. package/packages/core/src/cli/objective.ts +154 -0
  72. package/packages/core/src/cli/publication-settlement.ts +106 -22
  73. package/packages/core/src/cli/repo-lease.ts +1 -0
  74. package/packages/core/src/cli/repository-status.ts +179 -19
  75. package/packages/core/src/cli/status.ts +195 -17
  76. package/packages/core/src/cli/store-opening.ts +4 -0
  77. package/packages/core/src/cli/terminals.ts +205 -8
  78. package/packages/core/src/cli/ticket-start.ts +53 -0
  79. package/packages/core/src/cli/ticket.ts +68 -2
  80. package/packages/core/src/cli/upgrade-agent.ts +12 -8
  81. package/packages/core/src/cli/wait.ts +8 -2
  82. package/packages/core/src/cli/watch.ts +1325 -628
  83. package/packages/core/src/config/create-labels.ts +23 -0
  84. package/packages/core/src/config/live.ts +3 -0
  85. package/packages/core/src/config/load.ts +19 -0
  86. package/packages/core/src/config/pipeline-source.ts +1 -3
  87. package/packages/core/src/config/roles.ts +182 -73
  88. package/packages/core/src/config/schema.ts +226 -9
  89. package/packages/core/src/events/catalog.ts +41 -3
  90. package/packages/core/src/events/compatibility.ts +7 -1
  91. package/packages/core/src/events/payloads.ts +610 -1
  92. package/packages/core/src/events/policy.ts +62 -0
  93. package/packages/core/src/events/repository.ts +147 -21
  94. package/packages/core/src/kernel/__snapshots__/reducer-accumulator-shapes.json +1512 -199
  95. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/0ab2a90d0305dc9d.json.gz +0 -0
  96. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/10a4657408d4e121.json.gz +0 -0
  97. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/1152a2e97ee81728.json.gz +0 -0
  98. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/13ca84752c5f8b54.json.gz +0 -0
  99. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/1411d1cdbdd9911e.json.gz +0 -0
  100. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/1444fe1fa7fc802c.json.gz +0 -0
  101. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/1491ac0600349391.json.gz +0 -0
  102. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/1921f86f752428c9.json.gz +0 -0
  103. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/1972c1d66008ef6b.json.gz +0 -0
  104. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/19e8e43e7f3f1a06.json.gz +0 -0
  105. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/20a85c143c3e8164.json.gz +0 -0
  106. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/21ce2c0bf58318e1.json.gz +0 -0
  107. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/293dcb3a94fb3470.json.gz +0 -0
  108. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/2ab7436356267118.json.gz +0 -0
  109. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/2d084641735caaff.json.gz +0 -0
  110. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/3237bcecf68e5db9.json.gz +0 -0
  111. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/33d0cc593610e56f.json.gz +0 -0
  112. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/3451ed2136dcc356.json.gz +0 -0
  113. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/358ec8693f2237e6.json.gz +0 -0
  114. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/35cf9ccc4478b2d2.json.gz +0 -0
  115. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/3649e7bd1203f154.json.gz +0 -0
  116. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/378da6dece82202a.json.gz +0 -0
  117. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/38c75099d9191471.json.gz +0 -0
  118. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/398952f1f01db1a3.json.gz +0 -0
  119. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/3b64d352d56c9121.json.gz +0 -0
  120. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/3dc486226c05372d.json.gz +0 -0
  121. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/431c9bb2ee8838e0.json.gz +0 -0
  122. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/4400dffca929e2f0.json.gz +0 -0
  123. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/49064fc079964a5c.json.gz +0 -0
  124. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/4edded75f17742f4.json.gz +0 -0
  125. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/4f00c0f2c8afd159.json.gz +0 -0
  126. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/516a5a7aadf97587.json.gz +0 -0
  127. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/516dc6ea85d67cd7.json.gz +0 -0
  128. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/584e2ba74608e051.json.gz +0 -0
  129. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/59ffaa6974094c72.json.gz +0 -0
  130. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/5bb43afb121674c6.json.gz +0 -0
  131. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/5f0ca42af862c4ee.json.gz +0 -0
  132. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/6118031132db9bfc.json.gz +0 -0
  133. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/63107a8d58776b63.json.gz +0 -0
  134. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/63546b08d4d6fa11.json.gz +0 -0
  135. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/643d70429ce03dad.json.gz +0 -0
  136. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/677ea92572c29082.json.gz +0 -0
  137. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/6ae5bf60504d6467.json.gz +0 -0
  138. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/6efdc8defc75fccb.json.gz +0 -0
  139. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/71c53d33f09d8204.json.gz +0 -0
  140. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/7267ca2757cffba7.json.gz +0 -0
  141. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/76b7d4244082b3f9.json.gz +0 -0
  142. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/7749f918c6f10968.json.gz +0 -0
  143. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/7833e42d16301424.json.gz +0 -0
  144. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/7d4edad0614adaf1.json.gz +0 -0
  145. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/837365898d04f45a.json.gz +0 -0
  146. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/85f9f0c921b8b5bb.json.gz +0 -0
  147. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/8879f57a24733897.json.gz +0 -0
  148. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/88cb9e71bdec972d.json.gz +0 -0
  149. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/8a0cd6dd06cc155e.json.gz +0 -0
  150. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/8aa9ca8609dc051d.json.gz +0 -0
  151. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/8c8640255bd61658.json.gz +0 -0
  152. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/8cc15eb1807c0157.json.gz +0 -0
  153. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/8ced97c44bc0af3a.json.gz +0 -0
  154. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/8d4144004720b9f8.json.gz +0 -0
  155. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/8db633ead1807f8b.json.gz +0 -0
  156. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/8e42cdbd0994ab0c.json.gz +0 -0
  157. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/9011d0f6ff955ef9.json.gz +0 -0
  158. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/916ebc5433801c41.json.gz +0 -0
  159. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/9539b995af5c54a9.json.gz +0 -0
  160. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/95f391bfd7b7dbd7.json.gz +0 -0
  161. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/9613e8fa568a9281.json.gz +0 -0
  162. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/9a68f8753bd9038d.json.gz +0 -0
  163. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/9b25e58227080094.json.gz +0 -0
  164. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/9ee3919fbd4f9458.json.gz +0 -0
  165. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/a04a34cc2717147b.json.gz +0 -0
  166. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/a0b32c12e4e6edb6.json.gz +0 -0
  167. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/a55218252707bdd3.json.gz +0 -0
  168. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/a732fd08b31522a6.json.gz +0 -0
  169. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/a9d206a01f9039e5.json.gz +0 -0
  170. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/abf7fe3c92c82f2d.json.gz +0 -0
  171. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/ac928b04842c00db.json.gz +0 -0
  172. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/af953392d81911da.json.gz +0 -0
  173. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/b0d877c44810ecb0.json.gz +0 -0
  174. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/b0f7c6ebb2db57fc.json.gz +0 -0
  175. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/b905c22ec17eed31.json.gz +0 -0
  176. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/bce0c54e865f4b79.json.gz +0 -0
  177. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/c68b7ee2e2610f30.json.gz +0 -0
  178. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/c7f7e0378aeea237.json.gz +0 -0
  179. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/c98cb1659eb142b6.json.gz +0 -0
  180. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/ca830adf06ed55a1.json.gz +0 -0
  181. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/cb3a219f33e437ca.json.gz +0 -0
  182. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/cf1e0c0d82567e0c.json.gz +0 -0
  183. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/d008d86d9ff77b30.json.gz +0 -0
  184. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/d1432a819d8e48c5.json.gz +0 -0
  185. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/d185ed6aa9192aff.json.gz +0 -0
  186. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/d873fad29d6c7e55.json.gz +0 -0
  187. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/db84b12316e2da4a.json.gz +0 -0
  188. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/ddf6dc967d898767.json.gz +0 -0
  189. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/dfc64de6e7bfc0a0.json.gz +0 -0
  190. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/e2f18fa32fe1f6d0.json.gz +0 -0
  191. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/e37393fed29e84c5.json.gz +0 -0
  192. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/e6a8585e2a054ff6.json.gz +0 -0
  193. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/e7e9e327baca6903.json.gz +0 -0
  194. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/e86447af0571672c.json.gz +0 -0
  195. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/ea819202d22122e5.json.gz +0 -0
  196. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/eb4535585f2e84f6.json.gz +0 -0
  197. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/eb7ddd5319d09e27.json.gz +0 -0
  198. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/eca4959b2b87ae15.json.gz +0 -0
  199. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/ee10d7959ec4843c.json.gz +0 -0
  200. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/ef1b68347966ab26.json.gz +0 -0
  201. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/f3e55425cc41f230.json.gz +0 -0
  202. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/f40042c1cdb9fd43.json.gz +0 -0
  203. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/f48466215c790a3f.json.gz +0 -0
  204. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/f5b9ace9b59351e7.json.gz +0 -0
  205. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/fa8f1475a55be935.json.gz +0 -0
  206. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/fb21116a15d0b1f1.json.gz +0 -0
  207. package/packages/core/src/kernel/__snapshots__/reducer-identity-corpora/fe95444fbeabe592.json.gz +0 -0
  208. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/09bf0a1611d07363.json +984 -0
  209. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/10eac4988d66e161.json +1067 -0
  210. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/1a436b5fb45aee3e.json +1116 -0
  211. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/249db6f7a41f90e2.json +161 -0
  212. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/25dcb2fb6eaa83f4.json +858 -0
  213. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/2e1bdc763924616f.json +4932 -0
  214. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/30e9dabce3c4263d.json +399 -0
  215. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/4898ef339c68fa36.json +83 -0
  216. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/51816c0ffa62af6e.json +417 -0
  217. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/561bf45320062a44.json +83 -0
  218. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/5672d0233085d050.json +84 -0
  219. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/5e39f42cbdbf35ef.json +163 -0
  220. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/7771a7a2250f9964.json +868 -0
  221. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/881c491321bec99a.json +1074 -0
  222. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/965f25c3af1d2cdc.json +160 -0
  223. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/9b76d89da575ca90.json +20 -0
  224. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/9eb485320a72a9ff.json +233 -0
  225. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/a60448c01016135e.json +18 -0
  226. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/a6584fb61b6679bd.json +97 -0
  227. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/c88365c25b3186d3.json +543 -0
  228. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/e8f0481b23f90056.json +711 -0
  229. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/ee55782ed40ebbac.json +110 -0
  230. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/fc5082fac8167f3d.json +98 -0
  231. package/packages/core/src/kernel/__snapshots__/reducer-identity-records/fd55c329cfe921cc.json +1069 -0
  232. package/packages/core/src/kernel/attempt-creation-key.ts +20 -0
  233. package/packages/core/src/kernel/attempt-settlement.ts +125 -0
  234. package/packages/core/src/kernel/auto-merge-default.ts +1 -3
  235. package/packages/core/src/kernel/auto-merge.ts +34 -3
  236. package/packages/core/src/kernel/dispatch-capacity.ts +312 -38
  237. package/packages/core/src/kernel/dispatch-placement.ts +1 -1
  238. package/packages/core/src/kernel/dispatch-settings.ts +1 -4
  239. package/packages/core/src/kernel/dispatch-status.ts +3 -5
  240. package/packages/core/src/kernel/dispatch-upgrade.ts +1 -1
  241. package/packages/core/src/kernel/engine.ts +109 -13
  242. package/packages/core/src/kernel/forge-checks.ts +140 -0
  243. package/packages/core/src/kernel/forge-health.ts +2 -2
  244. package/packages/core/src/kernel/generated-files.ts +43 -0
  245. package/packages/core/src/kernel/generated-regeneration.ts +254 -0
  246. package/packages/core/src/kernel/generators/build-log.ts +30 -2
  247. package/packages/core/src/kernel/generators/optimization-log.ts +578 -0
  248. package/packages/core/src/kernel/generators/panel-log.ts +133 -0
  249. package/packages/core/src/kernel/generators/repository-journals.ts +18 -0
  250. package/packages/core/src/kernel/guarded-forge.ts +76 -11
  251. package/packages/core/src/kernel/harvest.ts +1 -4
  252. package/packages/core/src/kernel/head-paths.ts +4 -1
  253. package/packages/core/src/kernel/history-retention.ts +337 -0
  254. package/packages/core/src/kernel/incremental-fixtures.ts +6 -0
  255. package/packages/core/src/kernel/incremental.ts +14 -4
  256. package/packages/core/src/kernel/integration-landing.ts +64 -13
  257. package/packages/core/src/kernel/integration-stack.ts +123 -20
  258. package/packages/core/src/kernel/integration-state.ts +39 -2
  259. package/packages/core/src/kernel/janitor-failure.ts +2 -0
  260. package/packages/core/src/kernel/kernel-git.ts +1 -1
  261. package/packages/core/src/kernel/landing-measurement.ts +275 -0
  262. package/packages/core/src/kernel/landing-readiness.ts +2 -0
  263. package/packages/core/src/kernel/landing-state.ts +76 -1
  264. package/packages/core/src/kernel/leaf-restack-state.ts +17 -1
  265. package/packages/core/src/kernel/log-index-value.ts +2 -0
  266. package/packages/core/src/kernel/log-index.ts +81 -3
  267. package/packages/core/src/kernel/measurement.ts +406 -0
  268. package/packages/core/src/kernel/mixed-version.ts +6 -3
  269. package/packages/core/src/kernel/node-landing.ts +92 -18
  270. package/packages/core/src/kernel/node-restack-state.ts +27 -1
  271. package/packages/core/src/kernel/node-restack-transaction.ts +80 -23
  272. package/packages/core/src/kernel/node-verification-context.ts +14 -4
  273. package/packages/core/src/kernel/open-pr-backpressure-state.ts +24 -0
  274. package/packages/core/src/kernel/open-pr-backpressure.ts +133 -0
  275. package/packages/core/src/kernel/optimization-admission.ts +249 -0
  276. package/packages/core/src/kernel/optimization.ts +774 -0
  277. package/packages/core/src/kernel/panel.ts +225 -0
  278. package/packages/core/src/kernel/phases.ts +42 -6
  279. package/packages/core/src/kernel/pr-attachments.ts +4 -16
  280. package/packages/core/src/kernel/pr-summary.ts +2 -2
  281. package/packages/core/src/kernel/read-deferrals.ts +2 -2
  282. package/packages/core/src/kernel/read-facts.ts +69 -31
  283. package/packages/core/src/kernel/reconcile-restack.ts +352 -103
  284. package/packages/core/src/kernel/reducer-identity.ts +659 -0
  285. package/packages/core/src/kernel/reducer-registry.ts +37 -3
  286. package/packages/core/src/kernel/reducer-revisions.ts +50 -0
  287. package/packages/core/src/kernel/reducer.ts +208 -9
  288. package/packages/core/src/kernel/reopen-state.ts +48 -0
  289. package/packages/core/src/kernel/reopen.ts +143 -0
  290. package/packages/core/src/kernel/replay-retention.ts +208 -39
  291. package/packages/core/src/kernel/repository-attention.ts +1 -1
  292. package/packages/core/src/kernel/service-facts.ts +19 -7
  293. package/packages/core/src/kernel/terminal-guard.ts +13 -5
  294. package/packages/core/src/kernel/ticket-handbacks.ts +1 -1
  295. package/packages/core/src/kernel/ticket-migrations.ts +1 -1
  296. package/packages/core/src/kernel/ticket-preparation.ts +1 -1
  297. package/packages/core/src/kernel/ticket-source-health.ts +1 -1
  298. package/packages/core/src/kernel/ticket-starts.ts +118 -0
  299. package/packages/core/src/kernel/ticket-wait.ts +37 -2
  300. package/packages/core/src/kernel/verify-diff-base.ts +62 -0
  301. package/packages/core/src/kernel/verify-stage-state.ts +1 -0
  302. package/packages/core/src/kernel/verify-stages.ts +41 -1
  303. package/packages/core/src/objective.ts +532 -0
  304. package/packages/core/src/ontology.ts +49 -6
  305. package/packages/core/src/operator/annotations.ts +35 -4
  306. package/packages/core/src/operator/control.ts +2 -1
  307. package/packages/core/src/operator/index.ts +12 -0
  308. package/packages/core/src/operator/optimization.ts +307 -0
  309. package/packages/core/src/operator/protocol.ts +30 -1
  310. package/packages/core/src/operator/query.ts +15 -1
  311. package/packages/core/src/operator/registry.ts +219 -13
  312. package/packages/core/src/operator/requests.ts +25 -2
  313. package/packages/core/src/operator/ticket-start.ts +152 -0
  314. package/packages/core/src/operator/tickets.ts +3 -2
  315. package/packages/core/src/plugin-sdk/index.ts +9 -1
  316. package/packages/core/src/plugins/registry.ts +1 -0
  317. package/packages/core/src/ports/forge/contract.ts +9 -0
  318. package/packages/core/src/ports/forge/fake.ts +151 -10
  319. package/packages/core/src/ports/forge/git-rewrite.ts +38 -5
  320. package/packages/core/src/ports/forge/github-readiness.ts +1 -1
  321. package/packages/core/src/ports/forge/github-squash-message.ts +89 -0
  322. package/packages/core/src/ports/forge/github-transport.ts +186 -1
  323. package/packages/core/src/ports/forge/github.ts +846 -239
  324. package/packages/core/src/ports/forge/readiness.ts +15 -3
  325. package/packages/core/src/ports/forge-failure.ts +22 -0
  326. package/packages/core/src/ports/forge-request-context.ts +23 -1
  327. package/packages/core/src/ports/forge-telemetry.ts +16 -0
  328. package/packages/core/src/ports/runner/antigravity.ts +1071 -0
  329. package/packages/core/src/ports/runner/claude.ts +6 -1
  330. package/packages/core/src/ports/runner/codex.ts +11 -2
  331. package/packages/core/src/ports/runner/contract.ts +25 -1
  332. package/packages/core/src/ports/runner/fake.ts +2 -2
  333. package/packages/core/src/ports/runner/native-cli-fixture.ts +40 -5
  334. package/packages/core/src/ports/runner/native-process-fixture.ts +4 -1
  335. package/packages/core/src/ports/runner/pi.ts +23 -7
  336. package/packages/core/src/ports/runner/production.ts +19 -2
  337. package/packages/core/src/ports/runner/session-env.ts +65 -5
  338. package/packages/core/src/ports/runner/start-prompt.ts +6 -4
  339. package/packages/core/src/ports/tickets/contract.ts +4 -2
  340. package/packages/core/src/ports/tickets/github.ts +20 -5
  341. package/packages/core/src/ports/tickets/hosted-index.ts +6 -1
  342. package/packages/core/src/ports/tickets/labels.ts +21 -0
  343. package/packages/core/src/ports/tickets/linear.ts +33 -0
  344. package/packages/core/src/ports/tickets/migration.ts +2 -0
  345. package/packages/core/src/ports/tickets/priority.ts +11 -0
  346. package/packages/core/src/ports/tickets/remote-protocol.ts +71 -6
  347. package/packages/core/src/ports/tickets/remote.ts +138 -16
  348. package/packages/core/src/ports/tickets/tree.ts +17 -4
  349. package/packages/core/src/ports/types.ts +145 -7
  350. package/packages/core/src/ports/workspace/builtin-capabilities.ts +7 -4
  351. package/packages/core/src/ports/workspace/commit-preservation.ts +182 -64
  352. package/packages/core/src/ports/workspace/create.ts +3 -0
  353. package/packages/core/src/ports/workspace/git-worktree.ts +13 -1
  354. package/packages/core/src/ports/workspace/vercel-sandbox.ts +242 -61
  355. package/packages/core/src/processes/build-execution-state.ts +5 -6
  356. package/packages/core/src/processes/build-runner.ts +1435 -132
  357. package/packages/core/src/processes/dispatch-failure-budget.ts +1 -1
  358. package/packages/core/src/processes/dispatcher-selectors.ts +15 -13
  359. package/packages/core/src/processes/dispatcher.ts +2874 -266
  360. package/packages/core/src/processes/execution-no-progress.ts +38 -1
  361. package/packages/core/src/processes/execution-settlement.ts +2 -6
  362. package/packages/core/src/processes/harvest-execution-state.ts +2 -6
  363. package/packages/core/src/processes/harvest-runner.ts +7 -2
  364. package/packages/core/src/processes/hook-command.ts +125 -0
  365. package/packages/core/src/processes/hook-webhook.ts +144 -0
  366. package/packages/core/src/processes/hooks.ts +740 -0
  367. package/packages/core/src/processes/infrastructure-failure-budget.ts +1 -3
  368. package/packages/core/src/processes/judge-launcher.ts +38 -0
  369. package/packages/core/src/processes/measurement-runner.ts +235 -0
  370. package/packages/core/src/processes/optimization-merges.ts +101 -0
  371. package/packages/core/src/processes/optimization-stop.ts +179 -0
  372. package/packages/core/src/processes/panel-runner.ts +756 -0
  373. package/packages/core/src/processes/phase-failure-budget.ts +1 -0
  374. package/packages/core/src/processes/publication-state.ts +1 -4
  375. package/packages/core/src/processes/repo-view.ts +77 -5
  376. package/packages/core/src/processes/sandbox-state.ts +1 -4
  377. package/packages/core/src/processes/tick-state.ts +1 -3
  378. package/packages/core/src/processes/workspace-preservation.ts +67 -9
  379. package/packages/core/src/scenarios/harness.ts +19 -8
  380. package/packages/core/src/store/contract.ts +72 -0
  381. package/packages/core/src/store/digest.ts +89 -7
  382. package/packages/core/src/store/judge-authority.ts +161 -0
  383. package/packages/core/src/store/phase-session.ts +226 -4
  384. package/packages/core/src/store/reduced-reads.ts +10 -0
  385. package/packages/core/src/store/reducer-value-shapes.json +17254 -11861
  386. package/packages/core/src/store/remote/client.ts +12 -2
  387. package/packages/core/src/store/remote/credentials.ts +31 -1
  388. package/packages/core/src/store/remote/index.ts +8 -0
  389. package/packages/core/src/store/remote/protocol.ts +38 -0
  390. package/packages/core/src/store/remote/released-clients.json +22 -0
  391. package/packages/core/src/store/remote/released-reducer-values/1.10.0.json +34439 -0
  392. package/packages/core/src/store/remote/released-reducer-values/1.9.0.json +29475 -0
  393. package/packages/core/src/store/remote/released-reducer-values/index.ts +18 -14
  394. package/packages/core/src/store/remote/token.ts +13 -4
  395. package/packages/core/src/store/repo-state-events.ts +9 -8
  396. package/packages/core/src/store/retention.ts +16 -2
  397. package/packages/core/src/store/session-reducer.ts +1 -4
  398. package/packages/core/src/store/ticket-assets.ts +1 -3
  399. package/packages/core/src/store/types.ts +9 -0
  400. package/packages/core/src/testing/dispatch-read-budget.ts +70 -0
  401. package/packages/core/src/testing/git-config-isolation.ts +25 -0
  402. package/packages/core/src/testing/index.ts +14 -0
  403. package/packages/core/src/testing/reduced-read-budget.ts +3950 -54
  404. package/skills/code-review/SKILL.md +16 -0
  405. package/skills/finalize/SKILL.md +10 -4
  406. package/skills/guide/SKILL.md +464 -83
  407. package/skills/guide/references/integration-tree.md +102 -11
  408. package/skills/guide/references/merge-policy.md +70 -14
  409. package/skills/guide/references/migration-1.0.md +2 -1
  410. package/skills/guide/references/operator-api.md +128 -16
  411. package/skills/guide/references/optimization-nodes.md +1042 -0
  412. package/skills/guide/references/plugin-authoring.md +50 -13
  413. package/skills/guide/references/remote-store-protocol.md +46 -7
  414. package/skills/guide/references/remote-ticket-protocol.md +50 -2
  415. package/skills/guide/references/restacking.md +102 -10
  416. package/skills/guide/references/setup.md +16 -3
  417. package/skills/guide/references/spec-standard.md +2 -1
  418. package/skills/guide/references/ticket-dependencies.md +5 -0
  419. package/skills/guide/references/ticket-migration.md +4 -2
  420. package/skills/implement/SKILL.md +51 -1
  421. package/skills/judge/SKILL.md +43 -0
  422. package/skills/operate/SKILL.md +267 -32
  423. package/skills/plan/SKILL.md +18 -0
  424. package/skills/plan-review/SKILL.md +15 -1
  425. package/skills/propose/SKILL.md +121 -0
  426. package/skills/reconcile/SKILL.md +21 -2
  427. package/skills/spec/SKILL.md +30 -4
  428. package/skills/tickets/SKILL.md +44 -5
  429. package/templates/hosted-service/package.json +2 -2
@@ -6,7 +6,8 @@ forge, except that a GitHub source reads and writes the repository's issues.
6
6
  File, hosted and GitHub sources support import. Every built-in source supports
7
7
  export.
8
8
 
9
- 1. Pause intake and quiesce build-related ticket writes and other ticket writers
9
+ 1. Pause intake, cancel any pending `ab start` request (`ab repository status`
10
+ lists them), and quiesce build-related ticket writes and other ticket writers
10
11
  for the cutover. In-flight builds need not be aborted. Import preflight does
11
12
  not reserve numbers against concurrent writers.
12
13
  2. With the old `[tickets]` configuration, run `ab ticket export /path/to/export`.
@@ -134,7 +135,8 @@ Before any write, import reports every problem together: states that cannot be
134
135
  a rejected state when `[tickets].rejectedState` is unset, and ticket labels that
135
136
  would collide with a state label (`autobuild:<state>`) or an issue-link label
136
137
  (`autobuild-link:…`). The `autobuild:proposal` and `autobuild:aborted` marker
137
- labels are ordinary labels and import as-is. Node kinds become the exact `node`
138
+ labels are ordinary labels and import as-is. Import never adds
139
+ `[tickets].createLabels`: exported labels import exactly as they are. Node kinds become the exact `node`
138
140
  label, and targets become sub-issue relationships to the remapped node issues.
139
141
  Issue links are kept. They are rewritten through the mapping only when the export
140
142
  came from GitHub, because only then do they name the exported tickets.
@@ -12,6 +12,24 @@ order: 13
12
12
 
13
13
  A ticket source owns ticket CRUD, lifecycle transitions, claiming, labels, blockers and creation identity. The build's pinned spec, history, transcripts and artifacts live in the BuildStore; editing a ticket after claim doesn't replace the pinned spec. See [Tickets are the interface](tickets.md) for grooming and the ready gate.
14
14
 
15
+ ## Creation labels
16
+
17
+ `[tickets].createLabels` marks every ticket Autobuild files, so a shared tracker can tell them apart from reports people file:
18
+
19
+ ```toml
20
+ [tickets]
21
+ source = "github"
22
+ readyLabels = []
23
+ createLabels = ["autobuild"]
24
+ ```
25
+
26
+ - **Where.** `ab ticket create`, the operator `tickets.create` tool, harvest proposals and optimization attempts add the labels.
27
+ - **Union.** Labels a create names are kept, and the creation labels are added after them; they never replace each other. A harvest proposal carries `autobuild:proposal` plus the creation labels, including when a retried create adopts the ticket it already filed.
28
+ - **Import.** `ab ticket import` keeps the exported labels and never adds creation labels.
29
+ - **Not a ready gate.** Creation labels are ordinary labels and count toward `readyLabels` only if listed there too. A name in both lists makes every Autobuild-filed ticket pass the label gate. On `github` and `linear` an omitted `readyLabels` defaults to `["autobuild"]`, so pair `createLabels = ["autobuild"]` with an explicit `readyLabels`, as above.
30
+ - **Reserved names.** `github` refuses `autobuild:<state>` and `autobuild-link:` labels and `node`; `linear` refuses `node`. `[]` or omission adds none.
31
+ - **Hosted.** The service's own operator `tickets.create` applies the value from the published ticket policy, so it sees a change at the next publish: any non-delegated `ab` ticket command, `ab connect`, or dispatcher start. A service older than this field refuses a policy naming it.
32
+
15
33
  ## Shipped adapters
16
34
 
17
35
  Install with `bun add -d --exact @defrex/autobuild`. Examples are complete minimal `autobuild.toml` files. Credentials go in the dispatcher environment or an ignored `.env`, never TOML.
@@ -137,9 +155,9 @@ rejectedState = "rejected"
137
155
  - **States are `autobuild:` labels.** An open issue with one `autobuild:<state>` label is in that state, and an open issue with none is in triage, so issues filed on GitHub arrive there. An issue with two or more state labels is left out of listings with a diagnostic naming it and its labels. `ab ticket state create icebox --about "…"` creates the `autobuild:icebox` label, with the purpose as its description. A name is one to forty lowercase letters, digits or hyphens, starting with a letter.
138
156
  - **Closing reasons.** Closed as completed, or closed before GitHub recorded reasons, is done. Closed as not planned or duplicate is in the `rejectedState` state; without `rejectedState` it reads as a fixed `not-planned` state that is never ready, never resolves a blocker and can't be moved into. Moving to done or rejected closes the issue with that reason (an issue already closed with the other reason is reopened and closed again, because GitHub changes a reason only with the state); moving to any other state opens it with exactly that state's label.
139
157
  - **Reopen goes to triage.** If a state label survived the close, the adapter strips that stale label the first time it reads the reopened issue. It tells stale from fresh by the issue's last 100 label and reopen events; an issue whose deciding event is older than that is left out of listings with a diagnostic until its state label is removed and re-added.
140
- - **Labels.** `readyLabels` defaults to `["autobuild"]`; `[]` removes the gate. Missing labels are created on demand. State and link labels are never part of a ticket's labels, and a write that names one is refused. The `autobuild:proposal` and `autobuild:aborted` labels that harvest and abort apply are ordinary labels, so `proposal` and `aborted` can't be states.
158
+ - **Labels.** `readyLabels` defaults to `["autobuild"]`; `[]` removes the gate. Missing labels, [creation labels](#creation-labels) included, are created on demand. State and link labels are never part of a ticket's labels, and a write that names one is refused. The `autobuild:proposal` and `autobuild:aborted` labels that harvest and abort apply are ordinary labels, so `proposal` and `aborted` can't be states.
141
159
  - **Assignee.** `readyAssignee = "me"` keeps only issues assigned to the login that owns the GitHub credential; a username, including an Enterprise Managed User login such as `mona_acme`, names a specific user. The ready read itself is narrowed by assignee, an unassigned issue is never ready, and any one of several assignees matches. While `readyAssignee` is set, each scan reports open ready issues that carry every `readyLabels` entry but have no assignee in the ticket diagnostics, which `ab repository status` and the dashboards show, naming the ten lowest-numbered and counting the rest. The report never claims or assigns them; assigning one makes it claimable. `"me"` costs one `GET /user` per dispatcher start, never during a tick, so a reload that enables it needs no restart unless startup couldn't resolve the credential's owner.
142
- - **Assignees.** Tickets carry the issue's assignees as an `assignees` array of usernames in JSON reads, whether they were set on GitHub or through `ab`, and `ab ticket show` prints them. They aren't part of the ticket's `revision`. `--assignees` on `ab ticket create` and `ab ticket update`, and the `assignees` field of the operator `tickets.create` and `tickets.update` tools, set them: each entry is a username or `me`, at most ten entries counted before duplicates collapse, and an update replaces the whole set. `createAssignee = "me"` (or a username) assigns every ticket Autobuild creates, through `ab ticket create`, operator `tickets.create` and harvest proposals, unless the create names its own assignees; a harvest proposal goes to the owner of the filing dispatcher's credential. That pairs with `readyAssignee = "me"`, so each person's dispatcher picks up the tickets they file. A create or update fails, naming the cause and writing nothing, when `me` has no user behind the credential (a GitHub App installation token has none) or a user can't be assigned issues in the repository. GitHub silently drops assignees a token without push access sets, so a write whose assignees don't come back fails, naming the issue and saying it is unassigned; a retried harvest create adopts that issue and assigns it. A write naming assignees costs one check per user per process, `me` reuses the `readyAssignee` `GET /user`, and reads cost nothing extra.
160
+ - **Assignees.** Tickets carry the issue's assignees as an `assignees` array of usernames in JSON reads, whether they were set on GitHub or through `ab`, and `ab ticket show` prints them. They aren't part of the ticket's `revision`. `--assignees` on `ab ticket create` and `ab ticket update`, and the `assignees` field of the operator `tickets.create` and `tickets.update` tools, set them: each entry is a username or `me`, at most ten entries counted before duplicates collapse, and an update replaces the whole set. `createAssignee = "me"` (or a username) assigns every ticket Autobuild creates, through `ab ticket create`, operator `tickets.create` and harvest proposals, unless the create names its own assignees; a harvest proposal goes to the owner of the filing dispatcher's credential. That pairs with `readyAssignee = "me"`, so each person's dispatcher picks up the tickets they file. A create or update fails, naming the cause and writing nothing, when `me` has no user behind the credential (a GitHub App installation token has none) or a user can't be assigned issues in the repository. GitHub silently drops assignees a token without push access sets, so a write whose assignees don't come back fails, naming the issue and saying it is unassigned; a retried harvest create adopts that issue, assigns it and adds any requested labels it is missing. A write naming assignees costs one check per user per process, `me` reuses the `readyAssignee` `GET /user`, and reads cost nothing extra.
143
161
  - **Blockers** are native issue dependencies ("blocked by"), visible on both issues, including ones added on GitHub. A blocker resolves when its issue is done. One in another repository never resolves and is named in the dependency diagnostics. An issue transferred to another repository is no longer a ticket here: its old number reads as missing, so it is never written and never resolves a blocker.
144
162
  - **Issue links.** The ticket's own issue is always a `closes` link that can't be removed. Links to other issues are labels named `autobuild-link:<intent> #<n>`, such as `autobuild-link:refs #820`, so they show on the issue and survive edits on GitHub. Each linked issue and intent adds one repository label, which appears in GitHub's label picker; unused link labels are never deleted.
145
163
  - **Comments and assets.** Dispatcher notices post as issue comments, but tickets carry no comment history, so `ab ticket show` lists none; export and import read comment history explicitly. Assets live in the BuildStore, with the usual note left as an issue comment.
@@ -173,7 +191,7 @@ The `file`, `hosted` and `github` sources store [forge issue links](tickets.md#g
173
191
 
174
192
  ### Optional priority
175
193
 
176
- A ticket is `urgent` or `normal` (the default); the dispatcher claims urgent ready work first. The `file` and `hosted` sources store priority: as `priority = "urgent"` frontmatter with no key for normal (`file`), or transactional project data covered by the ticket revision (`hosted`, whose ready listing returns urgent tickets first). `linear` uses its native Urgent priority, described in its section above.
194
+ A ticket is `urgent` or `normal` (the default); the dispatcher claims urgent ready work first, ahead of normal builds waiting for a slot. The `file` and `hosted` sources store priority: as `priority = "urgent"` frontmatter with no key for normal (`file`), or transactional project data covered by the ticket revision (`hosted`, whose ready listing returns urgent tickets first). `linear` uses its native Urgent priority, described in its section above.
177
195
 
178
196
  ### Optional ticket tree
179
197
 
@@ -208,6 +226,8 @@ Declare `readyAssignee` only if `listReady` filters by `criteria.assignee`; with
208
226
 
209
227
  Declare `assignees` only if you store, return and verify ticket assignees; without it, a write naming assignees and a configured `createAssignee` are refused, naming your source. See the [optional assignees capability](plugin-authoring.md#optional-assignees-capability).
210
228
 
229
+ Labels need no capability: every source stores them. Callers union `[tickets].createLabels` into the draft's `labels` before `create`, so a draft's labels are always exact.
230
+
211
231
  Declare tree support only if you keep the [optional tree contract](plugin-authoring.md#optional-ticket-tree-capability) on the same port and harness: exhaustive pagination, canonical targets, revision coverage and atomic rejection.
212
232
 
213
233
  Native paging is an optional API 1.9 ticket-source capability:
@@ -228,15 +248,13 @@ Only paged operator listings select this capability. Sources without it retain
228
248
  the full-read fallback, which orders the listing before offset and limit: by
229
249
  default a stable urgent-first partition (urgent, then normal, each in source
230
250
  order), or for newest the reversed listing, which is newest filed first for
231
- sources that list in filing order (file, GitHub, Linear). The remote
232
- `HostedTicketSource` is the exception: the hosted list-ready protocol returns
233
- urgent tickets first and carries no filing time, so the client cannot see
234
- filing order, and its newest pages are reversed dispatch order whenever urgent
235
- tickets exist. Native errors propagate. Unpaged operator
236
- listings, CLI ticket lists and dispatcher ready scans remain exhaustive through
237
- `listReady`/`listAll`. The hosted PostgreSQL source counts matches without
238
- bodies and reads only the SQL-bounded window. File, Linear, GitHub and the remote
239
- `HostedTicketSource` retain fallback; the POST list-ready protocol stays exhaustive.
251
+ sources that list in filing order (file, GitHub, Linear). Native errors
252
+ propagate. Unpaged operator listings, CLI ticket lists and dispatcher ready
253
+ scans remain exhaustive through `listReady`/`listAll`. The hosted PostgreSQL
254
+ source counts matches without bodies and reads only the SQL-bounded window.
255
+ File, Linear and GitHub retain fallback; the remote `HostedTicketSource`
256
+ forwards pages to the service's native paging (`list-page`), falling back only
257
+ against a service predating it. The POST list-ready protocol stays exhaustive.
240
258
 
241
259
  Bounded state counts are another optional capability:
242
260
  `countStates?(names: readonly string[]): Promise<TicketStateCount[]>`. It returns
package/docs/tickets.md CHANGED
@@ -61,15 +61,17 @@ On the `github` source a ticket has assignees. `--assignees alice,me` on `ab tic
61
61
  bun ab ticket update 412 --assignees octocat
62
62
  ```
63
63
 
64
+ Set `[tickets].createLabels` to label every ticket Autobuild creates, including harvest proposals, so a shared tracker separates them from reports people file. `--labels` on create adds to them instead of replacing them, and `ab ticket import` never applies them. See [Creation labels](ticket-sources.md#creation-labels).
65
+
64
66
 
65
67
  ## Backlog and rejected
66
68
 
67
69
  Two optional lifecycle roles sit beside triage, ready, claimed and done:
68
70
 
69
71
  - **Backlog** holds work you deferred on purpose. Nothing dispatches from it.
70
- - **Rejected** holds work you considered and declined. A rejected ticket never unblocks the tickets it blocks, and a rejected child no longer holds its node open.
72
+ - **Rejected** holds work you considered and declined. A rejected ticket never unblocks the tickets it blocks, and a rejected child no longer holds its node open. The dispatcher moves a ticket here only when an optimization attempt ends without landing, including when you abort it.
71
73
 
72
- Both roles are recommended. Map each to a native state with `[tickets].backlogState` and `[tickets].rejectedState`; `ab init` writes `backlog` and `rejected` for the file, hosted and GitHub sources, and a Linear team might use `Icebox` and `Canceled`. With a key unset, that role doesn't exist. Your operator agent moves tickets by role, so it never needs your native names:
74
+ Both roles are recommended. Map each to a native state with `[tickets].backlogState` and `[tickets].rejectedState`; `ab init` writes `backlog` and `rejected` for the file, hosted and GitHub sources, and a Linear team might use `Icebox` and `Canceled`. With a key unset, that role doesn't exist, and an [optimization node](optimization-nodes.md) is refused at dispatch: it needs the rejected role for its rejected attempts. Your operator agent moves tickets by role, so it never needs your native names:
73
75
 
74
76
  ```sh
75
77
  bun ab ticket move AUT-12 --role backlog
@@ -79,12 +81,13 @@ Moving a ticket back to triage, backlog or ready restores ordinary behavior. "Bu
79
81
 
80
82
  ## Ready is a gate, not a guarantee
81
83
 
82
- The dispatcher claims only tickets in the ready state with the required labels and any source-specific filter. A ready ticket still waits on:
84
+ Ordinary intake claims only tickets in the ready state with the required labels and any source-specific listing filter, such as a ready assignee. A ticket named by `ab start` (`tickets.start`) must still be in the ready state, but those listing labels and the ready assignee are not applied to it. A ready ticket still waits on:
83
85
 
84
86
  - **Blockers.** Unresolved prerequisite tickets keep it queued; they don't create a blocked build. With nodes, prerequisites with builds must be present at the sampled destination; see [integration and blocker presence](integration-overview.md).
85
- - **Destination and capacity.** Its target must accept new work, and a capacity slot must be free and not reserved for an integration node awaiting verification, a finished build waiting to re-verify or reconcile, or a build resuming after its ticket wait ends; each of those is admitted before new claims.
87
+ - **Destination and capacity.** Its target must accept new work, and a capacity slot must be free and not reserved for an integration node awaiting verification, a finished build waiting to re-verify or reconcile, or a build resuming after its ticket wait ends; each of those is admitted before normal claims (see [slot admission order](dispatcher.md#slot-admission-order)). A pending `ab start` request reserves a slot ahead of the claims and parked work its tier outranks.
88
+ - **Open-PR backpressure.** When the repository configures `maxOpenPrs` and that many root build PRs are open and unmerged, the dispatcher pauses ordinary ready-queue normal-priority claims, even with a free slot, until the count drains to `resumeOpenPrs` (below `maxOpenPrs` when the two are equal). Urgent tickets bypass this gate, and so does every `ab start` tier, which still respects capacity and repository pause. See [`[policy]`](configuration.md#policy) for the thresholds.
86
89
 
87
- When a slot is free, the dispatcher takes urgent ready tickets first, then normal ones, each in the source's order. Priority changes only that order: a blocked urgent ticket waits like any other while normal work proceeds, and an urgent ticket never stops or pauses a running build. The web dashboard's Queue tab lists tickets in the same order and marks urgent ones `URGENT`; the mark shows priority, not that the ticket will dispatch next.
90
+ When a slot is free, the dispatcher takes urgent ready tickets first, then normal ones, each in the source's order. Urgent tickets also go ahead of normal builds waiting to re-verify, reconcile or resume, though not ahead of urgent ones. A claimed ticket's priority becomes its build's priority; to expedite a build that already exists, run `ab priority <slug> urgent`. Urgent tickets also bypass open-PR backpressure: a blocked urgent ticket waits like any other while normal work proceeds, and an urgent ticket never stops or pauses a running build. The web dashboard's Queue tab lists tickets in the same order and marks urgent ones `URGENT`; the mark shows priority, not that the ticket will dispatch next.
88
91
 
89
92
  Before ready filing, the agent checks `ab repository status --json`. With live
90
93
  `operator.registrations`, it records intent, rejected alternatives and out-of-scope
@@ -92,12 +95,18 @@ reasons in the ticket body, files, tells you the existing operator will pick it
92
95
  and stops without a watch. Otherwise it takes the operator role for the builds the repository's dispatcher dispatches.
93
96
  Your explicit instruction overrides either default; non-ready work needs no watch.
94
97
 
95
- At dispatch, Autobuild pins the spec, so later tracker edits don't change what reviewers approved. A deliberate revision goes through your operator agent answering an escalation, and restarts planning:
98
+ At dispatch, Autobuild pins the spec, so later tracker edits don't change what reviewers approved. Editing the ticket alone publishes nothing; a deliberate revision must be published explicitly, and restarts planning. For a blocked build, your operator agent publishes it while answering an escalation:
96
99
 
97
100
  ```sh
98
101
  bun ab answer <slug> --revise-spec-from-ticket
99
102
  ```
100
103
 
104
+ For a finished leaf that is waiting for its merge decision and not yet merged, reopen it with the revision instead; no escalation is needed, and the open PR is kept. Revising from the ticket also re-pins its assets. See [Send a finished build back](operating.md#send-a-finished-build-back):
105
+
106
+ ```sh
107
+ bun ab reopen <slug> --revise-spec-from-ticket
108
+ ```
109
+
101
110
 
102
111
  ## Work and node tickets
103
112
 
@@ -57,7 +57,8 @@ bun ab harvest status
57
57
  - **Ready state:** ticket in the exact ready state with every required label.
58
58
  - **Blockers and destination:** blockers done, target node open, required changes in the destination. A target node built by another dispatcher's store never opens here; see [several dispatchers](build-store.md#several-dispatchers-on-one-repository). `ab repository status` lists the queue diagnostics.
59
59
  - **Claims:** claimed tickets aren't reclaimed.
60
- - **Capacity:** paused unfinished work, and work blocked on a question, keeps its slot; builds waiting for a merge decision, builds waiting on other tickets, and idle collecting nodes take none. A finished build that must re-verify or reconcile, or a build whose ticket wait ended, reserves a slot ahead of new claims. Node verification and reconciliation account specially for descendants' slots.
60
+ - **Forge cooldown:** `forge landing/polling paused until <reset>` means a GitHub rate limit holds forge work until that reset, whether a request was refused or a successful response reported the quota exhausted. `forge rate limit <resource>` lines show the last observed quota and when it was seen.
61
+ - **Capacity:** paused unfinished work, and work blocked on a question, keeps its slot; builds waiting for a merge decision, builds waiting on other tickets, and idle collecting nodes take none. A finished build that must re-verify or reconcile, or a build whose ticket wait ended, reserves a slot ahead of normal claims; urgent work, including urgent ready tickets, goes first, and `ab priority <slug> urgent` expedites a waiting build. Node verification and reconciliation account specially for descendants' slots.
61
62
  - **Harvest:** check the acknowledged harvest gate and unclaimed observations. Harvest triggers at `policy.harvestThreshold` observations, or `policy.harvestMaxDrift` other merged builds since the oldest observation (zero disables drift), and uses no build slot.
62
63
 
63
64
  ## Authentication failures
@@ -68,7 +69,7 @@ bun ab harvest status
68
69
  |---|---|
69
70
  | Linear | `LINEAR_API_KEY`, team and workflow states, in the actual process environment or supported `.env` |
70
71
  | GitHub | `gh auth status` and repository permissions; test Git fetch and push separately. With `source = "github"` tickets, the same token needs Issues read and write |
71
- | Agent providers | The effective role's runtime: `codex login` when the Codex diagnostic asks; for Pi, provider login and the provider-qualified model |
72
+ | Agent providers | The effective role's runtime: `codex login` when the Codex diagnostic asks; for Pi, provider login and the provider-qualified model; for Antigravity, sign in with `agy` or check `GEMINI_API_KEY` and `modelProvider` |
72
73
  | Hosted store | `bun ab connect` for service, project and credential status |
73
74
 
74
75
  - **Provider refusals.** Fix permission, billing and quota failures on the provider side.
@@ -115,6 +115,17 @@ Path rules:
115
115
 
116
116
  After a reconcile, the `afterReconcile` policy applies before plan and path selection. By default it re-verifies; excluded steps are recorded as policy skips.
117
117
 
118
+ ## What a check command receives
119
+
120
+ A `check` command runs in the build's workspace with `AB_VERIFY_BASE` set to the commit verification compares against, the same base path applicability diffs from:
121
+
122
+ - **Leaf builds:** the branch-cut SHA, or the refreshed base after a completed reconcile or restack.
123
+ - **Integration nodes:** the integration cycle's parent.
124
+
125
+ Use it for checks that only make sense relative to the base, such as "this file changed, so that one must change too": `git diff --name-only "$AB_VERIFY_BASE" HEAD`.
126
+
127
+ The variable is absent outside a build, under a runtime that predates the variable, and for a leaf with no provisioned base. A check that needs it must handle its absence, by skipping that clause with a notice, for example, rather than assuming it is set. Checks that ignore it behave as before.
128
+
118
129
  ## Route the verifier role
119
130
 
120
131
  Agent steps route by step name, not skill name: [`[roles.acceptance]`](agent-runtimes.md#choosing-models) picks the agent for the `acceptance` step. Omitted `runtime` and `model` each inherit from the default role.
@@ -170,14 +181,15 @@ Autobuild's own chain: this repository's choices, not defaults.
170
181
  | 3 | unit | check | the in-memory test suite; a guard fails any test that does IO |
171
182
  | 4 | build | check | packs every publishable package and checks its contents, imports and bins; mandatory |
172
183
  | 5 | integration | check | every IO test (filesystem, processes, network, real time) plus database-backed suites and a packed hosted-service deploy rehearsal; runs concurrently with unit and build |
173
- | 6 | ui-tui | agent | captures terminal-dashboard frames and judges them |
174
- | 7 | ui-app | agent | captures operator web-app frames and judges them against the design |
175
- | 8 | ui-website | agent | captures site and docs frames at desktop and phone widths, compared with approved references |
176
- | 9 | docs | agent | fails when a `docs/` passage no longer matches the build's user-facing changes |
184
+ | 6 | app-load | check | mounts each operator web-app page's real client code in headless Chromium over fixture data; any uncaught exception or unhandled rejection fails, naming the page and error |
185
+ | 7 | ui-tui | agent | captures terminal-dashboard frames and judges them |
186
+ | 8 | ui-app | agent | captures operator web-app frames and judges them against the design; the capture first mounts each depicted page the same way |
187
+ | 9 | ui-website | agent | captures site and docs frames at desktop and phone widths, compared with approved references |
188
+ | 10 | docs | agent | fails when a `docs/` passage no longer matches the build's user-facing changes |
177
189
 
178
- Steps 5 to 9 are optional. Integration covers every package plus `tools/`, `scripts/` and `bin/`, and applies to every build because many of its tests check skills, docs and configuration. Steps 6 to 9 are path-scoped and run through repository skills `verify-ui-tui`, `verify-ui-app`, `verify-ui-website` and `verify-docs`. The docs step applies to product source, skills, templates, `SPEC.md`, `README.md` and `docs/`.
190
+ Steps 5 to 10 are optional. Integration covers every package plus `tools/`, `scripts/` and `bin/`, and applies to every build because many of its tests check skills, docs and configuration. Steps 6 to 10 are path-scoped. App-load is the step that catches a web-app page failing to load in a browser. Its paths cover every file the web app's client bundle reads: the app, the hosted service source, `packages/core/src/`, the capture tooling and the workspace manifests. A kernel-only diff that changes what the dashboard bundles still runs it, while docs-, skills- and website-only diffs skip it. Steps 7 to 10 run through repository skills `verify-ui-tui`, `verify-ui-app`, `verify-ui-website` and `verify-docs`. The docs step applies to product source, skills, templates, `SPEC.md`, `README.md` and `docs/`.
179
191
 
180
- A plan for a docs change like this page selects lint, types, unit, build, integration, ui-website and docs; both of the last two pass their path checks because they cover `docs/`. The untouched ui-tui and ui-app steps aren't selected.
192
+ A plan for a docs change like this page selects lint, types, unit, build, integration, ui-website and docs; both of the last two pass their path checks because they cover `docs/`. The untouched app-load, ui-tui and ui-app steps aren't selected.
181
193
 
182
194
  Grouped failures retain the legacy `feedback.verify` object for the first report
183
195
  in configured order. A decisive `verify.stage-failed` receipt carries the full
@@ -113,7 +113,7 @@ Sandbox preparation order:
113
113
  - **Runtimes.** Every primary and alternate runtime needs a pinned install and exact-version preflight, and gets only the credentials named in `environmentVariables`, except declared [accounts](configuration-overview.md#accounts), whose credentials remain on the host and are brokered by egress policy using guest placeholders.
114
114
  - **Repetition.** New sandboxes repeat provisioning and preflights rerun before each build-runner; keep setup idempotent.
115
115
  - **Validation.** `bun ab init --validate` runs named provisioning, setup, runtime and Store checks in a disposable environment, deletes it even on failure, and starts no build. For every declared account, including unused accounts, it runs a tool-free model probe through the account's runtime (Claude Code for Claude/Kimi, Codex for ChatGPT); these probes create no ordinary build phase or persistent agent session. Hosted ChatGPT, Claude and Kimi project secrets report readiness from write-only status metadata instead; the first hosted build is the live check.
116
- - **Lifetime.** `timeoutSeconds` bounds a sandbox; provider operations have their own timeouts. An intact sandbox resumes. Before replacement, the dispatcher fences it, preserves reachable unpublished commits to build-private refs, and records a receipt; the next workspace restores those commits. Loss is limited to already absent or unrecoverable work and uncommitted files; known loss appears in the next session's recovery context. See the [workspace recovery contract](architecture.md#key-boundaries).
116
+ - **Lifetime.** `timeoutSeconds` bounds a sandbox; provider operations have their own timeouts. An intact sandbox resumes. Before replacement, the dispatcher fences it, preserves reachable unpublished commits to build-private archive refs or, where the forge refuses them, BuildStore copies, and records a receipt; the next workspace restores those commits. Loss is limited to already absent or unrecoverable work and uncommitted files; known loss appears in the next session's recovery context. See the [workspace recovery contract](architecture.md#key-boundaries).
117
117
 
118
118
  ### Private repositories
119
119
 
@@ -150,3 +150,5 @@ The suite certifies only the basic working copy. Remote execution adds trusted s
150
150
 
151
151
  - Publication reports confirmed SHA and cache tips and supports the required guarded rewrites.
152
152
  - Store grants go through the host's `delegateCredential` callback; never serialize host tokens into execution identity.
153
+ - An optional `provisionEstimateMs` declares the expected wall time of one `provision`; a bounded dispatcher invocation does not start provisioning with less budget left.
154
+ - `provision` may receive `adoptAbandoned` when the previous attempt at the same generation was cut off by a recorded dispatcher teardown. Finish that environment in place only after verifying it; otherwise throw `WorkspaceCleanupRequired`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defrex/autobuild",
3
- "version": "1.8.1",
3
+ "version": "1.10.0",
4
4
  "description": "Agent-driven software delivery from groomed ticket to merged PR",
5
5
  "repository": {
6
6
  "type": "git",
@@ -126,6 +126,7 @@
126
126
  "dev:cli": "bun --hot --no-clear-screen bin/ab-dev.ts",
127
127
  "capture:dashboard": "bun tools/dashboard-capture.ts",
128
128
  "capture:web-dashboard": "bun packages/web-dashboard-capture/src/web-dashboard-capture.tsx",
129
+ "check:app-load": "bun packages/web-dashboard-capture/src/client-load.ts && AB_APP_LOAD_BROWSER_TEST=1 bun test packages/web-dashboard-capture/src/client-load.browser.integration.test.ts",
129
130
  "capture:website": "bun tools/website-capture.ts",
130
131
  "website:dev": "bun packages/website/src/dev.ts",
131
132
  "website:build": "bun packages/website/src/build.ts",
@@ -157,8 +158,8 @@
157
158
  },
158
159
  "devDependencies": {
159
160
  "@biomejs/biome": "2.5.5",
160
- "@defrex/autobuild-postgres-store": "1.8.1",
161
- "@defrex/autobuild-vercel-sandbox": "1.8.1",
161
+ "@defrex/autobuild-postgres-store": "1.10.0",
162
+ "@defrex/autobuild-vercel-sandbox": "1.10.0",
162
163
  "@resvg/resvg-js": "2.6.2",
163
164
  "@types/bun": "^1.3.14",
164
165
  "@types/node": "^24.0.0",
@@ -1,5 +1,5 @@
1
1
  import { createHash, randomBytes } from 'node:crypto'
2
- import { createRemoteJWKSet, jwtVerify, type JWTVerifyGetKey } from 'jose'
2
+ import type { JWTVerifyGetKey } from 'jose'
3
3
  import { chatgptStateSchema, earliestRefreshAt, type ChatGPTState } from './chatgpt-state'
4
4
 
5
5
  const issuer = 'https://auth.openai.com'
@@ -69,15 +69,17 @@ export function callback(t: OAuthTransaction, url: URL): { code: string; clientI
69
69
  throw failure()
70
70
  return { code, clientId }
71
71
  }
72
- const jwks = createRemoteJWKSet(new URL(`${issuer}/.well-known/jwks.json`), {
73
- timeoutDuration: 15000,
74
- })
72
+ let jwks: JWTVerifyGetKey | undefined
75
73
  export async function verifyIdentity(
76
74
  idToken: string,
77
75
  clientId: string,
78
76
  nonce?: string,
79
- keys: JWTVerifyGetKey = jwks,
77
+ keys?: JWTVerifyGetKey,
80
78
  ): Promise<string> {
79
+ const { createRemoteJWKSet, jwtVerify } = await import('jose')
80
+ keys ??= jwks ??= createRemoteJWKSet(new URL(`${issuer}/.well-known/jwks.json`), {
81
+ timeoutDuration: 15000,
82
+ })
81
83
  const { payload } = await jwtVerify(idToken, keys, {
82
84
  issuer,
83
85
  audience: clientId,
@@ -0,0 +1,103 @@
1
+ /**
2
+ * Optimization attempt resolution for the CLI (RFC 0005 §6.1, §6.2): whether
3
+ * a session's build is an in-flight attempt of an optimization node, and the
4
+ * harness paths its contribution touches.
5
+ *
6
+ * A build is an attempt exactly when it targets a node whose objective was
7
+ * accepted and its ticket was filed from one of that node's in-flight
8
+ * proposals. Proposal and child refs are compared through the recorded
9
+ * ticket-migration identity, as the dispatcher compares them, so a proposal
10
+ * recorded before a migration still matches a child dispatched after it.
11
+ */
12
+ import { compilePathSelectors } from '../config/path-selectors'
13
+ import { parseNulChangedPaths } from '../kernel/head-paths'
14
+ import {
15
+ optimizationAttempt,
16
+ type InFlightAttempt,
17
+ type OptimizationState,
18
+ } from '../kernel/optimization'
19
+ import type { BuildState } from '../kernel/reducer'
20
+ import { migrationIdentity } from '../kernel/ticket-migrations'
21
+ import type { TicketRef } from '../ontology'
22
+ import type { Exec } from '../ports/workspace/git-worktree'
23
+ import { readBuildFacts, readRepositoryFacts } from '../store/reduced-reads'
24
+ import type { BuildStore } from '../store/types'
25
+
26
+ export interface AttemptContext {
27
+ /** The node build's slug. */
28
+ node: string
29
+ attempt: InFlightAttempt
30
+ optimization: OptimizationState
31
+ }
32
+
33
+ export interface AttemptInput {
34
+ slug: string
35
+ state: BuildState
36
+ /** The build's `build.created` repository. */
37
+ repo: string
38
+ /** The build's `build.created` ticket. */
39
+ ticket: TicketRef
40
+ /** The configured ticket source, the migration destination. Loaded only
41
+ * once the node is known to be an optimization node. */
42
+ ticketSource: () => Promise<string>
43
+ }
44
+
45
+ /**
46
+ * The attempt `input.slug` is, or undefined. A build without a target reads
47
+ * nothing; any other build reads its node's served reduced value once, and
48
+ * only an optimization node adds one served repository value. Unresolvable
49
+ * migration continuity throws: an attempt is never silently treated as an
50
+ * ordinary build.
51
+ */
52
+ export async function readAttemptContext(
53
+ store: Pick<BuildStore, 'getReducerValue' | 'getRepo'>,
54
+ input: AttemptInput,
55
+ ): Promise<AttemptContext | undefined> {
56
+ const target = input.state.target
57
+ if (input.state.kind === 'node' || target === undefined) return undefined
58
+ const optimization = (await readBuildFacts(store, target.build)).value.state.optimization
59
+ if (optimization === undefined) return undefined
60
+ const migrations = (await readRepositoryFacts(store, input.repo)).value.ticketMigrations
61
+ const key = migrationIdentity(migrations, await input.ticketSource())
62
+ let attempt: InFlightAttempt | undefined
63
+ try {
64
+ attempt = optimizationAttempt(optimization, input.ticket, (ref) => key(ref, input.slug))
65
+ } catch (error) {
66
+ const detail = error instanceof Error ? error.message : String(error)
67
+ throw new Error(
68
+ `cannot resolve optimization attempt identity for build ${input.slug}: ${detail}`,
69
+ )
70
+ }
71
+ if (attempt === undefined) return undefined
72
+ return { node: target.build, attempt, optimization }
73
+ }
74
+
75
+ /** The sorted net contribution paths between `base` and `head` that the
76
+ * objective's harness selectors match. A reverted harness edit is absent. */
77
+ export async function harnessPathsTouched(
78
+ exec: Exec,
79
+ workspacePath: string,
80
+ base: string,
81
+ head: string,
82
+ harness: readonly string[],
83
+ ): Promise<string[]> {
84
+ const args = ['git', 'diff', '--no-renames', '--name-only', '-z', base, head, '--']
85
+ const result = await exec(args, { cwd: workspacePath })
86
+ if (result.exitCode !== 0)
87
+ throw new Error(
88
+ `${args.join(' ')} exited ${result.exitCode}: ` +
89
+ `${result.stderr.trim() || result.stdout.trim() || '(no output)'}`,
90
+ )
91
+ const matches = compilePathSelectors(harness)
92
+ return [...new Set(parseNulChangedPaths(result.stdout))].filter(matches).sort()
93
+ }
94
+
95
+ /** The `ab done` refusal for an attempt whose contribution changes its harness. */
96
+ export function harnessRejection(paths: readonly string[]): Error {
97
+ return new Error(
98
+ 'publication rejected: an optimization attempt must not change its harness ' +
99
+ "(the measurement's ruler):\n" +
100
+ paths.map((path) => ` ${path}`).join('\n') +
101
+ "\nRevert these paths to the contribution base, commit, then retry 'ab done'.",
102
+ )
103
+ }
@@ -9,6 +9,8 @@ import {
9
9
  type DeferralLedger,
10
10
  } from '../kernel/auto-merge'
11
11
  import { reduceBuild, type BuildState } from '../kernel/reducer'
12
+ import { actionableEscalations } from '../kernel/ticket-wait'
13
+ import { currentCiFailure } from '../kernel/forge-checks'
12
14
 
13
15
  export interface MergeDecision {
14
16
  type: 'build.merge-decision'
@@ -43,7 +45,8 @@ export function buildNeedsAttention(events: AbEvent[], state: BuildState): boole
43
45
  state.janitor?.attention === true ||
44
46
  !!state.targetRewrite ||
45
47
  (state.compatibility?.decisiveFacts ?? 0) > 0 ||
46
- (state.openEscalations?.length ?? 0) > 0 ||
48
+ actionableEscalations(state).length > 0 ||
49
+ currentCiFailure(state) !== undefined ||
47
50
  mergeDecision(events, new Date(0), state) !== null
48
51
  )
49
52
  }
@@ -62,9 +65,16 @@ export function repositoryNeedsAttention(event: RepositoryEvent): boolean {
62
65
  case 'dispatcher.runtime-rolled-back':
63
66
  case 'dispatcher.upgrade-failed':
64
67
  case 'dispatcher.kernel-git-unavailable':
68
+ case 'hook.failing':
69
+ case 'hook.recovered':
70
+ case 'hook.skipped':
65
71
  case 'forge.credential-limited':
66
72
  case 'ticket.handed-back':
73
+ case 'ticket.start-settled':
67
74
  return true
75
+ case 'dispatcher.forge-degraded':
76
+ // An episode's opening cooldown wakes once; its extensions are silent.
77
+ return event.payload.continued !== true
68
78
  case 'dispatcher.config-reloaded':
69
79
  return event.payload.restartRequired.length > 0
70
80
  case 'dispatcher.run-stopped':
@@ -12,8 +12,19 @@ import { join } from 'node:path'
12
12
  import { isSessionlessInvocation, runCli } from './main'
13
13
  import { createUpgradeAgentResolver } from './upgrade-agent'
14
14
  import { loadDotEnv } from './dotenv'
15
- import { MissingAmbientContextError, resolveCliEnv, resolveHarvestCliEnv } from './env'
15
+ import {
16
+ MissingAmbientContextError,
17
+ resolveCliEnv,
18
+ resolveHarvestCliEnv,
19
+ resolveJudgeCliEnv,
20
+ } from './env'
21
+ import { isRemoteStoreRef } from './repo-state'
22
+ import {
23
+ scopeLocalStoreToJudgeSession,
24
+ scopeRemoteStoreToJudgeSession,
25
+ } from '../store/phase-session'
16
26
  import { openProductionSessionStore } from './store-opening'
27
+ import { judgeAccountRedaction } from './judge'
17
28
  import { processTerminal, processTerminalInput } from './terminal'
18
29
  import type { TerminalRestoreProcess } from './terminal-restore'
19
30
  import type { DashboardRendererResolver } from './dashboard/render'
@@ -134,6 +145,46 @@ export async function runDirectBinary(
134
145
  }
135
146
  }
136
147
 
148
+ if (command === 'judge') {
149
+ let judgeEnv: ReturnType<typeof resolveJudgeCliEnv>
150
+ try {
151
+ judgeEnv = resolveJudgeCliEnv(process.env)
152
+ } catch (error) {
153
+ if (error instanceof MissingAmbientContextError) {
154
+ return runCli(argv, unscopedDeps)
155
+ }
156
+ console.error(error instanceof Error ? error.message : String(error))
157
+ return 1
158
+ }
159
+ const judgeRedact = judgeAccountRedaction(process.env)
160
+ // A local judge holds no store: its preference goes to its outbox.
161
+ if (judgeEnv.store === undefined)
162
+ return runCli(argv, {
163
+ ...unscopedDeps,
164
+ judgeEnv,
165
+ ...(judgeRedact !== undefined ? { judgeRedact } : {}),
166
+ })
167
+ // A judge's store handle appends its one preference and refuses every
168
+ // read; a remote server is the authority behind the same refusals. A
169
+ // local store path is never set by the runner; set by hand, it is guarded
170
+ // the same way.
171
+ const inner = openProductionStore(judgeEnv.store, judgeEnv.token)
172
+ const scope = {
173
+ build: judgeEnv.build,
174
+ panel: judgeEnv.panel,
175
+ judge: judgeEnv.judge,
176
+ session: judgeEnv.session,
177
+ }
178
+ const store = isRemoteStoreRef(judgeEnv.store)
179
+ ? scopeRemoteStoreToJudgeSession(inner, scope)
180
+ : scopeLocalStoreToJudgeSession(inner, scope)
181
+ try {
182
+ return await runCli(argv, { ...unscopedDeps, store, judgeEnv })
183
+ } finally {
184
+ await store.close()
185
+ }
186
+ }
187
+
137
188
  let cliEnv: ReturnType<typeof resolveCliEnv>
138
189
  try {
139
190
  cliEnv = resolveCliEnv(process.env)
@@ -1,10 +1,8 @@
1
- import { selectDispatchMode } from './dispatch-mode'
2
1
  import { spawnExec } from '../ports/workspace/git-worktree'
3
2
  import { join } from 'node:path'
4
3
  import type { DashboardRendererResolver } from './dashboard/render'
5
4
  import { loadDotEnv } from './dotenv'
6
5
  import { parseDispatchArgs } from './dispatch-args'
7
- import { launchDispatcher } from './dispatch-launcher'
8
6
  import { DISPATCH_GENERATION_ENV, DISPATCH_CONDITIONAL_ENV } from './dispatch-launch-contract'
9
7
  export {
10
8
  usesGenericSessionlessSigintHandler,
@@ -30,6 +28,7 @@ export async function runBinary(
30
28
  try {
31
29
  const args = parseDispatchArgs(argv.slice(1), process.env)
32
30
  if (!args.viewer && !args.once && !args.repository) {
31
+ const { selectDispatchMode } = await import('./dispatch-mode')
33
32
  const mode = await selectDispatchMode({
34
33
  ...args,
35
34
  targetRepo: process.cwd(),
@@ -37,7 +36,10 @@ export async function runBinary(
37
36
  exec: spawnExec,
38
37
  stderr: console.error,
39
38
  })
40
- if (!mode.viewer) return await launchDispatcher(argv)
39
+ if (!mode.viewer) {
40
+ const { launchDispatcher } = await import('./dispatch-launcher')
41
+ return await launchDispatcher(argv)
42
+ }
41
43
  const { runDirectBinary } = await import('./binary-direct')
42
44
  return runDirectBinary(
43
45
  [...argv, '--viewer', '--dispatched-by', mode.dispatchedBy!],