@wildo-ai/dev-companion 1.1.13 → 1.1.15

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 (363) hide show
  1. package/dist/esm/.tsbuildinfo +1 -1
  2. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.d.ts +89 -1
  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 +114 -9
  5. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.js.map +1 -1
  6. package/dist/esm/claude-cli/models/concurrent-coding-runs.models.d.ts +46 -1
  7. package/dist/esm/claude-cli/models/concurrent-coding-runs.models.d.ts.map +1 -1
  8. package/dist/esm/claude-cli/models/concurrent-coding-runs.models.js +39 -2
  9. package/dist/esm/claude-cli/models/concurrent-coding-runs.models.js.map +1 -1
  10. package/dist/esm/claude-cli/models/shared-tree-reconciliation.models.d.ts +6 -0
  11. package/dist/esm/claude-cli/models/shared-tree-reconciliation.models.d.ts.map +1 -1
  12. package/dist/esm/claude-cli/models/shared-tree-reconciliation.models.js.map +1 -1
  13. package/dist/esm/claude-cli/models/verification-tool-availability.models.d.ts +19 -5
  14. package/dist/esm/claude-cli/models/verification-tool-availability.models.d.ts.map +1 -1
  15. package/dist/esm/claude-cli/models/verification-tool-availability.models.js +17 -5
  16. package/dist/esm/claude-cli/models/verification-tool-availability.models.js.map +1 -1
  17. package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.d.ts +16 -1
  18. package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.d.ts.map +1 -1
  19. package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.js +53 -6
  20. package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.js.map +1 -1
  21. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.d.ts +145 -6
  22. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.d.ts.map +1 -1
  23. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.js +474 -47
  24. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.js.map +1 -1
  25. package/dist/esm/claude-cli/services/git-change-set.companion.service.d.ts +6 -2
  26. package/dist/esm/claude-cli/services/git-change-set.companion.service.d.ts.map +1 -1
  27. package/dist/esm/claude-cli/services/git-change-set.companion.service.js +16 -39
  28. package/dist/esm/claude-cli/services/git-change-set.companion.service.js.map +1 -1
  29. package/dist/esm/claude-cli/services/research-evidence-store.companion.d.ts +14 -0
  30. package/dist/esm/claude-cli/services/research-evidence-store.companion.d.ts.map +1 -1
  31. package/dist/esm/claude-cli/services/research-evidence-store.companion.js +35 -0
  32. package/dist/esm/claude-cli/services/research-evidence-store.companion.js.map +1 -1
  33. package/dist/esm/claude-cli/services/unrecorded-provider-directories.companion.d.ts +36 -0
  34. package/dist/esm/claude-cli/services/unrecorded-provider-directories.companion.d.ts.map +1 -0
  35. package/dist/esm/claude-cli/services/unrecorded-provider-directories.companion.js +134 -0
  36. package/dist/esm/claude-cli/services/unrecorded-provider-directories.companion.js.map +1 -0
  37. package/dist/esm/code-compliance-check/check-raw-feature-id-literals.companion.js +31 -2
  38. package/dist/esm/code-compliance-check/check-raw-feature-id-literals.companion.js.map +1 -1
  39. package/dist/esm/companion-api/companion-api.schemas.d.ts +2 -0
  40. package/dist/esm/companion-api/companion-api.schemas.d.ts.map +1 -1
  41. package/dist/esm/companion-api/companion-api.schemas.js +8 -0
  42. package/dist/esm/companion-api/companion-api.schemas.js.map +1 -1
  43. package/dist/esm/companion-api/controllers/companion.controller.d.ts +7 -0
  44. package/dist/esm/companion-api/controllers/companion.controller.d.ts.map +1 -1
  45. package/dist/esm/companion-api/controllers/companion.controller.js +26 -12
  46. package/dist/esm/companion-api/controllers/companion.controller.js.map +1 -1
  47. package/dist/esm/companion-api/controllers/long-held-request.companion.d.ts +17 -0
  48. package/dist/esm/companion-api/controllers/long-held-request.companion.d.ts.map +1 -0
  49. package/dist/esm/companion-api/controllers/long-held-request.companion.js +33 -0
  50. package/dist/esm/companion-api/controllers/long-held-request.companion.js.map +1 -0
  51. package/dist/esm/core/introspection/resources/creation-home-projection.companion.d.ts +9 -0
  52. package/dist/esm/core/introspection/resources/creation-home-projection.companion.d.ts.map +1 -1
  53. package/dist/esm/core/introspection/resources/creation-home-projection.companion.js +12 -0
  54. package/dist/esm/core/introspection/resources/creation-home-projection.companion.js.map +1 -1
  55. package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.d.ts.map +1 -1
  56. package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.js +7 -1
  57. package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.js.map +1 -1
  58. package/dist/esm/core/introspection/services/introspection-source-state.companion.service.d.ts +8 -20
  59. package/dist/esm/core/introspection/services/introspection-source-state.companion.service.d.ts.map +1 -1
  60. package/dist/esm/core/introspection/services/introspection-source-state.companion.service.js +37 -142
  61. package/dist/esm/core/introspection/services/introspection-source-state.companion.service.js.map +1 -1
  62. package/dist/esm/core/introspection/services/introspection-source-walk.worker.d.ts +64 -0
  63. package/dist/esm/core/introspection/services/introspection-source-walk.worker.d.ts.map +1 -0
  64. package/dist/esm/core/introspection/services/introspection-source-walk.worker.js +304 -0
  65. package/dist/esm/core/introspection/services/introspection-source-walk.worker.js.map +1 -0
  66. package/dist/esm/core/introspection/services/translation-placement.companion.service.d.ts +3 -2
  67. package/dist/esm/core/introspection/services/translation-placement.companion.service.d.ts.map +1 -1
  68. package/dist/esm/core/introspection/services/translation-placement.companion.service.js.map +1 -1
  69. package/dist/esm/core/introspection/subprocess/companion-introspection-behavior-handlers.d.ts.map +1 -1
  70. package/dist/esm/core/introspection/subprocess/companion-introspection-behavior-handlers.js +24 -14
  71. package/dist/esm/core/introspection/subprocess/companion-introspection-behavior-handlers.js.map +1 -1
  72. package/dist/esm/core/introspection/workspace-element-index.companion.d.ts +42 -0
  73. package/dist/esm/core/introspection/workspace-element-index.companion.d.ts.map +1 -1
  74. package/dist/esm/core/introspection/workspace-element-index.companion.js +42 -0
  75. package/dist/esm/core/introspection/workspace-element-index.companion.js.map +1 -1
  76. package/dist/esm/core/runtime/companion-language-model-route.d.ts +16 -1
  77. package/dist/esm/core/runtime/companion-language-model-route.d.ts.map +1 -1
  78. package/dist/esm/core/runtime/companion-language-model-route.js +23 -1
  79. package/dist/esm/core/runtime/companion-language-model-route.js.map +1 -1
  80. package/dist/esm/core/runtime/dev-compile-quiet.companion.d.ts +53 -0
  81. package/dist/esm/core/runtime/dev-compile-quiet.companion.d.ts.map +1 -1
  82. package/dist/esm/core/runtime/dev-compile-quiet.companion.js +119 -2
  83. package/dist/esm/core/runtime/dev-compile-quiet.companion.js.map +1 -1
  84. package/dist/esm/core/runtime/services/start-companion-application.service.d.ts.map +1 -1
  85. package/dist/esm/core/runtime/services/start-companion-application.service.js +16 -3
  86. package/dist/esm/core/runtime/services/start-companion-application.service.js.map +1 -1
  87. package/dist/esm/core/runtime/utils/companion-platform-config.companion.d.ts +2 -2
  88. package/dist/esm/core/runtime/utils/companion-platform-config.companion.d.ts.map +1 -1
  89. package/dist/esm/core/runtime/utils/companion-platform-config.companion.js +6 -6
  90. package/dist/esm/core/runtime/utils/companion-platform-config.companion.js.map +1 -1
  91. package/dist/esm/core/utils/git-read-broker.companion.d.ts +62 -0
  92. package/dist/esm/core/utils/git-read-broker.companion.d.ts.map +1 -0
  93. package/dist/esm/core/utils/git-read-broker.companion.js +282 -0
  94. package/dist/esm/core/utils/git-read-broker.companion.js.map +1 -0
  95. package/dist/esm/core/utils/local-write-recording.companion.d.ts +8 -1
  96. package/dist/esm/core/utils/local-write-recording.companion.d.ts.map +1 -1
  97. package/dist/esm/core/utils/local-write-recording.companion.js +7 -23
  98. package/dist/esm/core/utils/local-write-recording.companion.js.map +1 -1
  99. package/dist/esm/email/services/email-template.companion.service.d.ts +5 -0
  100. package/dist/esm/email/services/email-template.companion.service.d.ts.map +1 -1
  101. package/dist/esm/email/services/email-template.companion.service.js +44 -11
  102. package/dist/esm/email/services/email-template.companion.service.js.map +1 -1
  103. package/dist/esm/email/utils/email-template-fs-discovery.utils.d.ts +26 -2
  104. package/dist/esm/email/utils/email-template-fs-discovery.utils.d.ts.map +1 -1
  105. package/dist/esm/email/utils/email-template-fs-discovery.utils.js +41 -2
  106. package/dist/esm/email/utils/email-template-fs-discovery.utils.js.map +1 -1
  107. package/dist/esm/email/utils/email-template-scanner-calls.companion.utils.d.ts +19 -0
  108. package/dist/esm/email/utils/email-template-scanner-calls.companion.utils.d.ts.map +1 -0
  109. package/dist/esm/email/utils/email-template-scanner-calls.companion.utils.js +171 -0
  110. package/dist/esm/email/utils/email-template-scanner-calls.companion.utils.js.map +1 -0
  111. package/dist/esm/email/utils/module-email-root.companion.utils.d.ts +75 -0
  112. package/dist/esm/email/utils/module-email-root.companion.utils.d.ts.map +1 -0
  113. package/dist/esm/email/utils/module-email-root.companion.utils.js +162 -0
  114. package/dist/esm/email/utils/module-email-root.companion.utils.js.map +1 -0
  115. package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.en.d.ts +29 -0
  116. package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.en.d.ts.map +1 -0
  117. package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.en.js +29 -0
  118. package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.en.js.map +1 -0
  119. package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.fr.d.ts +29 -0
  120. package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.fr.d.ts.map +1 -0
  121. package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.fr.js +29 -0
  122. package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.fr.js.map +1 -0
  123. package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.en.d.ts +1 -0
  124. package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.en.d.ts.map +1 -1
  125. package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.en.js +1 -0
  126. package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.en.js.map +1 -1
  127. package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.fr.d.ts +1 -0
  128. package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.fr.d.ts.map +1 -1
  129. package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.fr.js +1 -0
  130. package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.fr.js.map +1 -1
  131. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.en.d.ts +1 -0
  132. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.en.d.ts.map +1 -1
  133. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.en.js +2 -1
  134. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.en.js.map +1 -1
  135. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.fr.d.ts +1 -0
  136. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.fr.d.ts.map +1 -1
  137. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.fr.js +2 -1
  138. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.fr.js.map +1 -1
  139. package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.en.d.ts +5 -2
  140. package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.en.d.ts.map +1 -1
  141. package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.en.js +5 -2
  142. package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.en.js.map +1 -1
  143. package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.fr.d.ts +5 -2
  144. package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.fr.d.ts.map +1 -1
  145. package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.fr.js +5 -2
  146. package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.fr.js.map +1 -1
  147. package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.en.d.ts +41 -0
  148. package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.en.d.ts.map +1 -0
  149. package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.en.js +41 -0
  150. package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.en.js.map +1 -0
  151. package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.fr.d.ts +41 -0
  152. package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.fr.d.ts.map +1 -0
  153. package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.fr.js +41 -0
  154. package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.fr.js.map +1 -0
  155. package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.en.d.ts +1 -0
  156. package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.en.d.ts.map +1 -1
  157. package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.en.js +2 -1
  158. package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.en.js.map +1 -1
  159. package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.fr.d.ts +1 -0
  160. package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.fr.d.ts.map +1 -1
  161. package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.fr.js +2 -1
  162. package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.fr.js.map +1 -1
  163. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.en.d.ts +1 -0
  164. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.en.d.ts.map +1 -1
  165. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.en.js +2 -1
  166. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.en.js.map +1 -1
  167. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.fr.d.ts +1 -0
  168. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.fr.d.ts.map +1 -1
  169. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.fr.js +2 -1
  170. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.fr.js.map +1 -1
  171. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.en.d.ts +1 -0
  172. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.en.d.ts.map +1 -1
  173. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.en.js +2 -1
  174. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.en.js.map +1 -1
  175. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.fr.d.ts +1 -0
  176. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.fr.d.ts.map +1 -1
  177. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.fr.js +2 -1
  178. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.fr.js.map +1 -1
  179. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.en.d.ts +2 -0
  180. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.en.d.ts.map +1 -1
  181. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.en.js +3 -1
  182. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.en.js.map +1 -1
  183. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.fr.d.ts +2 -0
  184. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.fr.d.ts.map +1 -1
  185. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.fr.js +3 -1
  186. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.fr.js.map +1 -1
  187. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_AUTH.en.d.ts +1 -1
  188. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_AUTH.en.js +1 -1
  189. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_AUTH.en.js.map +1 -1
  190. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_AUTH.fr.d.ts +1 -1
  191. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_AUTH.fr.js +1 -1
  192. package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_AUTH.fr.js.map +1 -1
  193. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.en.d.ts +2 -0
  194. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.en.d.ts.map +1 -1
  195. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.en.js +3 -1
  196. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.en.js.map +1 -1
  197. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.fr.d.ts +3 -1
  198. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.fr.d.ts.map +1 -1
  199. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.fr.js +4 -2
  200. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.fr.js.map +1 -1
  201. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.en.d.ts +17 -0
  202. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.en.d.ts.map +1 -1
  203. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.en.js +18 -1
  204. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.en.js.map +1 -1
  205. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.fr.d.ts +17 -0
  206. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.fr.d.ts.map +1 -1
  207. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.fr.js +18 -1
  208. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.fr.js.map +1 -1
  209. package/dist/esm/i18n/composite_views/app.creation-conversation.fr.d.ts +206 -195
  210. package/dist/esm/i18n/composite_views/app.creation-conversation.fr.d.ts.map +1 -1
  211. package/dist/esm/i18n/composite_views/app.creation-conversation.fr.js +206 -195
  212. package/dist/esm/i18n/composite_views/app.creation-conversation.fr.js.map +1 -1
  213. package/dist/esm/i18n/composite_views/app.creation-dossier.fr.d.ts +10 -0
  214. package/dist/esm/i18n/composite_views/app.creation-dossier.fr.d.ts.map +1 -1
  215. package/dist/esm/i18n/composite_views/app.creation-dossier.fr.js +12 -2
  216. package/dist/esm/i18n/composite_views/app.creation-dossier.fr.js.map +1 -1
  217. package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.fr.d.ts +70 -0
  218. package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.fr.d.ts.map +1 -1
  219. package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.fr.js +70 -0
  220. package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.fr.js.map +1 -1
  221. package/dist/esm/i18n/resources/wildoApplicationActorTasks.fr.d.ts +12 -2
  222. package/dist/esm/i18n/resources/wildoApplicationActorTasks.fr.d.ts.map +1 -1
  223. package/dist/esm/i18n/resources/wildoApplicationActorTasks.fr.js +12 -2
  224. package/dist/esm/i18n/resources/wildoApplicationActorTasks.fr.js.map +1 -1
  225. package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.fr.d.ts +10 -0
  226. package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.fr.d.ts.map +1 -1
  227. package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.fr.js +10 -0
  228. package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.fr.js.map +1 -1
  229. package/dist/esm/i18n/resources/workbenchAspects.en.d.ts.map +1 -1
  230. package/dist/esm/i18n/resources/workbenchAspects.en.js +4 -0
  231. package/dist/esm/i18n/resources/workbenchAspects.en.js.map +1 -1
  232. package/dist/esm/i18n/resources/workbenchBuildDispatchPlan.fr.d.ts +25 -20
  233. package/dist/esm/i18n/resources/workbenchBuildDispatchPlan.fr.d.ts.map +1 -1
  234. package/dist/esm/i18n/resources/workbenchBuildDispatchPlan.fr.js +25 -20
  235. package/dist/esm/i18n/resources/workbenchBuildDispatchPlan.fr.js.map +1 -1
  236. package/dist/esm/i18n/resources/workbenchBuildPlanTasks.fr.d.ts +32 -32
  237. package/dist/esm/i18n/resources/workbenchBuildPlanTasks.fr.js +32 -32
  238. package/dist/esm/i18n/resources/workbenchBuildPlanTasks.fr.js.map +1 -1
  239. package/dist/esm/i18n/resources/workbenchBuildTaskRecords.fr.d.ts +65 -65
  240. package/dist/esm/i18n/resources/workbenchBuildTaskRecords.fr.js +65 -65
  241. package/dist/esm/i18n/resources/workbenchBuildTaskRecords.fr.js.map +1 -1
  242. package/dist/esm/i18n/resources/workbenchDossierEntries.fr.d.ts +20 -0
  243. package/dist/esm/i18n/resources/workbenchDossierEntries.fr.d.ts.map +1 -1
  244. package/dist/esm/i18n/resources/workbenchDossierEntries.fr.js +20 -0
  245. package/dist/esm/i18n/resources/workbenchDossierEntries.fr.js.map +1 -1
  246. package/dist/esm/i18n/resources/workbenchGovernanceQuestions.fr.d.ts +12 -0
  247. package/dist/esm/i18n/resources/workbenchGovernanceQuestions.fr.d.ts.map +1 -1
  248. package/dist/esm/i18n/resources/workbenchGovernanceQuestions.fr.js +13 -1
  249. package/dist/esm/i18n/resources/workbenchGovernanceQuestions.fr.js.map +1 -1
  250. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.d.ts +35 -0
  251. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.d.ts.map +1 -1
  252. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.js +12 -0
  253. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.js.map +1 -1
  254. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.fr.d.ts +536 -531
  255. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.fr.d.ts.map +1 -1
  256. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.fr.js +536 -531
  257. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.fr.js.map +1 -1
  258. package/dist/esm/i18n/system_enums/application-creation.fr.d.ts +170 -170
  259. package/dist/esm/i18n/system_enums/application-creation.fr.js +170 -170
  260. package/dist/esm/i18n/system_enums/application-creation.fr.js.map +1 -1
  261. package/dist/esm/i18n/system_enums/flows-actors.fr.d.ts +22 -22
  262. package/dist/esm/i18n/system_enums/flows-actors.fr.js +22 -22
  263. package/dist/esm/i18n/system_enums/flows-actors.fr.js.map +1 -1
  264. package/dist/esm/i18n/system_enums/run-records.fr.d.ts +21 -21
  265. package/dist/esm/i18n/system_enums/run-records.fr.js +21 -21
  266. package/dist/esm/i18n/system_enums/run-records.fr.js.map +1 -1
  267. package/dist/esm/i18n/system_enums/workbench-build.en.d.ts +3 -2
  268. package/dist/esm/i18n/system_enums/workbench-build.en.d.ts.map +1 -1
  269. package/dist/esm/i18n/system_enums/workbench-build.en.js +3 -2
  270. package/dist/esm/i18n/system_enums/workbench-build.en.js.map +1 -1
  271. package/dist/esm/i18n/system_enums/workbench-build.fr.d.ts +37 -33
  272. package/dist/esm/i18n/system_enums/workbench-build.fr.d.ts.map +1 -1
  273. package/dist/esm/i18n/system_enums/workbench-build.fr.js +37 -33
  274. package/dist/esm/i18n/system_enums/workbench-build.fr.js.map +1 -1
  275. package/dist/esm/i18n/system_enums/workbench-creation-home.en.d.ts +1 -0
  276. package/dist/esm/i18n/system_enums/workbench-creation-home.en.d.ts.map +1 -1
  277. package/dist/esm/i18n/system_enums/workbench-creation-home.en.js +1 -0
  278. package/dist/esm/i18n/system_enums/workbench-creation-home.en.js.map +1 -1
  279. package/dist/esm/i18n/system_enums/workbench-creation-home.fr.d.ts +18 -17
  280. package/dist/esm/i18n/system_enums/workbench-creation-home.fr.d.ts.map +1 -1
  281. package/dist/esm/i18n/system_enums/workbench-creation-home.fr.js +18 -17
  282. package/dist/esm/i18n/system_enums/workbench-creation-home.fr.js.map +1 -1
  283. package/dist/esm/i18n/system_enums/workbench-dossier.fr.d.ts +7 -5
  284. package/dist/esm/i18n/system_enums/workbench-dossier.fr.d.ts.map +1 -1
  285. package/dist/esm/i18n/system_enums/workbench-dossier.fr.js +8 -6
  286. package/dist/esm/i18n/system_enums/workbench-dossier.fr.js.map +1 -1
  287. package/dist/esm/i18n/system_enums/workbench-secrets.fr.d.ts +12 -12
  288. package/dist/esm/i18n/system_enums/workbench-secrets.fr.js +12 -12
  289. package/dist/esm/i18n/system_enums/workbench-secrets.fr.js.map +1 -1
  290. package/dist/esm/i18n/system_enums/workbench-specification-artifact.fr.d.ts +1 -0
  291. package/dist/esm/i18n/system_enums/workbench-specification-artifact.fr.d.ts.map +1 -1
  292. package/dist/esm/i18n/system_enums/workbench-specification-artifact.fr.js +2 -1
  293. package/dist/esm/i18n/system_enums/workbench-specification-artifact.fr.js.map +1 -1
  294. package/dist/esm/i18n-labelling/services/email-template-labelling-units.companion.service.d.ts.map +1 -1
  295. package/dist/esm/i18n-labelling/services/email-template-labelling-units.companion.service.js +7 -3
  296. package/dist/esm/i18n-labelling/services/email-template-labelling-units.companion.service.js.map +1 -1
  297. package/dist/esm/i18n-labelling/services/labelling-planner.companion.service.d.ts.map +1 -1
  298. package/dist/esm/i18n-labelling/services/labelling-planner.companion.service.js +3 -4
  299. package/dist/esm/i18n-labelling/services/labelling-planner.companion.service.js.map +1 -1
  300. package/dist/esm/i18n-labelling/utils/declared-refusal-codes.utils.d.ts +11 -0
  301. package/dist/esm/i18n-labelling/utils/declared-refusal-codes.utils.d.ts.map +1 -1
  302. package/dist/esm/i18n-labelling/utils/declared-refusal-codes.utils.js +21 -0
  303. package/dist/esm/i18n-labelling/utils/declared-refusal-codes.utils.js.map +1 -1
  304. package/dist/esm/meta-workflows/models/creation-journey-timeline.models.d.ts +9 -0
  305. package/dist/esm/meta-workflows/models/creation-journey-timeline.models.d.ts.map +1 -1
  306. package/dist/esm/meta-workflows/models/creation-journey-timeline.models.js +18 -2
  307. package/dist/esm/meta-workflows/models/creation-journey-timeline.models.js.map +1 -1
  308. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts +153 -22
  309. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts.map +1 -1
  310. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js +970 -208
  311. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js.map +1 -1
  312. package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.d.ts +115 -13
  313. package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.d.ts.map +1 -1
  314. package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.js +295 -56
  315. package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.js.map +1 -1
  316. package/dist/esm/meta-workflows/services/application-build-landing-projection.companion.d.ts +3 -3
  317. package/dist/esm/meta-workflows/services/application-build-landing-projection.companion.js +3 -3
  318. package/dist/esm/meta-workflows/services/application-build-landing-projection.companion.js.map +1 -1
  319. package/dist/esm/meta-workflows/services/application-build-task-closure.companion.d.ts +9 -0
  320. package/dist/esm/meta-workflows/services/application-build-task-closure.companion.d.ts.map +1 -1
  321. package/dist/esm/meta-workflows/services/application-build-task-closure.companion.js +19 -0
  322. package/dist/esm/meta-workflows/services/application-build-task-closure.companion.js.map +1 -1
  323. package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.d.ts +1 -1
  324. package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.d.ts.map +1 -1
  325. package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.js +48 -26
  326. package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.js.map +1 -1
  327. package/dist/esm/meta-workflows/services/build-task-brief-application-facts.companion.d.ts +12 -0
  328. package/dist/esm/meta-workflows/services/build-task-brief-application-facts.companion.d.ts.map +1 -1
  329. package/dist/esm/meta-workflows/services/build-task-brief-application-facts.companion.js +30 -1
  330. package/dist/esm/meta-workflows/services/build-task-brief-application-facts.companion.js.map +1 -1
  331. package/dist/esm/meta-workflows/services/creation-intervention-ledger.companion.service.d.ts.map +1 -1
  332. package/dist/esm/meta-workflows/services/creation-intervention-ledger.companion.service.js +4 -5
  333. package/dist/esm/meta-workflows/services/creation-intervention-ledger.companion.service.js.map +1 -1
  334. package/dist/esm/meta-workflows/services/creation-run-report.companion.service.d.ts.map +1 -1
  335. package/dist/esm/meta-workflows/services/creation-run-report.companion.service.js +12 -1
  336. package/dist/esm/meta-workflows/services/creation-run-report.companion.service.js.map +1 -1
  337. package/dist/esm/meta-workflows/services/foundation-executor.companion.service.d.ts.map +1 -1
  338. package/dist/esm/meta-workflows/services/foundation-executor.companion.service.js +6 -3
  339. package/dist/esm/meta-workflows/services/foundation-executor.companion.service.js.map +1 -1
  340. package/dist/esm/meta-workflows/services/playbook-run-write-register-window.companion.d.ts.map +1 -1
  341. package/dist/esm/meta-workflows/services/playbook-run-write-register-window.companion.js +3 -5
  342. package/dist/esm/meta-workflows/services/playbook-run-write-register-window.companion.js.map +1 -1
  343. package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts +8 -1
  344. package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts.map +1 -1
  345. package/dist/esm/meta-workflows/services/playbook-run.companion.service.js +119 -25
  346. package/dist/esm/meta-workflows/services/playbook-run.companion.service.js.map +1 -1
  347. package/dist/esm/meta-workflows/services/provider-registry-brief.companion.utils.d.ts +55 -1
  348. package/dist/esm/meta-workflows/services/provider-registry-brief.companion.utils.d.ts.map +1 -1
  349. package/dist/esm/meta-workflows/services/provider-registry-brief.companion.utils.js +157 -10
  350. package/dist/esm/meta-workflows/services/provider-registry-brief.companion.utils.js.map +1 -1
  351. package/dist/esm/module-layout/module-layout-convention.companion.d.ts +158 -0
  352. package/dist/esm/module-layout/module-layout-convention.companion.d.ts.map +1 -0
  353. package/dist/esm/module-layout/module-layout-convention.companion.js +272 -0
  354. package/dist/esm/module-layout/module-layout-convention.companion.js.map +1 -0
  355. package/dist/esm/module-layout/module-layout-inspection.companion.d.ts +42 -0
  356. package/dist/esm/module-layout/module-layout-inspection.companion.d.ts.map +1 -0
  357. package/dist/esm/module-layout/module-layout-inspection.companion.js +290 -0
  358. package/dist/esm/module-layout/module-layout-inspection.companion.js.map +1 -0
  359. package/dist/esm/module-layout/module-source-files.companion.d.ts +3 -0
  360. package/dist/esm/module-layout/module-source-files.companion.d.ts.map +1 -0
  361. package/dist/esm/module-layout/module-source-files.companion.js +45 -0
  362. package/dist/esm/module-layout/module-source-files.companion.js.map +1 -0
  363. package/package.json +18 -18
@@ -35,7 +35,7 @@ import { SAAS_SERVICE_TYPES, describeCaughtError } from '@wildo-ai/saas-backend-
35
35
  import { Actor_Task_Topics, FlowsActors_Status } from '@wildo-ai/saas-models';
36
36
  import { PER_SERVICE_WEBSITE_CONFIG_FILE_NAME, resolveStaticWebsiteServiceEntry } from '@wildo-ai/saas-website/config-loader';
37
37
  import { AcceptOrigin, ApplicationSpecificationFamily, BUILD_PLAN_TASK_GRAPH_HARD_FLOOR_CODES, BuildPlanResourceStage, BuildPlanTaskGraphSchema, BuildPlanTaskTargetKind, BuildPlanTaskProductKind, FrontendConfigSurface, DomainPlanTenancyModel, MetaWorkflow_FunctionalTopic, PlacementDisposition, PlacementPlanSchema, PlacementSurface, RoadmapSnapshotSchema, selectReadyBuildPlanTasks, validateBuildPlanTaskGraph, } from '@wildo-ai/saas-specifications/application-creation';
38
- import { relatedWorkspaceResources } from '../../core/introspection/workspace-element-index.companion.js';
38
+ import { TARGET_NEIGHBOURHOOD_NOTE, neighbourhoodForCodingBrief, relatedWorkspaceResources } from '../../core/introspection/workspace-element-index.companion.js';
39
39
  import { BRIEF_INCOMPLETE_SOURCE_REF, BRIEF_PROVENANCE_UNAVAILABLE_SOURCE_REF, ThirdPartyBriefContent } from '../models/build-brief-content-trust.models.js';
40
40
  import { companionScreeningVerdicts, DERIVED_TEXT_UNSCREENED_NOTICE, DERIVED_TEXT_UNSCREENED_SOURCE_REF, screenRunOutputSection, screenThirdPartyBriefElements, unscreenedClassifierReason, WITHHELD_RUN_OUTPUT_NOTICE, } from './build-brief-third-party-screening.companion.js';
41
41
  import { loadEffectiveSystemOfRecordFacets, systemOfRecordInstancePartitionSupportOf } from './system-of-record-facet-library.companion.utils.js';
@@ -69,13 +69,13 @@ import { APPLICATION_BUILD_GENERATION_STEP_ACTOR_REF, APPLICATION_BUILD_SYSTEM_R
69
69
  import { APPLICATION_BUILD_DECISIONS_DOOR_ACTOR_REF, APPLICATION_BUILD_DECISIONS_SYSTEM_REF } from '../models/application-build-decisions.actors-system.definitions.js';
70
70
  import { readRecordedPlaybookSpend } from '../models/playbook-run-record.models.js';
71
71
  import { ApplicationBuildGenerationStep, ApplicationBuildGenerationStepCompanionService, ApplicationBuildGenerationStepLandedKind, readDesignSystemConfigImportsBrandDesign, signSchemaPlanInputs, generationStepCheckReadsSpecifications, generationStepReadsSpecifications, GenerationStepFailureOwner, readGenerationStepFailureOwner, } from './application-build-generation-step.companion.service.js';
72
- import { INSTALLED_SKILL_INDEX_RELATIVE_PATH, readApplicationCapabilityFacts, sliceSkillIndexForTask } from './build-task-brief-application-facts.companion.js';
72
+ import { INSTALLED_SKILL_INDEX_RELATIVE_PATH, SKILL_INDEX_BRIEF_SOURCE_REF, readApplicationCapabilityFacts, sliceSkillIndexForTask } from './build-task-brief-application-facts.companion.js';
73
73
  import { resolveAssemblyRepairCodingPolicy, resolveBuildPlanTaskCodingPolicy, BuildPlanTaskLandedProbeKind, buildPlanTaskLandedProbePaths, declarationsAppearAt, findAgentWorkShortfalls, findConfigurationShortfalls, findSystemOfRecordDeclarationShortfalls, systemOfRecordPartitionUnanswerable, isConfigurationProvenProduct, unreadableResourceConfigurationFor, relativeImportedFiles, applicationConfigurationDeclarationsOf, flowsActorsIndexImportedFiles, labelFileDeclaresKeys, labelPacksDeclareKeyPrefix, launcherShellIdentities, placementSubjectShellIdentity, ProductDeclarationRelation, productDerivedSkillRefs, resourceSchemaFilePath, schemaSourceDeclaresPersonalData, targetDerivedSkillRefs, resolveBuildTaskLandedProbes, buildPlanTaskLandedProbeWritablePaths, resolveBuildTaskLandingAdvisories, buildTaskProducesBillingCatalogue, BACKEND_BILLING_SWITCH_FILE, resolveUndraftableDocumentRef, settingsDestinationShellIdentity, shellModuleContributionFile, shellSurfaceConfigFile, websiteLabelPackPath, websiteSectionLabelFragmentPath, } from './application-build-task-coding-policy.companion.service.js';
74
74
  import { describeStaleFrontendLibrary, findStaleFrontendLibraryOutputs, readFrontendLibraryProgram } from './frontend-config-library-currency.companion.js';
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
@@ -641,13 +711,22 @@ export function productWritePathsMeet(left, right) {
641
711
  return left.some((path) => right.some((other) => covers(path, other) || covers(other, path)));
642
712
  }
643
713
  /**
644
- * Dispatches one wave call may make per slot before it returns and lets the next call continue (the playbook loop takes a
645
- * turn between waves). A wave returns only once its live runs have drained, so each wave costs the tail of its slowest run:
646
- * raised from 4 to 8 with #3204, once nothing but the isolated re-checks and the single-flight repairs waited on a drain
647
- * any more (progress reads the working tree; commits are checkpoints). Not unbounded: a drain is also the quiet moment the
648
- * runtime supervisor restarts the companion in, and a restart held past its ceiling kills the live runs.
714
+ * Dispatches one wave call may make per slot before it returns: the outer bound, no longer the loop's only turn (#3884). A
715
+ * wave returns only once its live runs have drained, so each drain costs the tail of its slowest run: on reference run
716
+ * 43691253927 every drain at the former 8 per slot held about 20 minutes with 0 to 5 sessions running. The loop now asks for
717
+ * a yield when a playbook the wave holds back needs the turn (`YIELD_REQUESTED`, honoured from
718
+ * {@link WAVE_DISPATCHES_BEFORE_A_YIELD_PER_DEGREE}), and a held restart stops the filling on its own (`RESTART_PENDING`).
719
+ *
720
+ * Not higher (review M2), for two costs that grow with a wave: a run that failed its checks beside its siblings waits for
721
+ * the wave's END to be re-checked alone (`AWAITING_ISOLATED_RECHECK`), its dependents with it; and every dispatch entry of
722
+ * the wave's result carries the plan's ready and landed lists. Raised from 4 to 8 with #3204, and to 16 with #3884.
723
+ */
724
+ export const WAVE_DISPATCHES_PER_DEGREE = 16;
725
+ /**
726
+ * The dispatches per slot a wave starts before it honours a yield the loop asked for (#3884 review H2): the former cap, so a
727
+ * playbook the loop holds back but never chooses can shorten a wave to what it was before #3884, and no further.
649
728
  */
650
- export const WAVE_DISPATCHES_PER_DEGREE = 8;
729
+ export const WAVE_DISPATCHES_BEFORE_A_YIELD_PER_DEGREE = 8;
651
730
  /**
652
731
  * Every run of the wave that has ALSO settled by now, without waiting for one that has not (#3204).
653
732
  *
@@ -672,8 +751,18 @@ export var ApplicationBuildWaveStop;
672
751
  ApplicationBuildWaveStop["NOTHING_READY"] = "nothing-ready";
673
752
  /** The call reached its dispatch cap; the next call continues. */
674
753
  ApplicationBuildWaveStop["DISPATCH_CAP"] = "dispatch-cap";
675
- /** The next ready task is a generation step this call already ran, and its landing is still unmet. */
754
+ /**
755
+ * The selection offered a generation step this wave had already run. It should be unreachable: since #3885 the selection
756
+ * passes over such a step (`ran_this_wave`) and the slots keep filling. It is kept as a backstop, because the fill's
757
+ * termination rests on that pass-over; without it a step whose landing stays unmet would be selected again forever.
758
+ */
676
759
  ApplicationBuildWaveStop["GENERATION_STEP_REPEATED"] = "generation-step-repeated";
760
+ /**
761
+ * The playbook loop asked the wave to yield (#3884): a playbook it holds back writes what the wave's lane writes, so the
762
+ * wave starts nothing more and drains, and that playbook runs at the wave's end. The yield the dispatch cap used to force
763
+ * every 8 dispatches per slot, whether or not anything was waiting.
764
+ */
765
+ ApplicationBuildWaveStop["YIELD_REQUESTED"] = "yield-requested";
677
766
  /** An admission was refused; the refusal is on the dispatch entry. */
678
767
  ApplicationBuildWaveStop["DISPATCH_REFUSED"] = "dispatch-refused";
679
768
  /**
@@ -711,6 +800,20 @@ export var ApplicationBuildWaveStop;
711
800
  */
712
801
  ApplicationBuildWaveStop["VERIFICATION_TOOL_UNAVAILABLE"] = "verification-tool-unavailable";
713
802
  })(ApplicationBuildWaveStop || (ApplicationBuildWaveStop = {}));
803
+ /**
804
+ * The stops a slot still PREPARING must honour before it admits its run (#3883 review F4): the wave prepares several slots
805
+ * at once, so one of these can arrive while a sibling composes its brief. Not the usage limit (a coding slot reads that hold
806
+ * itself, and a generation step still runs under it, #2388 review F8d), not the cap (the launcher counts the slots being
807
+ * prepared), and not the backstop for a repeated step (it says nothing about the other slots' tasks).
808
+ */
809
+ const SLOT_ABANDONING_STOPS = new Set([
810
+ ApplicationBuildWaveStop.STOP_REQUESTED,
811
+ ApplicationBuildWaveStop.YIELD_REQUESTED,
812
+ ApplicationBuildWaveStop.RESTART_PENDING,
813
+ ApplicationBuildWaveStop.DISPATCH_REFUSED,
814
+ ApplicationBuildWaveStop.VERIFICATION_TOOL_UNAVAILABLE,
815
+ ApplicationBuildWaveStop.APPLICATION_DOES_NOT_BOOT,
816
+ ]);
714
817
  /**
715
818
  * The next-task doors' refusal while the application's backend does not start (#2405). A CONFLICT: the request is
716
819
  * valid, the application's state forbids it, and the message names the refusal and the repair.
@@ -785,7 +888,8 @@ export function describeBuildWaveHoldsForSelector(wave) {
785
888
  command: wave.verificationToolUnavailable.command,
786
889
  checkRef: wave.verificationToolUnavailable.checkRef,
787
890
  guidance: `${describeVerificationHostCause(wave.verificationToolUnavailable)} No coding turn is admitted until then. `
788
- + 'Stop selecting build waves: only a person repairing this lifts it, and nothing a later round does changes it.',
891
+ // Not "only a person lifts it": a compiled model catching up, or a re-ask once due, ends some holds on their own (run 43961156770).
892
+ + 'Stop selecting build waves: nothing a later round does changes it, and the hold ends as the sentence above says.',
789
893
  },
790
894
  } : {}),
791
895
  ...(wave.staleExpertCharters ? {
@@ -1313,12 +1417,21 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
1313
1417
  landingKeyRead;
1314
1418
  /** How many landing-key reads have started; see {@link readLandingSourceKey}. */
1315
1419
  landingKeyReadSequence = 0;
1316
- /** The slot a running wave is filling now, while it prepares the dispatch (#3206); see `application-build-dispatch-preparation`. */
1317
- currentBuildPreparation;
1420
+ /**
1421
+ * The slots being prepared right now (#3206), oldest first: a wave prepares several at once since #3883. Built on first use,
1422
+ * because some harnesses build this service through its prototype and skip field initializers.
1423
+ */
1424
+ openBuildPreparations;
1318
1425
  /** The last preparation that ended, with each step's duration. */
1319
1426
  lastBuildPreparation;
1320
1427
  /** When `wildo build stop` asked the running wave to stop (#3206); cleared when the wave ends. */
1321
1428
  buildWaveStopRequestedAt;
1429
+ /**
1430
+ * Why the playbook loop asked the running wave to YIELD (#3884), cleared when the wave ends: a playbook it holds back
1431
+ * because the wave's lane writes what it writes. Unlike a person's stop it holds nothing afterwards; the next wave fills
1432
+ * as usual once the held playbook has had its turn.
1433
+ */
1434
+ buildWaveYieldRequestedBecause;
1322
1435
  /**
1323
1436
  * The build HOLD a person's `wildo build stop` sets (#3206), kept after the wave it ended: while it is set no build
1324
1437
  * wave or task starts unless a person's door released it first ({@link releaseBuildStopHold}) — not the choreography
@@ -2236,7 +2349,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2236
2349
  return openedStep;
2237
2350
  }
2238
2351
  // Announced by the coding service itself when it opens the PENDING execution.
2239
- return this.dispatch.openSelectedApplicationCodingExecution(prepared.contract, session, origin, mode);
2352
+ return this.dispatch.openSelectedApplicationCodingExecution(prepared.contract, session, this.withCarriedFollowUpGaps(prepared, origin), mode);
2240
2353
  }
2241
2354
  /** The execution a generation step is: one task of the build system's programmatic actor. */
2242
2355
  buildGenerationStepExecutionRequest(prepared, session, origin) {
@@ -2270,6 +2383,8 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2270
2383
  mode = CodingRunConcurrency.SINGLE_FLIGHT,
2271
2384
  /** Already opened by {@link openPreparedBuildTask}; opened here otherwise. */
2272
2385
  opened) {
2386
+ // A follow-up's run records the gaps its objective carried (#3204), at the open and again at admission.
2387
+ origin = this.withCarriedFollowUpGaps(prepared, origin);
2273
2388
  if (prepared.kind === 'GENERATION_STEP') {
2274
2389
  this.logDebug('Running a companion generation step', {
2275
2390
  taskRef: prepared.plan.taskRef,
@@ -2406,7 +2521,8 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2406
2521
  * `interference` memory entry).
2407
2522
  *
2408
2523
  * 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
2524
+ * step at most once — a step whose landing stays unmet is passed over as `ran_this_wave` for the rest of the call,
2525
+ * and the slots keep filling with the ready coding tasks (#3885). The
2410
2526
  * interference re-runs are outside that cap, bounded per task by `MAXIMUM_INTERFERENCE_REARMS` and at most
2411
2527
  * one per completed run of this wave. The next call continues from wherever the build stands.
2412
2528
  *
@@ -2427,7 +2543,8 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2427
2543
  finally {
2428
2544
  this.liveWaveStartedAt = undefined;
2429
2545
  this.buildWaveStopRequestedAt = undefined;
2430
- this.currentBuildPreparation = undefined;
2546
+ this.buildWaveYieldRequestedBecause = undefined;
2547
+ this.openBuildPreparations?.clear();
2431
2548
  }
2432
2549
  }
2433
2550
  /**
@@ -2460,6 +2577,19 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2460
2577
  });
2461
2578
  return { stopping: true, heldSince: this.buildStopHeldSince, waveStartedAt: this.liveWaveStartedAt, requestedAt: this.buildWaveStopRequestedAt };
2462
2579
  }
2580
+ /**
2581
+ * Ask the build wave to yield (#3884): once it has dispatched {@link WAVE_DISPATCHES_BEFORE_A_YIELD_PER_DEGREE} per slot,
2582
+ * it starts nothing more, drains and returns, so a playbook the loop holds back because of it can run. Idempotent. A
2583
+ * request made before the wave starts applies to it; every request is cleared when a wave ends.
2584
+ */
2585
+ requestBuildWaveYield(because) {
2586
+ // Kept when no wave has started yet (review M1): the loop can ask between the lane's start and its wave's, and the
2587
+ // request then applies to that wave. Cleared when a wave ends, and asked again while the playbook is still held.
2588
+ if (this.buildWaveYieldRequestedBecause !== undefined)
2589
+ return;
2590
+ this.buildWaveYieldRequestedBecause = because;
2591
+ this.logger.info?.('The running build wave was asked to yield: it starts no new task and ends once its live runs settle', { because });
2592
+ }
2463
2593
  /** The generation steps held because their panel refused stale expert charters (#3204); empty when none is. */
2464
2594
  readStaleExpertChartersHold() {
2465
2595
  return [...this.staleExpertChartersHeld.values()];
@@ -2547,23 +2677,25 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2547
2677
  throw new ApplicationBuildStoppedByPersonError(this.buildStopHeldSince);
2548
2678
  }
2549
2679
  /**
2550
- * What the build lane is doing right now between slots (#3206): the running wave, the preparation of its current slot
2680
+ * What the build lane is doing right now between slots (#3206): the running wave, the preparation of its oldest slot
2551
2681
  * ("selected X, preparing dispatch since T (step)"), a requested stop, and the last preparation that ended with each
2552
2682
  * step's duration. Read by `GET /build/dispatches` and the creation feed.
2553
2683
  */
2554
2684
  readBuildDispatchPreparation() {
2555
- const preparing = this.currentBuildPreparation?.read();
2685
+ const open = [...(this.openBuildPreparations ?? [])];
2686
+ const preparing = open[0]?.read();
2556
2687
  return {
2557
2688
  waveStartedAt: this.liveWaveStartedAt ?? null,
2558
2689
  stopRequestedAt: this.buildWaveStopRequestedAt ?? null,
2559
2690
  heldByStopSince: this.buildStopHeldSince ?? null,
2560
2691
  preparing: preparing === undefined ? null : { ...preparing, summary: describeBuildPreparation(preparing) },
2692
+ preparingCount: open.length,
2561
2693
  lastPreparation: this.lastBuildPreparation ?? null,
2562
2694
  };
2563
2695
  }
2564
2696
  openBuildPreparation() {
2565
2697
  const tracker = new ApplicationBuildPreparationTracker(ApplicationBuildPreparationPhase.CHECKING_THE_BACKEND_STARTS);
2566
- this.currentBuildPreparation = tracker;
2698
+ (this.openBuildPreparations ??= new Set()).add(tracker);
2567
2699
  return tracker;
2568
2700
  }
2569
2701
  /**
@@ -2573,8 +2705,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2573
2705
  */
2574
2706
  async closeBuildPreparation(tracker, session) {
2575
2707
  const ended = tracker.end();
2576
- if (this.currentBuildPreparation === tracker)
2577
- this.currentBuildPreparation = undefined;
2708
+ this.openBuildPreparations?.delete(tracker);
2578
2709
  this.lastBuildPreparation = ended;
2579
2710
  const durations = Object.fromEntries(ended.phases.map((entry) => [entry.phase, entry.durationMs]));
2580
2711
  this.logDebug('Build dispatch preparation ended', { selectedTaskRef: ended.selectedTaskRef ?? null, durationMs: ended.durationMs, phases: durations });
@@ -2603,6 +2734,11 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2603
2734
  throw new ApplicationBuildWaveInFlightError(this.liveWaveStartedAt);
2604
2735
  }
2605
2736
  async runBuildWave(session) {
2737
+ // Every isolated re-check, a sharing episode's end included, asks the application's current start first (#3880 review R2).
2738
+ this.dispatch.registerIsolatedRecheckHold?.(async () => ((await this.readCurrentBootFailures()).length > 0 ? 'the application does not start' : undefined));
2739
+ return this.runBuildWaveFilling(session);
2740
+ }
2741
+ async runBuildWaveFilling(session) {
2606
2742
  const degree = readBuildParallelism(this.companionContext.saasRoot);
2607
2743
  const mode = degree > 1 ? CodingRunConcurrency.CONCURRENT : CodingRunConcurrency.SINGLE_FLIGHT;
2608
2744
  const maximumDispatches = degree * WAVE_DISPATCHES_PER_DEGREE;
@@ -2621,113 +2757,328 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2621
2757
  const startedAt = new Date().toISOString();
2622
2758
  let usageLimit;
2623
2759
  let bootFailures;
2760
+ /*
2761
+ * A start the application refuses while runs are live (#3880): how many runs had settled when it was first seen, and
2762
+ * the repair this wave already started beside them. Waiting for every live run to drain held the repair 24 minutes on
2763
+ * reference run 43691253927; the repair starts once one sibling has settled and the start is still refused.
2764
+ */
2765
+ let bootFailureSeenAtSettlement;
2766
+ let startupRepairInWave;
2767
+ // Set while a repair is being started (#3883 review F5): the launcher and the drain both ask, so neither starts a second.
2768
+ let startupRepairStarting = false;
2769
+ /*
2770
+ * Start the repair of a refused start beside the live runs (#3880): once one sibling has settled since the refusal was
2771
+ * first seen and it is still refused, that sibling's completion did not repair it (the #2405 review F2 wait, kept on
2772
+ * purpose). Asked from the fill and, once the fill has stopped (the cap, a refused admission), after every settlement,
2773
+ * 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
2774
+ * own runs (review F9): it is reported among the repairs, and its own acceptance commits it.
2775
+ */
2776
+ const repairStartBesideLiveRuns = async (notBooting) => {
2777
+ bootFailureSeenAtSettlement ??= settledTaskIds.length;
2778
+ if (startupRepairInWave !== undefined || startupRepairStarting || settledTaskIds.length <= bootFailureSeenAtSettlement)
2779
+ return;
2780
+ startupRepairStarting = true;
2781
+ try {
2782
+ await startTheRepair(notBooting);
2783
+ }
2784
+ finally {
2785
+ startupRepairStarting = false;
2786
+ }
2787
+ };
2788
+ const startTheRepair = async (notBooting) => {
2789
+ const repair = await this.prepareStartupRepair(notBooting);
2790
+ if (repair === undefined)
2791
+ return;
2792
+ try {
2793
+ const result = await this.executePreparedBuildTask(repair.prepared, session, { preparationStartedAt: new Date().toISOString() }, mode);
2794
+ const taskId = result.admission.taskId;
2795
+ startupRepairInWave = { checkRef: repair.checkRef, taskRef: repair.prepared.plan.taskRef, taskId };
2796
+ inFlight.set(taskId, this.awaitCodingRunOutcome(taskId, session).then((outcome) => ({ taskId, outcome })));
2797
+ }
2798
+ catch (error) {
2799
+ this.logger.warn('The repair of the application\'s refused start could not be run beside the live runs', { error: describeCaughtError(error) });
2800
+ }
2801
+ };
2802
+ /*
2803
+ * One landing reading for the wave's slots (#3204), held across fills (#3883): its guards drop it once a run that was in
2804
+ * flight has left or a settlement moved the landing, so a refill after a settlement reads again and a refill after an
2805
+ * admission alone does not.
2806
+ */
2807
+ const fillLanding = {};
2808
+ /*
2809
+ * The slots being PREPARED right now (#3883), by slot number. Until #3883 the fill prepared one slot at a time, awaiting
2810
+ * its landing reading and its brief before starting the next: on reference run 43691253927, 0 of 347 preparations
2811
+ * overlapped, a vacated slot waited a median 105 s, and 4.0 of 10 slots ran on average with about 73 tasks ready.
2812
+ * Now the LAUNCHER (`fill`) starts the next slot as soon as the previous one has SELECTED its task, so the slots select
2813
+ * one after another from the reading the first took, and each composes its brief and is admitted on its own.
2814
+ */
2815
+ const preparing = new Map();
2816
+ // Every slot launched, settled or not: a slot leaves `preparing` before its tracker is closed, and the wave waits for that.
2817
+ const slotsLaunchedInWave = [];
2818
+ let slotsLaunched = 0;
2819
+ /*
2820
+ * What the wave's slots selected, with the files they write (#3883), held until the run or step SETTLES (review H1): a
2821
+ * slot reads its in-flight set once, when it starts, and selects only after the landing and its checks, so a sibling's
2822
+ * task admitted in between is in no list that slot reads. Released here when the task settles, and by the slot itself
2823
+ * when it hands nothing on.
2824
+ */
2825
+ const reservations = new Map();
2826
+ // The task each admitted run builds, so its reservation is released when the run settles.
2827
+ const reservedTaskOfRun = new Map();
2828
+ /*
2829
+ * How many runs and steps have settled in this wave (#3883 review M1): a slot that finds nothing ready on a reading taken
2830
+ * before the latest settlement says nothing about what that settlement unlocked, so it does not hold the launcher back.
2831
+ */
2832
+ let settlements = 0;
2833
+ /*
2834
+ * A slot found nothing ready (#3883): no more slots are launched until something settles, since another would find the
2835
+ * same. Cleared by a settled run or step, and by a slot that gives back a task it reserved.
2836
+ */
2837
+ let nothingReady = false;
2838
+ // The first failure of a slot that is not "nothing ready": no more slots start, and the wave throws once what is live drains.
2839
+ let preparationFailure;
2840
+ const occupied = () => inFlight.size + generationInFlight.size + preparing.size;
2841
+ /*
2842
+ * A yield is honoured only once the wave has started a floor of dispatches (#3884 review H2): the loop asks for every
2843
+ * playbook the wave holds back, chosen or not, so without a floor a playbook the selector never picks would make every
2844
+ * wave yield at once. The floor is the former cap, so the worst case is the wave as it was.
2845
+ */
2846
+ const yieldFloor = degree * WAVE_DISPATCHES_BEFORE_A_YIELD_PER_DEGREE;
2847
+ const yieldIsDue = () => this.buildWaveYieldRequestedBecause !== undefined
2848
+ && dispatched.length + generationInFlight.size >= yieldFloor;
2849
+ /*
2850
+ * Wakes the drain when what it races GROWS (#3883): a run admitted, a step started, a slot launched. The drain races the
2851
+ * set it saw when it last looked, and the launcher can wait a whole landing derivation for a slot's selection, so a run
2852
+ * admitted meanwhile would settle unseen: its reservation held, its settlement uncounted, its slot not refilled.
2853
+ */
2854
+ let wakeDrain = () => undefined;
2855
+ let drainWake = new Promise((resolve) => { wakeDrain = resolve; });
2856
+ const raceSetGrew = () => {
2857
+ const wake = wakeDrain;
2858
+ drainWake = new Promise((resolve) => { wakeDrain = resolve; });
2859
+ wake();
2860
+ };
2861
+ /*
2862
+ * Admissions take TURNS (#3883): a slot reads the stops and admits only once the slot before it has finished admitting.
2863
+ * Composing a brief, the slow part, stays side by side; admitting is short. So a refused admission, a usage limit met
2864
+ * or a stop is seen by every later slot before it starts anything, as when the wave prepared one slot at a time.
2865
+ */
2866
+ let admissionTurn = Promise.resolve();
2867
+ const takeAdmissionTurn = async () => {
2868
+ let release;
2869
+ const previous = admissionTurn;
2870
+ admissionTurn = new Promise((resolve) => { release = resolve; });
2871
+ await previous;
2872
+ return release;
2873
+ };
2874
+ /*
2875
+ * A task admitted after the held landing reading was taken joins that reading's in-flight guard (#3883 review M3): when
2876
+ * its run leaves the in-flight list, a few seconds before its settlement moves the landing, the reading is dropped
2877
+ * rather than offering the task the run just landed. Held for the whole wave, the reading would otherwise reach
2878
+ * every admission between two settlements, past the safety argument its guards were written for.
2879
+ */
2880
+ const guardHeldReadingAgainst = (taskRef) => {
2881
+ fillLanding.current?.inFlightTaskRefs.add(taskRef);
2882
+ fillLanding.pending?.inFlightTaskRefs.add(taskRef);
2883
+ };
2884
+ /** Why a slot about to be admitted must start nothing (#3883 review F4): a stop that arrived while it prepared. */
2885
+ const stopBeforeAdmission = () => {
2886
+ // A sibling failed (review M2): nothing more starts, and the wave throws once what is live drains.
2887
+ if (preparationFailure !== undefined)
2888
+ return 'failed';
2889
+ if (this.buildWaveStopRequestedAt !== undefined)
2890
+ return ApplicationBuildWaveStop.STOP_REQUESTED;
2891
+ if (yieldIsDue())
2892
+ return ApplicationBuildWaveStop.YIELD_REQUESTED;
2893
+ const saasRoot = this.companionContext?.saasRoot;
2894
+ if (saasRoot !== undefined && companionRestartDrain.isRestartHeld(saasRoot))
2895
+ return ApplicationBuildWaveStop.RESTART_PENDING;
2896
+ if (stoppedFillingBecause !== undefined && SLOT_ABANDONING_STOPS.has(stoppedFillingBecause))
2897
+ return stoppedFillingBecause;
2898
+ return undefined;
2899
+ };
2900
+ /*
2901
+ * One slot (#3883): select, compose, admit. Runs beside the other slots; the launcher waits only for its SELECTION.
2902
+ * Every stop is read again just before admission, so a stop, a held restart, a refused admission or a refused start
2903
+ * that arrived while it prepared starts nothing. Its reservation is given back however it ends.
2904
+ */
2905
+ const runSlot = async (slot, selected) => {
2906
+ const settlementsAtLaunch = settlements;
2907
+ const preparation = this.openBuildPreparation();
2908
+ let reservedTaskRef;
2909
+ // Whether the slot handed its task on to a live run or step; one that did not gives it back to the other slots.
2910
+ let handedOn = false;
2911
+ // The end of this slot's admission turn, once it has one.
2912
+ let endAdmissionTurn;
2913
+ try {
2914
+ let prepared;
2915
+ try {
2916
+ prepared = await this.prepareNextBuildTask(undefined, preparation, {
2917
+ fillLanding,
2918
+ generationStepsInFlight: new Set(generationInFlight.keys()),
2919
+ generationStepsRunInWave: generationStepsRun,
2920
+ reservations,
2921
+ onSelected: (taskRef) => { reservedTaskRef = taskRef; selected(); },
2922
+ });
2923
+ }
2924
+ catch (error) {
2925
+ // Nothing ready NOW. While runs are live that is a pause, not an end: a settle may unlock more.
2926
+ if (error instanceof ApplicationBuildPlanExhaustedError || error instanceof ApplicationBuildTaskCompletedButUnlandedError) {
2927
+ // Only when nothing settled since this slot started (review M1): a settlement since may have unlocked a task.
2928
+ if (settlements === settlementsAtLaunch)
2929
+ nothingReady = true;
2930
+ return;
2931
+ }
2932
+ preparationFailure ??= { error };
2933
+ return;
2934
+ }
2935
+ preparation.select(prepared.plan.taskRef);
2936
+ preparation.enter(ApplicationBuildPreparationPhase.ADMITTING_THE_RUN);
2937
+ endAdmissionTurn = await takeAdmissionTurn();
2938
+ const abandonedFor = stopBeforeAdmission();
2939
+ if (abandonedFor !== undefined) {
2940
+ if (abandonedFor !== 'failed')
2941
+ stoppedFillingBecause ??= abandonedFor;
2942
+ return;
2943
+ }
2944
+ // On the run's row, so its dispatch wait — this slot's whole preparation — survives a restart (#3206).
2945
+ const preparedOrigin = { preparationStartedAt: preparation.read().startedAt };
2946
+ if (prepared.kind === 'GENERATION_STEP') {
2947
+ // Never twice in one wave (#3885): the selection passes over a step in this set, so the slots keep filling. The
2948
+ // check below is the backstop the fill's termination rests on, if a selection ever offers one again.
2949
+ if (generationStepsRun.has(prepared.plan.taskRef)) {
2950
+ stoppedFillingBecause ??= ApplicationBuildWaveStop.GENERATION_STEP_REPEATED;
2951
+ return;
2952
+ }
2953
+ generationStepsRun.add(prepared.plan.taskRef);
2954
+ // The step writes the tree while the next slots are prepared: each reads the landing again.
2955
+ fillLanding.current = undefined;
2956
+ fillLanding.pending = undefined;
2957
+ const step = prepared;
2958
+ generationInFlight.set(step.plan.taskRef, this.executePreparedBuildTask(step, session, preparedOrigin)
2959
+ .then((result) => ({ prepared: step, result }), (error) => ({ prepared: step, error })));
2960
+ raceSetGrew();
2961
+ handedOn = true;
2962
+ guardHeldReadingAgainst(step.plan.taskRef);
2963
+ return;
2964
+ }
2965
+ /*
2966
+ * Before every CODING admission, including the refill after a run settles (#2388): a sibling that just met the
2967
+ * account's usage limit makes every coding turn started before its reset certain to fail the same way. On
2968
+ * app-creation-test-005 the refill went on regardless, and four tasks spent three or four attempts each in
2969
+ * five minutes. The live runs still drain; nothing new starts. Asked after the selection, which only reads,
2970
+ * so a generation step — run on the configured model providers, not on the coding agent's account — still
2971
+ * runs (#2388 review F8d).
2972
+ */
2973
+ const held = this.dispatch.readCodingAgentUsageLimitHold();
2974
+ if (held) {
2975
+ stoppedFillingBecause ??= ApplicationBuildWaveStop.CODING_AGENT_USAGE_LIMITED;
2976
+ usageLimit ??= held;
2977
+ return;
2978
+ }
2979
+ try {
2980
+ const result = await this.executePreparedBuildTask(prepared, session, preparedOrigin, mode);
2981
+ dispatched.push(result);
2982
+ const taskId = result.admission.taskId;
2983
+ inFlight.set(taskId, this.awaitCodingRunOutcome(taskId, session).then((outcome) => ({ taskId, outcome })));
2984
+ raceSetGrew();
2985
+ handedOn = true;
2986
+ reservedTaskOfRun.set(taskId, prepared.plan.taskRef);
2987
+ guardHeldReadingAgainst(prepared.plan.taskRef);
2988
+ }
2989
+ catch (error) {
2990
+ // A refused admission is recorded and ends the filling; the live runs still drain.
2991
+ dispatched.push({ plan: prepared.plan, error: describeCaughtError(error) });
2992
+ // Refused because a check's command is absent (#3423): its own stop, so the selector stops asking for waves.
2993
+ stoppedFillingBecause ??= this.dispatch.readVerificationToolUnavailableHold()
2994
+ ? ApplicationBuildWaveStop.VERIFICATION_TOOL_UNAVAILABLE
2995
+ : ApplicationBuildWaveStop.DISPATCH_REFUSED;
2996
+ }
2997
+ }
2998
+ finally {
2999
+ /*
3000
+ * Given back when the slot handed nothing on (#3883 review F3), so its task is selectable again. A task handed on to a
3001
+ * run or a step stays reserved until it settles, released by the drain (review H1).
3002
+ */
3003
+ endAdmissionTurn?.();
3004
+ // A task handed on stays reserved until it settles (review H1); one the slot did not hand on is selectable again.
3005
+ if (reservedTaskRef !== undefined && !handedOn) {
3006
+ reservations.delete(reservedTaskRef);
3007
+ nothingReady = false;
3008
+ }
3009
+ // No longer a slot being prepared, BEFORE the launcher resumes: a run it handed on now counts as live instead, and
3010
+ // counted in both it would read the wave as full and stop launching.
3011
+ preparing.delete(slot);
3012
+ selected();
3013
+ await this.closeBuildPreparation(preparation, session);
3014
+ }
3015
+ };
3016
+ /*
3017
+ * The LAUNCHER (#3883): the stops, the start and the cap are asked here, one slot at a time, so a refused start is read
3018
+ * once per slot and repaired once (review F5); then a slot is launched, and the next waits only for its SELECTION.
3019
+ */
2624
3020
  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) {
3021
+ while (stoppedFillingBecause === undefined && preparationFailure === undefined && !nothingReady && occupied() < degree) {
2628
3022
  /*
2629
3023
  * `wildo build stop` (#3206): the wave ends at a task boundary — it starts nothing more, and drains what is live,
2630
3024
  * reconciles and repairs as at any other end. Asked before every slot, so a stop is honoured within one slot.
2631
3025
  */
2632
3026
  if (this.buildWaveStopRequestedAt !== undefined) {
2633
- stoppedFillingBecause = ApplicationBuildWaveStop.STOP_REQUESTED;
3027
+ stoppedFillingBecause ??= ApplicationBuildWaveStop.STOP_REQUESTED;
3028
+ return;
3029
+ }
3030
+ // The loop needs the turn (#3884): a playbook it holds back writes what this wave's lane writes. Not before the floor.
3031
+ if (yieldIsDue()) {
3032
+ stoppedFillingBecause ??= ApplicationBuildWaveStop.YIELD_REQUESTED;
2634
3033
  return;
2635
3034
  }
2636
3035
  // A restart the dev supervisor holds (#3204): start nothing more, so the live runs settle before it.
2637
3036
  const saasRoot = this.companionContext?.saasRoot;
2638
3037
  if (saasRoot !== undefined && companionRestartDrain.isRestartHeld(saasRoot)) {
2639
- stoppedFillingBecause = ApplicationBuildWaveStop.RESTART_PENDING;
3038
+ stoppedFillingBecause ??= ApplicationBuildWaveStop.RESTART_PENDING;
2640
3039
  return;
2641
3040
  }
2642
- if (dispatched.length + generationInFlight.size >= maximumDispatches) {
2643
- stoppedFillingBecause = ApplicationBuildWaveStop.DISPATCH_CAP;
2644
- return;
2645
- }
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
- }
3041
+ /*
3042
+ * And before every slot, whether the application still STARTS (#2405). On app-creation-test-005 one task broke
3043
+ * the backend's start and about 45 more landed on top over four hours, each verified by typechecks that could
3044
+ * not see it. The live runs drain; nothing new starts into an application that cannot run.
3045
+ */
3046
+ const notBooting = await this.readCurrentBootFailures();
3047
+ if (notBooting.length > 0) {
3048
+ bootFailures = notBooting;
2698
3049
  /*
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).
3050
+ * While runs are live this PAUSES the filling rather than ending it (#2405 review F2): a sibling half-way
3051
+ * through writing a configuration can make one restart fail, and its own completion may repair it. The next
3052
+ * settle asks again. With nothing live there is nothing left to wait for, and the wave stops.
3053
+ *
3054
+ * But once a sibling HAS settled and the start is still refused, its completion did not repair it, and the
3055
+ * repair starts in a slot now rather than after the last live run drains (#3880).
2705
3056
  */
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;
3057
+ if (inFlight.size > 0) {
3058
+ await repairStartBesideLiveRuns(notBooting);
2725
3059
  return;
2726
3060
  }
3061
+ stoppedFillingBecause ??= ApplicationBuildWaveStop.APPLICATION_DOES_NOT_BOOT;
3062
+ return;
2727
3063
  }
2728
- finally {
2729
- await this.closeBuildPreparation(preparation, session);
3064
+ bootFailures = undefined;
3065
+ bootFailureSeenAtSettlement = undefined;
3066
+ // Asked again: a slot may have stopped the filling while the start was read.
3067
+ if (stoppedFillingBecause !== undefined || preparationFailure !== undefined || nothingReady || occupied() >= degree)
3068
+ return;
3069
+ // After the start is known good (#3880): a capped wave that also cannot start stops for the start, which is repaired.
3070
+ if (dispatched.length + generationInFlight.size + preparing.size >= maximumDispatches) {
3071
+ stoppedFillingBecause ??= ApplicationBuildWaveStop.DISPATCH_CAP;
3072
+ return;
2730
3073
  }
3074
+ let markSelected;
3075
+ const selection = new Promise((resolve) => { markSelected = resolve; });
3076
+ const slot = slotsLaunched += 1;
3077
+ const running = runSlot(slot, () => markSelected());
3078
+ preparing.set(slot, running);
3079
+ slotsLaunchedInWave.push(running);
3080
+ raceSetGrew();
3081
+ await selection;
2731
3082
  }
2732
3083
  };
2733
3084
  const outcomes = [];
@@ -2740,6 +3091,8 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2740
3091
  */
2741
3092
  const concludeGenerationStep = (settled) => {
2742
3093
  generationInFlight.delete(settled.prepared.plan.taskRef);
3094
+ reservations.delete(settled.prepared.plan.taskRef);
3095
+ settlements += 1;
2743
3096
  if (settled.error === undefined) {
2744
3097
  dispatched.push(settled.result);
2745
3098
  return;
@@ -2750,17 +3103,44 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2750
3103
  this.holdForStaleExpertCharters(settled.prepared.plan.taskRef, staleSeats);
2751
3104
  return;
2752
3105
  }
2753
- if (!(settled.error instanceof SpecificationWriteRefusedError))
2754
- throw settled.error;
3106
+ // Anything else is the wave's own failure (review M2): nothing more starts, and the wave throws once what is live drains.
3107
+ if (!(settled.error instanceof SpecificationWriteRefusedError)) {
3108
+ preparationFailure ??= { error: settled.error };
3109
+ return;
3110
+ }
2755
3111
  dispatched.push({ plan: settled.prepared.plan, error: describeCaughtError(settled.error) });
2756
3112
  stoppedFillingBecause ??= ApplicationBuildWaveStop.DISPATCH_REFUSED;
2757
3113
  };
2758
- await fill();
2759
- while (inFlight.size > 0 || generationInFlight.size > 0) {
3114
+ /*
3115
+ * The launcher runs beside the drain (#3883), so a settlement is taken while slots are still being prepared. Relaunched
3116
+ * after a run, a step or a slot settles, never after the launcher's own end: it ends when nothing can be launched until
3117
+ * something settles (full, nothing ready, a stop, a refused start paused beside live runs), so relaunching it there
3118
+ * would only poll the start in a loop.
3119
+ */
3120
+ let launcher;
3121
+ const launch = () => {
3122
+ if (launcher !== undefined || stoppedFillingBecause !== undefined || preparationFailure !== undefined || nothingReady || occupied() >= degree)
3123
+ return;
3124
+ launcher = fill().finally(() => { launcher = undefined; });
3125
+ };
3126
+ launch();
3127
+ while (inFlight.size > 0 || generationInFlight.size > 0 || preparing.size > 0 || launcher !== undefined) {
2760
3128
  const first = await Promise.race([
2761
3129
  ...[...inFlight.values()].map((run) => run.then((settled) => ({ kind: 'coding', run: settled }))),
2762
3130
  ...[...generationInFlight.values()].map((step) => step.then((settled) => ({ kind: 'generation', step: settled }))),
3131
+ ...[...preparing.values()].map((slot) => slot.then(() => ({ kind: 'slot' }))),
3132
+ ...(launcher !== undefined ? [launcher.then(() => ({ kind: 'launcher' }))] : []),
3133
+ drainWake.then(() => ({ kind: 'grew' })),
2763
3134
  ]);
3135
+ // The set grew, or the launcher ended: look again at what is live, without relaunching (see `launch`).
3136
+ if (first.kind === 'launcher' || first.kind === 'grew')
3137
+ continue;
3138
+ if (first.kind === 'slot') {
3139
+ launch();
3140
+ continue;
3141
+ }
3142
+ // A settled run or step may have landed what a ready task waits on, so a slot may find work again.
3143
+ nothingReady = false;
2764
3144
  if (first.kind === 'generation') {
2765
3145
  concludeGenerationStep(first.step);
2766
3146
  }
@@ -2768,17 +3148,47 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2768
3148
  inFlight.delete(first.run.taskId);
2769
3149
  for (const run of [first.run, ...await takeAlreadySettled(inFlight)]) {
2770
3150
  inFlight.delete(run.taskId);
3151
+ // Its task is in no in-flight list now (#3883 review H1): the reservation that stood for it is released.
3152
+ const reservedTask = reservedTaskOfRun.get(run.taskId);
3153
+ if (reservedTask !== undefined)
3154
+ reservations.delete(reservedTask);
3155
+ reservedTaskOfRun.delete(run.taskId);
3156
+ settlements += 1;
3157
+ // The startup repair is reported as a repair, never as one of the wave's runs (#3880 review F9).
3158
+ if (run.taskId === startupRepairInWave?.taskId)
3159
+ continue;
2771
3160
  outcomes.push(run.outcome);
2772
3161
  settledTaskIds.push(run.taskId);
2773
3162
  }
2774
3163
  }
2775
3164
  for (const step of await takeAlreadySettled(generationInFlight))
2776
3165
  concludeGenerationStep(step);
2777
- await fill();
3166
+ // A fill that has stopped (the cap, a refused admission) no longer reads the start: read it here (#3880 review F2).
3167
+ if (stoppedFillingBecause !== undefined && stoppedFillingBecause !== ApplicationBuildWaveStop.STOP_REQUESTED
3168
+ && stoppedFillingBecause !== ApplicationBuildWaveStop.RESTART_PENDING && inFlight.size > 0) {
3169
+ const notBooting = await this.readCurrentBootFailures();
3170
+ if (notBooting.length > 0) {
3171
+ bootFailures = notBooting;
3172
+ await repairStartBesideLiveRuns(notBooting);
3173
+ }
3174
+ }
3175
+ launch();
2778
3176
  }
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)
3177
+ // Every slot has closed its preparation, so the wave's record of them is complete when it returns.
3178
+ await Promise.all(slotsLaunchedInWave);
3179
+ // A slot failed for a reason other than "nothing ready" (#3883 review F6): what was live has drained, and the wave throws.
3180
+ if (preparationFailure !== undefined)
3181
+ throw preparationFailure.error;
3182
+ /*
3183
+ * The start, asked again now that nothing writes (#3880). A start still refused outranks how the filling stopped (a
3184
+ * cap, nothing ready, a refused admission), so it is repaired below; only a person's stop or a held restart keeps its
3185
+ * own reason. Until this, a capped wave over a refused start ended "at the cap" and repaired nothing.
3186
+ */
3187
+ const bootFailuresAtEnd = await this.readCurrentBootFailures();
3188
+ bootFailures = bootFailuresAtEnd.length > 0 ? bootFailuresAtEnd : undefined;
3189
+ if (bootFailures !== undefined && stoppedFillingBecause !== ApplicationBuildWaveStop.STOP_REQUESTED && stoppedFillingBecause !== ApplicationBuildWaveStop.RESTART_PENDING) {
2781
3190
  stoppedFillingBecause = ApplicationBuildWaveStop.APPLICATION_DOES_NOT_BOOT;
3191
+ }
2782
3192
  stoppedFillingBecause ??= ApplicationBuildWaveStop.NOTHING_READY;
2783
3193
  /*
2784
3194
  * The wave's END, now that nothing is writing (#3204): the runs that failed verification beside their siblings are
@@ -2786,8 +3196,10 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2786
3196
  * (failed runs included: their files are in the tree). In both modes (review of 4a1b1f1bf F7): a single-flight run's
2787
3197
  * own settlement checkpoint may have been folded into a timer, and the wave's end is where it is guaranteed.
2788
3198
  */
3199
+ // A run re-checked alone against an application that cannot start fails for the start, not for itself (#3880): its
3200
+ // re-checks wait for the startup repair below, and run after it.
2789
3201
  const reconciliation = settledTaskIds.length > 0
2790
- ? await this.dispatch.reconcileWaveAcceptance({ startedAt, taskIds: settledTaskIds })
3202
+ ? await this.dispatch.reconcileWaveAcceptance({ startedAt, taskIds: settledTaskIds, ...(bootFailures !== undefined ? { deferRechecksBecause: 'the application does not start' } : {}) })
2791
3203
  : [];
2792
3204
  /*
2793
3205
  * And the repair reconciliation cannot make (#2210): a run that COMPLETED but whose product a sibling
@@ -2795,13 +3207,19 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2795
3207
  * bring it back; only running the task again can. Asked after the reconciliation, so landing reads the
2796
3208
  * tree every run's work has reached.
2797
3209
  */
2798
- const interferenceRepairs = mode === CodingRunConcurrency.CONCURRENT
3210
+ /*
3211
+ * Interference repairs are coding runs, so none starts into an application that cannot start (#3880 review F4). With a
3212
+ * good start they run here, before the plan-exhausted assembly reads the tree; with a refused one, once below, after
3213
+ * the startup repair has had its chance.
3214
+ */
3215
+ const interferenceRepairs = mode === CodingRunConcurrency.CONCURRENT && bootFailures === undefined
2799
3216
  ? await this.repairInterferedTasks(outcomes, session)
2800
3217
  : [];
2801
3218
  /*
2802
3219
  * #2222: a wave that ran out of ready work may have FINISHED the plan. Asked after the reconciliation and the
2803
3220
  * 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).
3221
+ * "done" (a cap, a refusal or a repeated step leaves work behind; so may a step this wave ran, which the
3222
+ * plan-exhausted read still selects, so it gives no verdict).
2805
3223
  */
2806
3224
  const { assembly: assessedAssembly, repairs: assemblyRepairsOfPlan } = stoppedFillingBecause === ApplicationBuildWaveStop.NOTHING_READY
2807
3225
  ? await this.assemblyIfPlanExhausted(session)
@@ -2813,8 +3231,26 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2813
3231
  * backend again. A dev-stack cause (a held port, an unreachable service) is never repaired here: no code fixes it.
2814
3232
  */
2815
3233
  const startupRepairs = stoppedFillingBecause === ApplicationBuildWaveStop.APPLICATION_DOES_NOT_BOOT && bootFailures !== undefined
2816
- ? await this.repairRefusedStartup(bootFailures, session)
3234
+ ? [...(startupRepairInWave === undefined ? await this.repairRefusedStartup(bootFailures, session) : [])]
2817
3235
  : [];
3236
+ // The repair started beside the live runs (#3880), reported like one run at the end.
3237
+ if (startupRepairInWave !== undefined) {
3238
+ startupRepairs.unshift({ checkRef: startupRepairInWave.checkRef, taskRef: startupRepairInWave.taskRef, outcome: await this.awaitCodingRunOutcome(startupRepairInWave.taskId, session) });
3239
+ }
3240
+ if (bootFailures !== undefined) {
3241
+ const startBack = (await this.readCurrentBootFailures()).length === 0;
3242
+ // The re-checks deferred above, now that the application starts again (#3880).
3243
+ if (startBack && settledTaskIds.length > 0)
3244
+ reconciliation.push(...await this.dispatch.reconcileWaveAcceptance({ startedAt, taskIds: settledTaskIds }));
3245
+ /*
3246
+ * The interference repairs deferred above, whatever the start now reads (#3880 review R3). This repair is the only
3247
+ * thing that re-arms a task whose product a sibling overwrote; skipped, the task reads `completed_unlanded` and waits
3248
+ * for a person. So a start still refused re-arms without re-running, and the next wave runs those tasks once the
3249
+ * start is repaired.
3250
+ */
3251
+ if (mode === CodingRunConcurrency.CONCURRENT)
3252
+ interferenceRepairs.push(...await this.repairInterferedTasks(outcomes, session, { startRefused: !startBack }));
3253
+ }
2818
3254
  const assemblyRepairs = [...startupRepairs, ...assemblyRepairsOfPlan];
2819
3255
  // Whichever way the verdict was reached: a repair's verdict is about the checks, and the plan is still not finished (#3258).
2820
3256
  const specificationFault = assessedAssembly === undefined ? undefined : (await this.resolveBuildExecutionProgress())?.specificationFault;
@@ -2869,25 +3305,34 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2869
3305
  * operation 'import_customers' not found` and two lifecycle verbs with no `requestDto`, each a build task's code, with
2870
3306
  * the remedy "wildo build run <taskRef>" addressed to a person nobody had told which task.
2871
3307
  */
2872
- async repairRefusedStartup(failures, session) {
3308
+ /**
3309
+ * The repair of a start the application's own code refused, prepared as an assembly repair of `check:backend-ready`, or
3310
+ * `undefined` when none is owed or allowed (no code fixes the failure, the round's repairs are spent, a usage-limit hold,
3311
+ * a person's stop). Shared by the repair at the wave's end and the one started beside live runs (#3880).
3312
+ */
3313
+ async prepareStartupRepair(failures) {
2873
3314
  const failure = describeRefusedStartupAsCheckFailure(failures);
2874
3315
  if (failure === undefined || this.dispatch.readCodingAgentUsageLimitHold() || this.buildStopHeldSince !== undefined)
2875
- return [];
2876
- const origin = { preparationStartedAt: new Date().toISOString() };
2877
- let prepared;
3316
+ return undefined;
2878
3317
  try {
2879
- ({ prepared } = await this.prepareAssemblyRepair({ checkRefs: [failure.checkRef], failed: [{ ...failure, detail: failure.detail ?? failure.output }] }, { landedTaskRefs: [] }));
3318
+ const { prepared } = await this.prepareAssemblyRepair({ checkRefs: [failure.checkRef], failed: [{ ...failure, detail: failure.detail ?? failure.output }] }, { landedTaskRefs: [] });
3319
+ return prepared === undefined ? undefined : { prepared, checkRef: failure.checkRef };
2880
3320
  }
2881
3321
  catch (error) {
2882
3322
  this.logger.warn('Could not prepare the repair of the application\'s refused start', { error: describeCaughtError(error) });
2883
- return [];
3323
+ return undefined;
2884
3324
  }
2885
- if (prepared === undefined)
3325
+ }
3326
+ async repairRefusedStartup(failures, session) {
3327
+ const repair = await this.prepareStartupRepair(failures);
3328
+ if (repair === undefined)
2886
3329
  return [];
3330
+ const { prepared } = repair;
3331
+ const origin = { preparationStartedAt: new Date().toISOString() };
2887
3332
  try {
2888
3333
  const dispatched = await this.executePreparedBuildTask(prepared, session, origin);
2889
3334
  const outcome = dispatched.admission ? await this.awaitCodingRunOutcome(dispatched.admission.taskId, session) : null;
2890
- return [{ checkRef: failure.checkRef, taskRef: prepared.plan.taskRef, outcome }];
3335
+ return [{ checkRef: repair.checkRef, taskRef: prepared.plan.taskRef, outcome }];
2891
3336
  }
2892
3337
  catch (error) {
2893
3338
  this.logger.warn('The repair of the application\'s refused start could not be run', { error: describeCaughtError(error) });
@@ -2982,7 +3427,9 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
2982
3427
  * repair, made where the evidence is. Bounded by {@link MAXIMUM_INTERFERENCE_REARMS} per task. Sequential,
2983
3428
  * because the re-runs are single-flight.
2984
3429
  */
2985
- async repairInterferedTasks(outcomes, session) {
3430
+ async repairInterferedTasks(outcomes, session,
3431
+ /** The application's start is refused: an interfered task is re-armed and recorded, and not re-run (#3880 review R3). */
3432
+ options = {}) {
2986
3433
  const completed = outcomes.filter((outcome) => outcome?.succeeded === true && outcome.taskRef !== null);
2987
3434
  if (completed.length === 0)
2988
3435
  return [];
@@ -3007,7 +3454,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3007
3454
  * rewritten the shared file since, and a reading taken before it would judge this run on stale text.
3008
3455
  */
3009
3456
  const landed = (await this.resolveLandedTaskRefs(graph.tasks)).landed;
3010
- const repair = await this.repairIfInterfered(run, graph, landed, this.createWorktreeReader(), session);
3457
+ const repair = await this.repairIfInterfered(run, graph, landed, this.createWorktreeReader(), session, options);
3011
3458
  if (repair)
3012
3459
  repairs.push(repair);
3013
3460
  }
@@ -3018,7 +3465,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3018
3465
  return repairs;
3019
3466
  }
3020
3467
  /** One run of {@link repairInterferedTasks}: `undefined` when it was not interfered with. */
3021
- async repairIfInterfered(run, graph, landed, worktree, session) {
3468
+ async repairIfInterfered(run, graph, landed, worktree, session, options = {}) {
3022
3469
  if (landed.has(run.taskRef))
3023
3470
  return undefined;
3024
3471
  const task = graph.tasks.find((candidate) => candidate.taskRef === run.taskRef);
@@ -3077,6 +3524,13 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3077
3524
  this.logger.warn('A completed run lost its product to a concurrent sibling; re-running its task alone', {
3078
3525
  taskRef: run.taskRef, runTaskId: run.taskId, ...interference,
3079
3526
  });
3527
+ /*
3528
+ * Not into an application that cannot start (#3880 review R3): the re-run's checks would fail for the start, not for
3529
+ * its work, and spend a re-arm. The task is re-armed already, so the next wave runs it once the start is repaired.
3530
+ */
3531
+ if (options.startRefused === true) {
3532
+ 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' } };
3533
+ }
3080
3534
  /*
3081
3535
  * Not into the account's usage limit (#2388): the re-run would fail like every other turn before the reset.
3082
3536
  * The task is re-armed already, so the wave that resumes after the reset offers it.
@@ -3207,13 +3661,18 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3207
3661
  }
3208
3662
  if (entry.reason === Workbench_BuildTaskStuckReason.LANDING_UNKNOWN) {
3209
3663
  return new ApplicationBuildTaskCompletedButUnlandedError(`${entry.landingUnknownCause ?? `Build step "${taskRef}" was not run: whether it has already landed could not be checked.`} `
3210
- + 'Running it now would either fail the same way or redo work that may already have landed, so it is not dispatched; '
3211
- + `it is offered again as soon as the check answers.${others}`, taskRef, priorTaskId, stuck, queue);
3664
+ /*
3665
+ * One wording for every holder (a generation step's landing check, a coding task's unread decisions, a coding task
3666
+ * whose verification checks could not be asked, run 43961156770): the stuck entry does not say which, reliably.
3667
+ */
3668
+ + 'Running it now would meet the same unanswered check, judge nothing, and may redo work that has already landed, so it '
3669
+ + `is not dispatched; it is offered again as soon as the check answers.${others}`, taskRef, priorTaskId, stuck, queue);
3212
3670
  }
3213
3671
  if (entry.reason === Workbench_BuildTaskStuckReason.FOLLOW_UP_AWAITING_REVIEW) {
3214
3672
  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);
3673
+ + `waits for your review before it runs. \`wildo build tasks\` lists the reports it covers; let it run with `
3674
+ + `\`wildo build approve ${taskRef} --covers <those refs>\`, or decline it with `
3675
+ + `\`wildo build close ${taskRef} --declined --reason "<why>" --covers <those refs>\` (\`wildo creation why ${taskRef}\` shows what was reported).${others}`, taskRef, priorTaskId, stuck, queue);
3217
3676
  }
3218
3677
  if (entry.reason === Workbench_BuildTaskStuckReason.CONTENDED) {
3219
3678
  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 +3682,10 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3223
3682
  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
3683
  + `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
3684
  }
3685
+ if (entry.reason === Workbench_BuildTaskStuckReason.RAN_THIS_WAVE) {
3686
+ 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. `
3687
+ + `Its run is on the wave's result; the next wave offers it again. Nothing to do.${others}`, taskRef, priorTaskId, stuck, queue);
3688
+ }
3226
3689
  if (entry.reason === Workbench_BuildTaskStuckReason.IN_FLIGHT) {
3227
3690
  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
3691
  + `that run settles. Nothing to do: the next dispatch after it settles picks up wherever the build then stands.${others}`, taskRef, priorTaskId, stuck, queue);
@@ -3696,14 +4159,49 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3696
4159
  reason: Workbench_BuildTaskStuckReason.ATTEMPTS_EXHAUSTED,
3697
4160
  };
3698
4161
  }
4162
+ /*
4163
+ * Its latest runs could not have their checks ASKED (run 43961156770). They never count against the budget above, so
4164
+ * this is what bounds a cause only this task meets: held as `landing_unknown`, since whether its work passes is not
4165
+ * known, until a check answers, the compiled model it named catches up, or the re-ask is due. No attempt is spent.
4166
+ */
4167
+ const unanswered = typeof this.dispatch.readRepeatedlyUnansweredVerification === 'function'
4168
+ ? await this.dispatch.readRepeatedlyUnansweredVerification(candidate.taskRef)
4169
+ : undefined;
4170
+ if (unanswered !== undefined) {
4171
+ return {
4172
+ taskRef: candidate.taskRef,
4173
+ priorTaskId: unanswered.priorTaskId,
4174
+ ...(unanswered.settledAt ? { completedAt: unanswered.settledAt } : {}),
4175
+ reason: Workbench_BuildTaskStuckReason.LANDING_UNKNOWN,
4176
+ landingUnknownCause: `Build task "${candidate.taskRef}" was not run: ${unanswered.checkRef} could not be asked on its last `
4177
+ + `${unanswered.consecutive} runs (latest: task ${unanswered.priorTaskId}), so whether its work passes is not known: ${unanswered.message} `
4178
+ + 'A check that could not be asked judged nothing, so no attempt was spent. Repair what the message names (it may be the '
4179
+ + 'environment, or a load-time error in the tree); the task is offered again as soon as the check '
4180
+ + `answers for any run or the compiled model it names catches up, and at the latest from ${unanswered.asksAgainAt}. `
4181
+ + `If the cause is already gone: wildo build rearm ${candidate.taskRef} --reason environment --note "<why>".`,
4182
+ };
4183
+ }
3699
4184
  return null;
3700
4185
  }
3701
- async prepareNextBuildTask(selection, preparation,
3702
4186
  /**
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.
4187
+ * Select the next task and compose what its run needs. A thin door over {@link selectAndComposeNextBuildTask}: when the
4188
+ * selection RESERVED a task for the wave (#3883) and composing it then throws, the reservation is released here, since
4189
+ * the caller never learns which task it was.
3705
4190
  */
3706
- options = {}) {
4191
+ async prepareNextBuildTask(selection, preparation, options = {}) {
4192
+ const reservedHere = {};
4193
+ try {
4194
+ return await this.selectAndComposeNextBuildTask(selection, preparation, options, reservedHere);
4195
+ }
4196
+ catch (error) {
4197
+ if (reservedHere.taskRef !== undefined)
4198
+ options.reservations?.delete(reservedHere.taskRef);
4199
+ throw error;
4200
+ }
4201
+ }
4202
+ async selectAndComposeNextBuildTask(selection, preparation, options,
4203
+ /** Set to the task this call reserved, so the door can release it if composing throws. */
4204
+ reservedHere) {
3707
4205
  let graph;
3708
4206
  let resolution;
3709
4207
  // Read FIRST, before any landing: it decides whether a held reading may be reused, and every candidate is checked
@@ -3718,24 +4216,42 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3718
4216
  ...(this.dispatch.listActiveRunTaskRefs?.() ?? []),
3719
4217
  ...(options.generationStepsInFlight ?? []),
3720
4218
  ]);
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;
4219
+ const fillLanding = options.fillLanding;
4220
+ const stillHolds = (guards) => guards !== undefined
4221
+ && guards.settlementGeneration === this.landingSettlementGeneration
4222
+ && [...guards.inFlightTaskRefs].every((taskRef) => inFlightTaskRefs.has(taskRef));
4223
+ const reused = stillHolds(fillLanding?.current) ? fillLanding.current : undefined;
4224
+ const joinable = reused === undefined && stillHolds(fillLanding?.pending) ? fillLanding.pending : undefined;
3727
4225
  if (reused !== undefined) {
3728
4226
  ({ graph, resolution } = reused);
3729
4227
  }
4228
+ else if (joinable !== undefined) {
4229
+ // Another slot of the wave is reading the landing right now, under guards that still hold (#3883): wait for it.
4230
+ preparation?.enter(ApplicationBuildPreparationPhase.RESOLVING_LANDING);
4231
+ ({ graph, resolution } = await joinable.reading);
4232
+ }
3730
4233
  else {
3731
4234
  // Taken BEFORE the derivation: a run landing while it runs leaves the reading marked older than that run.
3732
4235
  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 };
4236
+ const reading = (async () => {
4237
+ preparation?.enter(ApplicationBuildPreparationPhase.READING_THE_PLAN);
4238
+ const readGraph = await this.readBuildPlan();
4239
+ preparation?.enter(ApplicationBuildPreparationPhase.RESOLVING_LANDING);
4240
+ return { graph: readGraph, resolution: await this.resolveLandedTaskRefs(readGraph.tasks) };
4241
+ })();
4242
+ if (fillLanding !== undefined) {
4243
+ // Stored before the first await, so a slot that asks meanwhile joins it rather than reading again.
4244
+ const pending = { settlementGeneration, inFlightTaskRefs, reading };
4245
+ fillLanding.pending = pending;
4246
+ reading.then((read) => {
4247
+ if (fillLanding.pending !== pending)
4248
+ return;
4249
+ fillLanding.pending = undefined;
4250
+ fillLanding.current = { ...read, settlementGeneration, inFlightTaskRefs };
4251
+ }, () => { if (fillLanding.pending === pending)
4252
+ fillLanding.pending = undefined; });
4253
+ }
4254
+ ({ graph, resolution } = await reading);
3739
4255
  }
3740
4256
  const landedTaskRefs = resolution.landed;
3741
4257
  preparation?.enter(ApplicationBuildPreparationPhase.SELECTING_THE_TASK);
@@ -3810,6 +4326,40 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3810
4326
  const inFlightProductWrites = selection === undefined && inFlightTaskRefs.size > 0
3811
4327
  ? graph.tasks.filter((task) => inFlightTaskRefs.has(task.taskRef)).flatMap(buildTaskProductWritePaths)
3812
4328
  : [];
4329
+ const reservations = selection === undefined ? options.reservations : undefined;
4330
+ /*
4331
+ * Another slot of the wave holds it, or a task it writes beside (#3883). Asked right before a candidate is taken, with
4332
+ * no await between the question and the reservation below, so concurrent slots see each other's choices.
4333
+ */
4334
+ /*
4335
+ * The follow-up a run or a reservation already holds on a candidate's SCOPE (#3886, review of the owner chains). Two
4336
+ * follow-ups on one scope write one scope; they declare no product, so neither the product-file check nor the
4337
+ * interference repair can see them, and chaining all of a scope's follow-ups would hold one owner's gaps behind
4338
+ * another's. So an unnamed selection takes one follow-up per scope at a time, whatever chain it waits on.
4339
+ */
4340
+ const taskByRef = new Map(graph.tasks.map((task) => [task.taskRef, task]));
4341
+ const followUpScopeBusy = (candidate) => {
4342
+ if (selection !== undefined || !candidate.taskRef.startsWith(HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX))
4343
+ return false;
4344
+ const scope = followUpScopeKey(candidate.target);
4345
+ return [...inFlightTaskRefs, ...(reservations?.keys() ?? [])].some((taskRef) => {
4346
+ if (taskRef === candidate.taskRef || !taskRef.startsWith(HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX))
4347
+ return false;
4348
+ const other = taskByRef.get(taskRef);
4349
+ return other !== undefined && followUpScopeKey(other.target) === scope;
4350
+ });
4351
+ };
4352
+ const reservedBeside = (candidate) => {
4353
+ if (followUpScopeBusy(candidate))
4354
+ return { taskRef: candidate.taskRef, priorTaskId: '', reason: Workbench_BuildTaskStuckReason.CONTENDED };
4355
+ if (reservations === undefined || reservations.size === 0)
4356
+ return undefined;
4357
+ if (reservations.has(candidate.taskRef))
4358
+ return { taskRef: candidate.taskRef, priorTaskId: '', reason: Workbench_BuildTaskStuckReason.IN_FLIGHT };
4359
+ return productWritePathsMeet(buildTaskProductWritePaths(candidate), [...reservations.values()].flat())
4360
+ ? { taskRef: candidate.taskRef, priorTaskId: '', reason: Workbench_BuildTaskStuckReason.CONTENDED }
4361
+ : undefined;
4362
+ };
3813
4363
  // Read once, and only for an UNNAMED selection: a named dispatch is the operator's door past the hold (#3233).
3814
4364
  const generationStepAttemptHistory = selection === undefined && candidates.some((candidate) => candidate.target?.kind === BuildPlanTaskTargetKind.COMPANION_GENERATION_STEP)
3815
4365
  ? await this.readGenerationStepAttemptHistory()
@@ -3872,11 +4422,25 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3872
4422
  this.logger.warn?.(`${landingUnknownCause} The rest of the plan proceeds; the step is offered again once the check answers.`, { deferredTaskRef: candidate.taskRef });
3873
4423
  continue;
3874
4424
  }
4425
+ /*
4426
+ * …and one this wave already ran that has not landed (#3885). Run again in the same wave it would meet the tree it
4427
+ * just met; passed over, so the wave fills its slots with the ready coding tasks instead of stopping, as it did
4428
+ * until #3885. Its run is on the wave's result, and the next wave offers it under the holds below.
4429
+ */
4430
+ if (selection === undefined && options.generationStepsRunInWave?.has(candidate.taskRef) === true) {
4431
+ stuck.push({ taskRef: candidate.taskRef, priorTaskId: '', reason: Workbench_BuildTaskStuckReason.RAN_THIS_WAVE });
4432
+ continue;
4433
+ }
3875
4434
  const ranAndHeld = selection === undefined ? await this.classifyRanGenerationStep(candidate, generationStepAttemptHistory) : null;
3876
4435
  if (ranAndHeld !== null) {
3877
4436
  stuck.push(ranAndHeld);
3878
4437
  continue;
3879
4438
  }
4439
+ const reservedStep = reservedBeside(candidate);
4440
+ if (reservedStep !== undefined) {
4441
+ stuck.push(reservedStep);
4442
+ continue;
4443
+ }
3880
4444
  selected = candidate;
3881
4445
  break;
3882
4446
  }
@@ -3894,6 +4458,11 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3894
4458
  stuck.push({ taskRef: candidate.taskRef, priorTaskId: '', reason: Workbench_BuildTaskStuckReason.CONTENDED });
3895
4459
  continue;
3896
4460
  }
4461
+ const reserved = reservedBeside(candidate);
4462
+ if (reserved !== undefined) {
4463
+ stuck.push(reserved);
4464
+ continue;
4465
+ }
3897
4466
  selected = candidate;
3898
4467
  break;
3899
4468
  }
@@ -3911,6 +4480,15 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
3911
4480
  ...withSpecificationFault(readBuildPlanSpecificationFault(graph.tasks, resolution)),
3912
4481
  });
3913
4482
  }
4483
+ /*
4484
+ * Reserved for the wave before anything awaits (#3883): the check in `reservedBeside` and this line run in one turn of
4485
+ * the event loop, so no concurrent slot can take it, or a task writing its files, in between.
4486
+ */
4487
+ if (reservations !== undefined) {
4488
+ reservations.set(selected.taskRef, buildTaskProductWritePaths(selected));
4489
+ reservedHere.taskRef = selected.taskRef;
4490
+ }
4491
+ options.onSelected?.(selected.taskRef);
3914
4492
  // A task being built right now, or waiting for one that writes its file, is not a finding (#1528, #3204).
3915
4493
  if (stuck.some((entry) => !WORKBENCH_BUILD_TASK_STUCK_REASONS_WAITING_ON_A_LIVE_RUN.has(entry.reason))) {
3916
4494
  const stuckByReason = Object.fromEntries(Object.values(Workbench_BuildTaskStuckReason).map((reason) => [reason, stuck.filter((entry) => entry.reason === reason).map((entry) => entry.taskRef)]));
@@ -4120,7 +4698,8 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
4120
4698
  const runs = await this.readLatestCompletedCodingRuns();
4121
4699
  const openReportedGaps = runs === undefined
4122
4700
  ? undefined
4123
- : collectOpenReportedGaps({ derivation: await this.deriveFollowUps(plan.tasks, runs.latest), tasks: plan.tasks, latestCompletedRuns: runs.latest, landedTaskRefs: landed });
4701
+ // The same derivation as the plan's, dispatch record included, so the reading and the plan agree on what carries a gap.
4702
+ : collectOpenReportedGaps({ derivation: await this.readFollowUpDerivation(plan.tasks, runs.latest), tasks: plan.tasks, latestCompletedRuns: runs.latest, landedTaskRefs: landed });
4124
4703
  // A task a person CLOSED is landed for the plan, never proven: its product was never found by a probe (#3224).
4125
4704
  return {
4126
4705
  landedTaskRefs,
@@ -4619,8 +5198,13 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
4619
5198
  throw new BuildTaskDecisionRefusedError(`"${request.satisfiedBy}" is neither a task of the build plan nor a commit HEAD contains.`);
4620
5199
  closure = { taskRef, kind: BuildTaskClosureKind.SATISFIED_BY_COMMIT, satisfiedBy: sha, reason: request.reason, closedAt };
4621
5200
  }
5201
+ // A follow-up's closure covers the gaps its objective showed, and the follow-up carries exactly those (#3832), never
5202
+ // one absorbed after the person looked (#3833).
5203
+ const coverage = this.decidedFollowUpCoverage(plan.tasks, taskRef);
5204
+ refuseFollowUpReportsNotDisplayed(taskRef, coverage.gaps, request.coveredReportRefs);
5205
+ closure = { ...closure, ...coverage.fields };
4622
5206
  const { commitSha, decisionsPath, replacedUnhonoured } = await this.commitBuildTaskDecision({ closure }, {
4623
- summary: `${taskRef}: closed (${closure.kind}${closure.satisfiedBy ? ` by ${closure.satisfiedBy}` : ''})`,
5207
+ summary: `${taskRef}: closed (${closure.kind}${closure.satisfiedBy ? ` by ${closure.satisfiedBy}` : ''})${describeFollowUpDecisionOrigins(coverage.gaps)}`,
4624
5208
  purpose: request.reason,
4625
5209
  actor,
4626
5210
  });
@@ -4630,6 +5214,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
4630
5214
  note: (commitSha
4631
5215
  ? `${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
5216
  : `${taskRef}'s closure is written to ${decisionsPath} and counts once it is committed.`)
5217
+ + describeFollowUpDecisionCoverage(coverage.gaps, 'closes', taskRef)
4633
5218
  + describeReplacedDecisions(replacedUnhonoured),
4634
5219
  };
4635
5220
  }
@@ -4642,7 +5227,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
4642
5227
  */
4643
5228
  async approveFollowUpTask(taskRef, request, actor) {
4644
5229
  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>"\`.`);
5230
+ 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
5231
  }
4647
5232
  if (!taskRef.startsWith(HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX)) {
4648
5233
  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 +5240,12 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
4655
5240
  throw new BuildTaskDecisionRefusedError(`${taskRef} is already approved.`);
4656
5241
  if (await this.dispatch.findCompletedRunForBuildTask(taskRef, undefined, { fresh: true }) !== null)
4657
5242
  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() };
5243
+ // The approval covers the gaps the objective carries now, named in the reply, and the follow-up carries exactly those (#3832).
5244
+ const coverage = this.decidedFollowUpCoverage(plan.tasks, taskRef);
5245
+ refuseFollowUpReportsNotDisplayed(taskRef, coverage.gaps, request.coveredReportRefs);
5246
+ const approval = { taskRef, ...(request.note ? { note: request.note } : {}), approvedAt: new Date().toISOString(), ...coverage.fields };
4659
5247
  const { commitSha, decisionsPath, replacedUnhonoured } = await this.commitBuildTaskDecision({ followUpApproval: approval }, {
4660
- summary: `${taskRef}: follow-up approved to run`,
5248
+ summary: `${taskRef}: follow-up approved to run${describeFollowUpDecisionOrigins(coverage.gaps)}`,
4661
5249
  purpose: request.note ?? 'The creator reviewed the derived follow-up and let it run.',
4662
5250
  actor,
4663
5251
  });
@@ -4667,6 +5255,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
4667
5255
  note: (commitSha
4668
5256
  ? `${taskRef} is approved, committed ${commitSha.slice(0, 8)}; the next wave may run it. To undo it before it runs, revert that commit.`
4669
5257
  : `${taskRef}'s approval is written to ${decisionsPath} and counts once it is committed.`)
5258
+ + describeFollowUpDecisionCoverage(coverage.gaps, 'lets run', taskRef)
4670
5259
  + describeReplacedDecisions(replacedUnhonoured),
4671
5260
  };
4672
5261
  }
@@ -4705,6 +5294,23 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
4705
5294
  : [];
4706
5295
  });
4707
5296
  }
5297
+ /**
5298
+ * The reported gaps only a person's decision can close (#3886): what the creation home's ASKED line names. Read from the
5299
+ * follow-up derivation the plan appended, so Home and the plan agree about which gaps wait on a decision; a later run of
5300
+ * the reporting task that no longer reports it removes it. `[]` with no build plan, or when the runs cannot be listed.
5301
+ */
5302
+ async readGapsAwaitingDecision() {
5303
+ if (!(await this.hasAuthoredBuildPlan()))
5304
+ return [];
5305
+ const plan = await this.readBuildPlan();
5306
+ const runs = await this.readLatestCompletedCodingRuns();
5307
+ if (runs === undefined)
5308
+ return [];
5309
+ const derivation = await this.readFollowUpDerivation(plan.tasks, runs.latest);
5310
+ return derivation.notDerived.flatMap((gap) => (gap.reason === FollowUpGapNotDerivedReason.AWAITS_DECISION && gap.needsDecision !== undefined
5311
+ ? [{ taskRef: gap.originTaskRef, requirementRef: gap.requirementRef, decision: gap.needsDecision }]
5312
+ : []));
5313
+ }
4708
5314
  /**
4709
5315
  * The LANDED tasks carrying a landing advisory (#3285), each with its advisories: what the creation home's advisory
4710
5316
  * line names. The same derivation the task records make (`resolveBuildTaskLandingAdvisories` over the committed
@@ -5014,10 +5620,12 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
5014
5620
  // false — and an invitation to pay for a re-run (#2217 review).
5015
5621
  const landedBeforeAnyRun = landed && !attemptsTruncated && !attempts.some(isCountedBuildTaskAttempt)
5016
5622
  ? { 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.
5623
+ // The follow-ups carrying this task's reports (#3204: an absorbed report is carried under another report's ref, whose
5624
+ // FIRST prerequisite is that report's origin; the others are the owner its gaps were reported as (#3886) or its routed
5625
+ // scope's planned tasks (#3991), the follow-up before it on its target (#3227), and host-derived steps appended later).
5019
5626
  const followUpTaskRefs = plan.tasks
5020
- .filter((candidate) => candidate.taskRef.startsWith(HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX) && candidate.prerequisiteTaskRefs[0] === task.taskRef)
5627
+ .filter((candidate) => candidate.taskRef.startsWith(HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX)
5628
+ && (candidate.prerequisiteTaskRefs[0] === task.taskRef || this.followUpOriginTaskRefs(candidate.taskRef)?.has(task.taskRef) === true))
5021
5629
  .map((candidate) => candidate.taskRef);
5022
5630
  // A declined closure accounts for the task without its product, so nothing it declined is owed to be served.
5023
5631
  const landingAdvisories = landed && resolution.closedTaskRefs.get(task.taskRef)?.kind !== BuildTaskClosureKind.DECLINED
@@ -5028,6 +5636,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
5028
5636
  status,
5029
5637
  ...(followUpTaskRefs.length > 0 ? { followUpTaskRefs } : {}),
5030
5638
  ...(task.taskRef.startsWith(HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX) && task.prerequisiteTaskRefs[0] !== undefined ? { followUpOf: task.prerequisiteTaskRefs[0] } : {}),
5639
+ ...(coveredReportsOf(this.decidedFollowUpCoverage(plan.tasks, task.taskRef).gaps)),
5031
5640
  ...(closureOf(resolution.closedTaskRefs.get(task.taskRef))),
5032
5641
  attempts,
5033
5642
  ...(stuck !== null ? { stuck } : {}),
@@ -6845,7 +7454,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
6845
7454
  return undefined;
6846
7455
  const roadmap = RoadmapSnapshotSchema.safeParse(decidedFamilyValuesFromCompanionExports(companionExports)[ApplicationSpecificationFamily.ROADMAP]);
6847
7456
  const phases = roadmap.success ? roadmap.data.phases : [];
6848
- const followUps = await this.deriveFollowUps(plan.tasks, runs.latest);
7457
+ const followUps = await this.readFollowUpDerivation(plan.tasks, runs.latest);
6849
7458
  return (requirementRef) => deriveWebsiteClaimDelivery(requirementRef, {
6850
7459
  tasks: plan.tasks,
6851
7460
  landedTaskRefs: landed,
@@ -6919,9 +7528,10 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
6919
7528
  return { latest, truncated: rows.length >= BUILD_TASK_RECORD_HISTORY_CEILING };
6920
7529
  }
6921
7530
  /**
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.
7531
+ * The follow-up tasks the requirements COMPLETED coding runs reported still unmet derive (#2496, #3227, #3204), appended
7532
+ * to the plan. The derivation is {@link deriveBuildPlanFollowUpTasks}: every requirement a run reported folded into one
7533
+ * follow-up, a follow-up not dispatched yet absorbing every later report on its target, each with a stable identity,
7534
+ * chained to the follow-up before it on the same target.
6925
7535
  *
6926
7536
  * 005's workers wrote "office/field access is only partly met" and "the roles do nothing yet … it still needs its own
6927
7537
  * work" into closing reports that every run was accepted on, and no later task, coherence entry or judge picked any of
@@ -6938,21 +7548,82 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
6938
7548
  if (runs === undefined)
6939
7549
  return graph;
6940
7550
  /*
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.
7551
+ * Held per (plan tasks, latest completed runs, absorption inputs) (#3204): the plan is read on every selection, board
7552
+ * and landing read, and this re-validated the whole plan once per follow-up and warned again on each read. On reference
7553
+ * run 42666728304 a re-decomposed plan already naming the follow-ups logged "already names another task" 184 times in
7554
+ * one burst, beside the companion's event-loop stalls. Nothing else decides the answer, so a read with none of them
7555
+ * changed reuses it.
6945
7556
  */
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))) });
7557
+ const absorption = await this.readFollowUpAbsorptionInputs();
7558
+ const runsKey = JSON.stringify([...runs.latest].map(([taskRef, attempt]) => [taskRef, attempt.runTaskId]).sort(([left], [right]) => String(left).localeCompare(String(right))));
7559
+ const memoKey = JSON.stringify({ tasks: graph.tasks, runs: runsKey, absorption: describeAbsorptionInputs(absorption) });
6947
7560
  if (this.followUpDerivationMemo?.key === memoKey)
6948
7561
  return this.followUpDerivationMemo.graph;
6949
- const derived = await this.deriveFollowUpTaskGraph(graph, runs);
6950
- this.followUpDerivationMemo = { key: memoKey, graph: derived };
7562
+ const { graph: derived, derivation } = await this.deriveFollowUpTaskGraph(graph, runs, absorption);
7563
+ this.followUpDerivationMemo = { key: memoKey, runsKey, graph: derived, derivation };
7564
+ // What each appended follow-up carries, by the objective it carries it under: stamped on its run at dispatch.
7565
+ for (const followUp of derivation.followUps) {
7566
+ const objectiveKey = `${followUp.task.taskRef}\u0000${followUp.task.objective}`;
7567
+ // Re-inserted, so the eviction below drops the objectives no read has derived for longest (review N5).
7568
+ this.carriedFollowUpGapKeys.delete(objectiveKey);
7569
+ this.carriedFollowUpGapKeys.set(objectiveKey, followUp.gaps);
7570
+ }
7571
+ while (this.carriedFollowUpGapKeys.size > CARRIED_FOLLOW_UP_GAP_KEYS_RETAINED)
7572
+ this.carriedFollowUpGapKeys.delete(this.carriedFollowUpGapKeys.keys().next().value);
6951
7573
  return derived;
6952
7574
  }
6953
7575
  followUpDerivationMemo;
6954
- async deriveFollowUpTaskGraph(graph, runs) {
6955
- const derivation = await this.deriveFollowUps(graph.tasks, runs.latest);
7576
+ /**
7577
+ * The gap keys each derived follow-up carries, by `<ref>\u0000<objective>` (#3204): looked up by the objective a dispatch
7578
+ * selected, and stamped on the run, so what a dispatched follow-up carried is RECORDED rather than inferred. An objective
7579
+ * is a function of its gaps, so a lookup that misses records nothing, and the follow-up then carries its own report only
7580
+ * (a report it held is carried again by the next follow-up: one run too many, never a gap nobody was told about).
7581
+ */
7582
+ carriedFollowUpGapKeys = new Map();
7583
+ /**
7584
+ * The follow-up derivation the plan read APPENDED, for these runs (#3204 review N6): read again when the last plan read
7585
+ * was over other runs, so a reader always answers from what the plan holds. Derived without the plan only if even that
7586
+ * read answers for other runs (the listing moved in between), which cannot name a refused follow-up but never hides a gap.
7587
+ */
7588
+ async readFollowUpDerivation(tasks, latest) {
7589
+ const runsKey = JSON.stringify([...latest].map(([taskRef, attempt]) => [taskRef, attempt.runTaskId]).sort(([left], [right]) => String(left).localeCompare(String(right))));
7590
+ if (this.followUpDerivationMemo?.runsKey !== runsKey)
7591
+ await this.readBuildPlan();
7592
+ if (this.followUpDerivationMemo?.runsKey === runsKey)
7593
+ return this.followUpDerivationMemo.derivation;
7594
+ return this.deriveFollowUps(tasks, latest, await this.readFollowUpAbsorptionInputs());
7595
+ }
7596
+ /** Every origin whose report a follow-up carries, as the last plan read appended it (#3204); undefined before any read. */
7597
+ followUpOriginTaskRefs(followUpTaskRef) {
7598
+ const followUp = this.followUpDerivationMemo?.derivation.followUps.find((candidate) => candidate.task.taskRef === followUpTaskRef);
7599
+ return followUp === undefined ? undefined : new Set(followUp.gaps.map((gap) => gap.originTaskRef));
7600
+ }
7601
+ /**
7602
+ * What a decision on a derived follow-up covers (#3832): the gaps its objective carries AT THE DECISION, recorded on the
7603
+ * decision so the follow-up carries exactly those from then on. Nothing for a task that is not a follow-up, or whose
7604
+ * objective was never derived (the follow-up then stays fixed to its own report).
7605
+ *
7606
+ * A pending follow-up keeps absorbing reports until it is decided, so this can hold a report that arrived after the person
7607
+ * last looked (review of #3832). A caller sends the reports it displayed (`coveredReportRefs`), and the door refuses a
7608
+ * decision that sends none or covers one more ({@link refuseFollowUpReportsNotDisplayed}, #3833). It also NAMES every report it covers, in
7609
+ * its reply and in the decision commit's summary, so one revert undoes it.
7610
+ */
7611
+ decidedFollowUpCoverage(tasks, taskRef) {
7612
+ if (!taskRef.startsWith(HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX))
7613
+ return { fields: {}, gaps: [] };
7614
+ const task = tasks.find((candidate) => candidate.taskRef === taskRef);
7615
+ const carried = task === undefined ? undefined : this.carriedFollowUpGapKeys.get(`${taskRef}\u0000${task.objective}`);
7616
+ return carried === undefined ? { fields: {}, gaps: [] } : { fields: { carriedFollowUpGapKeys: carried.map((gap) => followUpGapKey(gap)) }, gaps: carried };
7617
+ }
7618
+ /** The carried gap keys of the follow-up a dispatch selected (#3204), for its run's input. */
7619
+ withCarriedFollowUpGaps(prepared, origin) {
7620
+ if (!prepared.plan.taskRef.startsWith(HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX))
7621
+ return origin;
7622
+ const carried = this.carriedFollowUpGapKeys.get(`${prepared.plan.taskRef}\u0000${prepared.plan.objective}`);
7623
+ return carried === undefined ? origin : { ...origin, carriedFollowUpGapKeys: carried.map((gap) => followUpGapKey(gap)) };
7624
+ }
7625
+ async deriveFollowUpTaskGraph(graph, runs, absorption) {
7626
+ const derivation = await this.deriveFollowUps(graph.tasks, runs.latest, absorption);
6956
7627
  for (const skipped of derivation.notDerived) {
6957
7628
  if (skipped.reason === FollowUpGapNotDerivedReason.MET_SINCE && skipped.metSince !== undefined) {
6958
7629
  // Every drop is logged, with the run that stated it met and where (#3227).
@@ -6964,30 +7635,51 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
6964
7635
  });
6965
7636
  continue;
6966
7637
  }
7638
+ // A decision only a person can make (#3886, review M2): asked on Home, and said here at debug, since every plan read meets it.
7639
+ if (skipped.reason === FollowUpGapNotDerivedReason.AWAITS_DECISION) {
7640
+ 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 });
7641
+ continue;
7642
+ }
6967
7643
  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
7644
  }
6969
7645
  const taskRefs = new Set(graph.tasks.map((task) => task.taskRef));
6970
7646
  let current = graph;
7647
+ const appended = [];
6971
7648
  /*
6972
7649
  * Each follow-up waits on the last one APPENDED on its target (#3227 review F3): a follow-up skipped below would
6973
7650
  * otherwise be named as the next one's prerequisite, which the plan refuses as unknown, and the rest of its target's
6974
7651
  * chain would be dropped with it.
6975
7652
  */
6976
7653
  const lastAppendedOnTarget = new Map();
6977
- for (const derived of derivation.followUps) {
6978
- const followUp = chainFollowUpAfter(derived.task, lastAppendedOnTarget.get(derived.targetKey));
7654
+ const append = (derived) => {
7655
+ const followUp = chainFollowUpAfter(derived, lastAppendedOnTarget.get(derived.targetKey));
6979
7656
  if (taskRefs.has(followUp.taskRef)) {
6980
7657
  this.logger.warn?.(`Reported gaps derive "${followUp.taskRef}", which already names another task; not deriving it`, { origins: followUp.prerequisiteTaskRefs });
6981
- continue;
7658
+ return false;
6982
7659
  }
6983
7660
  const extended = BuildPlanTaskGraphSchema.safeParse({ ...current, tasks: [...current.tasks, followUp] });
6984
7661
  if (!extended.success) {
6985
7662
  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;
7663
+ return false;
6987
7664
  }
6988
7665
  current = extended.data;
6989
7666
  taskRefs.add(followUp.taskRef);
6990
7667
  lastAppendedOnTarget.set(derived.targetKey, followUp.taskRef);
7668
+ appended.push({ ...derived, task: followUp, absorbed: [] });
7669
+ return true;
7670
+ };
7671
+ // A gap whose follow-up could not join the plan still reads OPEN, with no follow-up (#3204 review N1).
7672
+ const refused = [];
7673
+ const refuse = (gaps) => refused.push(...gaps.map((gap) => ({ ...gap, reason: FollowUpGapNotDerivedReason.FOLLOW_UP_NOT_APPENDED })));
7674
+ for (const derived of derivation.followUps) {
7675
+ if (append(derived))
7676
+ continue;
7677
+ // A follow-up that cannot join the plan does not take the reports it absorbed with it (#3204): each gets its own.
7678
+ const absorbedKeys = new Set(derived.absorbed.flatMap((absorbed) => absorbed.gaps.map((gap) => followUpGapKey(gap))));
7679
+ refuse(derived.gaps.filter((gap) => !absorbedKeys.has(followUpGapKey(gap))));
7680
+ for (const absorbed of derived.absorbed)
7681
+ if (!append(absorbed))
7682
+ refuse(absorbed.gaps);
6991
7683
  }
6992
7684
  /*
6993
7685
  * Whenever the cap is hit, derived or not (#2496 review N1): the gap the cap hides is exactly the case that derives
@@ -6997,28 +7689,39 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
6997
7689
  this.followUpListingTruncationWarned = true;
6998
7690
  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
7691
  }
7000
- return current;
7692
+ // Every reader answers from what was appended, so none names a follow-up the plan does not hold (#3204 review F7).
7693
+ return { graph: current, derivation: assembleFollowUpDerivation(appended, [...derivation.notDerived, ...refused]) };
7001
7694
  }
7002
7695
  /**
7003
7696
  * The follow-up derivation over a plan and the latest completed runs (#2496, #3227): one function for every reader.
7004
7697
  *
7005
7698
  * A gap a later run STATED met is dropped only once this host confirms two things the pure candidates cannot know
7006
7699
  * ({@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) {
7700
+ * committed (a statement about a tree whose work is still uncommitted is about a tree HEAD does not have), and no
7701
+ * follow-up holding the gap was ever attempted, in any state: neither its own report's, nor the one that absorbed it
7702
+ * (#3204), since a follow-up the build ran or is running keeps what it was given (#2530). Both are read only when a
7703
+ * candidate exists, so a plan with no met statement costs nothing extra. Anything this cannot read keeps the gap: an
7704
+ * unknown is not a statement that it is met.
7705
+ */
7706
+ async deriveFollowUps(tasks, latest, absorption) {
7707
+ const withAbsorption = absorption ? { absorption } : {};
7013
7708
  const candidates = collectFollowUpGapsMetSince({ tasks, latestCompletedRuns: latest });
7014
7709
  if (candidates.length === 0)
7015
- return deriveBuildPlanFollowUpTasks({ tasks, latestCompletedRuns: latest });
7710
+ return deriveBuildPlanFollowUpTasks({ tasks, latestCompletedRuns: latest, ...withAbsorption });
7016
7711
  const metSince = new Map();
7017
7712
  try {
7018
- const attempted = await this.readAttemptedBuildTaskRefs();
7713
+ // Every task with ANY run (#2530); unknown when the listing could not be read or reached its ceiling.
7714
+ if (absorption === undefined)
7715
+ throw new Error('the coding-run listing could not be read whole, so an attempted follow-up may be missing from it');
7716
+ const attempted = absorption.dispatched;
7717
+ // Every gap a dispatched follow-up carries, before anything is dropped: an absorbed gap is carried under another
7718
+ // report's ref, and a gap routed to several modules by several follow-ups (#3204 review N2).
7719
+ const carriedByAttempted = new Set(deriveBuildPlanFollowUpTasks({ tasks, latestCompletedRuns: latest, absorption }).followUps
7720
+ .filter((followUp) => attempted.has(followUp.task.taskRef))
7721
+ .flatMap((followUp) => followUp.gaps.map((gap) => followUpGapKey(gap))));
7019
7722
  const landedRuns = await this.selectLandedRunTaskIds([...new Set(candidates.map((candidate) => candidate.metByRunTaskId))]);
7020
7723
  for (const candidate of candidates) {
7021
- if (attempted.has(candidate.followUpTaskRef) || !landedRuns.has(candidate.metByRunTaskId))
7724
+ if (attempted.has(candidate.followUpTaskRef) || carriedByAttempted.has(followUpGapKey(candidate.gap)) || !landedRuns.has(candidate.metByRunTaskId))
7022
7725
  continue;
7023
7726
  // The first confirmed statement, in plan order, is the one the log names.
7024
7727
  if (!metSince.has(followUpGapKey(candidate.gap)))
@@ -7028,24 +7731,66 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
7028
7731
  catch (error) {
7029
7732
  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
7733
  }
7031
- return deriveBuildPlanFollowUpTasks({ tasks, latestCompletedRuns: latest, metSince });
7734
+ return deriveBuildPlanFollowUpTasks({ tasks, latestCompletedRuns: latest, metSince, ...withAbsorption });
7032
7735
  }
7033
7736
  /**
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.
7737
+ * What decides which reports a follow-up absorbs (#3204), cached like {@link readLatestCompletedCodingRuns}, which every
7738
+ * plan read also makes:
7739
+ *
7740
+ * - `dispatched`: every build task with ANY coding run in the history, whatever its state, with the gap keys its runs
7741
+ * recorded at dispatch (`carriedFollowUpGapKeys`). Also the attempted set the met-since confirmation reads (#2530).
7742
+ * - `decided`: every task the COMMITTED build-task decisions name (a closure, a follow-up approval), with the gap keys
7743
+ * the decision recorded (#3832), read without asking whether they are honoured: a follow-up a person decided on, or
7744
+ * that an unread decision may name, absorbs nothing more than the decision covered.
7745
+ *
7746
+ * `undefined` when either cannot be read whole (the listing failed or reached its ceiling, the decisions do not parse):
7747
+ * a dispatch outside the window would read as never made, so every caller derives as if nothing were absorbed or
7748
+ * confirmed met.
7036
7749
  */
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).
7750
+ readFollowUpAbsorptionInputs() {
7751
+ const now = Date.now();
7752
+ if (this.followUpAbsorptionInputs !== undefined && now - this.followUpAbsorptionInputs.at < LATEST_COMPLETED_CODING_RUNS_TTL_MS) {
7753
+ return this.followUpAbsorptionInputs.value;
7754
+ }
7755
+ const value = this.fetchFollowUpAbsorptionInputs();
7756
+ this.followUpAbsorptionInputs = { at: now, value };
7757
+ return value;
7758
+ }
7759
+ followUpAbsorptionInputs;
7760
+ async fetchFollowUpAbsorptionInputs() {
7761
+ let rows;
7762
+ let decisionsText;
7763
+ try {
7764
+ rows = await this.executions.listActorExecutions({ systemRef: APPLICATION_CODING_SYSTEM_REF, limit: BUILD_TASK_RECORD_HISTORY_CEILING });
7765
+ const decisionsPath = this.buildTaskDecisionsPath();
7766
+ decisionsText = decisionsPath === undefined ? undefined : await this.createCommittedTreeReader().readText(decisionsPath);
7767
+ }
7768
+ catch (error) {
7769
+ 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) });
7770
+ return undefined;
7771
+ }
7040
7772
  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();
7773
+ return undefined;
7774
+ const decisions = parseBuildTaskDecisions(decisionsText ?? undefined);
7775
+ if (decisions.unreadable !== undefined)
7776
+ return undefined;
7777
+ const dispatched = new Map();
7043
7778
  for (const row of rows) {
7044
- const taskRef = row.standaloneTasks[0]?.input?.taskRef;
7045
- if (typeof taskRef === 'string')
7046
- refs.add(taskRef);
7779
+ const input = row.standaloneTasks[0]?.input;
7780
+ if (typeof input?.taskRef !== 'string')
7781
+ continue;
7782
+ const carried = dispatched.get(input.taskRef) ?? new Set();
7783
+ if (Array.isArray(input.carriedFollowUpGapKeys))
7784
+ for (const key of input.carriedFollowUpGapKeys)
7785
+ if (typeof key === 'string')
7786
+ carried.add(key);
7787
+ dispatched.set(input.taskRef, carried);
7047
7788
  }
7048
- return refs;
7789
+ const decided = new Map();
7790
+ for (const decision of [...decisions.closures.values(), ...decisions.followUpApprovals.values()]) {
7791
+ decided.set(decision.taskRef, new Set([...(decided.get(decision.taskRef) ?? []), ...(decision.carriedFollowUpGapKeys ?? [])]));
7792
+ }
7793
+ return { dispatched, decided };
7049
7794
  }
7050
7795
  /**
7051
7796
  * Which completed coding runs LANDED (#3227): their write record exists. Since #3204 a task lands on the WORKING tree, so
@@ -7434,7 +8179,7 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
7434
8179
  const slice = sliceSkillIndexForTask(indexMarkdown, skillRefs);
7435
8180
  if (slice !== undefined) {
7436
8181
  sources.push({
7437
- sourceRef: 'application-creation:context/skill-index',
8182
+ sourceRef: SKILL_INDEX_BRIEF_SOURCE_REF,
7438
8183
  originRef: 'application-creation:origin/installed-skill-index',
7439
8184
  // Framework knowledge, compiled and installed by the framework.
7440
8185
  trust: MetaWorkflow_ContextSourceTrust.TRUSTED,
@@ -7564,6 +8309,8 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
7564
8309
  const resourceType = [...index.resources.keys()].find((candidate) => slugifyRegistryIdentifier(candidate) === resourceRef);
7565
8310
  const related = resourceType === undefined ? undefined : relatedWorkspaceResources(index, resourceType);
7566
8311
  if (related) {
8312
+ // Hub neighbours as stubs (#3891): their relationship lists grew the brief with their degree.
8313
+ const briefed = neighbourhoodForCodingBrief(related);
7567
8314
  sources.push({
7568
8315
  sourceRef: 'application-creation:context/target-resource-neighbourhood',
7569
8316
  originRef: 'application-creation:origin/application-domain-model',
@@ -7572,12 +8319,10 @@ let ApplicationBuildDispatchCompanionService = class ApplicationBuildDispatchCom
7572
8319
  content: {
7573
8320
  freshness: describeWorkspaceFreshness(freshness),
7574
8321
  target: resourceType,
7575
- edges: related.edges,
7576
- resources: related.resources,
8322
+ edges: briefed.edges,
8323
+ resources: briefed.resources,
7577
8324
  ...(related.unresolved.length > 0 ? { unresolvedNeighbours: related.unresolved } : {}),
7578
- note: 'The target resource as it EXISTS today, with its fields, operations and relationships, plus the '
7579
- + 'resources one hop away. Direction matters: `foreignKeyHolderResourceType` says which side carries the key. '
7580
- + 'Ask for more with `wildo context workspace get <resourceType>` or `wildo context workspace related <resourceType>`.',
8325
+ note: TARGET_NEIGHBOURHOOD_NOTE,
7581
8326
  },
7582
8327
  });
7583
8328
  }
@@ -8033,7 +8778,21 @@ thirdParty) {
8033
8778
  return target?.moduleRef === moduleRef;
8034
8779
  })
8035
8780
  .map((element) => ({ taskRef: element.ref, objective: element.label }));
8036
- if (served.length === 0 && unresolved.length === 0 && moduleTasks.length === 0)
8781
+ /*
8782
+ * The OTHER planned tasks serving each requirement this task serves (#3886): what a closing report names as the owner of
8783
+ * a gap (`ownedByTaskRef`) when what is missing is their work. Until #3886 a task saw only its module's siblings, so a
8784
+ * website section that found a feature missing could not say which task builds it, and 24 follow-up runs on reference
8785
+ * run 43691253927 changed nothing because they ran before that task had landed.
8786
+ */
8787
+ const otherTasksServing = Object.fromEntries(task.servesRefs.flatMap((requirementRef) => {
8788
+ const serving = (index.aspects.get(TASK_ASPECT)?.elements ?? [])
8789
+ // A follow-up is never an owner the derivation honours (review LOW): only the plan's own tasks are listed.
8790
+ .filter((element) => element.ref !== task.taskRef && !element.ref.startsWith(HOST_DERIVED_FOLLOW_UP_TASK_REF_PREFIX))
8791
+ .filter((element) => (element.item.servesRefs ?? []).includes(requirementRef))
8792
+ .map((element) => ({ taskRef: element.ref, objective: element.label }));
8793
+ return serving.length > 0 ? [[requirementRef, serving]] : [];
8794
+ }));
8795
+ if (served.length === 0 && unresolved.length === 0 && moduleTasks.length === 0 && Object.keys(otherTasksServing).length === 0)
8037
8796
  return null;
8038
8797
  return {
8039
8798
  sourceRef: 'application-creation:context/served-elements',
@@ -8050,8 +8809,11 @@ thirdParty) {
8050
8809
  }
8051
8810
  : {}),
8052
8811
  ...(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.',
8812
+ ...(Object.keys(otherTasksServing).length > 0 ? { otherTasksServing } : {}),
8813
+ note: 'servedElements are what this task is accountable to — its acceptance criteria. otherTasksInModule and '
8814
+ + 'otherTasksServing (by requirement) are maps only: read a task with `wildo context elements get --refs <taskRef>` if '
8815
+ + 'you need it. When what is missing for a requirement is one of otherTasksServing\'s own work, name it as '
8816
+ + '`ownedByTaskRef` in your unmet-requirements block.',
8055
8817
  },
8056
8818
  };
8057
8819
  }