@wildo-ai/dev-companion 1.1.13 → 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 (256) 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 +183 -7
  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 +7 -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 +26 -12
  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 +12 -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/services/introspection-source-state.companion.service.d.ts +8 -20
  39. package/dist/esm/core/introspection/services/introspection-source-state.companion.service.d.ts.map +1 -1
  40. package/dist/esm/core/introspection/services/introspection-source-state.companion.service.js +37 -142
  41. package/dist/esm/core/introspection/services/introspection-source-state.companion.service.js.map +1 -1
  42. package/dist/esm/core/introspection/services/introspection-source-walk.worker.d.ts +64 -0
  43. package/dist/esm/core/introspection/services/introspection-source-walk.worker.d.ts.map +1 -0
  44. package/dist/esm/core/introspection/services/introspection-source-walk.worker.js +304 -0
  45. package/dist/esm/core/introspection/services/introspection-source-walk.worker.js.map +1 -0
  46. package/dist/esm/core/runtime/companion-language-model-route.d.ts +16 -1
  47. package/dist/esm/core/runtime/companion-language-model-route.d.ts.map +1 -1
  48. package/dist/esm/core/runtime/companion-language-model-route.js +23 -1
  49. package/dist/esm/core/runtime/companion-language-model-route.js.map +1 -1
  50. package/dist/esm/core/runtime/services/start-companion-application.service.d.ts.map +1 -1
  51. package/dist/esm/core/runtime/services/start-companion-application.service.js +3 -2
  52. package/dist/esm/core/runtime/services/start-companion-application.service.js.map +1 -1
  53. package/dist/esm/core/utils/git-read-broker.companion.d.ts +62 -0
  54. package/dist/esm/core/utils/git-read-broker.companion.d.ts.map +1 -0
  55. package/dist/esm/core/utils/git-read-broker.companion.js +282 -0
  56. package/dist/esm/core/utils/git-read-broker.companion.js.map +1 -0
  57. package/dist/esm/core/utils/local-write-recording.companion.d.ts +8 -1
  58. package/dist/esm/core/utils/local-write-recording.companion.d.ts.map +1 -1
  59. package/dist/esm/core/utils/local-write-recording.companion.js +7 -23
  60. package/dist/esm/core/utils/local-write-recording.companion.js.map +1 -1
  61. package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.en.d.ts +29 -0
  62. package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.en.d.ts.map +1 -0
  63. package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.en.js +29 -0
  64. package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.en.js.map +1 -0
  65. package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.fr.d.ts +29 -0
  66. package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.fr.d.ts.map +1 -0
  67. package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.fr.js +29 -0
  68. package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.fr.js.map +1 -0
  69. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.en.d.ts +1 -0
  70. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.en.d.ts.map +1 -1
  71. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.en.js +2 -1
  72. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.en.js.map +1 -1
  73. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.fr.d.ts +1 -0
  74. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.fr.d.ts.map +1 -1
  75. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.fr.js +2 -1
  76. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.fr.js.map +1 -1
  77. package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.en.d.ts +5 -2
  78. package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.en.d.ts.map +1 -1
  79. package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.en.js +5 -2
  80. package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.en.js.map +1 -1
  81. package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.fr.d.ts +5 -2
  82. package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.fr.d.ts.map +1 -1
  83. package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.fr.js +5 -2
  84. package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.fr.js.map +1 -1
  85. package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.en.d.ts +41 -0
  86. package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.en.d.ts.map +1 -0
  87. package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.en.js +41 -0
  88. package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.en.js.map +1 -0
  89. package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.fr.d.ts +41 -0
  90. package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.fr.d.ts.map +1 -0
  91. package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.fr.js +41 -0
  92. package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.fr.js.map +1 -0
  93. package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.en.d.ts +1 -0
  94. package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.en.d.ts.map +1 -1
  95. package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.en.js +2 -1
  96. package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.en.js.map +1 -1
  97. package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.fr.d.ts +1 -0
  98. package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.fr.d.ts.map +1 -1
  99. package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.fr.js +2 -1
  100. package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.fr.js.map +1 -1
  101. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.en.d.ts +1 -0
  102. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.en.d.ts.map +1 -1
  103. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.en.js +2 -1
  104. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.en.js.map +1 -1
  105. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.fr.d.ts +1 -0
  106. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.fr.d.ts.map +1 -1
  107. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.fr.js +2 -1
  108. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.fr.js.map +1 -1
  109. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.en.d.ts +1 -0
  110. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.en.d.ts.map +1 -1
  111. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.en.js +2 -1
  112. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.en.js.map +1 -1
  113. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.fr.d.ts +1 -0
  114. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.fr.d.ts.map +1 -1
  115. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.fr.js +2 -1
  116. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.fr.js.map +1 -1
  117. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.en.d.ts +2 -0
  118. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.en.d.ts.map +1 -1
  119. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.en.js +3 -1
  120. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.en.js.map +1 -1
  121. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.fr.d.ts +2 -0
  122. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.fr.d.ts.map +1 -1
  123. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.fr.js +3 -1
  124. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.fr.js.map +1 -1
  125. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_AUTH.en.d.ts +1 -1
  126. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_AUTH.en.js +1 -1
  127. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_AUTH.en.js.map +1 -1
  128. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_AUTH.fr.d.ts +1 -1
  129. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_AUTH.fr.js +1 -1
  130. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_AUTH.fr.js.map +1 -1
  131. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.en.d.ts +2 -0
  132. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.en.d.ts.map +1 -1
  133. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.en.js +3 -1
  134. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.en.js.map +1 -1
  135. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.fr.d.ts +3 -1
  136. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.fr.d.ts.map +1 -1
  137. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.fr.js +4 -2
  138. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.fr.js.map +1 -1
  139. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.en.d.ts +17 -0
  140. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.en.d.ts.map +1 -1
  141. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.en.js +18 -1
  142. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.en.js.map +1 -1
  143. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.fr.d.ts +17 -0
  144. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.fr.d.ts.map +1 -1
  145. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.fr.js +18 -1
  146. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.fr.js.map +1 -1
  147. package/dist/esm/i18n/composite_views/app.creation-conversation.fr.d.ts +206 -195
  148. package/dist/esm/i18n/composite_views/app.creation-conversation.fr.d.ts.map +1 -1
  149. package/dist/esm/i18n/composite_views/app.creation-conversation.fr.js +206 -195
  150. package/dist/esm/i18n/composite_views/app.creation-conversation.fr.js.map +1 -1
  151. package/dist/esm/i18n/composite_views/app.creation-dossier.fr.d.ts +10 -0
  152. package/dist/esm/i18n/composite_views/app.creation-dossier.fr.d.ts.map +1 -1
  153. package/dist/esm/i18n/composite_views/app.creation-dossier.fr.js +12 -2
  154. package/dist/esm/i18n/composite_views/app.creation-dossier.fr.js.map +1 -1
  155. package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.fr.d.ts +70 -0
  156. package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.fr.d.ts.map +1 -1
  157. package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.fr.js +70 -0
  158. package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.fr.js.map +1 -1
  159. package/dist/esm/i18n/resources/wildoApplicationActorTasks.fr.d.ts +12 -2
  160. package/dist/esm/i18n/resources/wildoApplicationActorTasks.fr.d.ts.map +1 -1
  161. package/dist/esm/i18n/resources/wildoApplicationActorTasks.fr.js +12 -2
  162. package/dist/esm/i18n/resources/wildoApplicationActorTasks.fr.js.map +1 -1
  163. package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.fr.d.ts +10 -0
  164. package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.fr.d.ts.map +1 -1
  165. package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.fr.js +10 -0
  166. package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.fr.js.map +1 -1
  167. package/dist/esm/i18n/resources/workbenchBuildDispatchPlan.fr.d.ts +25 -20
  168. package/dist/esm/i18n/resources/workbenchBuildDispatchPlan.fr.d.ts.map +1 -1
  169. package/dist/esm/i18n/resources/workbenchBuildDispatchPlan.fr.js +25 -20
  170. package/dist/esm/i18n/resources/workbenchBuildDispatchPlan.fr.js.map +1 -1
  171. package/dist/esm/i18n/resources/workbenchBuildPlanTasks.fr.d.ts +32 -32
  172. package/dist/esm/i18n/resources/workbenchBuildPlanTasks.fr.js +32 -32
  173. package/dist/esm/i18n/resources/workbenchBuildPlanTasks.fr.js.map +1 -1
  174. package/dist/esm/i18n/resources/workbenchBuildTaskRecords.fr.d.ts +65 -65
  175. package/dist/esm/i18n/resources/workbenchBuildTaskRecords.fr.js +65 -65
  176. package/dist/esm/i18n/resources/workbenchBuildTaskRecords.fr.js.map +1 -1
  177. package/dist/esm/i18n/resources/workbenchDossierEntries.fr.d.ts +20 -0
  178. package/dist/esm/i18n/resources/workbenchDossierEntries.fr.d.ts.map +1 -1
  179. package/dist/esm/i18n/resources/workbenchDossierEntries.fr.js +20 -0
  180. package/dist/esm/i18n/resources/workbenchDossierEntries.fr.js.map +1 -1
  181. package/dist/esm/i18n/resources/workbenchGovernanceQuestions.fr.d.ts +12 -0
  182. package/dist/esm/i18n/resources/workbenchGovernanceQuestions.fr.d.ts.map +1 -1
  183. package/dist/esm/i18n/resources/workbenchGovernanceQuestions.fr.js +13 -1
  184. package/dist/esm/i18n/resources/workbenchGovernanceQuestions.fr.js.map +1 -1
  185. package/dist/esm/i18n/system_enums/application-creation.fr.d.ts +170 -170
  186. package/dist/esm/i18n/system_enums/application-creation.fr.js +170 -170
  187. package/dist/esm/i18n/system_enums/application-creation.fr.js.map +1 -1
  188. package/dist/esm/i18n/system_enums/flows-actors.fr.d.ts +22 -22
  189. package/dist/esm/i18n/system_enums/flows-actors.fr.js +22 -22
  190. package/dist/esm/i18n/system_enums/flows-actors.fr.js.map +1 -1
  191. package/dist/esm/i18n/system_enums/run-records.fr.d.ts +21 -21
  192. package/dist/esm/i18n/system_enums/run-records.fr.js +21 -21
  193. package/dist/esm/i18n/system_enums/run-records.fr.js.map +1 -1
  194. package/dist/esm/i18n/system_enums/workbench-build.en.d.ts +1 -0
  195. package/dist/esm/i18n/system_enums/workbench-build.en.d.ts.map +1 -1
  196. package/dist/esm/i18n/system_enums/workbench-build.en.js +1 -0
  197. package/dist/esm/i18n/system_enums/workbench-build.en.js.map +1 -1
  198. package/dist/esm/i18n/system_enums/workbench-build.fr.d.ts +37 -33
  199. package/dist/esm/i18n/system_enums/workbench-build.fr.d.ts.map +1 -1
  200. package/dist/esm/i18n/system_enums/workbench-build.fr.js +37 -33
  201. package/dist/esm/i18n/system_enums/workbench-build.fr.js.map +1 -1
  202. package/dist/esm/i18n/system_enums/workbench-creation-home.en.d.ts +1 -0
  203. package/dist/esm/i18n/system_enums/workbench-creation-home.en.d.ts.map +1 -1
  204. package/dist/esm/i18n/system_enums/workbench-creation-home.en.js +1 -0
  205. package/dist/esm/i18n/system_enums/workbench-creation-home.en.js.map +1 -1
  206. package/dist/esm/i18n/system_enums/workbench-creation-home.fr.d.ts +18 -17
  207. package/dist/esm/i18n/system_enums/workbench-creation-home.fr.d.ts.map +1 -1
  208. package/dist/esm/i18n/system_enums/workbench-creation-home.fr.js +18 -17
  209. package/dist/esm/i18n/system_enums/workbench-creation-home.fr.js.map +1 -1
  210. package/dist/esm/i18n/system_enums/workbench-dossier.fr.d.ts +7 -5
  211. package/dist/esm/i18n/system_enums/workbench-dossier.fr.d.ts.map +1 -1
  212. package/dist/esm/i18n/system_enums/workbench-dossier.fr.js +8 -6
  213. package/dist/esm/i18n/system_enums/workbench-dossier.fr.js.map +1 -1
  214. package/dist/esm/i18n/system_enums/workbench-secrets.fr.d.ts +12 -12
  215. package/dist/esm/i18n/system_enums/workbench-secrets.fr.js +12 -12
  216. package/dist/esm/i18n/system_enums/workbench-secrets.fr.js.map +1 -1
  217. package/dist/esm/i18n/system_enums/workbench-specification-artifact.fr.d.ts +1 -0
  218. package/dist/esm/i18n/system_enums/workbench-specification-artifact.fr.d.ts.map +1 -1
  219. package/dist/esm/i18n/system_enums/workbench-specification-artifact.fr.js +2 -1
  220. package/dist/esm/i18n/system_enums/workbench-specification-artifact.fr.js.map +1 -1
  221. package/dist/esm/i18n-labelling/services/labelling-planner.companion.service.d.ts.map +1 -1
  222. package/dist/esm/i18n-labelling/services/labelling-planner.companion.service.js +3 -4
  223. package/dist/esm/i18n-labelling/services/labelling-planner.companion.service.js.map +1 -1
  224. package/dist/esm/i18n-labelling/utils/declared-refusal-codes.utils.d.ts +11 -0
  225. package/dist/esm/i18n-labelling/utils/declared-refusal-codes.utils.d.ts.map +1 -1
  226. package/dist/esm/i18n-labelling/utils/declared-refusal-codes.utils.js +21 -0
  227. package/dist/esm/i18n-labelling/utils/declared-refusal-codes.utils.js.map +1 -1
  228. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts +120 -16
  229. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts.map +1 -1
  230. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js +875 -191
  231. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js.map +1 -1
  232. package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.d.ts +102 -13
  233. package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.d.ts.map +1 -1
  234. package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.js +243 -57
  235. package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.js.map +1 -1
  236. package/dist/esm/meta-workflows/services/application-build-landing-projection.companion.d.ts +3 -3
  237. package/dist/esm/meta-workflows/services/application-build-landing-projection.companion.js +3 -3
  238. package/dist/esm/meta-workflows/services/application-build-landing-projection.companion.js.map +1 -1
  239. package/dist/esm/meta-workflows/services/application-build-task-closure.companion.d.ts +9 -0
  240. package/dist/esm/meta-workflows/services/application-build-task-closure.companion.d.ts.map +1 -1
  241. package/dist/esm/meta-workflows/services/application-build-task-closure.companion.js +19 -0
  242. package/dist/esm/meta-workflows/services/application-build-task-closure.companion.js.map +1 -1
  243. package/dist/esm/meta-workflows/services/creation-intervention-ledger.companion.service.d.ts.map +1 -1
  244. package/dist/esm/meta-workflows/services/creation-intervention-ledger.companion.service.js +4 -5
  245. package/dist/esm/meta-workflows/services/creation-intervention-ledger.companion.service.js.map +1 -1
  246. package/dist/esm/meta-workflows/services/foundation-executor.companion.service.d.ts.map +1 -1
  247. package/dist/esm/meta-workflows/services/foundation-executor.companion.service.js +6 -3
  248. package/dist/esm/meta-workflows/services/foundation-executor.companion.service.js.map +1 -1
  249. package/dist/esm/meta-workflows/services/playbook-run-write-register-window.companion.d.ts.map +1 -1
  250. package/dist/esm/meta-workflows/services/playbook-run-write-register-window.companion.js +3 -5
  251. package/dist/esm/meta-workflows/services/playbook-run-write-register-window.companion.js.map +1 -1
  252. package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts +1 -1
  253. package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts.map +1 -1
  254. package/dist/esm/meta-workflows/services/playbook-run.companion.service.js +38 -21
  255. package/dist/esm/meta-workflows/services/playbook-run.companion.service.js.map +1 -1
  256. package/package.json +18 -18
@@ -75,7 +75,7 @@ import { describeStaleFrontendLibrary, findStaleFrontendLibraryOutputs, readFron
75
75
  import { buildTaskDecisionsApplicationPath } from '../models/build-task-decisions-path.models.js';
76
76
  import { BuildTaskDecisionRefusedError, BuildTaskDecisionsStanding, resolveHonouredDecisionsBlob, followUpAwaitsReview, followUpsAwaitReviewUnder, parseBuildTaskDecisions, resolveClosedBuildTaskRefs, withBuildTaskDecision, } from './application-build-task-closure.companion.js';
77
77
  import { APPLICATION_CREATION_AUTONOMY_POSTURE } from '../models/playbook-run-checkpoint.models.js';
78
- 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';
79
79
  import { resolveApplicationAssemblyCheckRefs } from './application-assembly-checks.companion.utils.js';
80
80
  import { BrandAssetPurpose, SpecificationModuleFaultReading, specificationModuleFaultsAreAVerdict, SpecificationUnavailableError, unguardedSpecifications } from '@wildo-ai/saas-specifications';
81
81
  import { hasAcceptedBrandMark } from '../../brand/models/accepted-brand-mark.models.js';
@@ -312,6 +312,69 @@ export function isCountedBuildTaskAttempt(attempt) {
312
312
  const BUILD_TASK_ATTEMPT_PAGE_CAP = 200;
313
313
  /** How long one listing of the latest completed coding runs serves the plan reads of a burst (#2496 review F8). */
314
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
+ }
315
378
  /**
316
379
  * How far back the BUILD RECORD reads each coding system's runs (#2530): the record is every attempt at every task, and a
317
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
@@ -347,6 +410,7 @@ const BUILD_TASK_REASONS_THAT_ARE_PROGRESS = new Set([
347
410
  Workbench_BuildTaskStuckReason.IN_FLIGHT,
348
411
  Workbench_BuildTaskStuckReason.CONTENDED,
349
412
  Workbench_BuildTaskStuckReason.AWAITING_ISOLATED_RECHECK,
413
+ Workbench_BuildTaskStuckReason.RAN_THIS_WAVE,
350
414
  ]);
351
415
  /** How much of a failed check's output a retry is shown — enough for a compiler's first errors, not a log. */
352
416
  const PREVIOUS_ATTEMPT_OUTPUT_TAIL_CHARS = 2000;
@@ -362,7 +426,13 @@ export function projectBuildTaskAttempt(execution) {
362
426
  const unmetRequirements = Array.isArray(output?.unmetRequirements)
363
427
  ? output.unmetRequirements
364
428
  .filter((entry) => typeof entry?.requirementRef === 'string' && typeof entry.missing === 'string')
365
- .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
+ }))
366
436
  : [];
367
437
  const metRequirements = Array.isArray(output?.metRequirements)
368
438
  ? output.metRequirements
@@ -672,7 +742,11 @@ export var ApplicationBuildWaveStop;
672
742
  ApplicationBuildWaveStop["NOTHING_READY"] = "nothing-ready";
673
743
  /** The call reached its dispatch cap; the next call continues. */
674
744
  ApplicationBuildWaveStop["DISPATCH_CAP"] = "dispatch-cap";
675
- /** 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
+ */
676
750
  ApplicationBuildWaveStop["GENERATION_STEP_REPEATED"] = "generation-step-repeated";
677
751
  /** An admission was refused; the refusal is on the dispatch entry. */
678
752
  ApplicationBuildWaveStop["DISPATCH_REFUSED"] = "dispatch-refused";
@@ -711,6 +785,19 @@ export var ApplicationBuildWaveStop;
711
785
  */
712
786
  ApplicationBuildWaveStop["VERIFICATION_TOOL_UNAVAILABLE"] = "verification-tool-unavailable";
713
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
+ ]);
714
801
  /**
715
802
  * The next-task doors' refusal while the application's backend does not start (#2405). A CONFLICT: the request is
716
803
  * valid, the application's state forbids it, and the message names the refusal and the repair.
@@ -1313,8 +1400,11 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
1313
1400
  landingKeyRead;
1314
1401
  /** How many landing-key reads have started; see {@link readLandingSourceKey}. */
1315
1402
  landingKeyReadSequence = 0;
1316
- /** The slot a running wave is filling now, while it prepares the dispatch (#3206); see `application-build-dispatch-preparation`. */
1317
- 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;
1318
1408
  /** The last preparation that ended, with each step's duration. */
1319
1409
  lastBuildPreparation;
1320
1410
  /** When `wildo build stop` asked the running wave to stop (#3206); cleared when the wave ends. */
@@ -2236,7 +2326,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2236
2326
  return openedStep;
2237
2327
  }
2238
2328
  // Announced by the coding service itself when it opens the PENDING execution.
2239
- return this.dispatch.openSelectedApplicationCodingExecution(prepared.contract, session, origin, mode);
2329
+ return this.dispatch.openSelectedApplicationCodingExecution(prepared.contract, session, this.withCarriedFollowUpGaps(prepared, origin), mode);
2240
2330
  }
2241
2331
  /** The execution a generation step is: one task of the build system's programmatic actor. */
2242
2332
  buildGenerationStepExecutionRequest(prepared, session, origin) {
@@ -2270,6 +2360,8 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2270
2360
  mode = CodingRunConcurrency.SINGLE_FLIGHT,
2271
2361
  /** Already opened by {@link openPreparedBuildTask}; opened here otherwise. */
2272
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);
2273
2365
  if (prepared.kind === 'GENERATION_STEP') {
2274
2366
  this.logDebug('Running a companion generation step', {
2275
2367
  taskRef: prepared.plan.taskRef,
@@ -2406,7 +2498,8 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2406
2498
  * `interference` memory entry).
2407
2499
  *
2408
2500
  * Bounded per call: at most {@link WAVE_DISPATCHES_PER_DEGREE} dispatches per slot, and a generation
2409
- * 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
2410
2503
  * interference re-runs are outside that cap, bounded per task by `MAXIMUM_INTERFERENCE_REARMS` and at most
2411
2504
  * one per completed run of this wave. The next call continues from wherever the build stands.
2412
2505
  *
@@ -2427,7 +2520,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2427
2520
  finally {
2428
2521
  this.liveWaveStartedAt = undefined;
2429
2522
  this.buildWaveStopRequestedAt = undefined;
2430
- this.currentBuildPreparation = undefined;
2523
+ this.openBuildPreparations?.clear();
2431
2524
  }
2432
2525
  }
2433
2526
  /**
@@ -2547,23 +2640,25 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2547
2640
  throw new ApplicationBuildStoppedByPersonError(this.buildStopHeldSince);
2548
2641
  }
2549
2642
  /**
2550
- * 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
2551
2644
  * ("selected X, preparing dispatch since T (step)"), a requested stop, and the last preparation that ended with each
2552
2645
  * step's duration. Read by `GET /build/dispatches` and the creation feed.
2553
2646
  */
2554
2647
  readBuildDispatchPreparation() {
2555
- const preparing = this.currentBuildPreparation?.read();
2648
+ const open = [...(this.openBuildPreparations ?? [])];
2649
+ const preparing = open[0]?.read();
2556
2650
  return {
2557
2651
  waveStartedAt: this.liveWaveStartedAt ?? null,
2558
2652
  stopRequestedAt: this.buildWaveStopRequestedAt ?? null,
2559
2653
  heldByStopSince: this.buildStopHeldSince ?? null,
2560
2654
  preparing: preparing === undefined ? null : { ...preparing, summary: describeBuildPreparation(preparing) },
2655
+ preparingCount: open.length,
2561
2656
  lastPreparation: this.lastBuildPreparation ?? null,
2562
2657
  };
2563
2658
  }
2564
2659
  openBuildPreparation() {
2565
2660
  const tracker = new ApplicationBuildPreparationTracker(ApplicationBuildPreparationPhase.CHECKING_THE_BACKEND_STARTS);
2566
- this.currentBuildPreparation = tracker;
2661
+ (this.openBuildPreparations ??= new Set()).add(tracker);
2567
2662
  return tracker;
2568
2663
  }
2569
2664
  /**
@@ -2573,8 +2668,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2573
2668
  */
2574
2669
  async closeBuildPreparation(tracker, session) {
2575
2670
  const ended = tracker.end();
2576
- if (this.currentBuildPreparation === tracker)
2577
- this.currentBuildPreparation = undefined;
2671
+ this.openBuildPreparations?.delete(tracker);
2578
2672
  this.lastBuildPreparation = ended;
2579
2673
  const durations = Object.fromEntries(ended.phases.map((entry) => [entry.phase, entry.durationMs]));
2580
2674
  this.logDebug('Build dispatch preparation ended', { selectedTaskRef: ended.selectedTaskRef ?? null, durationMs: ended.durationMs, phases: durations });
@@ -2603,6 +2697,11 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2603
2697
  throw new ApplicationBuildWaveInFlightError(this.liveWaveStartedAt);
2604
2698
  }
2605
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) {
2606
2705
  const degree = readBuildParallelism(this.companionContext.saasRoot);
2607
2706
  const mode = degree > 1 ? CodingRunConcurrency.CONCURRENT : CodingRunConcurrency.SINGLE_FLIGHT;
2608
2707
  const maximumDispatches = degree * WAVE_DISPATCHES_PER_DEGREE;
@@ -2621,113 +2720,313 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2621
2720
  const startedAt = new Date().toISOString();
2622
2721
  let usageLimit;
2623
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
+ */
2624
2973
  const fill = async () => {
2625
- // One landing reading for every slot this fill prepares (#3204); a refill follows a settlement, so it reads again.
2626
- const fillLanding = {};
2627
- while (stoppedFillingBecause === undefined && inFlight.size + generationInFlight.size < degree) {
2974
+ while (stoppedFillingBecause === undefined && preparationFailure === undefined && !nothingReady && occupied() < degree) {
2628
2975
  /*
2629
2976
  * `wildo build stop` (#3206): the wave ends at a task boundary — it starts nothing more, and drains what is live,
2630
2977
  * reconciles and repairs as at any other end. Asked before every slot, so a stop is honoured within one slot.
2631
2978
  */
2632
2979
  if (this.buildWaveStopRequestedAt !== undefined) {
2633
- stoppedFillingBecause = ApplicationBuildWaveStop.STOP_REQUESTED;
2980
+ stoppedFillingBecause ??= ApplicationBuildWaveStop.STOP_REQUESTED;
2634
2981
  return;
2635
2982
  }
2636
2983
  // A restart the dev supervisor holds (#3204): start nothing more, so the live runs settle before it.
2637
2984
  const saasRoot = this.companionContext?.saasRoot;
2638
2985
  if (saasRoot !== undefined && companionRestartDrain.isRestartHeld(saasRoot)) {
2639
- stoppedFillingBecause = ApplicationBuildWaveStop.RESTART_PENDING;
2640
- return;
2641
- }
2642
- if (dispatched.length + generationInFlight.size >= maximumDispatches) {
2643
- stoppedFillingBecause = ApplicationBuildWaveStop.DISPATCH_CAP;
2986
+ stoppedFillingBecause ??= ApplicationBuildWaveStop.RESTART_PENDING;
2644
2987
  return;
2645
2988
  }
2646
- // What this slot is waiting on, readable while it waits and recorded when it ends (#3206).
2647
- const preparation = this.openBuildPreparation();
2648
- try {
2649
- /*
2650
- * And before every slot, whether the application still STARTS (#2405). On app-creation-test-005 one task broke
2651
- * the backend's start and about 45 more landed on top over four hours, each verified by typechecks that could
2652
- * not see it. The live runs drain; nothing new starts into an application that cannot run.
2653
- */
2654
- const notBooting = await this.readCurrentBootFailures();
2655
- if (notBooting.length > 0) {
2656
- bootFailures = notBooting;
2657
- /*
2658
- * While runs are live this PAUSES the filling rather than ending it (#2405 review F2): a sibling half-way
2659
- * through writing a configuration can make one restart fail, and its own completion may repair it. The next
2660
- * settle asks again. With nothing live there is nothing left to wait for, and the wave stops.
2661
- */
2662
- if (inFlight.size > 0)
2663
- return;
2664
- stoppedFillingBecause = ApplicationBuildWaveStop.APPLICATION_DOES_NOT_BOOT;
2665
- return;
2666
- }
2667
- bootFailures = undefined;
2668
- let prepared;
2669
- try {
2670
- prepared = await this.prepareNextBuildTask(undefined, preparation, { fillLanding, generationStepsInFlight: new Set(generationInFlight.keys()) });
2671
- }
2672
- catch (error) {
2673
- if (error instanceof ApplicationBuildPlanExhaustedError || error instanceof ApplicationBuildTaskCompletedButUnlandedError) {
2674
- // Nothing ready NOW. While runs are live that is a pause, not an end: a settle may unlock more.
2675
- if (inFlight.size === 0 && generationInFlight.size === 0)
2676
- stoppedFillingBecause = ApplicationBuildWaveStop.NOTHING_READY;
2677
- return;
2678
- }
2679
- throw error;
2680
- }
2681
- preparation.select(prepared.plan.taskRef);
2682
- preparation.enter(ApplicationBuildPreparationPhase.ADMITTING_THE_RUN);
2683
- // On the run's row, so its dispatch wait — this slot's whole preparation — survives a restart (#3206).
2684
- const preparedOrigin = { preparationStartedAt: preparation.read().startedAt };
2685
- if (prepared.kind === 'GENERATION_STEP') {
2686
- if (generationStepsRun.has(prepared.plan.taskRef)) {
2687
- stoppedFillingBecause = ApplicationBuildWaveStop.GENERATION_STEP_REPEATED;
2688
- return;
2689
- }
2690
- generationStepsRun.add(prepared.plan.taskRef);
2691
- // The step writes the tree while the next slots are prepared: each reads the landing again.
2692
- fillLanding.current = undefined;
2693
- const step = prepared;
2694
- generationInFlight.set(step.plan.taskRef, this.executePreparedBuildTask(step, session, preparedOrigin)
2695
- .then((result) => ({ prepared: step, result }), (error) => ({ prepared: step, error })));
2696
- continue;
2697
- }
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;
2698
2997
  /*
2699
- * Before every CODING slot, including the refill after a run settles (#2388): a sibling that just met the
2700
- * account's usage limit makes every coding turn started before its reset certain to fail the same way. On
2701
- * app-creation-test-005 the refill went on regardless, and four tasks spent three or four attempts each in
2702
- * five minutes. The live runs still drain; nothing new starts. Asked after the selection, which only reads,
2703
- * so a generation step — run on the configured model providers, not on the coding agent's account — still
2704
- * 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).
2705
3004
  */
2706
- const held = this.dispatch.readCodingAgentUsageLimitHold();
2707
- if (held) {
2708
- stoppedFillingBecause = ApplicationBuildWaveStop.CODING_AGENT_USAGE_LIMITED;
2709
- usageLimit = held;
2710
- return;
2711
- }
2712
- try {
2713
- const result = await this.executePreparedBuildTask(prepared, session, preparedOrigin, mode);
2714
- dispatched.push(result);
2715
- const taskId = result.admission.taskId;
2716
- inFlight.set(taskId, this.awaitCodingRunOutcome(taskId, session).then((outcome) => ({ taskId, outcome })));
2717
- }
2718
- catch (error) {
2719
- // A refused admission is recorded and ends the filling; the live runs still drain.
2720
- dispatched.push({ plan: prepared.plan, error: describeCaughtError(error) });
2721
- // Refused because a check's command is absent (#3423): its own stop, so the selector stops asking for waves.
2722
- stoppedFillingBecause = this.dispatch.readVerificationToolUnavailableHold()
2723
- ? ApplicationBuildWaveStop.VERIFICATION_TOOL_UNAVAILABLE
2724
- : ApplicationBuildWaveStop.DISPATCH_REFUSED;
3005
+ if (inFlight.size > 0) {
3006
+ await repairStartBesideLiveRuns(notBooting);
2725
3007
  return;
2726
3008
  }
3009
+ stoppedFillingBecause ??= ApplicationBuildWaveStop.APPLICATION_DOES_NOT_BOOT;
3010
+ return;
2727
3011
  }
2728
- finally {
2729
- 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;
2730
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;
2731
3030
  }
2732
3031
  };
2733
3032
  const outcomes = [];
@@ -2740,6 +3039,8 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2740
3039
  */
2741
3040
  const concludeGenerationStep = (settled) => {
2742
3041
  generationInFlight.delete(settled.prepared.plan.taskRef);
3042
+ reservations.delete(settled.prepared.plan.taskRef);
3043
+ settlements += 1;
2743
3044
  if (settled.error === undefined) {
2744
3045
  dispatched.push(settled.result);
2745
3046
  return;
@@ -2750,17 +3051,44 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2750
3051
  this.holdForStaleExpertCharters(settled.prepared.plan.taskRef, staleSeats);
2751
3052
  return;
2752
3053
  }
2753
- if (!(settled.error instanceof SpecificationWriteRefusedError))
2754
- 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
+ }
2755
3059
  dispatched.push({ plan: settled.prepared.plan, error: describeCaughtError(settled.error) });
2756
3060
  stoppedFillingBecause ??= ApplicationBuildWaveStop.DISPATCH_REFUSED;
2757
3061
  };
2758
- await fill();
2759
- 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) {
2760
3076
  const first = await Promise.race([
2761
3077
  ...[...inFlight.values()].map((run) => run.then((settled) => ({ kind: 'coding', run: settled }))),
2762
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' })),
2763
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;
2764
3092
  if (first.kind === 'generation') {
2765
3093
  concludeGenerationStep(first.step);
2766
3094
  }
@@ -2768,17 +3096,47 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2768
3096
  inFlight.delete(first.run.taskId);
2769
3097
  for (const run of [first.run, ...await takeAlreadySettled(inFlight)]) {
2770
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;
2771
3108
  outcomes.push(run.outcome);
2772
3109
  settledTaskIds.push(run.taskId);
2773
3110
  }
2774
3111
  }
2775
3112
  for (const step of await takeAlreadySettled(generationInFlight))
2776
3113
  concludeGenerationStep(step);
2777
- 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();
2778
3124
  }
2779
- // A pause on a failing start that the drained runs did not clear ends the wave on it, not on "nothing ready".
2780
- 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) {
2781
3138
  stoppedFillingBecause = ApplicationBuildWaveStop.APPLICATION_DOES_NOT_BOOT;
3139
+ }
2782
3140
  stoppedFillingBecause ??= ApplicationBuildWaveStop.NOTHING_READY;
2783
3141
  /*
2784
3142
  * The wave's END, now that nothing is writing (#3204): the runs that failed verification beside their siblings are
@@ -2786,8 +3144,10 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2786
3144
  * (failed runs included: their files are in the tree). In both modes (review of 4a1b1f1bf F7): a single-flight run's
2787
3145
  * own settlement checkpoint may have been folded into a timer, and the wave's end is where it is guaranteed.
2788
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.
2789
3149
  const reconciliation = settledTaskIds.length > 0
2790
- ? await this.dispatch.reconcileWaveAcceptance({ startedAt, taskIds: settledTaskIds })
3150
+ ? await this.dispatch.reconcileWaveAcceptance({ startedAt, taskIds: settledTaskIds, ...(bootFailures !== undefined ? { deferRechecksBecause: 'the application does not start' } : {}) })
2791
3151
  : [];
2792
3152
  /*
2793
3153
  * And the repair reconciliation cannot make (#2210): a run that COMPLETED but whose product a sibling
@@ -2795,13 +3155,19 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2795
3155
  * bring it back; only running the task again can. Asked after the reconciliation, so landing reads the
2796
3156
  * tree every run's work has reached.
2797
3157
  */
2798
- 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
2799
3164
  ? await this.repairInterferedTasks(outcomes, session)
2800
3165
  : [];
2801
3166
  /*
2802
3167
  * #2222: a wave that ran out of ready work may have FINISHED the plan. Asked after the reconciliation and the
2803
3168
  * repairs, so it reads the tree every run's work reached — and only on NOTHING_READY, the one stop that can mean
2804
- * "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).
2805
3171
  */
2806
3172
  const { assembly: assessedAssembly, repairs: assemblyRepairsOfPlan } = stoppedFillingBecause === ApplicationBuildWaveStop.NOTHING_READY
2807
3173
  ? await this.assemblyIfPlanExhausted(session)
@@ -2813,8 +3179,26 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2813
3179
  * backend again. A dev-stack cause (a held port, an unreachable service) is never repaired here: no code fixes it.
2814
3180
  */
2815
3181
  const startupRepairs = stoppedFillingBecause === ApplicationBuildWaveStop.APPLICATION_DOES_NOT_BOOT && bootFailures !== undefined
2816
- ? await this.repairRefusedStartup(bootFailures, session)
3182
+ ? [...(startupRepairInWave === undefined ? await this.repairRefusedStartup(bootFailures, session) : [])]
2817
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
+ }
2818
3202
  const assemblyRepairs = [...startupRepairs, ...assemblyRepairsOfPlan];
2819
3203
  // Whichever way the verdict was reached: a repair's verdict is about the checks, and the plan is still not finished (#3258).
2820
3204
  const specificationFault = assessedAssembly === undefined ? undefined : (await this.resolveBuildExecutionProgress())?.specificationFault;
@@ -2869,25 +3253,34 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2869
3253
  * operation 'import_customers' not found` and two lifecycle verbs with no `requestDto`, each a build task's code, with
2870
3254
  * the remedy "wildo build run <taskRef>" addressed to a person nobody had told which task.
2871
3255
  */
2872
- 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) {
2873
3262
  const failure = describeRefusedStartupAsCheckFailure(failures);
2874
3263
  if (failure === undefined || this.dispatch.readCodingAgentUsageLimitHold() || this.buildStopHeldSince !== undefined)
2875
- return [];
2876
- const origin = { preparationStartedAt: new Date().toISOString() };
2877
- let prepared;
3264
+ return undefined;
2878
3265
  try {
2879
- ({ 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 };
2880
3268
  }
2881
3269
  catch (error) {
2882
3270
  this.logger.warn('Could not prepare the repair of the application\'s refused start', { error: describeCaughtError(error) });
2883
- return [];
3271
+ return undefined;
2884
3272
  }
2885
- if (prepared === undefined)
3273
+ }
3274
+ async repairRefusedStartup(failures, session) {
3275
+ const repair = await this.prepareStartupRepair(failures);
3276
+ if (repair === undefined)
2886
3277
  return [];
3278
+ const { prepared } = repair;
3279
+ const origin = { preparationStartedAt: new Date().toISOString() };
2887
3280
  try {
2888
3281
  const dispatched = await this.executePreparedBuildTask(prepared, session, origin);
2889
3282
  const outcome = dispatched.admission ? await this.awaitCodingRunOutcome(dispatched.admission.taskId, session) : null;
2890
- return [{ checkRef: failure.checkRef, taskRef: prepared.plan.taskRef, outcome }];
3283
+ return [{ checkRef: repair.checkRef, taskRef: prepared.plan.taskRef, outcome }];
2891
3284
  }
2892
3285
  catch (error) {
2893
3286
  this.logger.warn('The repair of the application\'s refused start could not be run', { error: describeCaughtError(error) });
@@ -2982,7 +3375,9 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2982
3375
  * repair, made where the evidence is. Bounded by {@link MAXIMUM_INTERFERENCE_REARMS} per task. Sequential,
2983
3376
  * because the re-runs are single-flight.
2984
3377
  */
2985
- 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 = {}) {
2986
3381
  const completed = outcomes.filter((outcome) => outcome?.succeeded === true && outcome.taskRef !== null);
2987
3382
  if (completed.length === 0)
2988
3383
  return [];
@@ -3007,7 +3402,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3007
3402
  * rewritten the shared file since, and a reading taken before it would judge this run on stale text.
3008
3403
  */
3009
3404
  const landed = (await this.resolveLandedTaskRefs(graph.tasks)).landed;
3010
- const repair = await this.repairIfInterfered(run, graph, landed, this.createWorktreeReader(), session);
3405
+ const repair = await this.repairIfInterfered(run, graph, landed, this.createWorktreeReader(), session, options);
3011
3406
  if (repair)
3012
3407
  repairs.push(repair);
3013
3408
  }
@@ -3018,7 +3413,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3018
3413
  return repairs;
3019
3414
  }
3020
3415
  /** One run of {@link repairInterferedTasks}: `undefined` when it was not interfered with. */
3021
- async repairIfInterfered(run, graph, landed, worktree, session) {
3416
+ async repairIfInterfered(run, graph, landed, worktree, session, options = {}) {
3022
3417
  if (landed.has(run.taskRef))
3023
3418
  return undefined;
3024
3419
  const task = graph.tasks.find((candidate) => candidate.taskRef === run.taskRef);
@@ -3077,6 +3472,13 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3077
3472
  this.logger.warn('A completed run lost its product to a concurrent sibling; re-running its task alone', {
3078
3473
  taskRef: run.taskRef, runTaskId: run.taskId, ...interference,
3079
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
+ }
3080
3482
  /*
3081
3483
  * Not into the account's usage limit (#2388): the re-run would fail like every other turn before the reset.
3082
3484
  * The task is re-armed already, so the wave that resumes after the reset offers it.
@@ -3212,8 +3614,9 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3212
3614
  }
3213
3615
  if (entry.reason === Workbench_BuildTaskStuckReason.FOLLOW_UP_AWAITING_REVIEW) {
3214
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 `
3215
- + `waits for your review before it runs. Let it run with \`wildo build approve ${taskRef}\`, or decline it with `
3216
- + `\`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);
3217
3620
  }
3218
3621
  if (entry.reason === Workbench_BuildTaskStuckReason.CONTENDED) {
3219
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 `
@@ -3223,6 +3626,10 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3223
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. `
3224
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);
3225
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
+ }
3226
3633
  if (entry.reason === Workbench_BuildTaskStuckReason.IN_FLIGHT) {
3227
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 `
3228
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);
@@ -3698,12 +4105,25 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3698
4105
  }
3699
4106
  return null;
3700
4107
  }
3701
- async prepareNextBuildTask(selection, preparation,
3702
4108
  /**
3703
- * A wave's fill: its landing reading, shared by every slot of one fill; and the generation steps the wave is running
3704
- * (#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.
3705
4112
  */
3706
- 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) {
3707
4127
  let graph;
3708
4128
  let resolution;
3709
4129
  // Read FIRST, before any landing: it decides whether a held reading may be reused, and every candidate is checked
@@ -3718,24 +4138,42 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3718
4138
  ...(this.dispatch.listActiveRunTaskRefs?.() ?? []),
3719
4139
  ...(options.generationStepsInFlight ?? []),
3720
4140
  ]);
3721
- const held = options.fillLanding?.current;
3722
- const reused = held !== undefined
3723
- && held.settlementGeneration === this.landingSettlementGeneration
3724
- && [...held.inFlightTaskRefs].every((taskRef) => inFlightTaskRefs.has(taskRef))
3725
- ? held
3726
- : 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;
3727
4147
  if (reused !== undefined) {
3728
4148
  ({ graph, resolution } = reused);
3729
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
+ }
3730
4155
  else {
3731
4156
  // Taken BEFORE the derivation: a run landing while it runs leaves the reading marked older than that run.
3732
4157
  const settlementGeneration = this.landingSettlementGeneration;
3733
- preparation?.enter(ApplicationBuildPreparationPhase.READING_THE_PLAN);
3734
- graph = await this.readBuildPlan();
3735
- preparation?.enter(ApplicationBuildPreparationPhase.RESOLVING_LANDING);
3736
- resolution = await this.resolveLandedTaskRefs(graph.tasks);
3737
- if (options.fillLanding !== undefined)
3738
- 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);
3739
4177
  }
3740
4178
  const landedTaskRefs = resolution.landed;
3741
4179
  preparation?.enter(ApplicationBuildPreparationPhase.SELECTING_THE_TASK);
@@ -3810,6 +4248,40 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3810
4248
  const inFlightProductWrites = selection === undefined && inFlightTaskRefs.size > 0
3811
4249
  ? graph.tasks.filter((task) => inFlightTaskRefs.has(task.taskRef)).flatMap(buildTaskProductWritePaths)
3812
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
+ };
3813
4285
  // Read once, and only for an UNNAMED selection: a named dispatch is the operator's door past the hold (#3233).
3814
4286
  const generationStepAttemptHistory = selection === undefined && candidates.some((candidate) => candidate.target?.kind === BuildPlanTaskTargetKind.COMPANION_GENERATION_STEP)
3815
4287
  ? await this.readGenerationStepAttemptHistory()
@@ -3872,11 +4344,25 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3872
4344
  this.logger.warn?.(`${landingUnknownCause} The rest of the plan proceeds; the step is offered again once the check answers.`, { deferredTaskRef: candidate.taskRef });
3873
4345
  continue;
3874
4346
  }
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
+ }
3875
4356
  const ranAndHeld = selection === undefined ? await this.classifyRanGenerationStep(candidate, generationStepAttemptHistory) : null;
3876
4357
  if (ranAndHeld !== null) {
3877
4358
  stuck.push(ranAndHeld);
3878
4359
  continue;
3879
4360
  }
4361
+ const reservedStep = reservedBeside(candidate);
4362
+ if (reservedStep !== undefined) {
4363
+ stuck.push(reservedStep);
4364
+ continue;
4365
+ }
3880
4366
  selected = candidate;
3881
4367
  break;
3882
4368
  }
@@ -3894,6 +4380,11 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3894
4380
  stuck.push({ taskRef: candidate.taskRef, priorTaskId: '', reason: Workbench_BuildTaskStuckReason.CONTENDED });
3895
4381
  continue;
3896
4382
  }
4383
+ const reserved = reservedBeside(candidate);
4384
+ if (reserved !== undefined) {
4385
+ stuck.push(reserved);
4386
+ continue;
4387
+ }
3897
4388
  selected = candidate;
3898
4389
  break;
3899
4390
  }
@@ -3911,6 +4402,15 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3911
4402
  ...withSpecificationFault(readBuildPlanSpecificationFault(graph.tasks, resolution)),
3912
4403
  });
3913
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);
3914
4414
  // A task being built right now, or waiting for one that writes its file, is not a finding (#1528, #3204).
3915
4415
  if (stuck.some((entry) => !WORKBENCH_BUILD_TASK_STUCK_REASONS_WAITING_ON_A_LIVE_RUN.has(entry.reason))) {
3916
4416
  const stuckByReason = Object.fromEntries(Object.values(Workbench_BuildTaskStuckReason).map((reason) => [reason, stuck.filter((entry) => entry.reason === reason).map((entry) => entry.taskRef)]));
@@ -4120,7 +4620,8 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
4120
4620
  const runs = await this.readLatestCompletedCodingRuns();
4121
4621
  const openReportedGaps = runs === undefined
4122
4622
  ? undefined
4123
- : 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 });
4124
4625
  // A task a person CLOSED is landed for the plan, never proven: its product was never found by a probe (#3224).
4125
4626
  return {
4126
4627
  landedTaskRefs,
@@ -4619,8 +5120,13 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
4619
5120
  throw new BuildTaskDecisionRefusedError(`"${request.satisfiedBy}" is neither a task of the build plan nor a commit HEAD contains.`);
4620
5121
  closure = { taskRef, kind: BuildTaskClosureKind.SATISFIED_BY_COMMIT, satisfiedBy: sha, reason: request.reason, closedAt };
4621
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 };
4622
5128
  const { commitSha, decisionsPath, replacedUnhonoured } = await this.commitBuildTaskDecision({ closure }, {
4623
- summary: `${taskRef}: closed (${closure.kind}${closure.satisfiedBy ? ` by ${closure.satisfiedBy}` : ''})`,
5129
+ summary: `${taskRef}: closed (${closure.kind}${closure.satisfiedBy ? ` by ${closure.satisfiedBy}` : ''})${describeFollowUpDecisionOrigins(coverage.gaps)}`,
4624
5130
  purpose: request.reason,
4625
5131
  actor,
4626
5132
  });
@@ -4630,6 +5136,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
4630
5136
  note: (commitSha
4631
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.`
4632
5138
  : `${taskRef}'s closure is written to ${decisionsPath} and counts once it is committed.`)
5139
+ + describeFollowUpDecisionCoverage(coverage.gaps, 'closes', taskRef)
4633
5140
  + describeReplacedDecisions(replacedUnhonoured),
4634
5141
  };
4635
5142
  }
@@ -4642,7 +5149,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
4642
5149
  */
4643
5150
  async approveFollowUpTask(taskRef, request, actor) {
4644
5151
  if (!followUpsAwaitReviewUnder(this.autonomyPosture)) {
4645
- 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>\`.`);
4646
5153
  }
4647
5154
  if (!taskRef.startsWith(HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX)) {
4648
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.`);
@@ -4655,9 +5162,12 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
4655
5162
  throw new BuildTaskDecisionRefusedError(`${taskRef} is already approved.`);
4656
5163
  if (await this.dispatch.findCompletedRunForBuildTask(taskRef, undefined, { fresh: true }) !== null)
4657
5164
  throw new BuildTaskDecisionRefusedError(`${taskRef} has already run; there is nothing to approve.`);
4658
- 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 };
4659
5169
  const { commitSha, decisionsPath, replacedUnhonoured } = await this.commitBuildTaskDecision({ followUpApproval: approval }, {
4660
- summary: `${taskRef}: follow-up approved to run`,
5170
+ summary: `${taskRef}: follow-up approved to run${describeFollowUpDecisionOrigins(coverage.gaps)}`,
4661
5171
  purpose: request.note ?? 'The creator reviewed the derived follow-up and let it run.',
4662
5172
  actor,
4663
5173
  });
@@ -4667,6 +5177,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
4667
5177
  note: (commitSha
4668
5178
  ? `${taskRef} is approved, committed ${commitSha.slice(0, 8)}; the next wave may run it. To undo it before it runs, revert that commit.`
4669
5179
  : `${taskRef}'s approval is written to ${decisionsPath} and counts once it is committed.`)
5180
+ + describeFollowUpDecisionCoverage(coverage.gaps, 'lets run', taskRef)
4670
5181
  + describeReplacedDecisions(replacedUnhonoured),
4671
5182
  };
4672
5183
  }
@@ -4705,6 +5216,23 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
4705
5216
  : [];
4706
5217
  });
4707
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
+ }
4708
5236
  /**
4709
5237
  * The LANDED tasks carrying a landing advisory (#3285), each with its advisories: what the creation home's advisory
4710
5238
  * line names. The same derivation the task records make (`resolveBuildTaskLandingAdvisories` over the committed
@@ -5014,10 +5542,12 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
5014
5542
  // false — and an invitation to pay for a re-run (#2217 review).
5015
5543
  const landedBeforeAnyRun = landed && !attemptsTruncated && !attempts.some(isCountedBuildTaskAttempt)
5016
5544
  ? { probedPaths: await this.resolveLandedEvidencePaths(task) } : undefined;
5017
- // A follow-up's FIRST prerequisite is its origin; the others are the follow-up before it on its target (#3227) and
5018
- // 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).
5019
5548
  const followUpTaskRefs = plan.tasks
5020
- .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))
5021
5551
  .map((candidate) => candidate.taskRef);
5022
5552
  // A declined closure accounts for the task without its product, so nothing it declined is owed to be served.
5023
5553
  const landingAdvisories = landed && resolution.closedTaskRefs.get(task.taskRef)?.kind !== BuildTaskClosureKind.DECLINED
@@ -5028,6 +5558,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
5028
5558
  status,
5029
5559
  ...(followUpTaskRefs.length > 0 ? { followUpTaskRefs } : {}),
5030
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)),
5031
5562
  ...(closureOf(resolution.closedTaskRefs.get(task.taskRef))),
5032
5563
  attempts,
5033
5564
  ...(stuck !== null ? { stuck } : {}),
@@ -6845,7 +7376,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
6845
7376
  return undefined;
6846
7377
  const roadmap = RoadmapSnapshotSchema.safeParse(decidedFamilyValuesFromCompanionExports(companionExports)[ApplicationSpecificationFamily.ROADMAP]);
6847
7378
  const phases = roadmap.success ? roadmap.data.phases : [];
6848
- const followUps = await this.deriveFollowUps(plan.tasks, runs.latest);
7379
+ const followUps = await this.readFollowUpDerivation(plan.tasks, runs.latest);
6849
7380
  return (requirementRef) => deriveWebsiteClaimDelivery(requirementRef, {
6850
7381
  tasks: plan.tasks,
6851
7382
  landedTaskRefs: landed,
@@ -6919,9 +7450,10 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
6919
7450
  return { latest, truncated: rows.length >= BUILD_TASK_RECORD_HISTORY_CEILING };
6920
7451
  }
6921
7452
  /**
6922
- * The follow-up tasks the requirements COMPLETED coding runs reported still unmet derive (#2496, #3227), appended to the
6923
- * plan. The derivation is {@link deriveBuildPlanFollowUpTasks}: one follow-up per reporting run, folding every requirement
6924
- * 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.
6925
7457
  *
6926
7458
  * 005's workers wrote "office/field access is only partly met" and "the roles do nothing yet … it still needs its own
6927
7459
  * work" into closing reports that every run was accepted on, and no later task, coherence entry or judge picked any of
@@ -6938,21 +7470,82 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
6938
7470
  if (runs === undefined)
6939
7471
  return graph;
6940
7472
  /*
6941
- * Held per (plan tasks, latest completed runs) (#3204): the plan is read on every selection, board and landing read,
6942
- * and this re-validated the whole plan once per follow-up and warned again on each read. On reference run 42666728304
6943
- * a re-decomposed plan already naming the follow-ups logged "already names another task" 184 times in one burst,
6944
- * 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.
6945
7478
  */
6946
- 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) });
6947
7482
  if (this.followUpDerivationMemo?.key === memoKey)
6948
7483
  return this.followUpDerivationMemo.graph;
6949
- const derived = await this.deriveFollowUpTaskGraph(graph, runs);
6950
- 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);
6951
7495
  return derived;
6952
7496
  }
6953
7497
  followUpDerivationMemo;
6954
- async deriveFollowUpTaskGraph(graph, runs) {
6955
- 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);
6956
7549
  for (const skipped of derivation.notDerived) {
6957
7550
  if (skipped.reason === FollowUpGapNotDerivedReason.MET_SINCE && skipped.metSince !== undefined) {
6958
7551
  // Every drop is logged, with the run that stated it met and where (#3227).
@@ -6964,30 +7557,51 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
6964
7557
  });
6965
7558
  continue;
6966
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
+ }
6967
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 });
6968
7566
  }
6969
7567
  const taskRefs = new Set(graph.tasks.map((task) => task.taskRef));
6970
7568
  let current = graph;
7569
+ const appended = [];
6971
7570
  /*
6972
7571
  * Each follow-up waits on the last one APPENDED on its target (#3227 review F3): a follow-up skipped below would
6973
7572
  * otherwise be named as the next one's prerequisite, which the plan refuses as unknown, and the rest of its target's
6974
7573
  * chain would be dropped with it.
6975
7574
  */
6976
7575
  const lastAppendedOnTarget = new Map();
6977
- for (const derived of derivation.followUps) {
6978
- const followUp = chainFollowUpAfter(derived.task, lastAppendedOnTarget.get(derived.targetKey));
7576
+ const append = (derived) => {
7577
+ const followUp = chainFollowUpAfter(derived, lastAppendedOnTarget.get(derived.targetKey));
6979
7578
  if (taskRefs.has(followUp.taskRef)) {
6980
7579
  this.logger.warn?.(`Reported gaps derive "${followUp.taskRef}", which already names another task; not deriving it`, { origins: followUp.prerequisiteTaskRefs });
6981
- continue;
7580
+ return false;
6982
7581
  }
6983
7582
  const extended = BuildPlanTaskGraphSchema.safeParse({ ...current, tasks: [...current.tasks, followUp] });
6984
7583
  if (!extended.success) {
6985
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) });
6986
- continue;
7585
+ return false;
6987
7586
  }
6988
7587
  current = extended.data;
6989
7588
  taskRefs.add(followUp.taskRef);
6990
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);
6991
7605
  }
6992
7606
  /*
6993
7607
  * Whenever the cap is hit, derived or not (#2496 review N1): the gap the cap hides is exactly the case that derives
@@ -6997,28 +7611,39 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
6997
7611
  this.followUpListingTruncationWarned = true;
6998
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.`);
6999
7613
  }
7000
- 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]) };
7001
7616
  }
7002
7617
  /**
7003
7618
  * The follow-up derivation over a plan and the latest completed runs (#2496, #3227): one function for every reader.
7004
7619
  *
7005
7620
  * A gap a later run STATED met is dropped only once this host confirms two things the pure candidates cannot know
7006
7621
  * ({@link collectFollowUpGapsMetSince}): the stating run LANDED, meaning every file its write record holds as its own is
7007
- * committed (a statement about a tree whose work is still uncommitted is about a tree HEAD does not have), and the gap's
7008
- * follow-up was never attempted, in any state (a follow-up the build ran or is running never leaves the plan, #2530).
7009
- * Both are read only when a candidate exists, so a plan with no met statement costs nothing extra. Anything this cannot
7010
- * read keeps the gap: an unknown is not a statement that it is met.
7011
- */
7012
- 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 } : {};
7013
7630
  const candidates = collectFollowUpGapsMetSince({ tasks, latestCompletedRuns: latest });
7014
7631
  if (candidates.length === 0)
7015
- return deriveBuildPlanFollowUpTasks({ tasks, latestCompletedRuns: latest });
7632
+ return deriveBuildPlanFollowUpTasks({ tasks, latestCompletedRuns: latest, ...withAbsorption });
7016
7633
  const metSince = new Map();
7017
7634
  try {
7018
- 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))));
7019
7644
  const landedRuns = await this.selectLandedRunTaskIds([...new Set(candidates.map((candidate) => candidate.metByRunTaskId))]);
7020
7645
  for (const candidate of candidates) {
7021
- if (attempted.has(candidate.followUpTaskRef) || !landedRuns.has(candidate.metByRunTaskId))
7646
+ if (attempted.has(candidate.followUpTaskRef) || carriedByAttempted.has(followUpGapKey(candidate.gap)) || !landedRuns.has(candidate.metByRunTaskId))
7022
7647
  continue;
7023
7648
  // The first confirmed statement, in plan order, is the one the log names.
7024
7649
  if (!metSince.has(followUpGapKey(candidate.gap)))
@@ -7028,24 +7653,66 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
7028
7653
  catch (error) {
7029
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) });
7030
7655
  }
7031
- return deriveBuildPlanFollowUpTasks({ tasks, latestCompletedRuns: latest, metSince });
7656
+ return deriveBuildPlanFollowUpTasks({ tasks, latestCompletedRuns: latest, metSince, ...withAbsorption });
7032
7657
  }
7033
7658
  /**
7034
- * Every build task with ANY coding run in the history, whatever its state (#3227): a follow-up attempted keeps its gaps.
7035
- * 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.
7036
7671
  */
7037
- async readAttemptedBuildTaskRefs() {
7038
- const rows = await this.executions.listActorExecutions({ systemRef: APPLICATION_CODING_SYSTEM_REF, limit: BUILD_TASK_RECORD_HISTORY_CEILING });
7039
- // 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
+ }
7040
7694
  if (rows.length >= BUILD_TASK_RECORD_HISTORY_CEILING)
7041
- throw new Error(`the coding-run listing reached its ${BUILD_TASK_RECORD_HISTORY_CEILING}-run ceiling, so an older attempt may be missing`);
7042
- 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();
7043
7700
  for (const row of rows) {
7044
- const taskRef = row.standaloneTasks[0]?.input?.taskRef;
7045
- if (typeof taskRef === 'string')
7046
- 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);
7710
+ }
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 ?? [])]));
7047
7714
  }
7048
- return refs;
7715
+ return { dispatched, decided };
7049
7716
  }
7050
7717
  /**
7051
7718
  * Which completed coding runs LANDED (#3227): their write record exists. Since #3204 a task lands on the WORKING tree, so
@@ -8033,7 +8700,21 @@ thirdParty) {
8033
8700
  return target?.moduleRef === moduleRef;
8034
8701
  })
8035
8702
  .map((element) => ({ taskRef: element.ref, objective: element.label }));
8036
- 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)
8037
8718
  return null;
8038
8719
  return {
8039
8720
  sourceRef: 'application-creation:context/served-elements',
@@ -8050,8 +8731,11 @@ thirdParty) {
8050
8731
  }
8051
8732
  : {}),
8052
8733
  ...(moduleRef !== undefined ? { moduleRef, otherTasksInModule: moduleTasks } : {}),
8053
- note: 'servedElements are what this task is accountable to — its acceptance criteria. otherTasksInModule is a map only: '
8054
- + '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.',
8055
8739
  },
8056
8740
  };
8057
8741
  }