@wildo-ai/dev-companion 1.1.12 → 1.1.14

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 (313) hide show
  1. package/dist/esm/.tsbuildinfo +1 -1
  2. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.d.ts +21 -0
  3. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.d.ts.map +1 -1
  4. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.js +37 -4
  5. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.js.map +1 -1
  6. package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.d.ts.map +1 -1
  7. package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.js +9 -2
  8. package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.js.map +1 -1
  9. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.d.ts +66 -0
  10. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.d.ts.map +1 -1
  11. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.js +191 -13
  12. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.js.map +1 -1
  13. package/dist/esm/claude-cli/services/git-change-set.companion.service.d.ts +6 -2
  14. package/dist/esm/claude-cli/services/git-change-set.companion.service.d.ts.map +1 -1
  15. package/dist/esm/claude-cli/services/git-change-set.companion.service.js +16 -39
  16. package/dist/esm/claude-cli/services/git-change-set.companion.service.js.map +1 -1
  17. package/dist/esm/code-compliance-check/check-raw-feature-id-literals.companion.js +31 -2
  18. package/dist/esm/code-compliance-check/check-raw-feature-id-literals.companion.js.map +1 -1
  19. package/dist/esm/companion-api/companion-api.schemas.d.ts +2 -0
  20. package/dist/esm/companion-api/companion-api.schemas.d.ts.map +1 -1
  21. package/dist/esm/companion-api/companion-api.schemas.js +8 -0
  22. package/dist/esm/companion-api/companion-api.schemas.js.map +1 -1
  23. package/dist/esm/companion-api/controllers/companion.controller.d.ts +13 -0
  24. package/dist/esm/companion-api/controllers/companion.controller.d.ts.map +1 -1
  25. package/dist/esm/companion-api/controllers/companion.controller.js +39 -13
  26. package/dist/esm/companion-api/controllers/companion.controller.js.map +1 -1
  27. package/dist/esm/companion-api/controllers/long-held-request.companion.d.ts +17 -0
  28. package/dist/esm/companion-api/controllers/long-held-request.companion.d.ts.map +1 -0
  29. package/dist/esm/companion-api/controllers/long-held-request.companion.js +33 -0
  30. package/dist/esm/companion-api/controllers/long-held-request.companion.js.map +1 -0
  31. package/dist/esm/core/introspection/resources/creation-home-projection.companion.d.ts +9 -0
  32. package/dist/esm/core/introspection/resources/creation-home-projection.companion.d.ts.map +1 -1
  33. package/dist/esm/core/introspection/resources/creation-home-projection.companion.js +19 -0
  34. package/dist/esm/core/introspection/resources/creation-home-projection.companion.js.map +1 -1
  35. package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.d.ts.map +1 -1
  36. package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.js +7 -1
  37. package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.js.map +1 -1
  38. package/dist/esm/core/introspection/resources/launch-blockers.companion.d.ts +5 -1
  39. package/dist/esm/core/introspection/resources/launch-blockers.companion.d.ts.map +1 -1
  40. package/dist/esm/core/introspection/resources/launch-blockers.companion.js +37 -4
  41. package/dist/esm/core/introspection/resources/launch-blockers.companion.js.map +1 -1
  42. package/dist/esm/core/introspection/services/companion-introspection.companion.service.d.ts +14 -0
  43. package/dist/esm/core/introspection/services/companion-introspection.companion.service.d.ts.map +1 -1
  44. package/dist/esm/core/introspection/services/companion-introspection.companion.service.js +48 -0
  45. package/dist/esm/core/introspection/services/companion-introspection.companion.service.js.map +1 -1
  46. package/dist/esm/core/introspection/services/introspection-dependency-tree.companion.d.ts +128 -0
  47. package/dist/esm/core/introspection/services/introspection-dependency-tree.companion.d.ts.map +1 -0
  48. package/dist/esm/core/introspection/services/introspection-dependency-tree.companion.js +180 -0
  49. package/dist/esm/core/introspection/services/introspection-dependency-tree.companion.js.map +1 -0
  50. package/dist/esm/core/introspection/services/introspection-source-state.companion.service.d.ts +8 -20
  51. package/dist/esm/core/introspection/services/introspection-source-state.companion.service.d.ts.map +1 -1
  52. package/dist/esm/core/introspection/services/introspection-source-state.companion.service.js +37 -142
  53. package/dist/esm/core/introspection/services/introspection-source-state.companion.service.js.map +1 -1
  54. package/dist/esm/core/introspection/services/introspection-source-walk.worker.d.ts +64 -0
  55. package/dist/esm/core/introspection/services/introspection-source-walk.worker.d.ts.map +1 -0
  56. package/dist/esm/core/introspection/services/introspection-source-walk.worker.js +304 -0
  57. package/dist/esm/core/introspection/services/introspection-source-walk.worker.js.map +1 -0
  58. package/dist/esm/core/introspection/services/introspection-worker-pool.companion.d.ts +9 -0
  59. package/dist/esm/core/introspection/services/introspection-worker-pool.companion.d.ts.map +1 -1
  60. package/dist/esm/core/introspection/services/introspection-worker-pool.companion.js +25 -3
  61. package/dist/esm/core/introspection/services/introspection-worker-pool.companion.js.map +1 -1
  62. package/dist/esm/core/runtime/companion-language-model-route.d.ts +16 -1
  63. package/dist/esm/core/runtime/companion-language-model-route.d.ts.map +1 -1
  64. package/dist/esm/core/runtime/companion-language-model-route.js +23 -1
  65. package/dist/esm/core/runtime/companion-language-model-route.js.map +1 -1
  66. package/dist/esm/core/runtime/restart-drain.companion.d.ts +107 -0
  67. package/dist/esm/core/runtime/restart-drain.companion.d.ts.map +1 -0
  68. package/dist/esm/core/runtime/restart-drain.companion.js +237 -0
  69. package/dist/esm/core/runtime/restart-drain.companion.js.map +1 -0
  70. package/dist/esm/core/runtime/services/start-companion-application.service.d.ts.map +1 -1
  71. package/dist/esm/core/runtime/services/start-companion-application.service.js +3 -2
  72. package/dist/esm/core/runtime/services/start-companion-application.service.js.map +1 -1
  73. package/dist/esm/core/utils/git-read-broker.companion.d.ts +62 -0
  74. package/dist/esm/core/utils/git-read-broker.companion.d.ts.map +1 -0
  75. package/dist/esm/core/utils/git-read-broker.companion.js +282 -0
  76. package/dist/esm/core/utils/git-read-broker.companion.js.map +1 -0
  77. package/dist/esm/core/utils/local-write-recording.companion.d.ts +8 -1
  78. package/dist/esm/core/utils/local-write-recording.companion.d.ts.map +1 -1
  79. package/dist/esm/core/utils/local-write-recording.companion.js +7 -23
  80. package/dist/esm/core/utils/local-write-recording.companion.js.map +1 -1
  81. package/dist/esm/executions/services/companion-executions.companion.service.d.ts +18 -1
  82. package/dist/esm/executions/services/companion-executions.companion.service.d.ts.map +1 -1
  83. package/dist/esm/executions/services/companion-executions.companion.service.js +34 -8
  84. package/dist/esm/executions/services/companion-executions.companion.service.js.map +1 -1
  85. package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.en.d.ts +29 -0
  86. package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.en.d.ts.map +1 -0
  87. package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.en.js +29 -0
  88. package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.en.js.map +1 -0
  89. package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.fr.d.ts +29 -0
  90. package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.fr.d.ts.map +1 -0
  91. package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.fr.js +29 -0
  92. package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.fr.js.map +1 -0
  93. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.en.d.ts +1 -0
  94. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.en.d.ts.map +1 -1
  95. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.en.js +2 -1
  96. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.en.js.map +1 -1
  97. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.fr.d.ts +1 -0
  98. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.fr.d.ts.map +1 -1
  99. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.fr.js +2 -1
  100. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.fr.js.map +1 -1
  101. package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.en.d.ts +5 -2
  102. package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.en.d.ts.map +1 -1
  103. package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.en.js +5 -2
  104. package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.en.js.map +1 -1
  105. package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.fr.d.ts +5 -2
  106. package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.fr.d.ts.map +1 -1
  107. package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.fr.js +5 -2
  108. package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.fr.js.map +1 -1
  109. package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.en.d.ts +41 -0
  110. package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.en.d.ts.map +1 -0
  111. package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.en.js +41 -0
  112. package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.en.js.map +1 -0
  113. package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.fr.d.ts +41 -0
  114. package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.fr.d.ts.map +1 -0
  115. package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.fr.js +41 -0
  116. package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.fr.js.map +1 -0
  117. package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.en.d.ts +1 -0
  118. package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.en.d.ts.map +1 -1
  119. package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.en.js +2 -1
  120. package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.en.js.map +1 -1
  121. package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.fr.d.ts +1 -0
  122. package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.fr.d.ts.map +1 -1
  123. package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.fr.js +2 -1
  124. package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.fr.js.map +1 -1
  125. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.en.d.ts +1 -0
  126. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.en.d.ts.map +1 -1
  127. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.en.js +2 -1
  128. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.en.js.map +1 -1
  129. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.fr.d.ts +1 -0
  130. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.fr.d.ts.map +1 -1
  131. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.fr.js +2 -1
  132. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.fr.js.map +1 -1
  133. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.en.d.ts +1 -0
  134. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.en.d.ts.map +1 -1
  135. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.en.js +2 -1
  136. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.en.js.map +1 -1
  137. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.fr.d.ts +1 -0
  138. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.fr.d.ts.map +1 -1
  139. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.fr.js +2 -1
  140. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.fr.js.map +1 -1
  141. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.en.d.ts +2 -0
  142. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.en.d.ts.map +1 -1
  143. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.en.js +3 -1
  144. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.en.js.map +1 -1
  145. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.fr.d.ts +2 -0
  146. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.fr.d.ts.map +1 -1
  147. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.fr.js +3 -1
  148. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.fr.js.map +1 -1
  149. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_AUTH.en.d.ts +1 -1
  150. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_AUTH.en.js +1 -1
  151. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_AUTH.en.js.map +1 -1
  152. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_AUTH.fr.d.ts +1 -1
  153. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_AUTH.fr.js +1 -1
  154. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_AUTH.fr.js.map +1 -1
  155. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.en.d.ts +2 -0
  156. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.en.d.ts.map +1 -1
  157. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.en.js +3 -1
  158. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.en.js.map +1 -1
  159. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.fr.d.ts +3 -1
  160. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.fr.d.ts.map +1 -1
  161. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.fr.js +4 -2
  162. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.fr.js.map +1 -1
  163. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.en.d.ts +17 -0
  164. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.en.d.ts.map +1 -1
  165. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.en.js +18 -1
  166. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.en.js.map +1 -1
  167. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.fr.d.ts +17 -0
  168. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.fr.d.ts.map +1 -1
  169. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.fr.js +18 -1
  170. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.fr.js.map +1 -1
  171. package/dist/esm/i18n/composite_views/app.creation-conversation.fr.d.ts +206 -195
  172. package/dist/esm/i18n/composite_views/app.creation-conversation.fr.d.ts.map +1 -1
  173. package/dist/esm/i18n/composite_views/app.creation-conversation.fr.js +206 -195
  174. package/dist/esm/i18n/composite_views/app.creation-conversation.fr.js.map +1 -1
  175. package/dist/esm/i18n/composite_views/app.creation-dossier.fr.d.ts +10 -0
  176. package/dist/esm/i18n/composite_views/app.creation-dossier.fr.d.ts.map +1 -1
  177. package/dist/esm/i18n/composite_views/app.creation-dossier.fr.js +12 -2
  178. package/dist/esm/i18n/composite_views/app.creation-dossier.fr.js.map +1 -1
  179. package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.fr.d.ts +70 -0
  180. package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.fr.d.ts.map +1 -1
  181. package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.fr.js +70 -0
  182. package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.fr.js.map +1 -1
  183. package/dist/esm/i18n/resources/wildoApplicationActorTasks.fr.d.ts +12 -2
  184. package/dist/esm/i18n/resources/wildoApplicationActorTasks.fr.d.ts.map +1 -1
  185. package/dist/esm/i18n/resources/wildoApplicationActorTasks.fr.js +12 -2
  186. package/dist/esm/i18n/resources/wildoApplicationActorTasks.fr.js.map +1 -1
  187. package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.fr.d.ts +10 -0
  188. package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.fr.d.ts.map +1 -1
  189. package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.fr.js +10 -0
  190. package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.fr.js.map +1 -1
  191. package/dist/esm/i18n/resources/workbenchBuildDispatchPlan.fr.d.ts +25 -20
  192. package/dist/esm/i18n/resources/workbenchBuildDispatchPlan.fr.d.ts.map +1 -1
  193. package/dist/esm/i18n/resources/workbenchBuildDispatchPlan.fr.js +25 -20
  194. package/dist/esm/i18n/resources/workbenchBuildDispatchPlan.fr.js.map +1 -1
  195. package/dist/esm/i18n/resources/workbenchBuildPlanTasks.fr.d.ts +32 -32
  196. package/dist/esm/i18n/resources/workbenchBuildPlanTasks.fr.js +32 -32
  197. package/dist/esm/i18n/resources/workbenchBuildPlanTasks.fr.js.map +1 -1
  198. package/dist/esm/i18n/resources/workbenchBuildTaskRecords.fr.d.ts +65 -65
  199. package/dist/esm/i18n/resources/workbenchBuildTaskRecords.fr.js +65 -65
  200. package/dist/esm/i18n/resources/workbenchBuildTaskRecords.fr.js.map +1 -1
  201. package/dist/esm/i18n/resources/workbenchDossierEntries.fr.d.ts +20 -0
  202. package/dist/esm/i18n/resources/workbenchDossierEntries.fr.d.ts.map +1 -1
  203. package/dist/esm/i18n/resources/workbenchDossierEntries.fr.js +20 -0
  204. package/dist/esm/i18n/resources/workbenchDossierEntries.fr.js.map +1 -1
  205. package/dist/esm/i18n/resources/workbenchGovernanceQuestions.fr.d.ts +12 -0
  206. package/dist/esm/i18n/resources/workbenchGovernanceQuestions.fr.d.ts.map +1 -1
  207. package/dist/esm/i18n/resources/workbenchGovernanceQuestions.fr.js +13 -1
  208. package/dist/esm/i18n/resources/workbenchGovernanceQuestions.fr.js.map +1 -1
  209. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.d.ts +40 -0
  210. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.d.ts.map +1 -1
  211. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.js +13 -0
  212. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.js.map +1 -1
  213. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.fr.d.ts +40 -0
  214. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.fr.d.ts.map +1 -1
  215. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.fr.js +40 -0
  216. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.fr.js.map +1 -1
  217. package/dist/esm/i18n/system_enums/application-creation.en.d.ts +5 -0
  218. package/dist/esm/i18n/system_enums/application-creation.en.d.ts.map +1 -1
  219. package/dist/esm/i18n/system_enums/application-creation.en.js +6 -0
  220. package/dist/esm/i18n/system_enums/application-creation.en.js.map +1 -1
  221. package/dist/esm/i18n/system_enums/application-creation.fr.d.ts +175 -170
  222. package/dist/esm/i18n/system_enums/application-creation.fr.d.ts.map +1 -1
  223. package/dist/esm/i18n/system_enums/application-creation.fr.js +175 -170
  224. package/dist/esm/i18n/system_enums/application-creation.fr.js.map +1 -1
  225. package/dist/esm/i18n/system_enums/flows-actors.fr.d.ts +22 -22
  226. package/dist/esm/i18n/system_enums/flows-actors.fr.js +22 -22
  227. package/dist/esm/i18n/system_enums/flows-actors.fr.js.map +1 -1
  228. package/dist/esm/i18n/system_enums/run-records.fr.d.ts +21 -21
  229. package/dist/esm/i18n/system_enums/run-records.fr.js +21 -21
  230. package/dist/esm/i18n/system_enums/run-records.fr.js.map +1 -1
  231. package/dist/esm/i18n/system_enums/workbench-build.en.d.ts +3 -0
  232. package/dist/esm/i18n/system_enums/workbench-build.en.d.ts.map +1 -1
  233. package/dist/esm/i18n/system_enums/workbench-build.en.js +3 -0
  234. package/dist/esm/i18n/system_enums/workbench-build.en.js.map +1 -1
  235. package/dist/esm/i18n/system_enums/workbench-build.fr.d.ts +37 -33
  236. package/dist/esm/i18n/system_enums/workbench-build.fr.d.ts.map +1 -1
  237. package/dist/esm/i18n/system_enums/workbench-build.fr.js +37 -33
  238. package/dist/esm/i18n/system_enums/workbench-build.fr.js.map +1 -1
  239. package/dist/esm/i18n/system_enums/workbench-creation-home.en.d.ts +1 -0
  240. package/dist/esm/i18n/system_enums/workbench-creation-home.en.d.ts.map +1 -1
  241. package/dist/esm/i18n/system_enums/workbench-creation-home.en.js +1 -0
  242. package/dist/esm/i18n/system_enums/workbench-creation-home.en.js.map +1 -1
  243. package/dist/esm/i18n/system_enums/workbench-creation-home.fr.d.ts +18 -17
  244. package/dist/esm/i18n/system_enums/workbench-creation-home.fr.d.ts.map +1 -1
  245. package/dist/esm/i18n/system_enums/workbench-creation-home.fr.js +18 -17
  246. package/dist/esm/i18n/system_enums/workbench-creation-home.fr.js.map +1 -1
  247. package/dist/esm/i18n/system_enums/workbench-dossier.fr.d.ts +7 -5
  248. package/dist/esm/i18n/system_enums/workbench-dossier.fr.d.ts.map +1 -1
  249. package/dist/esm/i18n/system_enums/workbench-dossier.fr.js +8 -6
  250. package/dist/esm/i18n/system_enums/workbench-dossier.fr.js.map +1 -1
  251. package/dist/esm/i18n/system_enums/workbench-secrets.fr.d.ts +12 -12
  252. package/dist/esm/i18n/system_enums/workbench-secrets.fr.js +12 -12
  253. package/dist/esm/i18n/system_enums/workbench-secrets.fr.js.map +1 -1
  254. package/dist/esm/i18n/system_enums/workbench-specification-artifact.fr.d.ts +1 -0
  255. package/dist/esm/i18n/system_enums/workbench-specification-artifact.fr.d.ts.map +1 -1
  256. package/dist/esm/i18n/system_enums/workbench-specification-artifact.fr.js +2 -1
  257. package/dist/esm/i18n/system_enums/workbench-specification-artifact.fr.js.map +1 -1
  258. package/dist/esm/i18n-labelling/services/labelling-planner.companion.service.d.ts.map +1 -1
  259. package/dist/esm/i18n-labelling/services/labelling-planner.companion.service.js +3 -4
  260. package/dist/esm/i18n-labelling/services/labelling-planner.companion.service.js.map +1 -1
  261. package/dist/esm/i18n-labelling/utils/declared-refusal-codes.utils.d.ts +11 -0
  262. package/dist/esm/i18n-labelling/utils/declared-refusal-codes.utils.d.ts.map +1 -1
  263. package/dist/esm/i18n-labelling/utils/declared-refusal-codes.utils.js +21 -0
  264. package/dist/esm/i18n-labelling/utils/declared-refusal-codes.utils.js.map +1 -1
  265. package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.d.ts +5 -1
  266. package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.d.ts.map +1 -1
  267. package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.js +5 -1
  268. package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.js.map +1 -1
  269. package/dist/esm/meta-workflows/models/playbook-run-record.models.d.ts +12 -0
  270. package/dist/esm/meta-workflows/models/playbook-run-record.models.d.ts.map +1 -1
  271. package/dist/esm/meta-workflows/models/playbook-run-record.models.js +9 -0
  272. package/dist/esm/meta-workflows/models/playbook-run-record.models.js.map +1 -1
  273. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts +200 -20
  274. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts.map +1 -1
  275. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js +1107 -230
  276. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js.map +1 -1
  277. package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.d.ts +158 -16
  278. package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.d.ts.map +1 -1
  279. package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.js +381 -46
  280. package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.js.map +1 -1
  281. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.d.ts +58 -0
  282. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.d.ts.map +1 -1
  283. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.js +116 -2
  284. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.js.map +1 -1
  285. package/dist/esm/meta-workflows/services/application-build-landing-projection.companion.d.ts +3 -3
  286. package/dist/esm/meta-workflows/services/application-build-landing-projection.companion.js +3 -3
  287. package/dist/esm/meta-workflows/services/application-build-landing-projection.companion.js.map +1 -1
  288. package/dist/esm/meta-workflows/services/application-build-task-closure.companion.d.ts +9 -0
  289. package/dist/esm/meta-workflows/services/application-build-task-closure.companion.d.ts.map +1 -1
  290. package/dist/esm/meta-workflows/services/application-build-task-closure.companion.js +19 -0
  291. package/dist/esm/meta-workflows/services/application-build-task-closure.companion.js.map +1 -1
  292. package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.d.ts +12 -0
  293. package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.d.ts.map +1 -1
  294. package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.js +31 -7
  295. package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.js.map +1 -1
  296. package/dist/esm/meta-workflows/services/creation-intervention-ledger.companion.service.d.ts.map +1 -1
  297. package/dist/esm/meta-workflows/services/creation-intervention-ledger.companion.service.js +4 -5
  298. package/dist/esm/meta-workflows/services/creation-intervention-ledger.companion.service.js.map +1 -1
  299. package/dist/esm/meta-workflows/services/creation-run-report.companion.service.d.ts +2 -2
  300. package/dist/esm/meta-workflows/services/creation-run-report.companion.service.d.ts.map +1 -1
  301. package/dist/esm/meta-workflows/services/creation-run-report.companion.service.js +10 -8
  302. package/dist/esm/meta-workflows/services/creation-run-report.companion.service.js.map +1 -1
  303. package/dist/esm/meta-workflows/services/foundation-executor.companion.service.d.ts.map +1 -1
  304. package/dist/esm/meta-workflows/services/foundation-executor.companion.service.js +6 -3
  305. package/dist/esm/meta-workflows/services/foundation-executor.companion.service.js.map +1 -1
  306. package/dist/esm/meta-workflows/services/playbook-run-write-register-window.companion.d.ts.map +1 -1
  307. package/dist/esm/meta-workflows/services/playbook-run-write-register-window.companion.js +3 -5
  308. package/dist/esm/meta-workflows/services/playbook-run-write-register-window.companion.js.map +1 -1
  309. package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts +68 -3
  310. package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts.map +1 -1
  311. package/dist/esm/meta-workflows/services/playbook-run.companion.service.js +281 -69
  312. package/dist/esm/meta-workflows/services/playbook-run.companion.service.js.map +1 -1
  313. package/package.json +18 -18
@@ -46,6 +46,7 @@ import { readSpecificationsEvaluationFindings } from '../../core/context/compani
46
46
  import { loadSpecificationFamilyData } from '../../core/context/specification-family-data.companion.js';
47
47
  import { specificationFaultModules } from '../../core/context/specification-fault-modules.companion.js';
48
48
  import { waitForDevCompileQuiet } from '../../core/runtime/dev-compile-quiet.companion.js';
49
+ import { companionRestartDrain } from '../../core/runtime/restart-drain.companion.js';
49
50
  import { getWorkspaceMutationLockPath, loadConfig, loadInfraEnvConfig, loadSaasConfig, readBuildParallelism, WildoEnvironment, withDedicatedFileLock } from '@wildo-ai/platform-config-lib';
50
51
  import { CodingRunConcurrency, failedVerificationBesideSiblings } from '../../claude-cli/models/concurrent-coding-runs.models.js';
51
52
  import { CodingAgentDispatchCompanionService, } from '../../claude-cli/services/coding-agent-dispatch.companion.service.js';
@@ -63,18 +64,18 @@ import { CompanionExecutionsCompanionService } from '../../executions/services/c
63
64
  import { CompanionCreateActorExecutionRequestSchema, CompanionCreateActorTaskRequestSchema, CompanionExecutionsListQuerySchema, CompanionUpdateActorTaskRequestSchema } from '../../companion-api/companion-api.schemas.js';
64
65
  import { APPLICATION_CODING_SYSTEM_REF } from '../models/application-coding-agent.actors-system.definitions.js';
65
66
  import { isApplicationStartupFailure, readApplicationBootFailures, readUnavailableApplicationRuntimes, } from '../../core/runtime/application-runtime-liveness.companion.js';
66
- import { MAXIMUM_INTERFERENCE_REARMS, NothingToRearmError, readBuildTaskInterference, landedOverrideContextSource, readBuildTaskLandedOverride, readBuildTaskRearm, } from '../models/build-task-rearm.models.js';
67
+ import { MAXIMUM_INTERFERENCE_REARMS, NothingToRearmError, readBuildTaskInterference, landedOverrideContextSource, readBuildTaskLandedOverride, readBuildTaskRearm, withBuildTaskRearm, } from '../models/build-task-rearm.models.js';
67
68
  import { APPLICATION_BUILD_GENERATION_STEP_ACTOR_REF, APPLICATION_BUILD_SYSTEM_REF } from '../models/application-build.actors-system.definitions.js';
68
69
  import { APPLICATION_BUILD_DECISIONS_DOOR_ACTOR_REF, APPLICATION_BUILD_DECISIONS_SYSTEM_REF } from '../models/application-build-decisions.actors-system.definitions.js';
69
70
  import { readRecordedPlaybookSpend } from '../models/playbook-run-record.models.js';
70
- import { ApplicationBuildGenerationStep, ApplicationBuildGenerationStepCompanionService, ApplicationBuildGenerationStepLandedKind, readDesignSystemConfigImportsBrandDesign, signSchemaPlanInputs, generationStepCheckReadsSpecifications, generationStepReadsSpecifications, } from './application-build-generation-step.companion.service.js';
71
+ import { ApplicationBuildGenerationStep, ApplicationBuildGenerationStepCompanionService, ApplicationBuildGenerationStepLandedKind, readDesignSystemConfigImportsBrandDesign, signSchemaPlanInputs, generationStepCheckReadsSpecifications, generationStepReadsSpecifications, GenerationStepFailureOwner, readGenerationStepFailureOwner, } from './application-build-generation-step.companion.service.js';
71
72
  import { INSTALLED_SKILL_INDEX_RELATIVE_PATH, readApplicationCapabilityFacts, sliceSkillIndexForTask } from './build-task-brief-application-facts.companion.js';
72
73
  import { resolveAssemblyRepairCodingPolicy, resolveBuildPlanTaskCodingPolicy, BuildPlanTaskLandedProbeKind, buildPlanTaskLandedProbePaths, declarationsAppearAt, findAgentWorkShortfalls, findConfigurationShortfalls, findSystemOfRecordDeclarationShortfalls, systemOfRecordPartitionUnanswerable, isConfigurationProvenProduct, unreadableResourceConfigurationFor, relativeImportedFiles, applicationConfigurationDeclarationsOf, flowsActorsIndexImportedFiles, labelFileDeclaresKeys, labelPacksDeclareKeyPrefix, launcherShellIdentities, placementSubjectShellIdentity, ProductDeclarationRelation, productDerivedSkillRefs, resourceSchemaFilePath, schemaSourceDeclaresPersonalData, targetDerivedSkillRefs, resolveBuildTaskLandedProbes, buildPlanTaskLandedProbeWritablePaths, resolveBuildTaskLandingAdvisories, buildTaskProducesBillingCatalogue, BACKEND_BILLING_SWITCH_FILE, resolveUndraftableDocumentRef, settingsDestinationShellIdentity, shellModuleContributionFile, shellSurfaceConfigFile, websiteLabelPackPath, websiteSectionLabelFragmentPath, } from './application-build-task-coding-policy.companion.service.js';
73
74
  import { describeStaleFrontendLibrary, findStaleFrontendLibraryOutputs, readFrontendLibraryProgram } from './frontend-config-library-currency.companion.js';
74
75
  import { buildTaskDecisionsApplicationPath } from '../models/build-task-decisions-path.models.js';
75
76
  import { BuildTaskDecisionRefusedError, BuildTaskDecisionsStanding, resolveHonouredDecisionsBlob, followUpAwaitsReview, followUpsAwaitReviewUnder, parseBuildTaskDecisions, resolveClosedBuildTaskRefs, withBuildTaskDecision, } from './application-build-task-closure.companion.js';
76
77
  import { APPLICATION_CREATION_AUTONOMY_POSTURE } from '../models/playbook-run-checkpoint.models.js';
77
- import { chainFollowUpAfter, collectFollowUpGapsMetSince, collectOpenReportedGaps, followUpGapKey, FollowUpGapNotDerivedReason, HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX, deriveBuildPlanFollowUpTasks, } from './application-build-follow-up-derivation.companion.js';
78
+ import { chainFollowUpAfter, collectFollowUpGapsMetSince, collectOpenReportedGaps, followUpGapKey, followUpReportRefOf, FollowUpGapNotDerivedReason, HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX, targetKey as followUpScopeKey, deriveBuildPlanFollowUpTasks, assembleFollowUpDerivation, } from './application-build-follow-up-derivation.companion.js';
78
79
  import { resolveApplicationAssemblyCheckRefs } from './application-assembly-checks.companion.utils.js';
79
80
  import { BrandAssetPurpose, SpecificationModuleFaultReading, specificationModuleFaultsAreAVerdict, SpecificationUnavailableError, unguardedSpecifications } from '@wildo-ai/saas-specifications';
80
81
  import { hasAcceptedBrandMark } from '../../brand/models/accepted-brand-mark.models.js';
@@ -311,6 +312,69 @@ export function isCountedBuildTaskAttempt(attempt) {
311
312
  const BUILD_TASK_ATTEMPT_PAGE_CAP = 200;
312
313
  /** How long one listing of the latest completed coding runs serves the plan reads of a burst (#2496 review F8). */
313
314
  const LATEST_COMPLETED_CODING_RUNS_TTL_MS = 2_000;
315
+ /** The `coveredReports` of a task record (#3833): nothing for a task whose decision would cover no derived report. */
316
+ function coveredReportsOf(gaps) {
317
+ if (gaps.length === 0)
318
+ return {};
319
+ return { coveredReports: gaps.map((gap) => ({ ref: followUpReportRefOf(gap), originTaskRef: gap.originTaskRef, requirementRef: gap.requirementRef, missing: gap.missing })) };
320
+ }
321
+ /**
322
+ * Refuse a decision on a derived follow-up that would cover a report the person was not shown (#3833). A pending follow-up
323
+ * keeps absorbing reports, so one can join between the moment a person looks and the moment they decide: a decline would
324
+ * then close it unseen and, under GUIDED, an approval would let it run unreviewed. A decision is a person's statement, and
325
+ * looking again costs one read, so the door refuses and names what joined, rather than deciding on the part displayed
326
+ * (an intersection would record a decision the person did not take on a follow-up they did not see whole).
327
+ *
328
+ * `displayed` absent on a follow-up that covers reports: refused too, naming every report. A caller that does not say
329
+ * what it showed cannot prove it showed anything, and the door is where the check holds for every caller, not only for
330
+ * the CLI that sends it. A follow-up that covers nothing derived (its objective was not matched, so it covers its own
331
+ * report only) needs no refs. A displayed report the follow-up no longer carries (met since) is not a refusal: the
332
+ * decision covers less than was shown, never more.
333
+ */
334
+ function refuseFollowUpReportsNotDisplayed(taskRef, gaps, displayed) {
335
+ if (gaps.length === 0)
336
+ return;
337
+ if (displayed === undefined) {
338
+ throw new BuildTaskDecisionRefusedError(`${taskRef} covers ${gaps.length === 1 ? 'a reported gap' : `${gaps.length} reported gaps`}, and a decision on it must say which `
339
+ + `reports the person was shown: ${gaps.map((gap) => `${followUpReportRefOf(gap)} (${gap.missing})`).join('; ')}. `
340
+ + `Show them, then decide with --covers ${gaps.map((gap) => followUpReportRefOf(gap)).join(',')} (\`wildo build tasks\` lists them).`);
341
+ }
342
+ const shown = new Set(displayed);
343
+ const joined = gaps.filter((gap) => !shown.has(followUpReportRefOf(gap)));
344
+ if (joined.length === 0)
345
+ return;
346
+ throw new BuildTaskDecisionRefusedError(`${taskRef} now covers ${joined.length === 1 ? 'a report' : `${joined.length} reports`} you were not shown: `
347
+ + `${joined.map((gap) => `${followUpReportRefOf(gap)} (${gap.missing})`).join('; ')}. Look at it again (\`wildo build tasks\`) and decide on what it covers now.`);
348
+ }
349
+ /**
350
+ * Every reported gap a decision on a follow-up covers, for the door's reply (#3832): one per line, with the task that
351
+ * reported it, so a decision that took in a report the person had not seen yet says so. For a follow-up whose objective
352
+ * was not matched, says it covers its own report only; empty for any other task.
353
+ */
354
+ export function describeFollowUpDecisionCoverage(gaps, verb, taskRef) {
355
+ if (gaps.length === 0) {
356
+ // A follow-up whose objective was not matched is fixed to its own report: said, rather than left for the reader to infer.
357
+ return taskRef.startsWith(HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX) ? ` Its current objective could not be matched, so this decision ${verb} its own report only.` : '';
358
+ }
359
+ return ` This decision ${verb} ${gaps.length} reported gap${gaps.length === 1 ? '' : 's'}:`
360
+ + gaps.map((gap) => `\n- ${gap.requirementRef}, reported by ${gap.originTaskRef}: ${gap.missing}`).join('');
361
+ }
362
+ /** The reporting tasks a follow-up decision covers beyond its own, for the commit's one-line summary (#3832). */
363
+ export function describeFollowUpDecisionOrigins(gaps) {
364
+ const origins = [...new Set(gaps.map((gap) => gap.originTaskRef))];
365
+ return origins.length > 1 ? ` (covers the reports of ${origins.join(', ')})` : '';
366
+ }
367
+ /** How many derived follow-up objectives keep their carried gap keys for a dispatch to stamp (#3204): many plan reads' worth. */
368
+ const CARRIED_FOLLOW_UP_GAP_KEYS_RETAINED = 5_000;
369
+ /** The absorption inputs as a stable string, for the follow-up derivation's memo key (#3204). */
370
+ function describeAbsorptionInputs(absorption) {
371
+ if (absorption === undefined)
372
+ return null;
373
+ return JSON.stringify({
374
+ dispatched: [...absorption.dispatched].map(([taskRef, keys]) => [taskRef, [...keys].sort()]).sort(([left], [right]) => String(left).localeCompare(String(right))),
375
+ decided: [...absorption.decided].map(([taskRef, keys]) => [taskRef, [...keys].sort()]).sort(([left], [right]) => String(left).localeCompare(String(right))),
376
+ });
377
+ }
314
378
  /**
315
379
  * How far back the BUILD RECORD reads each coding system's runs (#2530): the record is every attempt at every task, and a
316
380
  * window of the newest 200 is not that. On a long build that window held only the latest runs, so an early task attempted
@@ -346,6 +410,7 @@ const BUILD_TASK_REASONS_THAT_ARE_PROGRESS = new Set([
346
410
  Workbench_BuildTaskStuckReason.IN_FLIGHT,
347
411
  Workbench_BuildTaskStuckReason.CONTENDED,
348
412
  Workbench_BuildTaskStuckReason.AWAITING_ISOLATED_RECHECK,
413
+ Workbench_BuildTaskStuckReason.RAN_THIS_WAVE,
349
414
  ]);
350
415
  /** How much of a failed check's output a retry is shown — enough for a compiler's first errors, not a log. */
351
416
  const PREVIOUS_ATTEMPT_OUTPUT_TAIL_CHARS = 2000;
@@ -361,7 +426,13 @@ export function projectBuildTaskAttempt(execution) {
361
426
  const unmetRequirements = Array.isArray(output?.unmetRequirements)
362
427
  ? output.unmetRequirements
363
428
  .filter((entry) => typeof entry?.requirementRef === 'string' && typeof entry.missing === 'string')
364
- .map((entry) => ({ requirementRef: entry.requirementRef, missing: entry.missing }))
429
+ .map((entry) => ({
430
+ requirementRef: entry.requirementRef,
431
+ missing: entry.missing,
432
+ // The owner or the decision the report named (#3886): the follow-up derivation acts on them.
433
+ ...(typeof entry.ownedByTaskRef === 'string' ? { ownedByTaskRef: entry.ownedByTaskRef } : {}),
434
+ ...(typeof entry.needsDecision === 'string' ? { needsDecision: entry.needsDecision } : {}),
435
+ }))
365
436
  : [];
366
437
  const metRequirements = Array.isArray(output?.metRequirements)
367
438
  ? output.metRequirements
@@ -401,7 +472,9 @@ export function projectBuildTaskAttempt(execution) {
401
472
  if (execution.systemRef !== APPLICATION_BUILD_SYSTEM_REF)
402
473
  return {};
403
474
  const generationStepSpend = readRecordedPlaybookSpend(task.output?.spend);
404
- return generationStepSpend ? { generationStepSpend } : {};
475
+ const recordedOwner = task.output?.failureOwner;
476
+ const failureOwner = Object.values(GenerationStepFailureOwner).includes(recordedOwner) ? recordedOwner : undefined;
477
+ return { ...(generationStepSpend ? { generationStepSpend } : {}), ...(failureOwner !== undefined ? { failureOwner } : {}) };
405
478
  })(),
406
479
  startedAt: execution.createdAt.toISOString(),
407
480
  ...readBuildAttemptDispatchInstants(task),
@@ -669,7 +742,11 @@ export var ApplicationBuildWaveStop;
669
742
  ApplicationBuildWaveStop["NOTHING_READY"] = "nothing-ready";
670
743
  /** The call reached its dispatch cap; the next call continues. */
671
744
  ApplicationBuildWaveStop["DISPATCH_CAP"] = "dispatch-cap";
672
- /** The next ready task is a generation step this call already ran, and its landing is still unmet. */
745
+ /**
746
+ * The selection offered a generation step this wave had already run. It should be unreachable: since #3885 the selection
747
+ * passes over such a step (`ran_this_wave`) and the slots keep filling. It is kept as a backstop, because the fill's
748
+ * termination rests on that pass-over; without it a step whose landing stays unmet would be selected again forever.
749
+ */
673
750
  ApplicationBuildWaveStop["GENERATION_STEP_REPEATED"] = "generation-step-repeated";
674
751
  /** An admission was refused; the refusal is on the dispatch entry. */
675
752
  ApplicationBuildWaveStop["DISPATCH_REFUSED"] = "dispatch-refused";
@@ -693,6 +770,13 @@ export var ApplicationBuildWaveStop;
693
770
  * ends as any wave does (reconciliation, repairs). The next `wildo build run` starts a new wave.
694
771
  */
695
772
  ApplicationBuildWaveStop["STOP_REQUESTED"] = "stop-requested";
773
+ /**
774
+ * The dev supervisor is HOLDING a restart of this companion (#3204): a dependency install or an engine rebuild needs a
775
+ * fresh process, and the supervisor waits for the work in flight. The wave starts nothing more and drains what is live,
776
+ * as for `STOP_REQUESTED`, so the restart comes once the runs have settled instead of killing them at the hold's ceiling
777
+ * (reference run 43237839187: nine coding runs, at 15:43). The next wave, in the restarted companion, continues.
778
+ */
779
+ ApplicationBuildWaveStop["RESTART_PENDING"] = "restart-pending";
696
780
  /**
697
781
  * A verification check cannot be asked for a host cause (#3423, #3432): a command not on PATH, one lacking the verb, the
698
782
  * same failure on two tasks. Every task's check would fail the same way, so the companion admits no coding turn until
@@ -701,6 +785,19 @@ export var ApplicationBuildWaveStop;
701
785
  */
702
786
  ApplicationBuildWaveStop["VERIFICATION_TOOL_UNAVAILABLE"] = "verification-tool-unavailable";
703
787
  })(ApplicationBuildWaveStop || (ApplicationBuildWaveStop = {}));
788
+ /**
789
+ * The stops a slot still PREPARING must honour before it admits its run (#3883 review F4): the wave prepares several slots
790
+ * at once, so one of these can arrive while a sibling composes its brief. Not the usage limit (a coding slot reads that hold
791
+ * itself, and a generation step still runs under it, #2388 review F8d), not the cap (the launcher counts the slots being
792
+ * prepared), and not the backstop for a repeated step (it says nothing about the other slots' tasks).
793
+ */
794
+ const SLOT_ABANDONING_STOPS = new Set([
795
+ ApplicationBuildWaveStop.STOP_REQUESTED,
796
+ ApplicationBuildWaveStop.RESTART_PENDING,
797
+ ApplicationBuildWaveStop.DISPATCH_REFUSED,
798
+ ApplicationBuildWaveStop.VERIFICATION_TOOL_UNAVAILABLE,
799
+ ApplicationBuildWaveStop.APPLICATION_DOES_NOT_BOOT,
800
+ ]);
704
801
  /**
705
802
  * The next-task doors' refusal while the application's backend does not start (#2405). A CONFLICT: the request is
706
803
  * valid, the application's state forbids it, and the message names the refusal and the repair.
@@ -751,6 +848,12 @@ export function describeBuildWaveHoldsForSelector(wave) {
751
848
  : 'The application\'s backend does not start, and no task broke it (the dev stack or the infrastructure did): no ordinary task is '
752
849
  + 'dispatched until it starts. Stop selecting build waves; each failure\'s `remedy` names the repair, which is the person\'s, not a task\'s.',
753
850
  } : {}),
851
+ ...(wave.stoppedFillingBecause === ApplicationBuildWaveStop.RESTART_PENDING ? {
852
+ restartPending: {
853
+ guidance: 'The dev supervisor is restarting the companion (a dependency install or an engine rebuild needs a fresh process): '
854
+ + 'this wave started nothing more so its runs could settle first. Keep the build lane: the next wave continues after the restart.',
855
+ },
856
+ } : {}),
754
857
  ...(stoppedByPerson ? {
755
858
  stoppedByPerson: {
756
859
  guidance: 'A person stopped the build with `wildo build stop`. Do not select build waves: they are refused until a person runs '
@@ -948,10 +1051,62 @@ function describeUnanswerableGenerationStepLanding(task) {
948
1051
  return `${subject} whether it has already landed could not be checked (\`wildo build tasks --json\` shows the step's record).`;
949
1052
  }
950
1053
  }
951
- /** The newest attempt of every task from a per-task attempt list sorted newest first, as the records build it. */
952
- function latestGenerationStepAttemptsOf(attemptsByTask) {
953
- return new Map([...attemptsByTask].flatMap(([taskRef, attempts]) => (attempts[0] === undefined ? [] : [[taskRef, attempts[0]]])));
1054
+ /**
1055
+ * What makes two failures of a generation step THE SAME failure (#3709): the failure text with what changes between two
1056
+ * runs of one cause taken out — an instant, a run or row id, a duration. `undefined` for a failure that recorded no text,
1057
+ * which never matches anything: a step is held only on a POSITIVE match, as a choreography lane is (596611bf2).
1058
+ *
1059
+ * Counts are kept on purpose. "6 authored example(s) do not match" and "5 … do not match" are progress, and reading them
1060
+ * as one failure would hold a step that is being repaired one example at a time.
1061
+ *
1062
+ * Rejected: compare the text exactly. A step's message can carry the instant it failed or the id of the run it read
1063
+ * (a labels unit's model call, a lock holder), so two runs of one cause would never match and the hold would never fire.
1064
+ */
1065
+ export function generationStepFailureFingerprint(failure) {
1066
+ if (failure === undefined)
1067
+ return undefined;
1068
+ const fingerprint = failure
1069
+ .replace(/\b\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:?\d{2})?/gu, '<instant>')
1070
+ .replace(/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/giu, '<id>')
1071
+ .replace(/\b[0-9a-f]{12,}\b/giu, '<id>')
1072
+ .replace(/\b\d+(?:\.\d+)?\s?(?:ms|milliseconds?|s|seconds?|min|minutes?)\b/gu, '<duration>')
1073
+ .replace(/\s+/gu, ' ')
1074
+ .trim();
1075
+ return fingerprint === '' ? undefined : fingerprint;
954
1076
  }
1077
+ /**
1078
+ * How many of a step's latest runs, newest first, FAILED with the same failure and were not re-armed (#3709): 0 when the
1079
+ * newest did not fail, or failed with no text to compare. The count stops at the first run that differs.
1080
+ */
1081
+ export function countConsecutiveIdenticalGenerationStepFailures(attemptsNewestFirst) {
1082
+ const newest = attemptsNewestFirst[0];
1083
+ const fingerprint = newest?.status === FlowsActors_Status.FAILED && newest.rearm === undefined ? generationStepFailureFingerprint(newest.error) : undefined;
1084
+ if (fingerprint === undefined)
1085
+ return 0;
1086
+ let count = 0;
1087
+ for (const attempt of attemptsNewestFirst) {
1088
+ if (attempt.status !== FlowsActors_Status.FAILED || attempt.rearm !== undefined || generationStepFailureFingerprint(attempt.error) !== fingerprint)
1089
+ break;
1090
+ count += 1;
1091
+ }
1092
+ return count;
1093
+ }
1094
+ /**
1095
+ * What a FAILED generation step's row records beside the engine's failure: what its model calls spent (#2232), and who can
1096
+ * fix the cause when the step could tell (#3709), which the selection holds a framework-owned failure on. `null` for
1097
+ * neither, so the row carries the failure alone.
1098
+ */
1099
+ export function recordBesideGenerationStepFailure(spend, error) {
1100
+ const failureOwner = readGenerationStepFailureOwner(error);
1101
+ const beside = { ...(spend ? { spend } : {}), ...(failureOwner !== undefined ? { failureOwner } : {}) };
1102
+ return Object.keys(beside).length > 0 ? beside : null;
1103
+ }
1104
+ /**
1105
+ * The identical failures, in a row, after which a generation step is withheld (#3709): TWO, the choreography's number.
1106
+ * One more run after a first failure is allowed, because a sibling's landing may have changed what the step reads; an
1107
+ * identical second failure over unchanged inputs says it did not.
1108
+ */
1109
+ export const GENERATION_STEP_IDENTICAL_FAILURES_WITHHELD_AFTER = 2;
955
1110
  /**
956
1111
  * The sentence a decision door adds when HEAD's decisions bytes were not honoured (review of 8d6b95d29): the decision was
957
1112
  * added to the newest decisions a person's door recorded, or, when there are none, the file was REPLACED.
@@ -1245,8 +1400,11 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
1245
1400
  landingKeyRead;
1246
1401
  /** How many landing-key reads have started; see {@link readLandingSourceKey}. */
1247
1402
  landingKeyReadSequence = 0;
1248
- /** The slot a running wave is filling now, while it prepares the dispatch (#3206); see `application-build-dispatch-preparation`. */
1249
- currentBuildPreparation;
1403
+ /**
1404
+ * The slots being prepared right now (#3206), oldest first: a wave prepares several at once since #3883. Built on first use,
1405
+ * because some harnesses build this service through its prototype and skip field initializers.
1406
+ */
1407
+ openBuildPreparations;
1250
1408
  /** The last preparation that ended, with each step's duration. */
1251
1409
  lastBuildPreparation;
1252
1410
  /** When `wildo build stop` asked the running wave to stop (#3206); cleared when the wave ends. */
@@ -2168,7 +2326,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2168
2326
  return openedStep;
2169
2327
  }
2170
2328
  // Announced by the coding service itself when it opens the PENDING execution.
2171
- return this.dispatch.openSelectedApplicationCodingExecution(prepared.contract, session, origin, mode);
2329
+ return this.dispatch.openSelectedApplicationCodingExecution(prepared.contract, session, this.withCarriedFollowUpGaps(prepared, origin), mode);
2172
2330
  }
2173
2331
  /** The execution a generation step is: one task of the build system's programmatic actor. */
2174
2332
  buildGenerationStepExecutionRequest(prepared, session, origin) {
@@ -2202,6 +2360,8 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2202
2360
  mode = CodingRunConcurrency.SINGLE_FLIGHT,
2203
2361
  /** Already opened by {@link openPreparedBuildTask}; opened here otherwise. */
2204
2362
  opened) {
2363
+ // A follow-up's run records the gaps its objective carried (#3204), at the open and again at admission.
2364
+ origin = this.withCarriedFollowUpGaps(prepared, origin);
2205
2365
  if (prepared.kind === 'GENERATION_STEP') {
2206
2366
  this.logDebug('Running a companion generation step', {
2207
2367
  taskRef: prepared.plan.taskRef,
@@ -2243,10 +2403,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2243
2403
  taskOutput: { generationStepRef: result.generationStepRef, evidencePaths: result.evidencePaths, spend: result.spend },
2244
2404
  }),
2245
2405
  // A failed run spent money too — also when the step itself succeeded and what followed it threw.
2246
- recordBesideFailure: () => {
2247
- const spend = this.generationSteps.spentByGenerationStep(prepared.task);
2248
- return spend ? { spend } : null;
2249
- },
2406
+ recordBesideFailure: (error) => recordBesideGenerationStepFailure(this.generationSteps.spentByGenerationStep(prepared.task), error),
2250
2407
  }).finally(() => this.dispatch.announceRunStateChanged());
2251
2408
  return { plan: prepared.plan, generationStep };
2252
2409
  }
@@ -2341,7 +2498,8 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2341
2498
  * `interference` memory entry).
2342
2499
  *
2343
2500
  * Bounded per call: at most {@link WAVE_DISPATCHES_PER_DEGREE} dispatches per slot, and a generation
2344
- * step at most once — a step whose landing stays unmet would otherwise be re-selected forever. The
2501
+ * step at most once — a step whose landing stays unmet is passed over as `ran_this_wave` for the rest of the call,
2502
+ * and the slots keep filling with the ready coding tasks (#3885). The
2345
2503
  * interference re-runs are outside that cap, bounded per task by `MAXIMUM_INTERFERENCE_REARMS` and at most
2346
2504
  * one per completed run of this wave. The next call continues from wherever the build stands.
2347
2505
  *
@@ -2353,12 +2511,16 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2353
2511
  this.assertNoBuildWaveInFlight();
2354
2512
  this.liveWaveStartedAt = new Date().toISOString();
2355
2513
  try {
2356
- return await this.runBuildWave(session);
2514
+ // Leaf work for the restart drain (#3204): no drained marker while a wave runs.
2515
+ const saasRoot = this.companionContext?.saasRoot;
2516
+ return saasRoot === undefined
2517
+ ? await this.runBuildWave(session)
2518
+ : await companionRestartDrain.whileWorking(saasRoot, () => this.runBuildWave(session));
2357
2519
  }
2358
2520
  finally {
2359
2521
  this.liveWaveStartedAt = undefined;
2360
2522
  this.buildWaveStopRequestedAt = undefined;
2361
- this.currentBuildPreparation = undefined;
2523
+ this.openBuildPreparations?.clear();
2362
2524
  }
2363
2525
  }
2364
2526
  /**
@@ -2478,23 +2640,25 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2478
2640
  throw new ApplicationBuildStoppedByPersonError(this.buildStopHeldSince);
2479
2641
  }
2480
2642
  /**
2481
- * What the build lane is doing right now between slots (#3206): the running wave, the preparation of its current slot
2643
+ * What the build lane is doing right now between slots (#3206): the running wave, the preparation of its oldest slot
2482
2644
  * ("selected X, preparing dispatch since T (step)"), a requested stop, and the last preparation that ended with each
2483
2645
  * step's duration. Read by `GET /build/dispatches` and the creation feed.
2484
2646
  */
2485
2647
  readBuildDispatchPreparation() {
2486
- const preparing = this.currentBuildPreparation?.read();
2648
+ const open = [...(this.openBuildPreparations ?? [])];
2649
+ const preparing = open[0]?.read();
2487
2650
  return {
2488
2651
  waveStartedAt: this.liveWaveStartedAt ?? null,
2489
2652
  stopRequestedAt: this.buildWaveStopRequestedAt ?? null,
2490
2653
  heldByStopSince: this.buildStopHeldSince ?? null,
2491
2654
  preparing: preparing === undefined ? null : { ...preparing, summary: describeBuildPreparation(preparing) },
2655
+ preparingCount: open.length,
2492
2656
  lastPreparation: this.lastBuildPreparation ?? null,
2493
2657
  };
2494
2658
  }
2495
2659
  openBuildPreparation() {
2496
2660
  const tracker = new ApplicationBuildPreparationTracker(ApplicationBuildPreparationPhase.CHECKING_THE_BACKEND_STARTS);
2497
- this.currentBuildPreparation = tracker;
2661
+ (this.openBuildPreparations ??= new Set()).add(tracker);
2498
2662
  return tracker;
2499
2663
  }
2500
2664
  /**
@@ -2504,8 +2668,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2504
2668
  */
2505
2669
  async closeBuildPreparation(tracker, session) {
2506
2670
  const ended = tracker.end();
2507
- if (this.currentBuildPreparation === tracker)
2508
- this.currentBuildPreparation = undefined;
2671
+ this.openBuildPreparations?.delete(tracker);
2509
2672
  this.lastBuildPreparation = ended;
2510
2673
  const durations = Object.fromEntries(ended.phases.map((entry) => [entry.phase, entry.durationMs]));
2511
2674
  this.logDebug('Build dispatch preparation ended', { selectedTaskRef: ended.selectedTaskRef ?? null, durationMs: ended.durationMs, phases: durations });
@@ -2534,6 +2697,11 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2534
2697
  throw new ApplicationBuildWaveInFlightError(this.liveWaveStartedAt);
2535
2698
  }
2536
2699
  async runBuildWave(session) {
2700
+ // Every isolated re-check, a sharing episode's end included, asks the application's current start first (#3880 review R2).
2701
+ this.dispatch.registerIsolatedRecheckHold?.(async () => ((await this.readCurrentBootFailures()).length > 0 ? 'the application does not start' : undefined));
2702
+ return this.runBuildWaveFilling(session);
2703
+ }
2704
+ async runBuildWaveFilling(session) {
2537
2705
  const degree = readBuildParallelism(this.companionContext.saasRoot);
2538
2706
  const mode = degree > 1 ? CodingRunConcurrency.CONCURRENT : CodingRunConcurrency.SINGLE_FLIGHT;
2539
2707
  const maximumDispatches = degree * WAVE_DISPATCHES_PER_DEGREE;
@@ -2552,107 +2720,313 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2552
2720
  const startedAt = new Date().toISOString();
2553
2721
  let usageLimit;
2554
2722
  let bootFailures;
2723
+ /*
2724
+ * A start the application refuses while runs are live (#3880): how many runs had settled when it was first seen, and
2725
+ * the repair this wave already started beside them. Waiting for every live run to drain held the repair 24 minutes on
2726
+ * reference run 43691253927; the repair starts once one sibling has settled and the start is still refused.
2727
+ */
2728
+ let bootFailureSeenAtSettlement;
2729
+ let startupRepairInWave;
2730
+ // Set while a repair is being started (#3883 review F5): the launcher and the drain both ask, so neither starts a second.
2731
+ let startupRepairStarting = false;
2732
+ /*
2733
+ * Start the repair of a refused start beside the live runs (#3880): once one sibling has settled since the refusal was
2734
+ * first seen and it is still refused, that sibling's completion did not repair it (the #2405 review F2 wait, kept on
2735
+ * purpose). Asked from the fill and, once the fill has stopped (the cap, a refused admission), after every settlement,
2736
+ * so a stopped fill does not leave the repair to the end of the drain (review F2). The repair is not one of the wave's
2737
+ * own runs (review F9): it is reported among the repairs, and its own acceptance commits it.
2738
+ */
2739
+ const repairStartBesideLiveRuns = async (notBooting) => {
2740
+ bootFailureSeenAtSettlement ??= settledTaskIds.length;
2741
+ if (startupRepairInWave !== undefined || startupRepairStarting || settledTaskIds.length <= bootFailureSeenAtSettlement)
2742
+ return;
2743
+ startupRepairStarting = true;
2744
+ try {
2745
+ await startTheRepair(notBooting);
2746
+ }
2747
+ finally {
2748
+ startupRepairStarting = false;
2749
+ }
2750
+ };
2751
+ const startTheRepair = async (notBooting) => {
2752
+ const repair = await this.prepareStartupRepair(notBooting);
2753
+ if (repair === undefined)
2754
+ return;
2755
+ try {
2756
+ const result = await this.executePreparedBuildTask(repair.prepared, session, { preparationStartedAt: new Date().toISOString() }, mode);
2757
+ const taskId = result.admission.taskId;
2758
+ startupRepairInWave = { checkRef: repair.checkRef, taskRef: repair.prepared.plan.taskRef, taskId };
2759
+ inFlight.set(taskId, this.awaitCodingRunOutcome(taskId, session).then((outcome) => ({ taskId, outcome })));
2760
+ }
2761
+ catch (error) {
2762
+ this.logger.warn('The repair of the application\'s refused start could not be run beside the live runs', { error: describeCaughtError(error) });
2763
+ }
2764
+ };
2765
+ /*
2766
+ * One landing reading for the wave's slots (#3204), held across fills (#3883): its guards drop it once a run that was in
2767
+ * flight has left or a settlement moved the landing, so a refill after a settlement reads again and a refill after an
2768
+ * admission alone does not.
2769
+ */
2770
+ const fillLanding = {};
2771
+ /*
2772
+ * The slots being PREPARED right now (#3883), by slot number. Until #3883 the fill prepared one slot at a time, awaiting
2773
+ * its landing reading and its brief before starting the next: on reference run 43691253927, 0 of 347 preparations
2774
+ * overlapped, a vacated slot waited a median 105 s, and 4.0 of 10 slots ran on average with about 73 tasks ready.
2775
+ * Now the LAUNCHER (`fill`) starts the next slot as soon as the previous one has SELECTED its task, so the slots select
2776
+ * one after another from the reading the first took, and each composes its brief and is admitted on its own.
2777
+ */
2778
+ const preparing = new Map();
2779
+ // Every slot launched, settled or not: a slot leaves `preparing` before its tracker is closed, and the wave waits for that.
2780
+ const slotsLaunchedInWave = [];
2781
+ let slotsLaunched = 0;
2782
+ /*
2783
+ * What the wave's slots selected, with the files they write (#3883), held until the run or step SETTLES (review H1): a
2784
+ * slot reads its in-flight set once, when it starts, and selects only after the landing and its checks, so a sibling's
2785
+ * task admitted in between is in no list that slot reads. Released here when the task settles, and by the slot itself
2786
+ * when it hands nothing on.
2787
+ */
2788
+ const reservations = new Map();
2789
+ // The task each admitted run builds, so its reservation is released when the run settles.
2790
+ const reservedTaskOfRun = new Map();
2791
+ /*
2792
+ * How many runs and steps have settled in this wave (#3883 review M1): a slot that finds nothing ready on a reading taken
2793
+ * before the latest settlement says nothing about what that settlement unlocked, so it does not hold the launcher back.
2794
+ */
2795
+ let settlements = 0;
2796
+ /*
2797
+ * A slot found nothing ready (#3883): no more slots are launched until something settles, since another would find the
2798
+ * same. Cleared by a settled run or step, and by a slot that gives back a task it reserved.
2799
+ */
2800
+ let nothingReady = false;
2801
+ // The first failure of a slot that is not "nothing ready": no more slots start, and the wave throws once what is live drains.
2802
+ let preparationFailure;
2803
+ const occupied = () => inFlight.size + generationInFlight.size + preparing.size;
2804
+ /*
2805
+ * Wakes the drain when what it races GROWS (#3883): a run admitted, a step started, a slot launched. The drain races the
2806
+ * set it saw when it last looked, and the launcher can wait a whole landing derivation for a slot's selection, so a run
2807
+ * admitted meanwhile would settle unseen: its reservation held, its settlement uncounted, its slot not refilled.
2808
+ */
2809
+ let wakeDrain = () => undefined;
2810
+ let drainWake = new Promise((resolve) => { wakeDrain = resolve; });
2811
+ const raceSetGrew = () => {
2812
+ const wake = wakeDrain;
2813
+ drainWake = new Promise((resolve) => { wakeDrain = resolve; });
2814
+ wake();
2815
+ };
2816
+ /*
2817
+ * Admissions take TURNS (#3883): a slot reads the stops and admits only once the slot before it has finished admitting.
2818
+ * Composing a brief, the slow part, stays side by side; admitting is short. So a refused admission, a usage limit met
2819
+ * or a stop is seen by every later slot before it starts anything, as when the wave prepared one slot at a time.
2820
+ */
2821
+ let admissionTurn = Promise.resolve();
2822
+ const takeAdmissionTurn = async () => {
2823
+ let release;
2824
+ const previous = admissionTurn;
2825
+ admissionTurn = new Promise((resolve) => { release = resolve; });
2826
+ await previous;
2827
+ return release;
2828
+ };
2829
+ /*
2830
+ * A task admitted after the held landing reading was taken joins that reading's in-flight guard (#3883 review M3): when
2831
+ * its run leaves the in-flight list, a few seconds before its settlement moves the landing, the reading is dropped
2832
+ * rather than offering the task the run just landed. Held for the whole wave, the reading would otherwise reach
2833
+ * every admission between two settlements, past the safety argument its guards were written for.
2834
+ */
2835
+ const guardHeldReadingAgainst = (taskRef) => {
2836
+ fillLanding.current?.inFlightTaskRefs.add(taskRef);
2837
+ fillLanding.pending?.inFlightTaskRefs.add(taskRef);
2838
+ };
2839
+ /** Why a slot about to be admitted must start nothing (#3883 review F4): a stop that arrived while it prepared. */
2840
+ const stopBeforeAdmission = () => {
2841
+ // A sibling failed (review M2): nothing more starts, and the wave throws once what is live drains.
2842
+ if (preparationFailure !== undefined)
2843
+ return 'failed';
2844
+ if (this.buildWaveStopRequestedAt !== undefined)
2845
+ return ApplicationBuildWaveStop.STOP_REQUESTED;
2846
+ const saasRoot = this.companionContext?.saasRoot;
2847
+ if (saasRoot !== undefined && companionRestartDrain.isRestartHeld(saasRoot))
2848
+ return ApplicationBuildWaveStop.RESTART_PENDING;
2849
+ if (stoppedFillingBecause !== undefined && SLOT_ABANDONING_STOPS.has(stoppedFillingBecause))
2850
+ return stoppedFillingBecause;
2851
+ return undefined;
2852
+ };
2853
+ /*
2854
+ * One slot (#3883): select, compose, admit. Runs beside the other slots; the launcher waits only for its SELECTION.
2855
+ * Every stop is read again just before admission, so a stop, a held restart, a refused admission or a refused start
2856
+ * that arrived while it prepared starts nothing. Its reservation is given back however it ends.
2857
+ */
2858
+ const runSlot = async (slot, selected) => {
2859
+ const settlementsAtLaunch = settlements;
2860
+ const preparation = this.openBuildPreparation();
2861
+ let reservedTaskRef;
2862
+ // Whether the slot handed its task on to a live run or step; one that did not gives it back to the other slots.
2863
+ let handedOn = false;
2864
+ // The end of this slot's admission turn, once it has one.
2865
+ let endAdmissionTurn;
2866
+ try {
2867
+ let prepared;
2868
+ try {
2869
+ prepared = await this.prepareNextBuildTask(undefined, preparation, {
2870
+ fillLanding,
2871
+ generationStepsInFlight: new Set(generationInFlight.keys()),
2872
+ generationStepsRunInWave: generationStepsRun,
2873
+ reservations,
2874
+ onSelected: (taskRef) => { reservedTaskRef = taskRef; selected(); },
2875
+ });
2876
+ }
2877
+ catch (error) {
2878
+ // Nothing ready NOW. While runs are live that is a pause, not an end: a settle may unlock more.
2879
+ if (error instanceof ApplicationBuildPlanExhaustedError || error instanceof ApplicationBuildTaskCompletedButUnlandedError) {
2880
+ // Only when nothing settled since this slot started (review M1): a settlement since may have unlocked a task.
2881
+ if (settlements === settlementsAtLaunch)
2882
+ nothingReady = true;
2883
+ return;
2884
+ }
2885
+ preparationFailure ??= { error };
2886
+ return;
2887
+ }
2888
+ preparation.select(prepared.plan.taskRef);
2889
+ preparation.enter(ApplicationBuildPreparationPhase.ADMITTING_THE_RUN);
2890
+ endAdmissionTurn = await takeAdmissionTurn();
2891
+ const abandonedFor = stopBeforeAdmission();
2892
+ if (abandonedFor !== undefined) {
2893
+ if (abandonedFor !== 'failed')
2894
+ stoppedFillingBecause ??= abandonedFor;
2895
+ return;
2896
+ }
2897
+ // On the run's row, so its dispatch wait — this slot's whole preparation — survives a restart (#3206).
2898
+ const preparedOrigin = { preparationStartedAt: preparation.read().startedAt };
2899
+ if (prepared.kind === 'GENERATION_STEP') {
2900
+ // Never twice in one wave (#3885): the selection passes over a step in this set, so the slots keep filling. The
2901
+ // check below is the backstop the fill's termination rests on, if a selection ever offers one again.
2902
+ if (generationStepsRun.has(prepared.plan.taskRef)) {
2903
+ stoppedFillingBecause ??= ApplicationBuildWaveStop.GENERATION_STEP_REPEATED;
2904
+ return;
2905
+ }
2906
+ generationStepsRun.add(prepared.plan.taskRef);
2907
+ // The step writes the tree while the next slots are prepared: each reads the landing again.
2908
+ fillLanding.current = undefined;
2909
+ fillLanding.pending = undefined;
2910
+ const step = prepared;
2911
+ generationInFlight.set(step.plan.taskRef, this.executePreparedBuildTask(step, session, preparedOrigin)
2912
+ .then((result) => ({ prepared: step, result }), (error) => ({ prepared: step, error })));
2913
+ raceSetGrew();
2914
+ handedOn = true;
2915
+ guardHeldReadingAgainst(step.plan.taskRef);
2916
+ return;
2917
+ }
2918
+ /*
2919
+ * Before every CODING admission, including the refill after a run settles (#2388): a sibling that just met the
2920
+ * account's usage limit makes every coding turn started before its reset certain to fail the same way. On
2921
+ * app-creation-test-005 the refill went on regardless, and four tasks spent three or four attempts each in
2922
+ * five minutes. The live runs still drain; nothing new starts. Asked after the selection, which only reads,
2923
+ * so a generation step — run on the configured model providers, not on the coding agent's account — still
2924
+ * runs (#2388 review F8d).
2925
+ */
2926
+ const held = this.dispatch.readCodingAgentUsageLimitHold();
2927
+ if (held) {
2928
+ stoppedFillingBecause ??= ApplicationBuildWaveStop.CODING_AGENT_USAGE_LIMITED;
2929
+ usageLimit ??= held;
2930
+ return;
2931
+ }
2932
+ try {
2933
+ const result = await this.executePreparedBuildTask(prepared, session, preparedOrigin, mode);
2934
+ dispatched.push(result);
2935
+ const taskId = result.admission.taskId;
2936
+ inFlight.set(taskId, this.awaitCodingRunOutcome(taskId, session).then((outcome) => ({ taskId, outcome })));
2937
+ raceSetGrew();
2938
+ handedOn = true;
2939
+ reservedTaskOfRun.set(taskId, prepared.plan.taskRef);
2940
+ guardHeldReadingAgainst(prepared.plan.taskRef);
2941
+ }
2942
+ catch (error) {
2943
+ // A refused admission is recorded and ends the filling; the live runs still drain.
2944
+ dispatched.push({ plan: prepared.plan, error: describeCaughtError(error) });
2945
+ // Refused because a check's command is absent (#3423): its own stop, so the selector stops asking for waves.
2946
+ stoppedFillingBecause ??= this.dispatch.readVerificationToolUnavailableHold()
2947
+ ? ApplicationBuildWaveStop.VERIFICATION_TOOL_UNAVAILABLE
2948
+ : ApplicationBuildWaveStop.DISPATCH_REFUSED;
2949
+ }
2950
+ }
2951
+ finally {
2952
+ /*
2953
+ * Given back when the slot handed nothing on (#3883 review F3), so its task is selectable again. A task handed on to a
2954
+ * run or a step stays reserved until it settles, released by the drain (review H1).
2955
+ */
2956
+ endAdmissionTurn?.();
2957
+ // A task handed on stays reserved until it settles (review H1); one the slot did not hand on is selectable again.
2958
+ if (reservedTaskRef !== undefined && !handedOn) {
2959
+ reservations.delete(reservedTaskRef);
2960
+ nothingReady = false;
2961
+ }
2962
+ // No longer a slot being prepared, BEFORE the launcher resumes: a run it handed on now counts as live instead, and
2963
+ // counted in both it would read the wave as full and stop launching.
2964
+ preparing.delete(slot);
2965
+ selected();
2966
+ await this.closeBuildPreparation(preparation, session);
2967
+ }
2968
+ };
2969
+ /*
2970
+ * The LAUNCHER (#3883): the stops, the start and the cap are asked here, one slot at a time, so a refused start is read
2971
+ * once per slot and repaired once (review F5); then a slot is launched, and the next waits only for its SELECTION.
2972
+ */
2555
2973
  const fill = async () => {
2556
- // One landing reading for every slot this fill prepares (#3204); a refill follows a settlement, so it reads again.
2557
- const fillLanding = {};
2558
- while (stoppedFillingBecause === undefined && inFlight.size + generationInFlight.size < degree) {
2974
+ while (stoppedFillingBecause === undefined && preparationFailure === undefined && !nothingReady && occupied() < degree) {
2559
2975
  /*
2560
2976
  * `wildo build stop` (#3206): the wave ends at a task boundary — it starts nothing more, and drains what is live,
2561
2977
  * reconciles and repairs as at any other end. Asked before every slot, so a stop is honoured within one slot.
2562
2978
  */
2563
2979
  if (this.buildWaveStopRequestedAt !== undefined) {
2564
- stoppedFillingBecause = ApplicationBuildWaveStop.STOP_REQUESTED;
2980
+ stoppedFillingBecause ??= ApplicationBuildWaveStop.STOP_REQUESTED;
2565
2981
  return;
2566
2982
  }
2567
- if (dispatched.length + generationInFlight.size >= maximumDispatches) {
2568
- stoppedFillingBecause = ApplicationBuildWaveStop.DISPATCH_CAP;
2983
+ // A restart the dev supervisor holds (#3204): start nothing more, so the live runs settle before it.
2984
+ const saasRoot = this.companionContext?.saasRoot;
2985
+ if (saasRoot !== undefined && companionRestartDrain.isRestartHeld(saasRoot)) {
2986
+ stoppedFillingBecause ??= ApplicationBuildWaveStop.RESTART_PENDING;
2569
2987
  return;
2570
2988
  }
2571
- // What this slot is waiting on, readable while it waits and recorded when it ends (#3206).
2572
- const preparation = this.openBuildPreparation();
2573
- try {
2574
- /*
2575
- * And before every slot, whether the application still STARTS (#2405). On app-creation-test-005 one task broke
2576
- * the backend's start and about 45 more landed on top over four hours, each verified by typechecks that could
2577
- * not see it. The live runs drain; nothing new starts into an application that cannot run.
2578
- */
2579
- const notBooting = await this.readCurrentBootFailures();
2580
- if (notBooting.length > 0) {
2581
- bootFailures = notBooting;
2582
- /*
2583
- * While runs are live this PAUSES the filling rather than ending it (#2405 review F2): a sibling half-way
2584
- * through writing a configuration can make one restart fail, and its own completion may repair it. The next
2585
- * settle asks again. With nothing live there is nothing left to wait for, and the wave stops.
2586
- */
2587
- if (inFlight.size > 0)
2588
- return;
2589
- stoppedFillingBecause = ApplicationBuildWaveStop.APPLICATION_DOES_NOT_BOOT;
2590
- return;
2591
- }
2592
- bootFailures = undefined;
2593
- let prepared;
2594
- try {
2595
- prepared = await this.prepareNextBuildTask(undefined, preparation, { fillLanding, generationStepsInFlight: new Set(generationInFlight.keys()) });
2596
- }
2597
- catch (error) {
2598
- if (error instanceof ApplicationBuildPlanExhaustedError || error instanceof ApplicationBuildTaskCompletedButUnlandedError) {
2599
- // Nothing ready NOW. While runs are live that is a pause, not an end: a settle may unlock more.
2600
- if (inFlight.size === 0 && generationInFlight.size === 0)
2601
- stoppedFillingBecause = ApplicationBuildWaveStop.NOTHING_READY;
2602
- return;
2603
- }
2604
- throw error;
2605
- }
2606
- preparation.select(prepared.plan.taskRef);
2607
- preparation.enter(ApplicationBuildPreparationPhase.ADMITTING_THE_RUN);
2608
- // On the run's row, so its dispatch wait — this slot's whole preparation — survives a restart (#3206).
2609
- const preparedOrigin = { preparationStartedAt: preparation.read().startedAt };
2610
- if (prepared.kind === 'GENERATION_STEP') {
2611
- if (generationStepsRun.has(prepared.plan.taskRef)) {
2612
- stoppedFillingBecause = ApplicationBuildWaveStop.GENERATION_STEP_REPEATED;
2613
- return;
2614
- }
2615
- generationStepsRun.add(prepared.plan.taskRef);
2616
- // The step writes the tree while the next slots are prepared: each reads the landing again.
2617
- fillLanding.current = undefined;
2618
- const step = prepared;
2619
- generationInFlight.set(step.plan.taskRef, this.executePreparedBuildTask(step, session, preparedOrigin)
2620
- .then((result) => ({ prepared: step, result }), (error) => ({ prepared: step, error })));
2621
- continue;
2622
- }
2989
+ /*
2990
+ * And before every slot, whether the application still STARTS (#2405). On app-creation-test-005 one task broke
2991
+ * the backend's start and about 45 more landed on top over four hours, each verified by typechecks that could
2992
+ * not see it. The live runs drain; nothing new starts into an application that cannot run.
2993
+ */
2994
+ const notBooting = await this.readCurrentBootFailures();
2995
+ if (notBooting.length > 0) {
2996
+ bootFailures = notBooting;
2623
2997
  /*
2624
- * Before every CODING slot, including the refill after a run settles (#2388): a sibling that just met the
2625
- * account's usage limit makes every coding turn started before its reset certain to fail the same way. On
2626
- * app-creation-test-005 the refill went on regardless, and four tasks spent three or four attempts each in
2627
- * five minutes. The live runs still drain; nothing new starts. Asked after the selection, which only reads,
2628
- * so a generation step — run on the configured model providers, not on the coding agent's account — still
2629
- * runs (#2388 review F8d).
2998
+ * While runs are live this PAUSES the filling rather than ending it (#2405 review F2): a sibling half-way
2999
+ * through writing a configuration can make one restart fail, and its own completion may repair it. The next
3000
+ * settle asks again. With nothing live there is nothing left to wait for, and the wave stops.
3001
+ *
3002
+ * But once a sibling HAS settled and the start is still refused, its completion did not repair it, and the
3003
+ * repair starts in a slot now rather than after the last live run drains (#3880).
2630
3004
  */
2631
- const held = this.dispatch.readCodingAgentUsageLimitHold();
2632
- if (held) {
2633
- stoppedFillingBecause = ApplicationBuildWaveStop.CODING_AGENT_USAGE_LIMITED;
2634
- usageLimit = held;
2635
- return;
2636
- }
2637
- try {
2638
- const result = await this.executePreparedBuildTask(prepared, session, preparedOrigin, mode);
2639
- dispatched.push(result);
2640
- const taskId = result.admission.taskId;
2641
- inFlight.set(taskId, this.awaitCodingRunOutcome(taskId, session).then((outcome) => ({ taskId, outcome })));
2642
- }
2643
- catch (error) {
2644
- // A refused admission is recorded and ends the filling; the live runs still drain.
2645
- dispatched.push({ plan: prepared.plan, error: describeCaughtError(error) });
2646
- // Refused because a check's command is absent (#3423): its own stop, so the selector stops asking for waves.
2647
- stoppedFillingBecause = this.dispatch.readVerificationToolUnavailableHold()
2648
- ? ApplicationBuildWaveStop.VERIFICATION_TOOL_UNAVAILABLE
2649
- : ApplicationBuildWaveStop.DISPATCH_REFUSED;
3005
+ if (inFlight.size > 0) {
3006
+ await repairStartBesideLiveRuns(notBooting);
2650
3007
  return;
2651
3008
  }
3009
+ stoppedFillingBecause ??= ApplicationBuildWaveStop.APPLICATION_DOES_NOT_BOOT;
3010
+ return;
2652
3011
  }
2653
- finally {
2654
- await this.closeBuildPreparation(preparation, session);
3012
+ bootFailures = undefined;
3013
+ bootFailureSeenAtSettlement = undefined;
3014
+ // Asked again: a slot may have stopped the filling while the start was read.
3015
+ if (stoppedFillingBecause !== undefined || preparationFailure !== undefined || nothingReady || occupied() >= degree)
3016
+ return;
3017
+ // After the start is known good (#3880): a capped wave that also cannot start stops for the start, which is repaired.
3018
+ if (dispatched.length + generationInFlight.size + preparing.size >= maximumDispatches) {
3019
+ stoppedFillingBecause ??= ApplicationBuildWaveStop.DISPATCH_CAP;
3020
+ return;
2655
3021
  }
3022
+ let markSelected;
3023
+ const selection = new Promise((resolve) => { markSelected = resolve; });
3024
+ const slot = slotsLaunched += 1;
3025
+ const running = runSlot(slot, () => markSelected());
3026
+ preparing.set(slot, running);
3027
+ slotsLaunchedInWave.push(running);
3028
+ raceSetGrew();
3029
+ await selection;
2656
3030
  }
2657
3031
  };
2658
3032
  const outcomes = [];
@@ -2665,6 +3039,8 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2665
3039
  */
2666
3040
  const concludeGenerationStep = (settled) => {
2667
3041
  generationInFlight.delete(settled.prepared.plan.taskRef);
3042
+ reservations.delete(settled.prepared.plan.taskRef);
3043
+ settlements += 1;
2668
3044
  if (settled.error === undefined) {
2669
3045
  dispatched.push(settled.result);
2670
3046
  return;
@@ -2675,17 +3051,44 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2675
3051
  this.holdForStaleExpertCharters(settled.prepared.plan.taskRef, staleSeats);
2676
3052
  return;
2677
3053
  }
2678
- if (!(settled.error instanceof SpecificationWriteRefusedError))
2679
- throw settled.error;
3054
+ // Anything else is the wave's own failure (review M2): nothing more starts, and the wave throws once what is live drains.
3055
+ if (!(settled.error instanceof SpecificationWriteRefusedError)) {
3056
+ preparationFailure ??= { error: settled.error };
3057
+ return;
3058
+ }
2680
3059
  dispatched.push({ plan: settled.prepared.plan, error: describeCaughtError(settled.error) });
2681
3060
  stoppedFillingBecause ??= ApplicationBuildWaveStop.DISPATCH_REFUSED;
2682
3061
  };
2683
- await fill();
2684
- while (inFlight.size > 0 || generationInFlight.size > 0) {
3062
+ /*
3063
+ * The launcher runs beside the drain (#3883), so a settlement is taken while slots are still being prepared. Relaunched
3064
+ * after a run, a step or a slot settles, never after the launcher's own end: it ends when nothing can be launched until
3065
+ * something settles (full, nothing ready, a stop, a refused start paused beside live runs), so relaunching it there
3066
+ * would only poll the start in a loop.
3067
+ */
3068
+ let launcher;
3069
+ const launch = () => {
3070
+ if (launcher !== undefined || stoppedFillingBecause !== undefined || preparationFailure !== undefined || nothingReady || occupied() >= degree)
3071
+ return;
3072
+ launcher = fill().finally(() => { launcher = undefined; });
3073
+ };
3074
+ launch();
3075
+ while (inFlight.size > 0 || generationInFlight.size > 0 || preparing.size > 0 || launcher !== undefined) {
2685
3076
  const first = await Promise.race([
2686
3077
  ...[...inFlight.values()].map((run) => run.then((settled) => ({ kind: 'coding', run: settled }))),
2687
3078
  ...[...generationInFlight.values()].map((step) => step.then((settled) => ({ kind: 'generation', step: settled }))),
3079
+ ...[...preparing.values()].map((slot) => slot.then(() => ({ kind: 'slot' }))),
3080
+ ...(launcher !== undefined ? [launcher.then(() => ({ kind: 'launcher' }))] : []),
3081
+ drainWake.then(() => ({ kind: 'grew' })),
2688
3082
  ]);
3083
+ // The set grew, or the launcher ended: look again at what is live, without relaunching (see `launch`).
3084
+ if (first.kind === 'launcher' || first.kind === 'grew')
3085
+ continue;
3086
+ if (first.kind === 'slot') {
3087
+ launch();
3088
+ continue;
3089
+ }
3090
+ // A settled run or step may have landed what a ready task waits on, so a slot may find work again.
3091
+ nothingReady = false;
2689
3092
  if (first.kind === 'generation') {
2690
3093
  concludeGenerationStep(first.step);
2691
3094
  }
@@ -2693,17 +3096,47 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2693
3096
  inFlight.delete(first.run.taskId);
2694
3097
  for (const run of [first.run, ...await takeAlreadySettled(inFlight)]) {
2695
3098
  inFlight.delete(run.taskId);
3099
+ // Its task is in no in-flight list now (#3883 review H1): the reservation that stood for it is released.
3100
+ const reservedTask = reservedTaskOfRun.get(run.taskId);
3101
+ if (reservedTask !== undefined)
3102
+ reservations.delete(reservedTask);
3103
+ reservedTaskOfRun.delete(run.taskId);
3104
+ settlements += 1;
3105
+ // The startup repair is reported as a repair, never as one of the wave's runs (#3880 review F9).
3106
+ if (run.taskId === startupRepairInWave?.taskId)
3107
+ continue;
2696
3108
  outcomes.push(run.outcome);
2697
3109
  settledTaskIds.push(run.taskId);
2698
3110
  }
2699
3111
  }
2700
3112
  for (const step of await takeAlreadySettled(generationInFlight))
2701
3113
  concludeGenerationStep(step);
2702
- await fill();
3114
+ // A fill that has stopped (the cap, a refused admission) no longer reads the start: read it here (#3880 review F2).
3115
+ if (stoppedFillingBecause !== undefined && stoppedFillingBecause !== ApplicationBuildWaveStop.STOP_REQUESTED
3116
+ && stoppedFillingBecause !== ApplicationBuildWaveStop.RESTART_PENDING && inFlight.size > 0) {
3117
+ const notBooting = await this.readCurrentBootFailures();
3118
+ if (notBooting.length > 0) {
3119
+ bootFailures = notBooting;
3120
+ await repairStartBesideLiveRuns(notBooting);
3121
+ }
3122
+ }
3123
+ launch();
2703
3124
  }
2704
- // A pause on a failing start that the drained runs did not clear ends the wave on it, not on "nothing ready".
2705
- if (stoppedFillingBecause === undefined && bootFailures !== undefined)
3125
+ // Every slot has closed its preparation, so the wave's record of them is complete when it returns.
3126
+ await Promise.all(slotsLaunchedInWave);
3127
+ // A slot failed for a reason other than "nothing ready" (#3883 review F6): what was live has drained, and the wave throws.
3128
+ if (preparationFailure !== undefined)
3129
+ throw preparationFailure.error;
3130
+ /*
3131
+ * The start, asked again now that nothing writes (#3880). A start still refused outranks how the filling stopped (a
3132
+ * cap, nothing ready, a refused admission), so it is repaired below; only a person's stop or a held restart keeps its
3133
+ * own reason. Until this, a capped wave over a refused start ended "at the cap" and repaired nothing.
3134
+ */
3135
+ const bootFailuresAtEnd = await this.readCurrentBootFailures();
3136
+ bootFailures = bootFailuresAtEnd.length > 0 ? bootFailuresAtEnd : undefined;
3137
+ if (bootFailures !== undefined && stoppedFillingBecause !== ApplicationBuildWaveStop.STOP_REQUESTED && stoppedFillingBecause !== ApplicationBuildWaveStop.RESTART_PENDING) {
2706
3138
  stoppedFillingBecause = ApplicationBuildWaveStop.APPLICATION_DOES_NOT_BOOT;
3139
+ }
2707
3140
  stoppedFillingBecause ??= ApplicationBuildWaveStop.NOTHING_READY;
2708
3141
  /*
2709
3142
  * The wave's END, now that nothing is writing (#3204): the runs that failed verification beside their siblings are
@@ -2711,8 +3144,10 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2711
3144
  * (failed runs included: their files are in the tree). In both modes (review of 4a1b1f1bf F7): a single-flight run's
2712
3145
  * own settlement checkpoint may have been folded into a timer, and the wave's end is where it is guaranteed.
2713
3146
  */
3147
+ // A run re-checked alone against an application that cannot start fails for the start, not for itself (#3880): its
3148
+ // re-checks wait for the startup repair below, and run after it.
2714
3149
  const reconciliation = settledTaskIds.length > 0
2715
- ? await this.dispatch.reconcileWaveAcceptance({ startedAt, taskIds: settledTaskIds })
3150
+ ? await this.dispatch.reconcileWaveAcceptance({ startedAt, taskIds: settledTaskIds, ...(bootFailures !== undefined ? { deferRechecksBecause: 'the application does not start' } : {}) })
2716
3151
  : [];
2717
3152
  /*
2718
3153
  * And the repair reconciliation cannot make (#2210): a run that COMPLETED but whose product a sibling
@@ -2720,13 +3155,19 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2720
3155
  * bring it back; only running the task again can. Asked after the reconciliation, so landing reads the
2721
3156
  * tree every run's work has reached.
2722
3157
  */
2723
- const interferenceRepairs = mode === CodingRunConcurrency.CONCURRENT
3158
+ /*
3159
+ * Interference repairs are coding runs, so none starts into an application that cannot start (#3880 review F4). With a
3160
+ * good start they run here, before the plan-exhausted assembly reads the tree; with a refused one, once below, after
3161
+ * the startup repair has had its chance.
3162
+ */
3163
+ const interferenceRepairs = mode === CodingRunConcurrency.CONCURRENT && bootFailures === undefined
2724
3164
  ? await this.repairInterferedTasks(outcomes, session)
2725
3165
  : [];
2726
3166
  /*
2727
3167
  * #2222: a wave that ran out of ready work may have FINISHED the plan. Asked after the reconciliation and the
2728
3168
  * repairs, so it reads the tree every run's work reached — and only on NOTHING_READY, the one stop that can mean
2729
- * "done" (a cap, a refusal or a repeated step leaves work behind).
3169
+ * "done" (a cap, a refusal or a repeated step leaves work behind; so may a step this wave ran, which the
3170
+ * plan-exhausted read still selects, so it gives no verdict).
2730
3171
  */
2731
3172
  const { assembly: assessedAssembly, repairs: assemblyRepairsOfPlan } = stoppedFillingBecause === ApplicationBuildWaveStop.NOTHING_READY
2732
3173
  ? await this.assemblyIfPlanExhausted(session)
@@ -2738,8 +3179,26 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2738
3179
  * backend again. A dev-stack cause (a held port, an unreachable service) is never repaired here: no code fixes it.
2739
3180
  */
2740
3181
  const startupRepairs = stoppedFillingBecause === ApplicationBuildWaveStop.APPLICATION_DOES_NOT_BOOT && bootFailures !== undefined
2741
- ? await this.repairRefusedStartup(bootFailures, session)
3182
+ ? [...(startupRepairInWave === undefined ? await this.repairRefusedStartup(bootFailures, session) : [])]
2742
3183
  : [];
3184
+ // The repair started beside the live runs (#3880), reported like one run at the end.
3185
+ if (startupRepairInWave !== undefined) {
3186
+ startupRepairs.unshift({ checkRef: startupRepairInWave.checkRef, taskRef: startupRepairInWave.taskRef, outcome: await this.awaitCodingRunOutcome(startupRepairInWave.taskId, session) });
3187
+ }
3188
+ if (bootFailures !== undefined) {
3189
+ const startBack = (await this.readCurrentBootFailures()).length === 0;
3190
+ // The re-checks deferred above, now that the application starts again (#3880).
3191
+ if (startBack && settledTaskIds.length > 0)
3192
+ reconciliation.push(...await this.dispatch.reconcileWaveAcceptance({ startedAt, taskIds: settledTaskIds }));
3193
+ /*
3194
+ * The interference repairs deferred above, whatever the start now reads (#3880 review R3). This repair is the only
3195
+ * thing that re-arms a task whose product a sibling overwrote; skipped, the task reads `completed_unlanded` and waits
3196
+ * for a person. So a start still refused re-arms without re-running, and the next wave runs those tasks once the
3197
+ * start is repaired.
3198
+ */
3199
+ if (mode === CodingRunConcurrency.CONCURRENT)
3200
+ interferenceRepairs.push(...await this.repairInterferedTasks(outcomes, session, { startRefused: !startBack }));
3201
+ }
2743
3202
  const assemblyRepairs = [...startupRepairs, ...assemblyRepairsOfPlan];
2744
3203
  // Whichever way the verdict was reached: a repair's verdict is about the checks, and the plan is still not finished (#3258).
2745
3204
  const specificationFault = assessedAssembly === undefined ? undefined : (await this.resolveBuildExecutionProgress())?.specificationFault;
@@ -2794,25 +3253,34 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2794
3253
  * operation 'import_customers' not found` and two lifecycle verbs with no `requestDto`, each a build task's code, with
2795
3254
  * the remedy "wildo build run <taskRef>" addressed to a person nobody had told which task.
2796
3255
  */
2797
- async repairRefusedStartup(failures, session) {
3256
+ /**
3257
+ * The repair of a start the application's own code refused, prepared as an assembly repair of `check:backend-ready`, or
3258
+ * `undefined` when none is owed or allowed (no code fixes the failure, the round's repairs are spent, a usage-limit hold,
3259
+ * a person's stop). Shared by the repair at the wave's end and the one started beside live runs (#3880).
3260
+ */
3261
+ async prepareStartupRepair(failures) {
2798
3262
  const failure = describeRefusedStartupAsCheckFailure(failures);
2799
3263
  if (failure === undefined || this.dispatch.readCodingAgentUsageLimitHold() || this.buildStopHeldSince !== undefined)
2800
- return [];
2801
- const origin = { preparationStartedAt: new Date().toISOString() };
2802
- let prepared;
3264
+ return undefined;
2803
3265
  try {
2804
- ({ prepared } = await this.prepareAssemblyRepair({ checkRefs: [failure.checkRef], failed: [{ ...failure, detail: failure.detail ?? failure.output }] }, { landedTaskRefs: [] }));
3266
+ const { prepared } = await this.prepareAssemblyRepair({ checkRefs: [failure.checkRef], failed: [{ ...failure, detail: failure.detail ?? failure.output }] }, { landedTaskRefs: [] });
3267
+ return prepared === undefined ? undefined : { prepared, checkRef: failure.checkRef };
2805
3268
  }
2806
3269
  catch (error) {
2807
3270
  this.logger.warn('Could not prepare the repair of the application\'s refused start', { error: describeCaughtError(error) });
2808
- return [];
3271
+ return undefined;
2809
3272
  }
2810
- if (prepared === undefined)
3273
+ }
3274
+ async repairRefusedStartup(failures, session) {
3275
+ const repair = await this.prepareStartupRepair(failures);
3276
+ if (repair === undefined)
2811
3277
  return [];
3278
+ const { prepared } = repair;
3279
+ const origin = { preparationStartedAt: new Date().toISOString() };
2812
3280
  try {
2813
3281
  const dispatched = await this.executePreparedBuildTask(prepared, session, origin);
2814
3282
  const outcome = dispatched.admission ? await this.awaitCodingRunOutcome(dispatched.admission.taskId, session) : null;
2815
- return [{ checkRef: failure.checkRef, taskRef: prepared.plan.taskRef, outcome }];
3283
+ return [{ checkRef: repair.checkRef, taskRef: prepared.plan.taskRef, outcome }];
2816
3284
  }
2817
3285
  catch (error) {
2818
3286
  this.logger.warn('The repair of the application\'s refused start could not be run', { error: describeCaughtError(error) });
@@ -2907,7 +3375,9 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2907
3375
  * repair, made where the evidence is. Bounded by {@link MAXIMUM_INTERFERENCE_REARMS} per task. Sequential,
2908
3376
  * because the re-runs are single-flight.
2909
3377
  */
2910
- async repairInterferedTasks(outcomes, session) {
3378
+ async repairInterferedTasks(outcomes, session,
3379
+ /** The application's start is refused: an interfered task is re-armed and recorded, and not re-run (#3880 review R3). */
3380
+ options = {}) {
2911
3381
  const completed = outcomes.filter((outcome) => outcome?.succeeded === true && outcome.taskRef !== null);
2912
3382
  if (completed.length === 0)
2913
3383
  return [];
@@ -2932,7 +3402,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2932
3402
  * rewritten the shared file since, and a reading taken before it would judge this run on stale text.
2933
3403
  */
2934
3404
  const landed = (await this.resolveLandedTaskRefs(graph.tasks)).landed;
2935
- const repair = await this.repairIfInterfered(run, graph, landed, this.createWorktreeReader(), session);
3405
+ const repair = await this.repairIfInterfered(run, graph, landed, this.createWorktreeReader(), session, options);
2936
3406
  if (repair)
2937
3407
  repairs.push(repair);
2938
3408
  }
@@ -2943,7 +3413,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2943
3413
  return repairs;
2944
3414
  }
2945
3415
  /** One run of {@link repairInterferedTasks}: `undefined` when it was not interfered with. */
2946
- async repairIfInterfered(run, graph, landed, worktree, session) {
3416
+ async repairIfInterfered(run, graph, landed, worktree, session, options = {}) {
2947
3417
  if (landed.has(run.taskRef))
2948
3418
  return undefined;
2949
3419
  const task = graph.tasks.find((candidate) => candidate.taskRef === run.taskRef);
@@ -3002,6 +3472,13 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3002
3472
  this.logger.warn('A completed run lost its product to a concurrent sibling; re-running its task alone', {
3003
3473
  taskRef: run.taskRef, runTaskId: run.taskId, ...interference,
3004
3474
  });
3475
+ /*
3476
+ * Not into an application that cannot start (#3880 review R3): the re-run's checks would fail for the start, not for
3477
+ * its work, and spend a re-arm. The task is re-armed already, so the next wave runs it once the start is repaired.
3478
+ */
3479
+ if (options.startRefused === true) {
3480
+ return { taskRef: run.taskRef, runTaskId: run.taskId, interference, rerun: { error: 'not re-run: the application does not start; the next wave runs it once the start is repaired' } };
3481
+ }
3005
3482
  /*
3006
3483
  * Not into the account's usage limit (#2388): the re-run would fail like every other turn before the reset.
3007
3484
  * The task is re-armed already, so the wave that resumes after the reset offers it.
@@ -3017,6 +3494,15 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3017
3494
  if (this.buildStopHeldSince !== undefined) {
3018
3495
  return { taskRef: run.taskRef, runTaskId: run.taskId, interference, rerun: { error: 'not re-run: a person stopped the build; the next `wildo build run` runs it' } };
3019
3496
  }
3497
+ /*
3498
+ * Nor while the dev supervisor holds a restart (#3204 review F5): the wave stopped filling so its runs could settle
3499
+ * before it, and a re-run here would hold the restart for a whole coding run more. The task is re-armed already, so
3500
+ * the next wave, in the restarted companion, offers it.
3501
+ */
3502
+ const saasRoot = this.companionContext?.saasRoot;
3503
+ if (saasRoot !== undefined && companionRestartDrain.isRestartHeld(saasRoot)) {
3504
+ return { taskRef: run.taskRef, runTaskId: run.taskId, interference, rerun: { error: 'not re-run: the dev supervisor is holding a restart; the next wave runs it' } };
3505
+ }
3020
3506
  let rerun;
3021
3507
  try {
3022
3508
  const dispatched = await this.dispatchBuildTask(run.taskRef, session);
@@ -3099,6 +3585,22 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3099
3585
  + `that depend on it wait, the rest of the plan proceeds. Fix the definition (the message names the field and the remedy), `
3100
3586
  + `then put it back with \`wildo build rearm ${taskRef} --reason <why> --note <what was fixed>\`.${others}`, taskRef, priorTaskId, stuck, queue);
3101
3587
  }
3588
+ if (entry.reason === Workbench_BuildTaskStuckReason.FAILURE_OUTSIDE_APPLICATION) {
3589
+ return new ApplicationBuildTaskCompletedButUnlandedError(`Build step "${taskRef}" failed (latest: run ${priorTaskId}${when}) on a cause the FRAMEWORK owns, not this application: `
3590
+ + `${entry.repeatedFailure?.failure || '(not recorded on the run row)'} No change in the application can fix it, so it is not `
3591
+ + 'offered again on its own; the rest of the plan proceeds. Fix it in the framework (the engine package or platform '
3592
+ + `service the failure names), then run it by name, \`wildo build run ${taskRef}\`, or put it back with `
3593
+ + `\`wildo build rearm ${taskRef} --reason <why> --note <what was fixed>\`.${others}`, taskRef, priorTaskId, stuck, queue);
3594
+ }
3595
+ if (entry.reason === Workbench_BuildTaskStuckReason.REPEATED_IDENTICAL_FAILURE) {
3596
+ return new ApplicationBuildTaskCompletedButUnlandedError(`Build step "${taskRef}" failed the same way ${entry.repeatedFailure?.consecutive ?? GENERATION_STEP_IDENTICAL_FAILURES_WITHHELD_AFTER} times in a row `
3597
+ + `(latest: run ${priorTaskId}${when}) and nothing it reads has changed since, so it is not offered again on its own; the rest of the `
3598
+ + `plan proceeds. Its failure: ${entry.repeatedFailure?.failure || '(not recorded on the run row)'} `
3599
+ + (entry.repeatedFailure?.owner === GenerationStepFailureOwner.APPLICATION ? 'The step attributes the cause to this application. ' : '')
3600
+ + 'Fix that cause. When it lies outside the application (an engine package\'s examples or labels, a platform service), fix it '
3601
+ + `there: no change in the application would release the step. Then run it by name, \`wildo build run ${taskRef}\`, or put it back `
3602
+ + `with \`wildo build rearm ${taskRef} --reason <why> --note <what was fixed>\`; a change to anything it reads releases it too.${others}`, taskRef, priorTaskId, stuck, queue);
3603
+ }
3102
3604
  if (entry.generationStep === true) {
3103
3605
  return new ApplicationBuildTaskCompletedButUnlandedError(`Build step "${taskRef}" already ran${when} (run ${priorTaskId}) and has not landed, and nothing it reads has changed since, `
3104
3606
  + 'so running it again would end the same way and it is not offered again. '
@@ -3112,8 +3614,9 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3112
3614
  }
3113
3615
  if (entry.reason === Workbench_BuildTaskStuckReason.FOLLOW_UP_AWAITING_REVIEW) {
3114
3616
  return new ApplicationBuildTaskCompletedButUnlandedError(`Build task "${taskRef}" is a follow-up the build derived from a reported gap, and under the ${this.autonomyPosture} posture a follow-up `
3115
- + `waits for your review before it runs. Let it run with \`wildo build approve ${taskRef}\`, or decline it with `
3116
- + `\`wildo build close ${taskRef} --declined --reason "<why>"\` (\`wildo creation why ${taskRef}\` shows what was reported).${others}`, taskRef, priorTaskId, stuck, queue);
3617
+ + `waits for your review before it runs. \`wildo build tasks\` lists the reports it covers; let it run with `
3618
+ + `\`wildo build approve ${taskRef} --covers <those refs>\`, or decline it with `
3619
+ + `\`wildo build close ${taskRef} --declined --reason "<why>" --covers <those refs>\` (\`wildo creation why ${taskRef}\` shows what was reported).${others}`, taskRef, priorTaskId, stuck, queue);
3117
3620
  }
3118
3621
  if (entry.reason === Workbench_BuildTaskStuckReason.CONTENDED) {
3119
3622
  return new ApplicationBuildTaskCompletedButUnlandedError(`Build task "${taskRef}" waits for a live run of another task that writes one of its product files: running both at once `
@@ -3123,6 +3626,10 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3123
3626
  return new ApplicationBuildTaskCompletedButUnlandedError(`Build task "${taskRef}" failed its checks while other runs of this wave were writing beside it, so the failure may be theirs. `
3124
3627
  + `Running it again now would meet the same tree; the wave's end runs its checks alone, and a pass lands it. Nothing to do.${others}`, taskRef, priorTaskId, stuck, queue);
3125
3628
  }
3629
+ if (entry.reason === Workbench_BuildTaskStuckReason.RAN_THIS_WAVE) {
3630
+ return new ApplicationBuildTaskCompletedButUnlandedError(`Build step "${taskRef}" already ran in this wave and has not landed, so the wave does not run it again on the tree it just met. `
3631
+ + `Its run is on the wave's result; the next wave offers it again. Nothing to do.${others}`, taskRef, priorTaskId, stuck, queue);
3632
+ }
3126
3633
  if (entry.reason === Workbench_BuildTaskStuckReason.IN_FLIGHT) {
3127
3634
  return new ApplicationBuildTaskCompletedButUnlandedError(`Build task "${taskRef}" is being built right now (a live coding run, or the companion running its generation step), so it is not offered again until `
3128
3635
  + `that run settles. Nothing to do: the next dispatch after it settles picks up wherever the build then stands.${others}`, taskRef, priorTaskId, stuck, queue);
@@ -3152,31 +3659,86 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3152
3659
  * checkpoint has committed it yet, and a commit would not change the answer. A NAMED dispatch (`wildo build run <taskRef>`) is never held by this: the operator running
3153
3660
  * it again is the door, and this hold only keeps the unattended loop from repeating it.
3154
3661
  *
3662
+ * **A step whose latest runs FAILED the same way is held too (#3709)**, by the choreography lane's rule (596611bf2): the
3663
+ * last {@link GENERATION_STEP_IDENTICAL_FAILURES_WITHHELD_AFTER} runs failed with one failure
3664
+ * ({@link generationStepFailureFingerprint}) and nothing outside its write scope moved since the latest. Until then only a
3665
+ * COMPLETED run held it, so a step failing every time was offered every wave: on reference run 42886943490
3666
+ * `build-task-documentation-publication` failed 21 times in a row on engine-owned OpenAPI examples no run could fix, and
3667
+ * `build-task-gen-i18n-labels` ran 32 times, for an hour as the only ready task. Held as `repeated_identical_failure`, with
3668
+ * the latest failure and how many times it repeated, so the board, `wildo build tasks` and the dispatch refusal name it.
3669
+ * The same doors release it: an input moving, a named dispatch, a re-arm recorded on its runs.
3670
+ *
3155
3671
  * Anything this cannot read (the run history, git) answers `null`: the step is offered as before rather than held on an
3156
3672
  * unknown.
3157
3673
  */
3158
- async classifyRanGenerationStep(candidate, latestAttempts) {
3159
- const latest = latestAttempts?.get(candidate.taskRef);
3160
- if (latest === undefined || latest.status !== FlowsActors_Status.COMPLETED || latest.rearm !== undefined)
3161
- return null;
3162
- const since = latest.settledAt ?? latest.startedAt;
3163
- if (typeof this.git.listPathsCommittedSince !== 'function' || typeof this.git.readLandingSourceState !== 'function')
3674
+ async classifyRanGenerationStep(candidate,
3675
+ /** Each step's runs, NEWEST FIRST: the latest decides, and the ones before it say whether a failure repeats. */
3676
+ attemptHistory) {
3677
+ const attempts = attemptHistory?.get(candidate.taskRef) ?? [];
3678
+ const latest = attempts[0];
3679
+ if (latest === undefined || latest.rearm !== undefined)
3164
3680
  return null;
3165
- const [committed, tree] = await Promise.all([this.git.listPathsCommittedSince(since), this.git.readLandingSourceState()]);
3166
- if (committed === undefined || tree === undefined)
3681
+ /*
3682
+ * A failure the step attributed to the FRAMEWORK holds it at once, whatever moves in the application (#3709): nothing
3683
+ * in this tree can fix it, so another run would only spend. A named run or a re-arm releases it once the framework is.
3684
+ */
3685
+ if (latest.status === FlowsActors_Status.FAILED && latest.failureOwner === GenerationStepFailureOwner.FRAMEWORK) {
3686
+ return {
3687
+ taskRef: candidate.taskRef,
3688
+ priorTaskId: latest.runTaskId,
3689
+ completedAt: latest.settledAt ?? latest.startedAt,
3690
+ generationStep: true,
3691
+ reason: Workbench_BuildTaskStuckReason.FAILURE_OUTSIDE_APPLICATION,
3692
+ repeatedFailure: { failure: latest.error ?? '', consecutive: Math.max(1, countConsecutiveIdenticalGenerationStepFailures(attempts)), owner: GenerationStepFailureOwner.FRAMEWORK },
3693
+ };
3694
+ }
3695
+ const identicalFailures = countConsecutiveIdenticalGenerationStepFailures(attempts);
3696
+ const completed = latest.status === FlowsActors_Status.COMPLETED;
3697
+ if (!completed && identicalFailures < GENERATION_STEP_IDENTICAL_FAILURES_WITHHELD_AFTER)
3167
3698
  return null;
3168
- const ownRoots = await this.generationSteps.resolveGenerationStepWritableRoots(candidate);
3169
- const isOwn = (path) => ownRoots.some((root) => (root.endsWith('/') ? path.startsWith(root) : path === root));
3170
- if ([...committed, ...tree.changedPaths].some((path) => !isOwn(path)))
3699
+ const since = latest.settledAt ?? latest.startedAt;
3700
+ if (!(await this.generationStepInputsUnmovedSince(candidate, since)))
3171
3701
  return null;
3702
+ if (completed) {
3703
+ return {
3704
+ taskRef: candidate.taskRef,
3705
+ priorTaskId: latest.runTaskId,
3706
+ completedAt: since,
3707
+ generationStep: true,
3708
+ reason: Workbench_BuildTaskStuckReason.COMPLETED_UNLANDED,
3709
+ };
3710
+ }
3172
3711
  return {
3173
3712
  taskRef: candidate.taskRef,
3174
3713
  priorTaskId: latest.runTaskId,
3175
3714
  completedAt: since,
3176
3715
  generationStep: true,
3177
- reason: Workbench_BuildTaskStuckReason.COMPLETED_UNLANDED,
3716
+ reason: Workbench_BuildTaskStuckReason.REPEATED_IDENTICAL_FAILURE,
3717
+ repeatedFailure: { failure: latest.error ?? '', consecutive: identicalFailures, ...(latest.failureOwner !== undefined ? { owner: latest.failureOwner } : {}) },
3178
3718
  };
3179
3719
  }
3720
+ /**
3721
+ * Whether nothing a generation step reads has moved since `since` (#3233, #3709): no commit since then, and no dirty path
3722
+ * in the working tree, touched what the step READS (`resolveGenerationStepReadRoots`) outside what it writes itself. A
3723
+ * step that names no read roots (an unknown step ref) reads every path outside its write scope, the rule before #3709.
3724
+ * Until #3709 every step read that way, so any sibling's checkpoint released a held step: on reference run 42886943490
3725
+ * a documentation publication failing on the engine's examples could run again after each frontend view landed.
3726
+ * `false` when git cannot be read, so a step is never held on an unknown.
3727
+ */
3728
+ async generationStepInputsUnmovedSince(candidate, since) {
3729
+ if (typeof this.git.listPathsCommittedSince !== 'function' || typeof this.git.readLandingSourceState !== 'function')
3730
+ return false;
3731
+ const [committed, tree] = await Promise.all([this.git.listPathsCommittedSince(since), this.git.readLandingSourceState()]);
3732
+ if (committed === undefined || tree === undefined)
3733
+ return false;
3734
+ const ownRoots = await this.generationSteps.resolveGenerationStepWritableRoots(candidate);
3735
+ const readRoots = typeof this.generationSteps.resolveGenerationStepReadRoots === 'function'
3736
+ ? await this.generationSteps.resolveGenerationStepReadRoots(candidate)
3737
+ : undefined;
3738
+ const under = (roots, path) => roots.some((root) => (root.endsWith('/') ? path.startsWith(root) : path === root));
3739
+ const isInput = (path) => !under(ownRoots, path) && (readRoots === undefined || under(readRoots, path));
3740
+ return ![...committed, ...tree.changedPaths].some(isInput);
3741
+ }
3180
3742
  /**
3181
3743
  * The build tasks whose LATEST coding run failed its own verification and was not cleared since (#3220): no re-arm, and
3182
3744
  * no isolated re-check that passed. Read once per landing derivation; `undefined` when the run history could not be read.
@@ -3325,22 +3887,25 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3325
3887
  return byTask;
3326
3888
  }
3327
3889
  /**
3328
- * The latest attempt of every generation step, by task ref, read once for a whole selection (#3233). `undefined` when the
3329
- * run history could not be read, so no step is held on an unknown.
3890
+ * Every generation step's runs, by task ref, NEWEST FIRST, read once for a whole selection (#3233, #3709): the latest
3891
+ * decides whether a step that ran is held, and the ones before it whether its failure repeats. `undefined` when the run
3892
+ * history could not be read, so no step is held on an unknown.
3330
3893
  */
3331
- async readLatestGenerationStepAttempts() {
3894
+ async readGenerationStepAttemptHistory() {
3332
3895
  try {
3333
3896
  // Not parsed through the route's query schema, whose 200 is an HTTP request's bound: in-process the listing pages.
3334
3897
  const listed = await this.executions.listActorExecutions({ systemRef: APPLICATION_BUILD_SYSTEM_REF, limit: BUILD_TASK_RECORD_HISTORY_CEILING });
3335
- const latest = new Map();
3898
+ const history = new Map();
3336
3899
  for (const projected of listed.map(projectBuildTaskAttempt)) {
3337
3900
  if (projected === null)
3338
3901
  continue;
3339
- const held = latest.get(projected.taskRef);
3340
- if (held === undefined || projected.attempt.startedAt > held.startedAt)
3341
- latest.set(projected.taskRef, projected.attempt);
3902
+ const attempts = history.get(projected.taskRef) ?? [];
3903
+ attempts.push(projected.attempt);
3904
+ history.set(projected.taskRef, attempts);
3342
3905
  }
3343
- return latest;
3906
+ for (const attempts of history.values())
3907
+ attempts.sort((left, right) => right.startedAt.localeCompare(left.startedAt));
3908
+ return history;
3344
3909
  }
3345
3910
  catch (error) {
3346
3911
  this.logDebug('Could not read the generation steps\' run history; none is held for having run', { error: describeCaughtError(error) });
@@ -3540,12 +4105,25 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3540
4105
  }
3541
4106
  return null;
3542
4107
  }
3543
- async prepareNextBuildTask(selection, preparation,
3544
4108
  /**
3545
- * A wave's fill: its landing reading, shared by every slot of one fill; and the generation steps the wave is running
3546
- * (#3204), which the coding plane's in-flight listings do not know, so the next slot passes over them.
4109
+ * Select the next task and compose what its run needs. A thin door over {@link selectAndComposeNextBuildTask}: when the
4110
+ * selection RESERVED a task for the wave (#3883) and composing it then throws, the reservation is released here, since
4111
+ * the caller never learns which task it was.
3547
4112
  */
3548
- options = {}) {
4113
+ async prepareNextBuildTask(selection, preparation, options = {}) {
4114
+ const reservedHere = {};
4115
+ try {
4116
+ return await this.selectAndComposeNextBuildTask(selection, preparation, options, reservedHere);
4117
+ }
4118
+ catch (error) {
4119
+ if (reservedHere.taskRef !== undefined)
4120
+ options.reservations?.delete(reservedHere.taskRef);
4121
+ throw error;
4122
+ }
4123
+ }
4124
+ async selectAndComposeNextBuildTask(selection, preparation, options,
4125
+ /** Set to the task this call reserved, so the door can release it if composing throws. */
4126
+ reservedHere) {
3549
4127
  let graph;
3550
4128
  let resolution;
3551
4129
  // Read FIRST, before any landing: it decides whether a held reading may be reused, and every candidate is checked
@@ -3560,24 +4138,42 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3560
4138
  ...(this.dispatch.listActiveRunTaskRefs?.() ?? []),
3561
4139
  ...(options.generationStepsInFlight ?? []),
3562
4140
  ]);
3563
- const held = options.fillLanding?.current;
3564
- const reused = held !== undefined
3565
- && held.settlementGeneration === this.landingSettlementGeneration
3566
- && [...held.inFlightTaskRefs].every((taskRef) => inFlightTaskRefs.has(taskRef))
3567
- ? held
3568
- : undefined;
4141
+ const fillLanding = options.fillLanding;
4142
+ const stillHolds = (guards) => guards !== undefined
4143
+ && guards.settlementGeneration === this.landingSettlementGeneration
4144
+ && [...guards.inFlightTaskRefs].every((taskRef) => inFlightTaskRefs.has(taskRef));
4145
+ const reused = stillHolds(fillLanding?.current) ? fillLanding.current : undefined;
4146
+ const joinable = reused === undefined && stillHolds(fillLanding?.pending) ? fillLanding.pending : undefined;
3569
4147
  if (reused !== undefined) {
3570
4148
  ({ graph, resolution } = reused);
3571
4149
  }
4150
+ else if (joinable !== undefined) {
4151
+ // Another slot of the wave is reading the landing right now, under guards that still hold (#3883): wait for it.
4152
+ preparation?.enter(ApplicationBuildPreparationPhase.RESOLVING_LANDING);
4153
+ ({ graph, resolution } = await joinable.reading);
4154
+ }
3572
4155
  else {
3573
4156
  // Taken BEFORE the derivation: a run landing while it runs leaves the reading marked older than that run.
3574
4157
  const settlementGeneration = this.landingSettlementGeneration;
3575
- preparation?.enter(ApplicationBuildPreparationPhase.READING_THE_PLAN);
3576
- graph = await this.readBuildPlan();
3577
- preparation?.enter(ApplicationBuildPreparationPhase.RESOLVING_LANDING);
3578
- resolution = await this.resolveLandedTaskRefs(graph.tasks);
3579
- if (options.fillLanding !== undefined)
3580
- options.fillLanding.current = { graph, resolution, settlementGeneration, inFlightTaskRefs };
4158
+ const reading = (async () => {
4159
+ preparation?.enter(ApplicationBuildPreparationPhase.READING_THE_PLAN);
4160
+ const readGraph = await this.readBuildPlan();
4161
+ preparation?.enter(ApplicationBuildPreparationPhase.RESOLVING_LANDING);
4162
+ return { graph: readGraph, resolution: await this.resolveLandedTaskRefs(readGraph.tasks) };
4163
+ })();
4164
+ if (fillLanding !== undefined) {
4165
+ // Stored before the first await, so a slot that asks meanwhile joins it rather than reading again.
4166
+ const pending = { settlementGeneration, inFlightTaskRefs, reading };
4167
+ fillLanding.pending = pending;
4168
+ reading.then((read) => {
4169
+ if (fillLanding.pending !== pending)
4170
+ return;
4171
+ fillLanding.pending = undefined;
4172
+ fillLanding.current = { ...read, settlementGeneration, inFlightTaskRefs };
4173
+ }, () => { if (fillLanding.pending === pending)
4174
+ fillLanding.pending = undefined; });
4175
+ }
4176
+ ({ graph, resolution } = await reading);
3581
4177
  }
3582
4178
  const landedTaskRefs = resolution.landed;
3583
4179
  preparation?.enter(ApplicationBuildPreparationPhase.SELECTING_THE_TASK);
@@ -3652,9 +4248,43 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3652
4248
  const inFlightProductWrites = selection === undefined && inFlightTaskRefs.size > 0
3653
4249
  ? graph.tasks.filter((task) => inFlightTaskRefs.has(task.taskRef)).flatMap(buildTaskProductWritePaths)
3654
4250
  : [];
4251
+ const reservations = selection === undefined ? options.reservations : undefined;
4252
+ /*
4253
+ * Another slot of the wave holds it, or a task it writes beside (#3883). Asked right before a candidate is taken, with
4254
+ * no await between the question and the reservation below, so concurrent slots see each other's choices.
4255
+ */
4256
+ /*
4257
+ * The follow-up a run or a reservation already holds on a candidate's SCOPE (#3886, review of the owner chains). Two
4258
+ * follow-ups on one scope write one scope; they declare no product, so neither the product-file check nor the
4259
+ * interference repair can see them, and chaining all of a scope's follow-ups would hold one owner's gaps behind
4260
+ * another's. So an unnamed selection takes one follow-up per scope at a time, whatever chain it waits on.
4261
+ */
4262
+ const taskByRef = new Map(graph.tasks.map((task) => [task.taskRef, task]));
4263
+ const followUpScopeBusy = (candidate) => {
4264
+ if (selection !== undefined || !candidate.taskRef.startsWith(HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX))
4265
+ return false;
4266
+ const scope = followUpScopeKey(candidate.target);
4267
+ return [...inFlightTaskRefs, ...(reservations?.keys() ?? [])].some((taskRef) => {
4268
+ if (taskRef === candidate.taskRef || !taskRef.startsWith(HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX))
4269
+ return false;
4270
+ const other = taskByRef.get(taskRef);
4271
+ return other !== undefined && followUpScopeKey(other.target) === scope;
4272
+ });
4273
+ };
4274
+ const reservedBeside = (candidate) => {
4275
+ if (followUpScopeBusy(candidate))
4276
+ return { taskRef: candidate.taskRef, priorTaskId: '', reason: Workbench_BuildTaskStuckReason.CONTENDED };
4277
+ if (reservations === undefined || reservations.size === 0)
4278
+ return undefined;
4279
+ if (reservations.has(candidate.taskRef))
4280
+ return { taskRef: candidate.taskRef, priorTaskId: '', reason: Workbench_BuildTaskStuckReason.IN_FLIGHT };
4281
+ return productWritePathsMeet(buildTaskProductWritePaths(candidate), [...reservations.values()].flat())
4282
+ ? { taskRef: candidate.taskRef, priorTaskId: '', reason: Workbench_BuildTaskStuckReason.CONTENDED }
4283
+ : undefined;
4284
+ };
3655
4285
  // Read once, and only for an UNNAMED selection: a named dispatch is the operator's door past the hold (#3233).
3656
- const latestGenerationStepAttempts = selection === undefined && candidates.some((candidate) => candidate.target?.kind === BuildPlanTaskTargetKind.COMPANION_GENERATION_STEP)
3657
- ? await this.readLatestGenerationStepAttempts()
4286
+ const generationStepAttemptHistory = selection === undefined && candidates.some((candidate) => candidate.target?.kind === BuildPlanTaskTargetKind.COMPANION_GENERATION_STEP)
4287
+ ? await this.readGenerationStepAttemptHistory()
3658
4288
  : undefined;
3659
4289
  for (const candidate of candidates) {
3660
4290
  /*
@@ -3714,11 +4344,25 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3714
4344
  this.logger.warn?.(`${landingUnknownCause} The rest of the plan proceeds; the step is offered again once the check answers.`, { deferredTaskRef: candidate.taskRef });
3715
4345
  continue;
3716
4346
  }
3717
- const ranAndHeld = selection === undefined ? await this.classifyRanGenerationStep(candidate, latestGenerationStepAttempts) : null;
4347
+ /*
4348
+ * …and one this wave already ran that has not landed (#3885). Run again in the same wave it would meet the tree it
4349
+ * just met; passed over, so the wave fills its slots with the ready coding tasks instead of stopping, as it did
4350
+ * until #3885. Its run is on the wave's result, and the next wave offers it under the holds below.
4351
+ */
4352
+ if (selection === undefined && options.generationStepsRunInWave?.has(candidate.taskRef) === true) {
4353
+ stuck.push({ taskRef: candidate.taskRef, priorTaskId: '', reason: Workbench_BuildTaskStuckReason.RAN_THIS_WAVE });
4354
+ continue;
4355
+ }
4356
+ const ranAndHeld = selection === undefined ? await this.classifyRanGenerationStep(candidate, generationStepAttemptHistory) : null;
3718
4357
  if (ranAndHeld !== null) {
3719
4358
  stuck.push(ranAndHeld);
3720
4359
  continue;
3721
4360
  }
4361
+ const reservedStep = reservedBeside(candidate);
4362
+ if (reservedStep !== undefined) {
4363
+ stuck.push(reservedStep);
4364
+ continue;
4365
+ }
3722
4366
  selected = candidate;
3723
4367
  break;
3724
4368
  }
@@ -3736,6 +4380,11 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3736
4380
  stuck.push({ taskRef: candidate.taskRef, priorTaskId: '', reason: Workbench_BuildTaskStuckReason.CONTENDED });
3737
4381
  continue;
3738
4382
  }
4383
+ const reserved = reservedBeside(candidate);
4384
+ if (reserved !== undefined) {
4385
+ stuck.push(reserved);
4386
+ continue;
4387
+ }
3739
4388
  selected = candidate;
3740
4389
  break;
3741
4390
  }
@@ -3753,6 +4402,15 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3753
4402
  ...withSpecificationFault(readBuildPlanSpecificationFault(graph.tasks, resolution)),
3754
4403
  });
3755
4404
  }
4405
+ /*
4406
+ * Reserved for the wave before anything awaits (#3883): the check in `reservedBeside` and this line run in one turn of
4407
+ * the event loop, so no concurrent slot can take it, or a task writing its files, in between.
4408
+ */
4409
+ if (reservations !== undefined) {
4410
+ reservations.set(selected.taskRef, buildTaskProductWritePaths(selected));
4411
+ reservedHere.taskRef = selected.taskRef;
4412
+ }
4413
+ options.onSelected?.(selected.taskRef);
3756
4414
  // A task being built right now, or waiting for one that writes its file, is not a finding (#1528, #3204).
3757
4415
  if (stuck.some((entry) => !WORKBENCH_BUILD_TASK_STUCK_REASONS_WAITING_ON_A_LIVE_RUN.has(entry.reason))) {
3758
4416
  const stuckByReason = Object.fromEntries(Object.values(Workbench_BuildTaskStuckReason).map((reason) => [reason, stuck.filter((entry) => entry.reason === reason).map((entry) => entry.taskRef)]));
@@ -3871,7 +4529,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3871
4529
  if (ready.length === 0)
3872
4530
  return undefined;
3873
4531
  const stuck = [];
3874
- let latestGenerationStepAttempts;
4532
+ let generationStepAttemptHistory;
3875
4533
  for (const task of ready) {
3876
4534
  if (task.target?.kind === BuildPlanTaskTargetKind.COMPANION_GENERATION_STEP) {
3877
4535
  /*
@@ -3882,8 +4540,8 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3882
4540
  return undefined;
3883
4541
  if (!resolution.unanswerableGenerationStepTaskRefs.has(task.taskRef)) {
3884
4542
  // A step held for having run on unchanged inputs is stuck too (#3233): the selector passes it over.
3885
- latestGenerationStepAttempts ??= await this.readLatestGenerationStepAttempts() ?? new Map();
3886
- if (await this.classifyRanGenerationStep(task, latestGenerationStepAttempts) === null)
4543
+ generationStepAttemptHistory ??= await this.readGenerationStepAttemptHistory() ?? new Map();
4544
+ if (await this.classifyRanGenerationStep(task, generationStepAttemptHistory) === null)
3887
4545
  return undefined;
3888
4546
  }
3889
4547
  stuck.push(task.taskRef);
@@ -3962,7 +4620,8 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3962
4620
  const runs = await this.readLatestCompletedCodingRuns();
3963
4621
  const openReportedGaps = runs === undefined
3964
4622
  ? undefined
3965
- : collectOpenReportedGaps({ derivation: await this.deriveFollowUps(plan.tasks, runs.latest), tasks: plan.tasks, latestCompletedRuns: runs.latest, landedTaskRefs: landed });
4623
+ // The same derivation as the plan's, dispatch record included, so the reading and the plan agree on what carries a gap.
4624
+ : collectOpenReportedGaps({ derivation: await this.readFollowUpDerivation(plan.tasks, runs.latest), tasks: plan.tasks, latestCompletedRuns: runs.latest, landedTaskRefs: landed });
3966
4625
  // A task a person CLOSED is landed for the plan, never proven: its product was never found by a probe (#3224).
3967
4626
  return {
3968
4627
  landedTaskRefs,
@@ -4461,8 +5120,13 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
4461
5120
  throw new BuildTaskDecisionRefusedError(`"${request.satisfiedBy}" is neither a task of the build plan nor a commit HEAD contains.`);
4462
5121
  closure = { taskRef, kind: BuildTaskClosureKind.SATISFIED_BY_COMMIT, satisfiedBy: sha, reason: request.reason, closedAt };
4463
5122
  }
5123
+ // A follow-up's closure covers the gaps its objective showed, and the follow-up carries exactly those (#3832), never
5124
+ // one absorbed after the person looked (#3833).
5125
+ const coverage = this.decidedFollowUpCoverage(plan.tasks, taskRef);
5126
+ refuseFollowUpReportsNotDisplayed(taskRef, coverage.gaps, request.coveredReportRefs);
5127
+ closure = { ...closure, ...coverage.fields };
4464
5128
  const { commitSha, decisionsPath, replacedUnhonoured } = await this.commitBuildTaskDecision({ closure }, {
4465
- summary: `${taskRef}: closed (${closure.kind}${closure.satisfiedBy ? ` by ${closure.satisfiedBy}` : ''})`,
5129
+ summary: `${taskRef}: closed (${closure.kind}${closure.satisfiedBy ? ` by ${closure.satisfiedBy}` : ''})${describeFollowUpDecisionOrigins(coverage.gaps)}`,
4466
5130
  purpose: request.reason,
4467
5131
  actor,
4468
5132
  });
@@ -4472,6 +5136,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
4472
5136
  note: (commitSha
4473
5137
  ? `${taskRef} is closed (${closure.kind}), committed ${commitSha.slice(0, 8)}; it counts as landed${closure.kind === BuildTaskClosureKind.SATISFIED_BY_TASK ? ` while ${closure.satisfiedBy} is landed` : ''}. To undo it, revert that commit.`
4474
5138
  : `${taskRef}'s closure is written to ${decisionsPath} and counts once it is committed.`)
5139
+ + describeFollowUpDecisionCoverage(coverage.gaps, 'closes', taskRef)
4475
5140
  + describeReplacedDecisions(replacedUnhonoured),
4476
5141
  };
4477
5142
  }
@@ -4484,7 +5149,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
4484
5149
  */
4485
5150
  async approveFollowUpTask(taskRef, request, actor) {
4486
5151
  if (!followUpsAwaitReviewUnder(this.autonomyPosture)) {
4487
- throw new BuildTaskDecisionRefusedError(`Under the ${this.autonomyPosture} autonomy posture derived follow-ups run without review, so there is nothing to approve. Decline one you do not want with \`wildo build close ${taskRef} --declined --reason "<why>"\`.`);
5152
+ throw new BuildTaskDecisionRefusedError(`Under the ${this.autonomyPosture} autonomy posture derived follow-ups run without review, so there is nothing to approve. Decline one you do not want with \`wildo build close ${taskRef} --declined --reason "<why>" --covers <the reports wildo build tasks lists>\`.`);
4488
5153
  }
4489
5154
  if (!taskRef.startsWith(HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX)) {
4490
5155
  throw new BuildTaskDecisionRefusedError(`Only a derived follow-up waits for review; ${taskRef} is a task of the accepted plan, which was reviewed with the plan.`);
@@ -4497,9 +5162,12 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
4497
5162
  throw new BuildTaskDecisionRefusedError(`${taskRef} is already approved.`);
4498
5163
  if (await this.dispatch.findCompletedRunForBuildTask(taskRef, undefined, { fresh: true }) !== null)
4499
5164
  throw new BuildTaskDecisionRefusedError(`${taskRef} has already run; there is nothing to approve.`);
4500
- const approval = { taskRef, ...(request.note ? { note: request.note } : {}), approvedAt: new Date().toISOString() };
5165
+ // The approval covers the gaps the objective carries now, named in the reply, and the follow-up carries exactly those (#3832).
5166
+ const coverage = this.decidedFollowUpCoverage(plan.tasks, taskRef);
5167
+ refuseFollowUpReportsNotDisplayed(taskRef, coverage.gaps, request.coveredReportRefs);
5168
+ const approval = { taskRef, ...(request.note ? { note: request.note } : {}), approvedAt: new Date().toISOString(), ...coverage.fields };
4501
5169
  const { commitSha, decisionsPath, replacedUnhonoured } = await this.commitBuildTaskDecision({ followUpApproval: approval }, {
4502
- summary: `${taskRef}: follow-up approved to run`,
5170
+ summary: `${taskRef}: follow-up approved to run${describeFollowUpDecisionOrigins(coverage.gaps)}`,
4503
5171
  purpose: request.note ?? 'The creator reviewed the derived follow-up and let it run.',
4504
5172
  actor,
4505
5173
  });
@@ -4509,6 +5177,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
4509
5177
  note: (commitSha
4510
5178
  ? `${taskRef} is approved, committed ${commitSha.slice(0, 8)}; the next wave may run it. To undo it before it runs, revert that commit.`
4511
5179
  : `${taskRef}'s approval is written to ${decisionsPath} and counts once it is committed.`)
5180
+ + describeFollowUpDecisionCoverage(coverage.gaps, 'lets run', taskRef)
4512
5181
  + describeReplacedDecisions(replacedUnhonoured),
4513
5182
  };
4514
5183
  }
@@ -4547,6 +5216,23 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
4547
5216
  : [];
4548
5217
  });
4549
5218
  }
5219
+ /**
5220
+ * The reported gaps only a person's decision can close (#3886): what the creation home's ASKED line names. Read from the
5221
+ * follow-up derivation the plan appended, so Home and the plan agree about which gaps wait on a decision; a later run of
5222
+ * the reporting task that no longer reports it removes it. `[]` with no build plan, or when the runs cannot be listed.
5223
+ */
5224
+ async readGapsAwaitingDecision() {
5225
+ if (!(await this.hasAuthoredBuildPlan()))
5226
+ return [];
5227
+ const plan = await this.readBuildPlan();
5228
+ const runs = await this.readLatestCompletedCodingRuns();
5229
+ if (runs === undefined)
5230
+ return [];
5231
+ const derivation = await this.readFollowUpDerivation(plan.tasks, runs.latest);
5232
+ return derivation.notDerived.flatMap((gap) => (gap.reason === FollowUpGapNotDerivedReason.AWAITS_DECISION && gap.needsDecision !== undefined
5233
+ ? [{ taskRef: gap.originTaskRef, requirementRef: gap.requirementRef, decision: gap.needsDecision }]
5234
+ : []));
5235
+ }
4550
5236
  /**
4551
5237
  * The LANDED tasks carrying a landing advisory (#3285), each with its advisories: what the creation home's advisory
4552
5238
  * line names. The same derivation the task records make (`resolveBuildTaskLandingAdvisories` over the committed
@@ -4580,11 +5266,46 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
4580
5266
  */
4581
5267
  async rearmBuildTask(taskRef, request, session) {
4582
5268
  const plan = await this.readBuildPlan();
4583
- if (!plan.tasks.some((task) => task.taskRef === taskRef)) {
5269
+ const task = plan.tasks.find((candidate) => candidate.taskRef === taskRef);
5270
+ if (task === undefined) {
4584
5271
  throw new NothingToRearmError(`"${taskRef}" is not a task of this application's build plan, so there is nothing to re-arm.`);
4585
5272
  }
5273
+ if (task.target?.kind === BuildPlanTaskTargetKind.COMPANION_GENERATION_STEP)
5274
+ return this.rearmGenerationStep(taskRef, request, session);
4586
5275
  return this.dispatch.rearmBuildTask(taskRef, request, session);
4587
5276
  }
5277
+ /**
5278
+ * Put a GENERATION STEP back in the queue (#3709): the re-arm is recorded on each of its runs that still holds it, a
5279
+ * completed one (#3233) or a failed one (#3709), exactly as a coding task's re-arm is recorded on its runs. The coding
5280
+ * lane's re-arm reads coding runs only, so a step's runs, which are the build system's own rows, were never re-armed and
5281
+ * a held step had only the named dispatch as its door.
5282
+ */
5283
+ async rearmGenerationStep(taskRef, request, session) {
5284
+ // Not parsed through the route's query schema, whose 200 is an HTTP request's bound: in-process the listing pages.
5285
+ const listed = await this.executions.listActorExecutions({ systemRef: APPLICATION_BUILD_SYSTEM_REF, limit: BUILD_TASK_RECORD_HISTORY_CEILING });
5286
+ const holding = listed.flatMap((execution) => {
5287
+ const row = execution.standaloneTasks[0];
5288
+ const holds = (execution.status === FlowsActors_Status.COMPLETED || execution.status === FlowsActors_Status.FAILED)
5289
+ && row?.input?.taskRef === taskRef
5290
+ && readBuildTaskRearm(row?.memory) === undefined;
5291
+ return holds && row !== undefined ? [row] : [];
5292
+ });
5293
+ if (holding.length === 0) {
5294
+ throw new NothingToRearmError(`Build step "${taskRef}" has no completed or failed run that still holds it, so there is nothing to re-arm: it was never run, `
5295
+ + 'or every run is already re-armed. A step in that state is offered by the next dispatch on its own.');
5296
+ }
5297
+ const rearm = { reason: request.reason, note: request.note, rearmedAt: new Date().toISOString() };
5298
+ try {
5299
+ for (const row of holding) {
5300
+ await this.executions.updateActorTask(String(row._id), { memory: withBuildTaskRearm(row.memory, rearm) }, session);
5301
+ }
5302
+ }
5303
+ finally {
5304
+ // Announced even when a later update threw: the rows re-armed before it did still moved.
5305
+ this.dispatch.announceRunStateChanged();
5306
+ }
5307
+ return { rearmedRunTaskIds: holding.map((row) => String(row._id)), rearm };
5308
+ }
4588
5309
  /**
4589
5310
  * Where a task's landing was found: its probes' paths, or a generation step's evidence paths. Empty for a probe
4590
5311
  * that names no fixed file (a shell surface, a schema-plan state) — the record then says "found" without a place
@@ -4684,7 +5405,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
4684
5405
  : resolution.unanswerableGenerationStepTaskRefs.has(task.taskRef)
4685
5406
  ? { taskRef: task.taskRef, priorTaskId: '', reason: Workbench_BuildTaskStuckReason.LANDING_UNKNOWN, landingUnknownCause: describeHeldBySpecificationFault(task, resolution.modulesHoldingGenerationSteps) ?? describeHeldByUnknownDecisions(task.taskRef, resolution.buildTaskDecisions) ?? describeUnanswerableGenerationStepLanding(task) }
4686
5407
  // #3233: a step that ran, did not land, and whose inputs have not moved — the unattended loop passes it over.
4687
- : await this.classifyRanGenerationStep(task, latestGenerationStepAttemptsOf(attemptsByTask));
5408
+ : await this.classifyRanGenerationStep(task, attemptsByTask);
4688
5409
  /*
4689
5410
  * A step the scheduler PASSES OVER because its landing check could not be answered reports that state before it
4690
5411
  * ever ran (#2531 review L6): without it the step read as plainly ready while every dispatch went past it.
@@ -4821,10 +5542,12 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
4821
5542
  // false — and an invitation to pay for a re-run (#2217 review).
4822
5543
  const landedBeforeAnyRun = landed && !attemptsTruncated && !attempts.some(isCountedBuildTaskAttempt)
4823
5544
  ? { probedPaths: await this.resolveLandedEvidencePaths(task) } : undefined;
4824
- // A follow-up's FIRST prerequisite is its origin; the others are the follow-up before it on its target (#3227) and
4825
- // host-derived steps appended later.
5545
+ // The follow-ups carrying this task's reports (#3204: an absorbed report is carried under another report's ref, whose
5546
+ // FIRST prerequisite is that report's origin; the others are the follow-up before it on its target, #3227, and
5547
+ // host-derived steps appended later).
4826
5548
  const followUpTaskRefs = plan.tasks
4827
- .filter((candidate) => candidate.taskRef.startsWith(HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX) && candidate.prerequisiteTaskRefs[0] === task.taskRef)
5549
+ .filter((candidate) => candidate.taskRef.startsWith(HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX)
5550
+ && (candidate.prerequisiteTaskRefs[0] === task.taskRef || this.followUpOriginTaskRefs(candidate.taskRef)?.has(task.taskRef) === true))
4828
5551
  .map((candidate) => candidate.taskRef);
4829
5552
  // A declined closure accounts for the task without its product, so nothing it declined is owed to be served.
4830
5553
  const landingAdvisories = landed && resolution.closedTaskRefs.get(task.taskRef)?.kind !== BuildTaskClosureKind.DECLINED
@@ -4835,6 +5558,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
4835
5558
  status,
4836
5559
  ...(followUpTaskRefs.length > 0 ? { followUpTaskRefs } : {}),
4837
5560
  ...(task.taskRef.startsWith(HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX) && task.prerequisiteTaskRefs[0] !== undefined ? { followUpOf: task.prerequisiteTaskRefs[0] } : {}),
5561
+ ...(coveredReportsOf(this.decidedFollowUpCoverage(plan.tasks, task.taskRef).gaps)),
4838
5562
  ...(closureOf(resolution.closedTaskRefs.get(task.taskRef))),
4839
5563
  attempts,
4840
5564
  ...(stuck !== null ? { stuck } : {}),
@@ -5422,13 +6146,13 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
5422
6146
  this.modulesWithNoRepairToRun = undefined;
5423
6147
  const specificationRepairOwed = modulesHoldingGenerationSteps.length > 0 && await this.readSpecificationRepairOwed(specificationFindings);
5424
6148
  if (modulesHoldingGenerationSteps.length > 0) {
5425
- const latestAttempts = await this.readLatestGenerationStepAttempts();
6149
+ const attemptHistory = await this.readGenerationStepAttemptHistory();
5426
6150
  for (const task of tasks) {
5427
6151
  if (task.target?.kind !== BuildPlanTaskTargetKind.COMPANION_GENERATION_STEP || landed.has(task.taskRef))
5428
6152
  continue;
5429
6153
  if (!generationStepReadsSpecifications(task.target.generationStepRef))
5430
6154
  continue;
5431
- const latest = latestAttempts?.get(task.taskRef);
6155
+ const latest = attemptHistory?.get(task.taskRef)?.[0];
5432
6156
  const ran = latest?.status === FlowsActors_Status.COMPLETED && latest.rearm === undefined;
5433
6157
  const checkKind = generationStepConditions.get(task.taskRef)?.kind;
5434
6158
  if (ran && checkKind !== undefined && generationStepCheckReadsSpecifications(checkKind)) {
@@ -5436,7 +6160,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
5436
6160
  unverifiable.add(task.taskRef);
5437
6161
  unanswerable.delete(task.taskRef);
5438
6162
  }
5439
- else if (!ran || await this.classifyRanGenerationStep(task, latestAttempts) === null) {
6163
+ else if (!ran || await this.classifyRanGenerationStep(task, attemptHistory) === null) {
5440
6164
  // A step that ran and awaits its commit stays out of this: the selection reports it as that.
5441
6165
  unanswerable.add(task.taskRef);
5442
6166
  }
@@ -6652,7 +7376,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
6652
7376
  return undefined;
6653
7377
  const roadmap = RoadmapSnapshotSchema.safeParse(decidedFamilyValuesFromCompanionExports(companionExports)[ApplicationSpecificationFamily.ROADMAP]);
6654
7378
  const phases = roadmap.success ? roadmap.data.phases : [];
6655
- const followUps = await this.deriveFollowUps(plan.tasks, runs.latest);
7379
+ const followUps = await this.readFollowUpDerivation(plan.tasks, runs.latest);
6656
7380
  return (requirementRef) => deriveWebsiteClaimDelivery(requirementRef, {
6657
7381
  tasks: plan.tasks,
6658
7382
  landedTaskRefs: landed,
@@ -6726,9 +7450,10 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
6726
7450
  return { latest, truncated: rows.length >= BUILD_TASK_RECORD_HISTORY_CEILING };
6727
7451
  }
6728
7452
  /**
6729
- * The follow-up tasks the requirements COMPLETED coding runs reported still unmet derive (#2496, #3227), appended to the
6730
- * plan. The derivation is {@link deriveBuildPlanFollowUpTasks}: one follow-up per reporting run, folding every requirement
6731
- * it reported, with a stable identity, chained to the follow-up before it on the same target.
7453
+ * The follow-up tasks the requirements COMPLETED coding runs reported still unmet derive (#2496, #3227, #3204), appended
7454
+ * to the plan. The derivation is {@link deriveBuildPlanFollowUpTasks}: every requirement a run reported folded into one
7455
+ * follow-up, a follow-up not dispatched yet absorbing every later report on its target, each with a stable identity,
7456
+ * chained to the follow-up before it on the same target.
6732
7457
  *
6733
7458
  * 005's workers wrote "office/field access is only partly met" and "the roles do nothing yet … it still needs its own
6734
7459
  * work" into closing reports that every run was accepted on, and no later task, coherence entry or judge picked any of
@@ -6745,21 +7470,82 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
6745
7470
  if (runs === undefined)
6746
7471
  return graph;
6747
7472
  /*
6748
- * Held per (plan tasks, latest completed runs) (#3204): the plan is read on every selection, board and landing read,
6749
- * and this re-validated the whole plan once per follow-up and warned again on each read. On reference run 42666728304
6750
- * a re-decomposed plan already naming the follow-ups logged "already names another task" 184 times in one burst,
6751
- * beside the companion's event-loop stalls. Nothing else decides the answer, so a read with neither changed reuses it.
7473
+ * Held per (plan tasks, latest completed runs, absorption inputs) (#3204): the plan is read on every selection, board
7474
+ * and landing read, and this re-validated the whole plan once per follow-up and warned again on each read. On reference
7475
+ * run 42666728304 a re-decomposed plan already naming the follow-ups logged "already names another task" 184 times in
7476
+ * one burst, beside the companion's event-loop stalls. Nothing else decides the answer, so a read with none of them
7477
+ * changed reuses it.
6752
7478
  */
6753
- const memoKey = JSON.stringify({ tasks: graph.tasks, runs: [...runs.latest].map(([taskRef, attempt]) => [taskRef, attempt.runTaskId]).sort(([left], [right]) => String(left).localeCompare(String(right))) });
7479
+ const absorption = await this.readFollowUpAbsorptionInputs();
7480
+ const runsKey = JSON.stringify([...runs.latest].map(([taskRef, attempt]) => [taskRef, attempt.runTaskId]).sort(([left], [right]) => String(left).localeCompare(String(right))));
7481
+ const memoKey = JSON.stringify({ tasks: graph.tasks, runs: runsKey, absorption: describeAbsorptionInputs(absorption) });
6754
7482
  if (this.followUpDerivationMemo?.key === memoKey)
6755
7483
  return this.followUpDerivationMemo.graph;
6756
- const derived = await this.deriveFollowUpTaskGraph(graph, runs);
6757
- this.followUpDerivationMemo = { key: memoKey, graph: derived };
7484
+ const { graph: derived, derivation } = await this.deriveFollowUpTaskGraph(graph, runs, absorption);
7485
+ this.followUpDerivationMemo = { key: memoKey, runsKey, graph: derived, derivation };
7486
+ // What each appended follow-up carries, by the objective it carries it under: stamped on its run at dispatch.
7487
+ for (const followUp of derivation.followUps) {
7488
+ const objectiveKey = `${followUp.task.taskRef}\u0000${followUp.task.objective}`;
7489
+ // Re-inserted, so the eviction below drops the objectives no read has derived for longest (review N5).
7490
+ this.carriedFollowUpGapKeys.delete(objectiveKey);
7491
+ this.carriedFollowUpGapKeys.set(objectiveKey, followUp.gaps);
7492
+ }
7493
+ while (this.carriedFollowUpGapKeys.size > CARRIED_FOLLOW_UP_GAP_KEYS_RETAINED)
7494
+ this.carriedFollowUpGapKeys.delete(this.carriedFollowUpGapKeys.keys().next().value);
6758
7495
  return derived;
6759
7496
  }
6760
7497
  followUpDerivationMemo;
6761
- async deriveFollowUpTaskGraph(graph, runs) {
6762
- const derivation = await this.deriveFollowUps(graph.tasks, runs.latest);
7498
+ /**
7499
+ * The gap keys each derived follow-up carries, by `<ref>\u0000<objective>` (#3204): looked up by the objective a dispatch
7500
+ * selected, and stamped on the run, so what a dispatched follow-up carried is RECORDED rather than inferred. An objective
7501
+ * is a function of its gaps, so a lookup that misses records nothing, and the follow-up then carries its own report only
7502
+ * (a report it held is carried again by the next follow-up: one run too many, never a gap nobody was told about).
7503
+ */
7504
+ carriedFollowUpGapKeys = new Map();
7505
+ /**
7506
+ * The follow-up derivation the plan read APPENDED, for these runs (#3204 review N6): read again when the last plan read
7507
+ * was over other runs, so a reader always answers from what the plan holds. Derived without the plan only if even that
7508
+ * read answers for other runs (the listing moved in between), which cannot name a refused follow-up but never hides a gap.
7509
+ */
7510
+ async readFollowUpDerivation(tasks, latest) {
7511
+ const runsKey = JSON.stringify([...latest].map(([taskRef, attempt]) => [taskRef, attempt.runTaskId]).sort(([left], [right]) => String(left).localeCompare(String(right))));
7512
+ if (this.followUpDerivationMemo?.runsKey !== runsKey)
7513
+ await this.readBuildPlan();
7514
+ if (this.followUpDerivationMemo?.runsKey === runsKey)
7515
+ return this.followUpDerivationMemo.derivation;
7516
+ return this.deriveFollowUps(tasks, latest, await this.readFollowUpAbsorptionInputs());
7517
+ }
7518
+ /** Every origin whose report a follow-up carries, as the last plan read appended it (#3204); undefined before any read. */
7519
+ followUpOriginTaskRefs(followUpTaskRef) {
7520
+ const followUp = this.followUpDerivationMemo?.derivation.followUps.find((candidate) => candidate.task.taskRef === followUpTaskRef);
7521
+ return followUp === undefined ? undefined : new Set(followUp.gaps.map((gap) => gap.originTaskRef));
7522
+ }
7523
+ /**
7524
+ * What a decision on a derived follow-up covers (#3832): the gaps its objective carries AT THE DECISION, recorded on the
7525
+ * decision so the follow-up carries exactly those from then on. Nothing for a task that is not a follow-up, or whose
7526
+ * objective was never derived (the follow-up then stays fixed to its own report).
7527
+ *
7528
+ * A pending follow-up keeps absorbing reports until it is decided, so this can hold a report that arrived after the person
7529
+ * last looked (review of #3832). A caller sends the reports it displayed (`coveredReportRefs`), and the door refuses a
7530
+ * decision that sends none or covers one more ({@link refuseFollowUpReportsNotDisplayed}, #3833). It also NAMES every report it covers, in
7531
+ * its reply and in the decision commit's summary, so one revert undoes it.
7532
+ */
7533
+ decidedFollowUpCoverage(tasks, taskRef) {
7534
+ if (!taskRef.startsWith(HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX))
7535
+ return { fields: {}, gaps: [] };
7536
+ const task = tasks.find((candidate) => candidate.taskRef === taskRef);
7537
+ const carried = task === undefined ? undefined : this.carriedFollowUpGapKeys.get(`${taskRef}\u0000${task.objective}`);
7538
+ return carried === undefined ? { fields: {}, gaps: [] } : { fields: { carriedFollowUpGapKeys: carried.map((gap) => followUpGapKey(gap)) }, gaps: carried };
7539
+ }
7540
+ /** The carried gap keys of the follow-up a dispatch selected (#3204), for its run's input. */
7541
+ withCarriedFollowUpGaps(prepared, origin) {
7542
+ if (!prepared.plan.taskRef.startsWith(HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX))
7543
+ return origin;
7544
+ const carried = this.carriedFollowUpGapKeys.get(`${prepared.plan.taskRef}\u0000${prepared.plan.objective}`);
7545
+ return carried === undefined ? origin : { ...origin, carriedFollowUpGapKeys: carried.map((gap) => followUpGapKey(gap)) };
7546
+ }
7547
+ async deriveFollowUpTaskGraph(graph, runs, absorption) {
7548
+ const derivation = await this.deriveFollowUps(graph.tasks, runs.latest, absorption);
6763
7549
  for (const skipped of derivation.notDerived) {
6764
7550
  if (skipped.reason === FollowUpGapNotDerivedReason.MET_SINCE && skipped.metSince !== undefined) {
6765
7551
  // Every drop is logged, with the run that stated it met and where (#3227).
@@ -6771,30 +7557,51 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
6771
7557
  });
6772
7558
  continue;
6773
7559
  }
7560
+ // A decision only a person can make (#3886, review M2): asked on Home, and said here at debug, since every plan read meets it.
7561
+ if (skipped.reason === FollowUpGapNotDerivedReason.AWAITS_DECISION) {
7562
+ this.logDebug(`A reported gap on ${skipped.originTaskRef} waits on a decision, so no coding task is derived: ${skipped.requirementRef}: ${skipped.needsDecision ?? ''}`, { requirementRef: skipped.requirementRef });
7563
+ continue;
7564
+ }
6774
7565
  this.logger.warn?.(`A reported gap on ${skipped.originTaskRef} derives no follow-up (${skipped.reason}): that target does not land by a coding run, so a follow-up would read as landed without running, or never run. The gap stays on the run's record.`, { requirementRef: skipped.requirementRef });
6775
7566
  }
6776
7567
  const taskRefs = new Set(graph.tasks.map((task) => task.taskRef));
6777
7568
  let current = graph;
7569
+ const appended = [];
6778
7570
  /*
6779
7571
  * Each follow-up waits on the last one APPENDED on its target (#3227 review F3): a follow-up skipped below would
6780
7572
  * otherwise be named as the next one's prerequisite, which the plan refuses as unknown, and the rest of its target's
6781
7573
  * chain would be dropped with it.
6782
7574
  */
6783
7575
  const lastAppendedOnTarget = new Map();
6784
- for (const derived of derivation.followUps) {
6785
- const followUp = chainFollowUpAfter(derived.task, lastAppendedOnTarget.get(derived.targetKey));
7576
+ const append = (derived) => {
7577
+ const followUp = chainFollowUpAfter(derived, lastAppendedOnTarget.get(derived.targetKey));
6786
7578
  if (taskRefs.has(followUp.taskRef)) {
6787
7579
  this.logger.warn?.(`Reported gaps derive "${followUp.taskRef}", which already names another task; not deriving it`, { origins: followUp.prerequisiteTaskRefs });
6788
- continue;
7580
+ return false;
6789
7581
  }
6790
7582
  const extended = BuildPlanTaskGraphSchema.safeParse({ ...current, tasks: [...current.tasks, followUp] });
6791
7583
  if (!extended.success) {
6792
7584
  this.logger.warn?.(`Reported gaps on ${followUp.prerequisiteTaskRefs.join(', ')} could not become a follow-up task; they stay on the runs' records`, { issues: extended.error.issues.map((issue) => issue.message) });
6793
- continue;
7585
+ return false;
6794
7586
  }
6795
7587
  current = extended.data;
6796
7588
  taskRefs.add(followUp.taskRef);
6797
7589
  lastAppendedOnTarget.set(derived.targetKey, followUp.taskRef);
7590
+ appended.push({ ...derived, task: followUp, absorbed: [] });
7591
+ return true;
7592
+ };
7593
+ // A gap whose follow-up could not join the plan still reads OPEN, with no follow-up (#3204 review N1).
7594
+ const refused = [];
7595
+ const refuse = (gaps) => refused.push(...gaps.map((gap) => ({ ...gap, reason: FollowUpGapNotDerivedReason.FOLLOW_UP_NOT_APPENDED })));
7596
+ for (const derived of derivation.followUps) {
7597
+ if (append(derived))
7598
+ continue;
7599
+ // A follow-up that cannot join the plan does not take the reports it absorbed with it (#3204): each gets its own.
7600
+ const absorbedKeys = new Set(derived.absorbed.flatMap((absorbed) => absorbed.gaps.map((gap) => followUpGapKey(gap))));
7601
+ refuse(derived.gaps.filter((gap) => !absorbedKeys.has(followUpGapKey(gap))));
7602
+ for (const absorbed of derived.absorbed)
7603
+ if (!append(absorbed))
7604
+ refuse(absorbed.gaps);
6798
7605
  }
6799
7606
  /*
6800
7607
  * Whenever the cap is hit, derived or not (#2496 review N1): the gap the cap hides is exactly the case that derives
@@ -6804,28 +7611,39 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
6804
7611
  this.followUpListingTruncationWarned = true;
6805
7612
  this.logger.warn?.(`The coding-run listing hit its ${BUILD_TASK_RECORD_HISTORY_CEILING}-run ceiling: a gap an older run reported may not have derived its follow-up.`);
6806
7613
  }
6807
- return current;
7614
+ // Every reader answers from what was appended, so none names a follow-up the plan does not hold (#3204 review F7).
7615
+ return { graph: current, derivation: assembleFollowUpDerivation(appended, [...derivation.notDerived, ...refused]) };
6808
7616
  }
6809
7617
  /**
6810
7618
  * The follow-up derivation over a plan and the latest completed runs (#2496, #3227): one function for every reader.
6811
7619
  *
6812
7620
  * A gap a later run STATED met is dropped only once this host confirms two things the pure candidates cannot know
6813
7621
  * ({@link collectFollowUpGapsMetSince}): the stating run LANDED, meaning every file its write record holds as its own is
6814
- * committed (a statement about a tree whose work is still uncommitted is about a tree HEAD does not have), and the gap's
6815
- * follow-up was never attempted, in any state (a follow-up the build ran or is running never leaves the plan, #2530).
6816
- * Both are read only when a candidate exists, so a plan with no met statement costs nothing extra. Anything this cannot
6817
- * read keeps the gap: an unknown is not a statement that it is met.
6818
- */
6819
- async deriveFollowUps(tasks, latest) {
7622
+ * committed (a statement about a tree whose work is still uncommitted is about a tree HEAD does not have), and no
7623
+ * follow-up holding the gap was ever attempted, in any state: neither its own report's, nor the one that absorbed it
7624
+ * (#3204), since a follow-up the build ran or is running keeps what it was given (#2530). Both are read only when a
7625
+ * candidate exists, so a plan with no met statement costs nothing extra. Anything this cannot read keeps the gap: an
7626
+ * unknown is not a statement that it is met.
7627
+ */
7628
+ async deriveFollowUps(tasks, latest, absorption) {
7629
+ const withAbsorption = absorption ? { absorption } : {};
6820
7630
  const candidates = collectFollowUpGapsMetSince({ tasks, latestCompletedRuns: latest });
6821
7631
  if (candidates.length === 0)
6822
- return deriveBuildPlanFollowUpTasks({ tasks, latestCompletedRuns: latest });
7632
+ return deriveBuildPlanFollowUpTasks({ tasks, latestCompletedRuns: latest, ...withAbsorption });
6823
7633
  const metSince = new Map();
6824
7634
  try {
6825
- const attempted = await this.readAttemptedBuildTaskRefs();
7635
+ // Every task with ANY run (#2530); unknown when the listing could not be read or reached its ceiling.
7636
+ if (absorption === undefined)
7637
+ throw new Error('the coding-run listing could not be read whole, so an attempted follow-up may be missing from it');
7638
+ const attempted = absorption.dispatched;
7639
+ // Every gap a dispatched follow-up carries, before anything is dropped: an absorbed gap is carried under another
7640
+ // report's ref, and a gap routed to several modules by several follow-ups (#3204 review N2).
7641
+ const carriedByAttempted = new Set(deriveBuildPlanFollowUpTasks({ tasks, latestCompletedRuns: latest, absorption }).followUps
7642
+ .filter((followUp) => attempted.has(followUp.task.taskRef))
7643
+ .flatMap((followUp) => followUp.gaps.map((gap) => followUpGapKey(gap))));
6826
7644
  const landedRuns = await this.selectLandedRunTaskIds([...new Set(candidates.map((candidate) => candidate.metByRunTaskId))]);
6827
7645
  for (const candidate of candidates) {
6828
- if (attempted.has(candidate.followUpTaskRef) || !landedRuns.has(candidate.metByRunTaskId))
7646
+ if (attempted.has(candidate.followUpTaskRef) || carriedByAttempted.has(followUpGapKey(candidate.gap)) || !landedRuns.has(candidate.metByRunTaskId))
6829
7647
  continue;
6830
7648
  // The first confirmed statement, in plan order, is the one the log names.
6831
7649
  if (!metSince.has(followUpGapKey(candidate.gap)))
@@ -6835,24 +7653,66 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
6835
7653
  catch (error) {
6836
7654
  this.logger.warn?.('Could not confirm the runs that state a reported gap met; every reported gap derives its follow-up', { error: describeCaughtError(error) });
6837
7655
  }
6838
- return deriveBuildPlanFollowUpTasks({ tasks, latestCompletedRuns: latest, metSince });
7656
+ return deriveBuildPlanFollowUpTasks({ tasks, latestCompletedRuns: latest, metSince, ...withAbsorption });
6839
7657
  }
6840
7658
  /**
6841
- * Every build task with ANY coding run in the history, whatever its state (#3227): a follow-up attempted keeps its gaps.
6842
- * Throws when the listing reached its ceiling: a follow-up attempted before the window would read as never attempted.
7659
+ * What decides which reports a follow-up absorbs (#3204), cached like {@link readLatestCompletedCodingRuns}, which every
7660
+ * plan read also makes:
7661
+ *
7662
+ * - `dispatched`: every build task with ANY coding run in the history, whatever its state, with the gap keys its runs
7663
+ * recorded at dispatch (`carriedFollowUpGapKeys`). Also the attempted set the met-since confirmation reads (#2530).
7664
+ * - `decided`: every task the COMMITTED build-task decisions name (a closure, a follow-up approval), with the gap keys
7665
+ * the decision recorded (#3832), read without asking whether they are honoured: a follow-up a person decided on, or
7666
+ * that an unread decision may name, absorbs nothing more than the decision covered.
7667
+ *
7668
+ * `undefined` when either cannot be read whole (the listing failed or reached its ceiling, the decisions do not parse):
7669
+ * a dispatch outside the window would read as never made, so every caller derives as if nothing were absorbed or
7670
+ * confirmed met.
6843
7671
  */
6844
- async readAttemptedBuildTaskRefs() {
6845
- const rows = await this.executions.listActorExecutions({ systemRef: APPLICATION_CODING_SYSTEM_REF, limit: BUILD_TASK_RECORD_HISTORY_CEILING });
6846
- // A listing cut at its ceiling may miss an older attempt: unknown, so nothing is confirmed met (#2530).
7672
+ readFollowUpAbsorptionInputs() {
7673
+ const now = Date.now();
7674
+ if (this.followUpAbsorptionInputs !== undefined && now - this.followUpAbsorptionInputs.at < LATEST_COMPLETED_CODING_RUNS_TTL_MS) {
7675
+ return this.followUpAbsorptionInputs.value;
7676
+ }
7677
+ const value = this.fetchFollowUpAbsorptionInputs();
7678
+ this.followUpAbsorptionInputs = { at: now, value };
7679
+ return value;
7680
+ }
7681
+ followUpAbsorptionInputs;
7682
+ async fetchFollowUpAbsorptionInputs() {
7683
+ let rows;
7684
+ let decisionsText;
7685
+ try {
7686
+ rows = await this.executions.listActorExecutions({ systemRef: APPLICATION_CODING_SYSTEM_REF, limit: BUILD_TASK_RECORD_HISTORY_CEILING });
7687
+ const decisionsPath = this.buildTaskDecisionsPath();
7688
+ decisionsText = decisionsPath === undefined ? undefined : await this.createCommittedTreeReader().readText(decisionsPath);
7689
+ }
7690
+ catch (error) {
7691
+ this.logger.warn?.('Could not read the coding runs or the build-task decisions: no pending follow-up absorbs a later report, and no reported gap is confirmed met', { error: describeCaughtError(error) });
7692
+ return undefined;
7693
+ }
6847
7694
  if (rows.length >= BUILD_TASK_RECORD_HISTORY_CEILING)
6848
- throw new Error(`the coding-run listing reached its ${BUILD_TASK_RECORD_HISTORY_CEILING}-run ceiling, so an older attempt may be missing`);
6849
- const refs = new Set();
7695
+ return undefined;
7696
+ const decisions = parseBuildTaskDecisions(decisionsText ?? undefined);
7697
+ if (decisions.unreadable !== undefined)
7698
+ return undefined;
7699
+ const dispatched = new Map();
6850
7700
  for (const row of rows) {
6851
- const taskRef = row.standaloneTasks[0]?.input?.taskRef;
6852
- if (typeof taskRef === 'string')
6853
- refs.add(taskRef);
7701
+ const input = row.standaloneTasks[0]?.input;
7702
+ if (typeof input?.taskRef !== 'string')
7703
+ continue;
7704
+ const carried = dispatched.get(input.taskRef) ?? new Set();
7705
+ if (Array.isArray(input.carriedFollowUpGapKeys))
7706
+ for (const key of input.carriedFollowUpGapKeys)
7707
+ if (typeof key === 'string')
7708
+ carried.add(key);
7709
+ dispatched.set(input.taskRef, carried);
6854
7710
  }
6855
- return refs;
7711
+ const decided = new Map();
7712
+ for (const decision of [...decisions.closures.values(), ...decisions.followUpApprovals.values()]) {
7713
+ decided.set(decision.taskRef, new Set([...(decided.get(decision.taskRef) ?? []), ...(decision.carriedFollowUpGapKeys ?? [])]));
7714
+ }
7715
+ return { dispatched, decided };
6856
7716
  }
6857
7717
  /**
6858
7718
  * Which completed coding runs LANDED (#3227): their write record exists. Since #3204 a task lands on the WORKING tree, so
@@ -7840,7 +8700,21 @@ thirdParty) {
7840
8700
  return target?.moduleRef === moduleRef;
7841
8701
  })
7842
8702
  .map((element) => ({ taskRef: element.ref, objective: element.label }));
7843
- if (served.length === 0 && unresolved.length === 0 && moduleTasks.length === 0)
8703
+ /*
8704
+ * The OTHER planned tasks serving each requirement this task serves (#3886): what a closing report names as the owner of
8705
+ * a gap (`ownedByTaskRef`) when what is missing is their work. Until #3886 a task saw only its module's siblings, so a
8706
+ * website section that found a feature missing could not say which task builds it, and 24 follow-up runs on reference
8707
+ * run 43691253927 changed nothing because they ran before that task had landed.
8708
+ */
8709
+ const otherTasksServing = Object.fromEntries(task.servesRefs.flatMap((requirementRef) => {
8710
+ const serving = (index.aspects.get(TASK_ASPECT)?.elements ?? [])
8711
+ // A follow-up is never an owner the derivation honours (review LOW): only the plan's own tasks are listed.
8712
+ .filter((element) => element.ref !== task.taskRef && !element.ref.startsWith(HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX))
8713
+ .filter((element) => (element.item.servesRefs ?? []).includes(requirementRef))
8714
+ .map((element) => ({ taskRef: element.ref, objective: element.label }));
8715
+ return serving.length > 0 ? [[requirementRef, serving]] : [];
8716
+ }));
8717
+ if (served.length === 0 && unresolved.length === 0 && moduleTasks.length === 0 && Object.keys(otherTasksServing).length === 0)
7844
8718
  return null;
7845
8719
  return {
7846
8720
  sourceRef: 'application-creation:context/served-elements',
@@ -7857,8 +8731,11 @@ thirdParty) {
7857
8731
  }
7858
8732
  : {}),
7859
8733
  ...(moduleRef !== undefined ? { moduleRef, otherTasksInModule: moduleTasks } : {}),
7860
- note: 'servedElements are what this task is accountable to — its acceptance criteria. otherTasksInModule is a map only: '
7861
- + 'read a sibling with `wildo context elements get --refs <taskRef>` if you need it.',
8734
+ ...(Object.keys(otherTasksServing).length > 0 ? { otherTasksServing } : {}),
8735
+ note: 'servedElements are what this task is accountable to — its acceptance criteria. otherTasksInModule and '
8736
+ + 'otherTasksServing (by requirement) are maps only: read a task with `wildo context elements get --refs <taskRef>` if '
8737
+ + 'you need it. When what is missing for a requirement is one of otherTasksServing\'s own work, name it as '
8738
+ + '`ownedByTaskRef` in your unmet-requirements block.',
7862
8739
  },
7863
8740
  };
7864
8741
  }