@wildo-ai/dev-companion 1.1.5 → 1.1.6

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 (596) hide show
  1. package/dist/esm/.tsbuildinfo +1 -1
  2. package/dist/esm/brand/models/logo-generation.actors-system.definitions.d.ts.map +1 -1
  3. package/dist/esm/brand/models/logo-generation.actors-system.definitions.js +0 -1
  4. package/dist/esm/brand/models/logo-generation.actors-system.definitions.js.map +1 -1
  5. package/dist/esm/brand/models/logo-judge.actors-system.definitions.d.ts.map +1 -1
  6. package/dist/esm/brand/models/logo-judge.actors-system.definitions.js +0 -1
  7. package/dist/esm/brand/models/logo-judge.actors-system.definitions.js.map +1 -1
  8. package/dist/esm/brand/services/brand-accept.companion.service.d.ts +8 -0
  9. package/dist/esm/brand/services/brand-accept.companion.service.d.ts.map +1 -1
  10. package/dist/esm/brand/services/brand-accept.companion.service.js +6 -0
  11. package/dist/esm/brand/services/brand-accept.companion.service.js.map +1 -1
  12. package/dist/esm/brand/services/brand-propagation.companion.utils.d.ts +21 -0
  13. package/dist/esm/brand/services/brand-propagation.companion.utils.d.ts.map +1 -0
  14. package/dist/esm/brand/services/brand-propagation.companion.utils.js +33 -0
  15. package/dist/esm/brand/services/brand-propagation.companion.utils.js.map +1 -0
  16. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.d.ts +69 -1
  17. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.d.ts.map +1 -1
  18. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.js +84 -3
  19. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.js.map +1 -1
  20. package/dist/esm/claude-cli/models/concurrent-coding-runs.models.d.ts +8 -4
  21. package/dist/esm/claude-cli/models/concurrent-coding-runs.models.d.ts.map +1 -1
  22. package/dist/esm/claude-cli/models/concurrent-coding-runs.models.js +9 -5
  23. package/dist/esm/claude-cli/models/concurrent-coding-runs.models.js.map +1 -1
  24. package/dist/esm/claude-cli/models/parked-question-answerer.actors-system.definitions.js +1 -1
  25. package/dist/esm/claude-cli/models/parked-question-answerer.actors-system.definitions.js.map +1 -1
  26. package/dist/esm/claude-cli/services/__tests__/support/in-memory-coding-actor-plane.d.ts +4 -0
  27. package/dist/esm/claude-cli/services/__tests__/support/in-memory-coding-actor-plane.d.ts.map +1 -1
  28. package/dist/esm/claude-cli/services/__tests__/support/in-memory-coding-actor-plane.js +25 -3
  29. package/dist/esm/claude-cli/services/__tests__/support/in-memory-coding-actor-plane.js.map +1 -1
  30. package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.d.ts +159 -11
  31. package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.d.ts.map +1 -1
  32. package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.js +424 -41
  33. package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.js.map +1 -1
  34. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.d.ts +333 -60
  35. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.d.ts.map +1 -1
  36. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.js +1029 -185
  37. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.js.map +1 -1
  38. package/dist/esm/claude-cli/services/coding-run-write-register.companion.service.d.ts +8 -2
  39. package/dist/esm/claude-cli/services/coding-run-write-register.companion.service.d.ts.map +1 -1
  40. package/dist/esm/claude-cli/services/coding-run-write-register.companion.service.js +8 -2
  41. package/dist/esm/claude-cli/services/coding-run-write-register.companion.service.js.map +1 -1
  42. package/dist/esm/claude-cli/services/in-flight-coding-runs.companion.d.ts +20 -0
  43. package/dist/esm/claude-cli/services/in-flight-coding-runs.companion.d.ts.map +1 -0
  44. package/dist/esm/claude-cli/services/in-flight-coding-runs.companion.js +29 -0
  45. package/dist/esm/claude-cli/services/in-flight-coding-runs.companion.js.map +1 -0
  46. package/dist/esm/claude-cli/services/research-agent-dispatch.companion.service.d.ts +11 -0
  47. package/dist/esm/claude-cli/services/research-agent-dispatch.companion.service.d.ts.map +1 -1
  48. package/dist/esm/claude-cli/services/research-agent-dispatch.companion.service.js +60 -7
  49. package/dist/esm/claude-cli/services/research-agent-dispatch.companion.service.js.map +1 -1
  50. package/dist/esm/claude-cli/services/research-evidence-store.companion.d.ts +5 -4
  51. package/dist/esm/claude-cli/services/research-evidence-store.companion.d.ts.map +1 -1
  52. package/dist/esm/claude-cli/services/research-evidence-store.companion.js +13 -4
  53. package/dist/esm/claude-cli/services/research-evidence-store.companion.js.map +1 -1
  54. package/dist/esm/companion-api/companion-api.schemas.d.ts +193 -2
  55. package/dist/esm/companion-api/companion-api.schemas.d.ts.map +1 -1
  56. package/dist/esm/companion-api/companion-api.schemas.js +20 -1
  57. package/dist/esm/companion-api/companion-api.schemas.js.map +1 -1
  58. package/dist/esm/companion-api/companion-error-guidance.models.d.ts +25 -0
  59. package/dist/esm/companion-api/companion-error-guidance.models.d.ts.map +1 -0
  60. package/dist/esm/companion-api/companion-error-guidance.models.js +26 -0
  61. package/dist/esm/companion-api/companion-error-guidance.models.js.map +1 -0
  62. package/dist/esm/companion-api/controllers/companion-file-route-confinement.d.ts +44 -0
  63. package/dist/esm/companion-api/controllers/companion-file-route-confinement.d.ts.map +1 -0
  64. package/dist/esm/companion-api/controllers/companion-file-route-confinement.js +111 -0
  65. package/dist/esm/companion-api/controllers/companion-file-route-confinement.js.map +1 -0
  66. package/dist/esm/companion-api/controllers/companion-token-floor.policy.d.ts +6 -14
  67. package/dist/esm/companion-api/controllers/companion-token-floor.policy.d.ts.map +1 -1
  68. package/dist/esm/companion-api/controllers/companion-token-floor.policy.js +6 -14
  69. package/dist/esm/companion-api/controllers/companion-token-floor.policy.js.map +1 -1
  70. package/dist/esm/companion-api/controllers/companion-trace-exemptions.d.ts +12 -0
  71. package/dist/esm/companion-api/controllers/companion-trace-exemptions.d.ts.map +1 -0
  72. package/dist/esm/companion-api/controllers/companion-trace-exemptions.js +20 -0
  73. package/dist/esm/companion-api/controllers/companion-trace-exemptions.js.map +1 -0
  74. package/dist/esm/companion-api/controllers/companion.controller.d.ts +104 -14
  75. package/dist/esm/companion-api/controllers/companion.controller.d.ts.map +1 -1
  76. package/dist/esm/companion-api/controllers/companion.controller.js +516 -122
  77. package/dist/esm/companion-api/controllers/companion.controller.js.map +1 -1
  78. package/dist/esm/core/catalogs/structured-data-catalog-audit.service.d.ts.map +1 -1
  79. package/dist/esm/core/catalogs/structured-data-catalog-audit.service.js +6 -38
  80. package/dist/esm/core/catalogs/structured-data-catalog-audit.service.js.map +1 -1
  81. package/dist/esm/core/config/primary-language.companion.utils.d.ts +13 -0
  82. package/dist/esm/core/config/primary-language.companion.utils.d.ts.map +1 -1
  83. package/dist/esm/core/config/primary-language.companion.utils.js +19 -0
  84. package/dist/esm/core/config/primary-language.companion.utils.js.map +1 -1
  85. package/dist/esm/core/context/companion-package-loaders.companion.js +1 -39
  86. package/dist/esm/core/context/companion-package-loaders.companion.js.map +1 -1
  87. package/dist/esm/core/inject/models/container.d.ts.map +1 -1
  88. package/dist/esm/core/inject/models/container.js +4 -0
  89. package/dist/esm/core/inject/models/container.js.map +1 -1
  90. package/dist/esm/core/inject/models/service-types.d.ts +4 -0
  91. package/dist/esm/core/inject/models/service-types.d.ts.map +1 -1
  92. package/dist/esm/core/inject/models/service-types.js +4 -0
  93. package/dist/esm/core/inject/models/service-types.js.map +1 -1
  94. package/dist/esm/core/introspection/behaviors/companion-introspection-behavior-definitions.d.ts.map +1 -1
  95. package/dist/esm/core/introspection/behaviors/companion-introspection-behavior-definitions.js +16 -0
  96. package/dist/esm/core/introspection/behaviors/companion-introspection-behavior-definitions.js.map +1 -1
  97. package/dist/esm/core/introspection/models/companion-introspection.models.d.ts +1 -1
  98. package/dist/esm/core/introspection/models/companion-introspection.models.d.ts.map +1 -1
  99. package/dist/esm/core/introspection/models/companion-introspection.models.js +6 -0
  100. package/dist/esm/core/introspection/models/companion-introspection.models.js.map +1 -1
  101. package/dist/esm/core/introspection/resources/application-secrets.companion.d.ts +41 -0
  102. package/dist/esm/core/introspection/resources/application-secrets.companion.d.ts.map +1 -0
  103. package/dist/esm/core/introspection/resources/application-secrets.companion.js +155 -0
  104. package/dist/esm/core/introspection/resources/application-secrets.companion.js.map +1 -0
  105. package/dist/esm/core/introspection/resources/creation-console-answer.companion.d.ts +76 -0
  106. package/dist/esm/core/introspection/resources/creation-console-answer.companion.d.ts.map +1 -0
  107. package/dist/esm/core/introspection/resources/creation-console-answer.companion.js +197 -0
  108. package/dist/esm/core/introspection/resources/creation-console-answer.companion.js.map +1 -0
  109. package/dist/esm/core/introspection/resources/creation-console-projection.companion.d.ts +47 -0
  110. package/dist/esm/core/introspection/resources/creation-console-projection.companion.d.ts.map +1 -0
  111. package/dist/esm/core/introspection/resources/creation-console-projection.companion.js +199 -0
  112. package/dist/esm/core/introspection/resources/creation-console-projection.companion.js.map +1 -0
  113. package/dist/esm/core/introspection/resources/creation-plane-dispatch.custom-impl.companion.service.d.ts +42 -0
  114. package/dist/esm/core/introspection/resources/creation-plane-dispatch.custom-impl.companion.service.d.ts.map +1 -1
  115. package/dist/esm/core/introspection/resources/creation-plane-dispatch.custom-impl.companion.service.js +173 -22
  116. package/dist/esm/core/introspection/resources/creation-plane-dispatch.custom-impl.companion.service.js.map +1 -1
  117. package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.d.ts +78 -90
  118. package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.d.ts.map +1 -1
  119. package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.js +288 -25
  120. package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.js.map +1 -1
  121. package/dist/esm/core/introspection/resources/introspection-resource-notifier.companion.service.d.ts +22 -36
  122. package/dist/esm/core/introspection/resources/introspection-resource-notifier.companion.service.d.ts.map +1 -1
  123. package/dist/esm/core/introspection/resources/introspection-resource-notifier.companion.service.js +49 -13
  124. package/dist/esm/core/introspection/resources/introspection-resource-notifier.companion.service.js.map +1 -1
  125. package/dist/esm/core/introspection/resources/introspection-resource-source.companion.service.d.ts +1 -1
  126. package/dist/esm/core/introspection/resources/introspection-resource-source.companion.service.d.ts.map +1 -1
  127. package/dist/esm/core/introspection/resources/introspection-resource-source.companion.service.js +10 -15
  128. package/dist/esm/core/introspection/resources/introspection-resource-source.companion.service.js.map +1 -1
  129. package/dist/esm/core/introspection/subprocess/application-domain-model.behavior.d.ts +2 -0
  130. package/dist/esm/core/introspection/subprocess/application-domain-model.behavior.d.ts.map +1 -1
  131. package/dist/esm/core/introspection/subprocess/application-domain-model.behavior.js.map +1 -1
  132. package/dist/esm/core/introspection/subprocess/asset-noop-hooks.d.ts +4 -0
  133. package/dist/esm/core/introspection/subprocess/asset-noop-hooks.d.ts.map +1 -1
  134. package/dist/esm/core/introspection/subprocess/asset-noop-hooks.js.map +1 -1
  135. package/dist/esm/core/introspection/subprocess/companion-introspection-behavior-handlers.d.ts.map +1 -1
  136. package/dist/esm/core/introspection/subprocess/companion-introspection-behavior-handlers.js +77 -9
  137. package/dist/esm/core/introspection/subprocess/companion-introspection-behavior-handlers.js.map +1 -1
  138. package/dist/esm/core/introspection/subprocess/compliance-primary-facts.behavior.d.ts +45 -3
  139. package/dist/esm/core/introspection/subprocess/compliance-primary-facts.behavior.d.ts.map +1 -1
  140. package/dist/esm/core/introspection/subprocess/compliance-primary-facts.behavior.js +8 -1
  141. package/dist/esm/core/introspection/subprocess/compliance-primary-facts.behavior.js.map +1 -1
  142. package/dist/esm/core/introspection/subprocess/frontend-labels-needed-info.behavior.d.ts +3 -2
  143. package/dist/esm/core/introspection/subprocess/frontend-labels-needed-info.behavior.d.ts.map +1 -1
  144. package/dist/esm/core/introspection/subprocess/frontend-labels-needed-info.behavior.js +8 -3
  145. package/dist/esm/core/introspection/subprocess/frontend-labels-needed-info.behavior.js.map +1 -1
  146. package/dist/esm/core/introspection/subprocess/openapi-generation-input.behavior.d.ts +30 -1
  147. package/dist/esm/core/introspection/subprocess/openapi-generation-input.behavior.d.ts.map +1 -1
  148. package/dist/esm/core/introspection/subprocess/openapi-generation-input.behavior.js +128 -20
  149. package/dist/esm/core/introspection/subprocess/openapi-generation-input.behavior.js.map +1 -1
  150. package/dist/esm/core/introspection/subprocess/specification-artifacts.behavior.d.ts +13 -0
  151. package/dist/esm/core/introspection/subprocess/specification-artifacts.behavior.d.ts.map +1 -1
  152. package/dist/esm/core/introspection/subprocess/specification-artifacts.behavior.js +21 -17
  153. package/dist/esm/core/introspection/subprocess/specification-artifacts.behavior.js.map +1 -1
  154. package/dist/esm/core/runtime/companion-endpoint-record.d.ts +8 -0
  155. package/dist/esm/core/runtime/companion-endpoint-record.d.ts.map +1 -0
  156. package/dist/esm/core/runtime/companion-endpoint-record.js +23 -0
  157. package/dist/esm/core/runtime/companion-endpoint-record.js.map +1 -0
  158. package/dist/esm/core/runtime/companion-env-file.d.ts +30 -0
  159. package/dist/esm/core/runtime/companion-env-file.d.ts.map +1 -0
  160. package/dist/esm/core/runtime/companion-env-file.js +53 -0
  161. package/dist/esm/core/runtime/companion-env-file.js.map +1 -0
  162. package/dist/esm/core/runtime/dev-compile-quiet.companion.d.ts +5 -0
  163. package/dist/esm/core/runtime/dev-compile-quiet.companion.d.ts.map +1 -1
  164. package/dist/esm/core/runtime/dev-compile-quiet.companion.js +11 -0
  165. package/dist/esm/core/runtime/dev-compile-quiet.companion.js.map +1 -1
  166. package/dist/esm/core/runtime/in-flight-work-heartbeat.companion.d.ts +56 -0
  167. package/dist/esm/core/runtime/in-flight-work-heartbeat.companion.d.ts.map +1 -0
  168. package/dist/esm/core/runtime/in-flight-work-heartbeat.companion.js +97 -0
  169. package/dist/esm/core/runtime/in-flight-work-heartbeat.companion.js.map +1 -0
  170. package/dist/esm/core/runtime/services/start-companion-application.service.d.ts +43 -3
  171. package/dist/esm/core/runtime/services/start-companion-application.service.d.ts.map +1 -1
  172. package/dist/esm/core/runtime/services/start-companion-application.service.js +127 -22
  173. package/dist/esm/core/runtime/services/start-companion-application.service.js.map +1 -1
  174. package/dist/esm/core/runtime/utils/companion-platform-config.companion.d.ts +11 -1
  175. package/dist/esm/core/runtime/utils/companion-platform-config.companion.d.ts.map +1 -1
  176. package/dist/esm/core/runtime/utils/companion-platform-config.companion.js +42 -19
  177. package/dist/esm/core/runtime/utils/companion-platform-config.companion.js.map +1 -1
  178. package/dist/esm/core/specifications/resource-specification-context.factory.d.ts.map +1 -1
  179. package/dist/esm/core/specifications/resource-specification-context.factory.js +10 -1
  180. package/dist/esm/core/specifications/resource-specification-context.factory.js.map +1 -1
  181. package/dist/esm/core/traceability/companion-traceability.models.d.ts +1 -7
  182. package/dist/esm/core/traceability/companion-traceability.models.d.ts.map +1 -1
  183. package/dist/esm/core/traceability/companion-traceability.models.js +3 -5
  184. package/dist/esm/core/traceability/companion-traceability.models.js.map +1 -1
  185. package/dist/esm/creation-conversation/creation-conversation.actors-system.definitions.d.ts.map +1 -1
  186. package/dist/esm/creation-conversation/creation-conversation.actors-system.definitions.js +15 -14
  187. package/dist/esm/creation-conversation/creation-conversation.actors-system.definitions.js.map +1 -1
  188. package/dist/esm/creation-conversation/creation-conversation.function-tools.d.ts +0 -23
  189. package/dist/esm/creation-conversation/creation-conversation.function-tools.d.ts.map +1 -1
  190. package/dist/esm/creation-conversation/creation-conversation.function-tools.js +251 -50
  191. package/dist/esm/creation-conversation/creation-conversation.function-tools.js.map +1 -1
  192. package/dist/esm/deliberations/models/deliberation-agents.actors-system.definitions.d.ts.map +1 -1
  193. package/dist/esm/deliberations/models/deliberation-agents.actors-system.definitions.js +0 -2
  194. package/dist/esm/deliberations/models/deliberation-agents.actors-system.definitions.js.map +1 -1
  195. package/dist/esm/deliberations/services/deliberation.companion.service.d.ts.map +1 -1
  196. package/dist/esm/deliberations/services/deliberation.companion.service.js +3 -2
  197. package/dist/esm/deliberations/services/deliberation.companion.service.js.map +1 -1
  198. package/dist/esm/email/models/email-template.actors-system.definitions.d.ts.map +1 -1
  199. package/dist/esm/email/models/email-template.actors-system.definitions.js +0 -1
  200. package/dist/esm/email/models/email-template.actors-system.definitions.js.map +1 -1
  201. package/dist/esm/email/services/email-template.companion.service.d.ts +5 -3
  202. package/dist/esm/email/services/email-template.companion.service.d.ts.map +1 -1
  203. package/dist/esm/email/services/email-template.companion.service.js +53 -255
  204. package/dist/esm/email/services/email-template.companion.service.js.map +1 -1
  205. package/dist/esm/email/utils/email-labels-file-source.utils.d.ts +12 -0
  206. package/dist/esm/email/utils/email-labels-file-source.utils.d.ts.map +1 -1
  207. package/dist/esm/email/utils/email-labels-file-source.utils.js +62 -3
  208. package/dist/esm/email/utils/email-labels-file-source.utils.js.map +1 -1
  209. package/dist/esm/email/utils/email-labels-tree.utils.d.ts +52 -0
  210. package/dist/esm/email/utils/email-labels-tree.utils.d.ts.map +1 -0
  211. package/dist/esm/email/utils/email-labels-tree.utils.js +261 -0
  212. package/dist/esm/email/utils/email-labels-tree.utils.js.map +1 -0
  213. package/dist/esm/executions/services/companion-actor-execution-persistence.adapter.d.ts +2 -0
  214. package/dist/esm/executions/services/companion-actor-execution-persistence.adapter.d.ts.map +1 -1
  215. package/dist/esm/executions/services/companion-actor-execution-persistence.adapter.js +21 -1
  216. package/dist/esm/executions/services/companion-actor-execution-persistence.adapter.js.map +1 -1
  217. package/dist/esm/executions/services/companion-executions.companion.service.d.ts +18 -1
  218. package/dist/esm/executions/services/companion-executions.companion.service.d.ts.map +1 -1
  219. package/dist/esm/executions/services/companion-executions.companion.service.js +187 -46
  220. package/dist/esm/executions/services/companion-executions.companion.service.js.map +1 -1
  221. package/dist/esm/expert-personas/models/expert-persona-critique.actors-system.definitions.d.ts.map +1 -1
  222. package/dist/esm/expert-personas/models/expert-persona-critique.actors-system.definitions.js +0 -1
  223. package/dist/esm/expert-personas/models/expert-persona-critique.actors-system.definitions.js.map +1 -1
  224. package/dist/esm/expert-personas/models/expert-persona-derivation.actors-system.definitions.d.ts.map +1 -1
  225. package/dist/esm/expert-personas/models/expert-persona-derivation.actors-system.definitions.js +0 -1
  226. package/dist/esm/expert-personas/models/expert-persona-derivation.actors-system.definitions.js.map +1 -1
  227. package/dist/esm/expert-personas/services/expert-persona.companion.service.d.ts.map +1 -1
  228. package/dist/esm/expert-personas/services/expert-persona.companion.service.js +10 -0
  229. package/dist/esm/expert-personas/services/expert-persona.companion.service.js.map +1 -1
  230. package/dist/esm/i18n/components/APPLICATION_LEVEL_NOTIFICATION_CENTER.en.d.ts +1 -8
  231. package/dist/esm/i18n/components/APPLICATION_LEVEL_NOTIFICATION_CENTER.en.d.ts.map +1 -1
  232. package/dist/esm/i18n/components/APPLICATION_LEVEL_NOTIFICATION_CENTER.en.js +2 -9
  233. package/dist/esm/i18n/components/APPLICATION_LEVEL_NOTIFICATION_CENTER.en.js.map +1 -1
  234. package/dist/esm/i18n/components/APPLICATION_LEVEL_USER_DROPDOWN.en.d.ts +2 -0
  235. package/dist/esm/i18n/components/APPLICATION_LEVEL_USER_DROPDOWN.en.d.ts.map +1 -1
  236. package/dist/esm/i18n/components/APPLICATION_LEVEL_USER_DROPDOWN.en.js +3 -1
  237. package/dist/esm/i18n/components/APPLICATION_LEVEL_USER_DROPDOWN.en.js.map +1 -1
  238. package/dist/esm/i18n/components/APP_LAYOUTS_AGENT_WORK_OVERRIDE_RATE_SETTINGS.en.d.ts +32 -0
  239. package/dist/esm/i18n/components/APP_LAYOUTS_AGENT_WORK_OVERRIDE_RATE_SETTINGS.en.d.ts.map +1 -0
  240. package/dist/esm/i18n/components/APP_LAYOUTS_AGENT_WORK_OVERRIDE_RATE_SETTINGS.en.js +32 -0
  241. package/dist/esm/i18n/components/APP_LAYOUTS_AGENT_WORK_OVERRIDE_RATE_SETTINGS.en.js.map +1 -0
  242. package/dist/esm/i18n/components/APP_LAYOUTS_APPEARANCE_SETTINGS.en.d.ts +0 -1
  243. package/dist/esm/i18n/components/APP_LAYOUTS_APPEARANCE_SETTINGS.en.d.ts.map +1 -1
  244. package/dist/esm/i18n/components/APP_LAYOUTS_APPEARANCE_SETTINGS.en.js +0 -1
  245. package/dist/esm/i18n/components/APP_LAYOUTS_APPEARANCE_SETTINGS.en.js.map +1 -1
  246. package/dist/esm/i18n/components/APP_LAYOUTS_BILLING_SETTINGS.en.d.ts +0 -7
  247. package/dist/esm/i18n/components/APP_LAYOUTS_BILLING_SETTINGS.en.d.ts.map +1 -1
  248. package/dist/esm/i18n/components/APP_LAYOUTS_BILLING_SETTINGS.en.js +0 -7
  249. package/dist/esm/i18n/components/APP_LAYOUTS_BILLING_SETTINGS.en.js.map +1 -1
  250. package/dist/esm/i18n/components/APP_LAYOUTS_CONNECTED_ACCOUNTS_SETTINGS.en.d.ts +30 -4
  251. package/dist/esm/i18n/components/APP_LAYOUTS_CONNECTED_ACCOUNTS_SETTINGS.en.d.ts.map +1 -1
  252. package/dist/esm/i18n/components/APP_LAYOUTS_CONNECTED_ACCOUNTS_SETTINGS.en.js +31 -5
  253. package/dist/esm/i18n/components/APP_LAYOUTS_CONNECTED_ACCOUNTS_SETTINGS.en.js.map +1 -1
  254. package/dist/esm/i18n/components/APP_LAYOUTS_INVITATIONS_SETTINGS.en.d.ts +0 -2
  255. package/dist/esm/i18n/components/APP_LAYOUTS_INVITATIONS_SETTINGS.en.d.ts.map +1 -1
  256. package/dist/esm/i18n/components/APP_LAYOUTS_INVITATIONS_SETTINGS.en.js +0 -2
  257. package/dist/esm/i18n/components/APP_LAYOUTS_INVITATIONS_SETTINGS.en.js.map +1 -1
  258. package/dist/esm/i18n/components/APP_LAYOUTS_MAIN_CONTAINER.en.d.ts +4 -0
  259. package/dist/esm/i18n/components/APP_LAYOUTS_MAIN_CONTAINER.en.d.ts.map +1 -1
  260. package/dist/esm/i18n/components/APP_LAYOUTS_MAIN_CONTAINER.en.js +5 -1
  261. package/dist/esm/i18n/components/APP_LAYOUTS_MAIN_CONTAINER.en.js.map +1 -1
  262. package/dist/esm/i18n/components/APP_LAYOUTS_SECURITY_SETTINGS.en.d.ts +1 -15
  263. package/dist/esm/i18n/components/APP_LAYOUTS_SECURITY_SETTINGS.en.d.ts.map +1 -1
  264. package/dist/esm/i18n/components/APP_LAYOUTS_SECURITY_SETTINGS.en.js +1 -15
  265. package/dist/esm/i18n/components/APP_LAYOUTS_SECURITY_SETTINGS.en.js.map +1 -1
  266. package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.en.d.ts +0 -3
  267. package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.en.d.ts.map +1 -1
  268. package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.en.js +0 -3
  269. package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.en.js.map +1 -1
  270. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.en.d.ts +49 -16
  271. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.en.d.ts.map +1 -1
  272. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.en.js +49 -16
  273. package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.en.js.map +1 -1
  274. package/dist/esm/i18n/components/LOW_LEVEL_AI_SYSTEM_CATALOG.en.d.ts +0 -5
  275. package/dist/esm/i18n/components/LOW_LEVEL_AI_SYSTEM_CATALOG.en.d.ts.map +1 -1
  276. package/dist/esm/i18n/components/LOW_LEVEL_AI_SYSTEM_CATALOG.en.js +0 -5
  277. package/dist/esm/i18n/components/LOW_LEVEL_AI_SYSTEM_CATALOG.en.js.map +1 -1
  278. package/dist/esm/i18n/components/LOW_LEVEL_BILLING_PLAN_CHANGE_PREVIEW.en.d.ts +3 -0
  279. package/dist/esm/i18n/components/LOW_LEVEL_BILLING_PLAN_CHANGE_PREVIEW.en.d.ts.map +1 -1
  280. package/dist/esm/i18n/components/LOW_LEVEL_BILLING_PLAN_CHANGE_PREVIEW.en.js +4 -1
  281. package/dist/esm/i18n/components/LOW_LEVEL_BILLING_PLAN_CHANGE_PREVIEW.en.js.map +1 -1
  282. package/dist/esm/i18n/components/LOW_LEVEL_BILLING_PRICING_TABLE.en.d.ts +7 -1
  283. package/dist/esm/i18n/components/LOW_LEVEL_BILLING_PRICING_TABLE.en.d.ts.map +1 -1
  284. package/dist/esm/i18n/components/LOW_LEVEL_BILLING_PRICING_TABLE.en.js +8 -2
  285. package/dist/esm/i18n/components/LOW_LEVEL_BILLING_PRICING_TABLE.en.js.map +1 -1
  286. package/dist/esm/i18n/components/LOW_LEVEL_BILLING_USAGE_DASHBOARD.en.d.ts +1 -0
  287. package/dist/esm/i18n/components/LOW_LEVEL_BILLING_USAGE_DASHBOARD.en.d.ts.map +1 -1
  288. package/dist/esm/i18n/components/LOW_LEVEL_BILLING_USAGE_DASHBOARD.en.js +2 -1
  289. package/dist/esm/i18n/components/LOW_LEVEL_BILLING_USAGE_DASHBOARD.en.js.map +1 -1
  290. package/dist/esm/i18n/components/LOW_LEVEL_DISPLAY_FIELD_FILE.en.d.ts +1 -0
  291. package/dist/esm/i18n/components/LOW_LEVEL_DISPLAY_FIELD_FILE.en.d.ts.map +1 -1
  292. package/dist/esm/i18n/components/LOW_LEVEL_DISPLAY_FIELD_FILE.en.js +2 -1
  293. package/dist/esm/i18n/components/LOW_LEVEL_DISPLAY_FIELD_FILE.en.js.map +1 -1
  294. package/dist/esm/i18n/components/LOW_LEVEL_DISPLAY_FIELD_NUMBER.en.d.ts +12 -0
  295. package/dist/esm/i18n/components/LOW_LEVEL_DISPLAY_FIELD_NUMBER.en.d.ts.map +1 -0
  296. package/dist/esm/i18n/components/LOW_LEVEL_DISPLAY_FIELD_NUMBER.en.js +12 -0
  297. package/dist/esm/i18n/components/LOW_LEVEL_DISPLAY_FIELD_NUMBER.en.js.map +1 -0
  298. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD.en.d.ts +1 -0
  299. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD.en.d.ts.map +1 -1
  300. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD.en.js +2 -1
  301. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD.en.js.map +1 -1
  302. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_ADDRESS.en.d.ts +10 -0
  303. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_ADDRESS.en.d.ts.map +1 -1
  304. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_ADDRESS.en.js +11 -1
  305. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_ADDRESS.en.js.map +1 -1
  306. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_FILE.en.d.ts +8 -0
  307. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_FILE.en.d.ts.map +1 -1
  308. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_FILE.en.js +9 -1
  309. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_FILE.en.js.map +1 -1
  310. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.en.d.ts +3 -0
  311. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.en.d.ts.map +1 -1
  312. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.en.js +4 -1
  313. package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.en.js.map +1 -1
  314. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.en.d.ts +2 -1
  315. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.en.d.ts.map +1 -1
  316. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.en.js +3 -2
  317. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.en.js.map +1 -1
  318. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_OPERATIONS_BULK.en.d.ts +6 -0
  319. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_OPERATIONS_BULK.en.d.ts.map +1 -1
  320. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_OPERATIONS_BULK.en.js +7 -1
  321. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_OPERATIONS_BULK.en.js.map +1 -1
  322. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_OPERATIONS_ITEMS.en.d.ts +1 -0
  323. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_OPERATIONS_ITEMS.en.d.ts.map +1 -1
  324. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_OPERATIONS_ITEMS.en.js +2 -1
  325. package/dist/esm/i18n/components/RESOURCES_LAYOUTS_OPERATIONS_ITEMS.en.js.map +1 -1
  326. package/dist/esm/i18n/components/progression_milestone_tracker.en.d.ts +0 -2
  327. package/dist/esm/i18n/components/progression_milestone_tracker.en.d.ts.map +1 -1
  328. package/dist/esm/i18n/components/progression_milestone_tracker.en.js +0 -2
  329. package/dist/esm/i18n/components/progression_milestone_tracker.en.js.map +1 -1
  330. package/dist/esm/i18n/composite_views/app.creation-conversation.en.d.ts +1 -0
  331. package/dist/esm/i18n/composite_views/app.creation-conversation.en.d.ts.map +1 -1
  332. package/dist/esm/i18n/composite_views/app.creation-conversation.en.js +123 -19
  333. package/dist/esm/i18n/composite_views/app.creation-conversation.en.js.map +1 -1
  334. package/dist/esm/i18n/composite_views/app.creation-dossier.en.d.ts.map +1 -1
  335. package/dist/esm/i18n/composite_views/app.creation-dossier.en.js +12 -0
  336. package/dist/esm/i18n/composite_views/app.creation-dossier.en.js.map +1 -1
  337. package/dist/esm/i18n/errors_guidance/errors-guidance.en.d.ts +25 -0
  338. package/dist/esm/i18n/errors_guidance/errors-guidance.en.d.ts.map +1 -0
  339. package/dist/esm/i18n/errors_guidance/errors-guidance.en.js +26 -0
  340. package/dist/esm/i18n/errors_guidance/errors-guidance.en.js.map +1 -0
  341. package/dist/esm/i18n/errors_messages/errors-messages.en.d.ts +26 -3
  342. package/dist/esm/i18n/errors_messages/errors-messages.en.d.ts.map +1 -1
  343. package/dist/esm/i18n/errors_messages/errors-messages.en.js +25 -3
  344. package/dist/esm/i18n/errors_messages/errors-messages.en.js.map +1 -1
  345. package/dist/esm/i18n/index.d.ts +10 -8
  346. package/dist/esm/i18n/index.d.ts.map +1 -1
  347. package/dist/esm/i18n/index.js +10 -8
  348. package/dist/esm/i18n/index.js.map +1 -1
  349. package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.en.d.ts +10 -0
  350. package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.en.d.ts.map +1 -1
  351. package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.en.js +2 -0
  352. package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.en.js.map +1 -1
  353. package/dist/esm/i18n/resources/workbenchApplicationSecrets.en.d.ts +97 -0
  354. package/dist/esm/i18n/resources/workbenchApplicationSecrets.en.d.ts.map +1 -0
  355. package/dist/esm/i18n/resources/workbenchApplicationSecrets.en.js +60 -0
  356. package/dist/esm/i18n/resources/workbenchApplicationSecrets.en.js.map +1 -0
  357. package/dist/esm/i18n/resources/workbenchAspects.en.d.ts.map +1 -1
  358. package/dist/esm/i18n/resources/workbenchAspects.en.js +6 -0
  359. package/dist/esm/i18n/resources/workbenchAspects.en.js.map +1 -1
  360. package/dist/esm/i18n/resources/workbenchBuildDispatches.en.d.ts +5 -0
  361. package/dist/esm/i18n/resources/workbenchBuildDispatches.en.d.ts.map +1 -1
  362. package/dist/esm/i18n/resources/workbenchBuildDispatches.en.js +1 -0
  363. package/dist/esm/i18n/resources/workbenchBuildDispatches.en.js.map +1 -1
  364. package/dist/esm/i18n/resources/workbenchCodingLaneStatus.en.d.ts +24 -0
  365. package/dist/esm/i18n/resources/workbenchCodingLaneStatus.en.d.ts.map +1 -1
  366. package/dist/esm/i18n/resources/workbenchCodingLaneStatus.en.js +8 -0
  367. package/dist/esm/i18n/resources/workbenchCodingLaneStatus.en.js.map +1 -1
  368. package/dist/esm/i18n/resources/workbenchDossierEntries.en.d.ts +30 -0
  369. package/dist/esm/i18n/resources/workbenchDossierEntries.en.d.ts.map +1 -1
  370. package/dist/esm/i18n/resources/workbenchDossierEntries.en.js +9 -0
  371. package/dist/esm/i18n/resources/workbenchDossierEntries.en.js.map +1 -1
  372. package/dist/esm/i18n/resources/workbenchGovernanceDocuments.en.d.ts +17 -4
  373. package/dist/esm/i18n/resources/workbenchGovernanceDocuments.en.d.ts.map +1 -1
  374. package/dist/esm/i18n/resources/workbenchGovernanceDocuments.en.js +32 -4
  375. package/dist/esm/i18n/resources/workbenchGovernanceDocuments.en.js.map +1 -1
  376. package/dist/esm/i18n/resources/workbenchParkedCodingQuestions.en.d.ts +8 -2
  377. package/dist/esm/i18n/resources/workbenchParkedCodingQuestions.en.d.ts.map +1 -1
  378. package/dist/esm/i18n/resources/workbenchParkedCodingQuestions.en.js +6 -2
  379. package/dist/esm/i18n/resources/workbenchParkedCodingQuestions.en.js.map +1 -1
  380. package/dist/esm/i18n/resources/workbenchPlaybookRuns.en.d.ts +18 -7
  381. package/dist/esm/i18n/resources/workbenchPlaybookRuns.en.d.ts.map +1 -1
  382. package/dist/esm/i18n/resources/workbenchPlaybookRuns.en.js +17 -7
  383. package/dist/esm/i18n/resources/workbenchPlaybookRuns.en.js.map +1 -1
  384. package/dist/esm/i18n/resources/workbenchPlaybooks.en.d.ts +28 -3
  385. package/dist/esm/i18n/resources/workbenchPlaybooks.en.d.ts.map +1 -1
  386. package/dist/esm/i18n/resources/workbenchPlaybooks.en.js +13 -3
  387. package/dist/esm/i18n/resources/workbenchPlaybooks.en.js.map +1 -1
  388. package/dist/esm/i18n/resources/workbenchRunWriteRecords.en.d.ts +3 -2
  389. package/dist/esm/i18n/resources/workbenchRunWriteRecords.en.d.ts.map +1 -1
  390. package/dist/esm/i18n/resources/workbenchRunWriteRecords.en.js +8 -2
  391. package/dist/esm/i18n/resources/workbenchRunWriteRecords.en.js.map +1 -1
  392. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.d.ts +118 -8
  393. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.d.ts.map +1 -1
  394. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.js +42 -16
  395. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.js.map +1 -1
  396. package/dist/esm/i18n/resources/workbenchWaitingPlaybookRuns.en.d.ts +12 -2
  397. package/dist/esm/i18n/resources/workbenchWaitingPlaybookRuns.en.d.ts.map +1 -1
  398. package/dist/esm/i18n/resources/workbenchWaitingPlaybookRuns.en.js +16 -2
  399. package/dist/esm/i18n/resources/workbenchWaitingPlaybookRuns.en.js.map +1 -1
  400. package/dist/esm/i18n/system_enums/application-creation.en.d.ts +10 -0
  401. package/dist/esm/i18n/system_enums/application-creation.en.d.ts.map +1 -1
  402. package/dist/esm/i18n/system_enums/application-creation.en.js +11 -0
  403. package/dist/esm/i18n/system_enums/application-creation.en.js.map +1 -1
  404. package/dist/esm/i18n/system_enums/processor-register.en.d.ts +6 -0
  405. package/dist/esm/i18n/system_enums/processor-register.en.d.ts.map +1 -1
  406. package/dist/esm/i18n/system_enums/processor-register.en.js +6 -0
  407. package/dist/esm/i18n/system_enums/processor-register.en.js.map +1 -1
  408. package/dist/esm/i18n/system_enums/workbench-dossier.en.d.ts +4 -1
  409. package/dist/esm/i18n/system_enums/workbench-dossier.en.d.ts.map +1 -1
  410. package/dist/esm/i18n/system_enums/workbench-dossier.en.js +5 -1
  411. package/dist/esm/i18n/system_enums/workbench-dossier.en.js.map +1 -1
  412. package/dist/esm/i18n/system_enums/workbench-secrets.en.d.ts +46 -0
  413. package/dist/esm/i18n/system_enums/workbench-secrets.en.d.ts.map +1 -0
  414. package/dist/esm/i18n/system_enums/workbench-secrets.en.js +46 -0
  415. package/dist/esm/i18n/system_enums/workbench-secrets.en.js.map +1 -0
  416. package/dist/esm/i18n/system_enums/workbench-specification-artifact.en.d.ts +8 -0
  417. package/dist/esm/i18n/system_enums/workbench-specification-artifact.en.d.ts.map +1 -1
  418. package/dist/esm/i18n/system_enums/workbench-specification-artifact.en.js +13 -0
  419. package/dist/esm/i18n/system_enums/workbench-specification-artifact.en.js.map +1 -1
  420. package/dist/esm/i18n-labelling/models/email-template-labelling-unit.models.d.ts +61 -0
  421. package/dist/esm/i18n-labelling/models/email-template-labelling-unit.models.d.ts.map +1 -0
  422. package/dist/esm/i18n-labelling/models/email-template-labelling-unit.models.js +22 -0
  423. package/dist/esm/i18n-labelling/models/email-template-labelling-unit.models.js.map +1 -0
  424. package/dist/esm/i18n-labelling/models/labelling-unit.models.d.ts +105 -24
  425. package/dist/esm/i18n-labelling/models/labelling-unit.models.d.ts.map +1 -1
  426. package/dist/esm/i18n-labelling/models/labelling-unit.models.js +55 -24
  427. package/dist/esm/i18n-labelling/models/labelling-unit.models.js.map +1 -1
  428. package/dist/esm/i18n-labelling/models/labelling.actors-system.definitions.d.ts.map +1 -1
  429. package/dist/esm/i18n-labelling/models/labelling.actors-system.definitions.js +0 -2
  430. package/dist/esm/i18n-labelling/models/labelling.actors-system.definitions.js.map +1 -1
  431. package/dist/esm/i18n-labelling/services/email-template-labelling-units.companion.service.d.ts +48 -0
  432. package/dist/esm/i18n-labelling/services/email-template-labelling-units.companion.service.d.ts.map +1 -0
  433. package/dist/esm/i18n-labelling/services/email-template-labelling-units.companion.service.js +145 -0
  434. package/dist/esm/i18n-labelling/services/email-template-labelling-units.companion.service.js.map +1 -0
  435. package/dist/esm/i18n-labelling/services/labelling-planner.companion.service.d.ts +70 -18
  436. package/dist/esm/i18n-labelling/services/labelling-planner.companion.service.d.ts.map +1 -1
  437. package/dist/esm/i18n-labelling/services/labelling-planner.companion.service.js +330 -113
  438. package/dist/esm/i18n-labelling/services/labelling-planner.companion.service.js.map +1 -1
  439. package/dist/esm/i18n-labelling/services/labelling-spec-context-loader.companion.service.d.ts +45 -0
  440. package/dist/esm/i18n-labelling/services/labelling-spec-context-loader.companion.service.d.ts.map +1 -1
  441. package/dist/esm/i18n-labelling/services/labelling-spec-context-loader.companion.service.js +208 -6
  442. package/dist/esm/i18n-labelling/services/labelling-spec-context-loader.companion.service.js.map +1 -1
  443. package/dist/esm/i18n-labelling/services/labellize-orchestrator.companion.service.d.ts +11 -2
  444. package/dist/esm/i18n-labelling/services/labellize-orchestrator.companion.service.d.ts.map +1 -1
  445. package/dist/esm/i18n-labelling/services/labellize-orchestrator.companion.service.js +101 -18
  446. package/dist/esm/i18n-labelling/services/labellize-orchestrator.companion.service.js.map +1 -1
  447. package/dist/esm/i18n-labelling/services/translate-orchestrator.companion.service.d.ts +64 -1
  448. package/dist/esm/i18n-labelling/services/translate-orchestrator.companion.service.d.ts.map +1 -1
  449. package/dist/esm/i18n-labelling/services/translate-orchestrator.companion.service.js +393 -70
  450. package/dist/esm/i18n-labelling/services/translate-orchestrator.companion.service.js.map +1 -1
  451. package/dist/esm/i18n-labelling/utils/declared-refusal-codes.utils.d.ts +9 -5
  452. package/dist/esm/i18n-labelling/utils/declared-refusal-codes.utils.d.ts.map +1 -1
  453. package/dist/esm/i18n-labelling/utils/declared-refusal-codes.utils.js.map +1 -1
  454. package/dist/esm/i18n-labelling/utils/email-template-translation.utils.d.ts +54 -0
  455. package/dist/esm/i18n-labelling/utils/email-template-translation.utils.d.ts.map +1 -0
  456. package/dist/esm/i18n-labelling/utils/email-template-translation.utils.js +74 -0
  457. package/dist/esm/i18n-labelling/utils/email-template-translation.utils.js.map +1 -0
  458. package/dist/esm/i18n-labelling/utils/frontend-derived-label-keys.utils.d.ts +3 -3
  459. package/dist/esm/i18n-labelling/utils/frontend-derived-label-keys.utils.js.map +1 -1
  460. package/dist/esm/i18n-labelling/utils/incomplete-plan-refusal.utils.d.ts +24 -0
  461. package/dist/esm/i18n-labelling/utils/incomplete-plan-refusal.utils.d.ts.map +1 -0
  462. package/dist/esm/i18n-labelling/utils/incomplete-plan-refusal.utils.js +34 -0
  463. package/dist/esm/i18n-labelling/utils/incomplete-plan-refusal.utils.js.map +1 -0
  464. package/dist/esm/i18n-labelling/utils/orphan-label-artifacts.utils.d.ts.map +1 -1
  465. package/dist/esm/i18n-labelling/utils/orphan-label-artifacts.utils.js +5 -1
  466. package/dist/esm/i18n-labelling/utils/orphan-label-artifacts.utils.js.map +1 -1
  467. package/dist/esm/i18n-labelling/utils/provider-display-name-keys.utils.d.ts +76 -0
  468. package/dist/esm/i18n-labelling/utils/provider-display-name-keys.utils.d.ts.map +1 -0
  469. package/dist/esm/i18n-labelling/utils/provider-display-name-keys.utils.js +110 -0
  470. package/dist/esm/i18n-labelling/utils/provider-display-name-keys.utils.js.map +1 -0
  471. package/dist/esm/i18n-labelling/utils/resource-section-label-keys.utils.d.ts +17 -0
  472. package/dist/esm/i18n-labelling/utils/resource-section-label-keys.utils.d.ts.map +1 -0
  473. package/dist/esm/i18n-labelling/utils/resource-section-label-keys.utils.js +23 -0
  474. package/dist/esm/i18n-labelling/utils/resource-section-label-keys.utils.js.map +1 -0
  475. package/dist/esm/i18n-labelling/utils/schema-fields-extractor.utils.d.ts +36 -3
  476. package/dist/esm/i18n-labelling/utils/schema-fields-extractor.utils.d.ts.map +1 -1
  477. package/dist/esm/i18n-labelling/utils/schema-fields-extractor.utils.js +77 -5
  478. package/dist/esm/i18n-labelling/utils/schema-fields-extractor.utils.js.map +1 -1
  479. package/dist/esm/i18n-labelling/utils/system-of-record-display-name-keys.utils.d.ts +38 -0
  480. package/dist/esm/i18n-labelling/utils/system-of-record-display-name-keys.utils.d.ts.map +1 -0
  481. package/dist/esm/i18n-labelling/utils/system-of-record-display-name-keys.utils.js +66 -0
  482. package/dist/esm/i18n-labelling/utils/system-of-record-display-name-keys.utils.js.map +1 -0
  483. package/dist/esm/index.d.ts.map +1 -1
  484. package/dist/esm/index.js +9 -3
  485. package/dist/esm/index.js.map +1 -1
  486. package/dist/esm/meta-workflows/models/application-build.actors-system.definitions.d.ts.map +1 -1
  487. package/dist/esm/meta-workflows/models/application-build.actors-system.definitions.js +0 -1
  488. package/dist/esm/meta-workflows/models/application-build.actors-system.definitions.js.map +1 -1
  489. package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.d.ts.map +1 -1
  490. package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.js +1 -3
  491. package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.js.map +1 -1
  492. package/dist/esm/meta-workflows/models/application-line-catalog.models.d.ts +11 -0
  493. package/dist/esm/meta-workflows/models/application-line-catalog.models.d.ts.map +1 -0
  494. package/dist/esm/meta-workflows/models/application-line-catalog.models.js +17 -0
  495. package/dist/esm/meta-workflows/models/application-line-catalog.models.js.map +1 -0
  496. package/dist/esm/meta-workflows/models/application-research-agent.actors-system.definitions.d.ts.map +1 -1
  497. package/dist/esm/meta-workflows/models/application-research-agent.actors-system.definitions.js +0 -1
  498. package/dist/esm/meta-workflows/models/application-research-agent.actors-system.definitions.js.map +1 -1
  499. package/dist/esm/meta-workflows/models/brief-adequacy.actors-system.definitions.js +1 -1
  500. package/dist/esm/meta-workflows/models/brief-adequacy.actors-system.definitions.js.map +1 -1
  501. package/dist/esm/meta-workflows/models/composite-round-relaunch.models.d.ts +14 -0
  502. package/dist/esm/meta-workflows/models/composite-round-relaunch.models.d.ts.map +1 -1
  503. package/dist/esm/meta-workflows/models/composite-round-relaunch.models.js +18 -0
  504. package/dist/esm/meta-workflows/models/composite-round-relaunch.models.js.map +1 -1
  505. package/dist/esm/meta-workflows/models/human-decision-settler.models.d.ts +14 -0
  506. package/dist/esm/meta-workflows/models/human-decision-settler.models.d.ts.map +1 -0
  507. package/dist/esm/meta-workflows/models/human-decision-settler.models.js +18 -0
  508. package/dist/esm/meta-workflows/models/human-decision-settler.models.js.map +1 -0
  509. package/dist/esm/meta-workflows/models/meta-workflows-lane.models.d.ts +31 -23
  510. package/dist/esm/meta-workflows/models/meta-workflows-lane.models.d.ts.map +1 -1
  511. package/dist/esm/meta-workflows/models/meta-workflows-lane.models.js +36 -5
  512. package/dist/esm/meta-workflows/models/meta-workflows-lane.models.js.map +1 -1
  513. package/dist/esm/meta-workflows/models/meta-workflows.actors-system.definitions.d.ts.map +1 -1
  514. package/dist/esm/meta-workflows/models/meta-workflows.actors-system.definitions.js +1 -3
  515. package/dist/esm/meta-workflows/models/meta-workflows.actors-system.definitions.js.map +1 -1
  516. package/dist/esm/meta-workflows/models/playbook-run-checkpoint.models.d.ts +19 -0
  517. package/dist/esm/meta-workflows/models/playbook-run-checkpoint.models.d.ts.map +1 -1
  518. package/dist/esm/meta-workflows/models/playbook-run-checkpoint.models.js +38 -6
  519. package/dist/esm/meta-workflows/models/playbook-run-checkpoint.models.js.map +1 -1
  520. package/dist/esm/meta-workflows/models/playbook-run-record.models.d.ts +48 -3
  521. package/dist/esm/meta-workflows/models/playbook-run-record.models.d.ts.map +1 -1
  522. package/dist/esm/meta-workflows/models/playbook-run-record.models.js +61 -8
  523. package/dist/esm/meta-workflows/models/playbook-run-record.models.js.map +1 -1
  524. package/dist/esm/meta-workflows/services/__tests__/support/in-memory-actor-plane.d.ts +15 -1
  525. package/dist/esm/meta-workflows/services/__tests__/support/in-memory-actor-plane.d.ts.map +1 -1
  526. package/dist/esm/meta-workflows/services/__tests__/support/in-memory-actor-plane.js +50 -5
  527. package/dist/esm/meta-workflows/services/__tests__/support/in-memory-actor-plane.js.map +1 -1
  528. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts +52 -9
  529. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts.map +1 -1
  530. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js +131 -59
  531. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js.map +1 -1
  532. package/dist/esm/meta-workflows/services/application-build-experience-skills.companion.service.d.ts +19 -0
  533. package/dist/esm/meta-workflows/services/application-build-experience-skills.companion.service.d.ts.map +1 -0
  534. package/dist/esm/meta-workflows/services/application-build-experience-skills.companion.service.js +36 -0
  535. package/dist/esm/meta-workflows/services/application-build-experience-skills.companion.service.js.map +1 -0
  536. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.d.ts +9 -0
  537. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.d.ts.map +1 -1
  538. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.js +41 -17
  539. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.js.map +1 -1
  540. package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.d.ts +42 -2
  541. package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.d.ts.map +1 -1
  542. package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.js +121 -4
  543. package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.js.map +1 -1
  544. package/dist/esm/meta-workflows/services/application-build-website-context.companion.service.d.ts +32 -0
  545. package/dist/esm/meta-workflows/services/application-build-website-context.companion.service.d.ts.map +1 -0
  546. package/dist/esm/meta-workflows/services/application-build-website-context.companion.service.js +161 -0
  547. package/dist/esm/meta-workflows/services/application-build-website-context.companion.service.js.map +1 -0
  548. package/dist/esm/meta-workflows/services/build-plan-authoring.companion.service.d.ts +2 -0
  549. package/dist/esm/meta-workflows/services/build-plan-authoring.companion.service.d.ts.map +1 -1
  550. package/dist/esm/meta-workflows/services/build-plan-authoring.companion.service.js +1 -0
  551. package/dist/esm/meta-workflows/services/build-plan-authoring.companion.service.js.map +1 -1
  552. package/dist/esm/meta-workflows/services/capability-composition-executor.companion.service.d.ts +3 -2
  553. package/dist/esm/meta-workflows/services/capability-composition-executor.companion.service.d.ts.map +1 -1
  554. package/dist/esm/meta-workflows/services/capability-composition-executor.companion.service.js +12 -3
  555. package/dist/esm/meta-workflows/services/capability-composition-executor.companion.service.js.map +1 -1
  556. package/dist/esm/meta-workflows/services/dossier.companion.service.d.ts +74 -1
  557. package/dist/esm/meta-workflows/services/dossier.companion.service.d.ts.map +1 -1
  558. package/dist/esm/meta-workflows/services/dossier.companion.service.js +227 -30
  559. package/dist/esm/meta-workflows/services/dossier.companion.service.js.map +1 -1
  560. package/dist/esm/meta-workflows/services/foundation-executor.companion.service.d.ts +29 -2
  561. package/dist/esm/meta-workflows/services/foundation-executor.companion.service.d.ts.map +1 -1
  562. package/dist/esm/meta-workflows/services/foundation-executor.companion.service.js +68 -5
  563. package/dist/esm/meta-workflows/services/foundation-executor.companion.service.js.map +1 -1
  564. package/dist/esm/meta-workflows/services/governed-document-texts.companion.d.ts +40 -0
  565. package/dist/esm/meta-workflows/services/governed-document-texts.companion.d.ts.map +1 -0
  566. package/dist/esm/meta-workflows/services/governed-document-texts.companion.js +91 -0
  567. package/dist/esm/meta-workflows/services/governed-document-texts.companion.js.map +1 -0
  568. package/dist/esm/meta-workflows/services/governed-documents-pdf.companion.d.ts +25 -0
  569. package/dist/esm/meta-workflows/services/governed-documents-pdf.companion.d.ts.map +1 -0
  570. package/dist/esm/meta-workflows/services/governed-documents-pdf.companion.js +40 -0
  571. package/dist/esm/meta-workflows/services/governed-documents-pdf.companion.js.map +1 -0
  572. package/dist/esm/meta-workflows/services/playbook-instance.companion.service.d.ts +90 -0
  573. package/dist/esm/meta-workflows/services/playbook-instance.companion.service.d.ts.map +1 -0
  574. package/dist/esm/meta-workflows/services/playbook-instance.companion.service.js +307 -0
  575. package/dist/esm/meta-workflows/services/playbook-instance.companion.service.js.map +1 -0
  576. package/dist/esm/meta-workflows/services/playbook-run-write-register.companion.service.d.ts +29 -0
  577. package/dist/esm/meta-workflows/services/playbook-run-write-register.companion.service.d.ts.map +1 -1
  578. package/dist/esm/meta-workflows/services/playbook-run-write-register.companion.service.js +44 -4
  579. package/dist/esm/meta-workflows/services/playbook-run-write-register.companion.service.js.map +1 -1
  580. package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts +360 -47
  581. package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts.map +1 -1
  582. package/dist/esm/meta-workflows/services/playbook-run.companion.service.js +1424 -246
  583. package/dist/esm/meta-workflows/services/playbook-run.companion.service.js.map +1 -1
  584. package/package.json +17 -17
  585. package/dist/esm/__time-gov.probe.d.mts +0 -0
  586. package/dist/esm/__time-gov.probe.d.mts.map +0 -0
  587. package/dist/esm/__time-gov.probe.mjs.map +0 -0
  588. package/dist/esm/core/introspection/subprocess/family-aspects.behavior.head-parity.tmp.d.ts +0 -0
  589. package/dist/esm/core/introspection/subprocess/family-aspects.behavior.head-parity.tmp.d.ts.map +0 -0
  590. package/dist/esm/core/introspection/subprocess/family-aspects.behavior.head-parity.tmp.js.map +0 -0
  591. package/dist/esm/i18n/composite_views/app.creation-board.en.d.ts +0 -0
  592. package/dist/esm/i18n/composite_views/app.creation-board.en.d.ts.map +0 -0
  593. package/dist/esm/i18n/composite_views/app.creation-board.en.js.map +0 -0
  594. package/dist/esm/meta-workflows/services/creator-inputs.companion.service.d.ts +0 -0
  595. package/dist/esm/meta-workflows/services/creator-inputs.companion.service.d.ts.map +0 -0
  596. package/dist/esm/meta-workflows/services/creator-inputs.companion.service.js.map +0 -0
@@ -21,6 +21,12 @@
21
21
  * the CLI mutates the same worktree from other processes). An in-memory
22
22
  * flag fronts the lock for fast 409s. The lock is held for the WHOLE run.
23
23
  *
24
+ * That is the SINGLE-FLIGHT mode. A CONCURRENT run (#1528, a parallel build
25
+ * wave) holds no lock and takes it only around its commit, so the lock is
26
+ * no longer the signal that "a coding agent is running" — the
27
+ * `coding-run.heartbeat` beaten from the active-run set is (see
28
+ * `CODING_RUN_HEARTBEAT_RELATIVE_PATH`).
29
+ *
24
30
  * The P-35 recursion cap falls out structurally: a dispatched run that
25
31
  * calls dispatch (it has shell access and can read the machine-local
26
32
  * token) always finds the lock held by ITS OWN run and is rejected 409 —
@@ -95,25 +101,28 @@ import { ApplicationSpecificationFamily } from '@wildo-ai/saas-specifications/ap
95
101
  import { AgentAnswerAttemptDecision, decideAgentAnswerAttempt, ParkedQuestionAnswerOutputSchema, ParkedQuestionAnswerVerdict, readParkedQuestionAnswers, renderParkedQuestionAnswerPrompt, withParkedQuestionAnswer, } from '../models/parked-question-answer.models.js';
96
102
  import { PARKED_QUESTION_ANSWERER_AGENT_REF } from '../models/parked-question-answerer.actors-system.definitions.js';
97
103
  import { applicationCodingExclusiveSubject, CODING_RUN_WINDOW_RETENTION_MS, CodingRunConcurrency, describeRunConcurrency, isConcurrentRunSubject, selectBudgetCountingFailures, collectRunClaimedPaths, } from '../models/concurrent-coding-runs.models.js';
98
- import { inject, injectable } from 'inversify';
99
- import { ActorsSystemBackendService, AgentsBackendService, ErrorBuilderBackendService, LoggerService, SAAS_SERVICE_TYPES, executeBoundedSubprocess, describeCaughtError, isActorExecutionSubjectBusyError, } from '@wildo-ai/saas-backend-lib';
104
+ import { inject, injectable, optional } from 'inversify';
105
+ import { ActorsSystemBackendService, AgentsBackendService, ErrorBuilderBackendService, LoggerService, SAAS_SERVICE_TYPES, WorkerShutdownManagerBackendService, executeBoundedSubprocess, describeCaughtError, actorExecutionSuspensionRef, isActorExecutionNotSuspendedError, isActorExecutionSubjectBusyError, } from '@wildo-ai/saas-backend-lib';
100
106
  import { Actor_Task_Topics, ErrorCustomMessageReference, ErrorType, FlowsActors_IO_PartKind, FlowsActors_Status, isWildoBackendError, HumanDecision_FieldKind, HumanDecision_ResponseIntent, } from '@wildo-ai/saas-models';
101
107
  import { CodingAgent_StopReason, } from '@wildo-ai/external-connectors-models';
102
108
  import { getWorkspaceMutationLockPath as resolveWorkspaceMutationLockPath, withDedicatedFileLock, } from '@wildo-ai/platform-config-lib';
103
109
  import { sanitizeWorkbenchCreationPlaneIdentity, Workbench_ParkedCodingQuestionOptionRef, WORKBENCH_PARKED_CODING_QUESTION_FIELD_REF, WORKBENCH_TASK_CORRELATION_DOMAIN, WorkbenchTaskCorrelationRef, } from '@wildo-ai/platform-core-shared';
104
110
  import { COMPANION_SERVICE_TYPES } from '../../core/inject/models/service-types.js';
111
+ import { InFlightWorkHeartbeat } from '../../core/runtime/in-flight-work-heartbeat.companion.js';
105
112
  import { CompanionTraceabilityLevel, CompanionTraceAliasKind } from '../../core/traceability/companion-traceability.models.js';
106
113
  import { CompanionTraceabilityService } from '../../core/traceability/companion-traceability.service.js';
107
114
  import { CompanionIntrospectionService } from '../../core/introspection/services/companion-introspection.companion.service.js';
108
115
  import { CompanionExecutionsCompanionService } from '../../executions/services/companion-executions.companion.service.js';
109
- import { CompanionActorTasksListQuerySchema, CompanionExecutionsListQuerySchema } from '../../companion-api/companion-api.schemas.js';
116
+ import { CompanionActorTasksListQuerySchema } from '../../companion-api/companion-api.schemas.js';
110
117
  import { GitChangeSetCompanionService, isConcurrentHostLanePath, isOutsideApplicationRootPath } from './git-change-set.companion.service.js';
111
118
  import { CodingRunWriteRegisterCompanionService } from './coding-run-write-register.companion.service.js';
112
119
  import { PlaybookLaneBoundaryDecision } from '@wildo-ai/application-creation-runtime';
113
120
  import { APPLICATION_CREATION_AUTONOMY_POSTURE, LaneBoundaryTreatment, laneBoundaryTreatmentFor, } from '../../meta-workflows/models/playbook-run-checkpoint.models.js';
114
- import { AcceptOrigin, AcceptedChangeCommitCompanionService, NothingToAcceptError } from './accepted-change-commit.companion.service.js';
121
+ import { AcceptOrigin, AcceptRefusalReason, AcceptedChangeCommitCompanionService, NothingToAcceptError } from './accepted-change-commit.companion.service.js';
122
+ import { listInFlightCodingRuns } from './in-flight-coding-runs.companion.js';
115
123
  import { APPLICATION_CODING_TURN_CLASSIFIER_AGENT_REF, CodingTurnEndClassificationOutputSchema, APPLICATION_CODING_AGENT_REFS, APPLICATION_CODING_SYSTEM_REF, APPLICATION_CODING_WORKTREE_SUBJECT, isApplicationCodingAgentRef, resolveSelectedApplicationCodingAgentBinding, } from '../../meta-workflows/models/application-coding-agent.actors-system.definitions.js';
116
- import { ChangeSetAttributionClass, ApplicationCodingTaskDisposition, CodingRunFailureAttribution, deriveCodingRunFailureAttribution, APPLICATION_CODING_CONTRACT_REFUSAL_MARKER, DISPATCH_DEFAULT_MAX_CAPTURED_BYTES, DISPATCH_DEFAULT_TIMEOUT_MS, DISPATCH_HARD_MAX_CAPTURED_BYTES, DISPATCH_HARD_MAX_TIMEOUT_MS, VerificationKind, renderApplicationCodingTaskAgentPrompt, resolveApplicationCodingTaskVerificationPlans, } from '../models/coding-agent-dispatch.models.js';
124
+ import { humanDecisionSettler } from '../../meta-workflows/models/human-decision-settler.models.js';
125
+ import { ApplicationCodingTaskDisposition, CodingRunFailureAttribution, CodingRunStart, deriveCodingRunFailureAttribution, deriveCodingRunStart, isAttributedToAnotherWriter, APPLICATION_CODING_CONTRACT_REFUSAL_MARKER, DISPATCH_DEFAULT_MAX_CAPTURED_BYTES, DISPATCH_DEFAULT_TIMEOUT_MS, DISPATCH_HARD_MAX_CAPTURED_BYTES, DISPATCH_HARD_MAX_TIMEOUT_MS, VerificationKind, renderApplicationCodingTaskAgentPrompt, resolveApplicationCodingTaskVerificationPlans, } from '../models/coding-agent-dispatch.models.js';
117
126
  import { CodingSessionFrameRetention } from '../models/coding-session-frame-retention.js';
118
127
  import { isInfrastructureShapedAgentFailure, isProviderAccountAgentFailure } from '../../core/runtime/dev-compile-quiet.companion.js';
119
128
  import { diagnoseCarriedVerificationFailure } from '../../meta-workflows/models/carried-verification-failure.models.js';
@@ -124,6 +133,41 @@ const VERIFICATION_TIMEOUT_MS = 10 * 60_000;
124
133
  const VERIFICATION_MAX_CAPTURED_BYTES = 10 * 1024 * 1024;
125
134
  /** Tail size persisted on the task row; full streams go to traceability artifacts. */
126
135
  const OUTPUT_TAIL_CHARS = 16_000;
136
+ /**
137
+ * What became of a cancelled run's park (#1581, tenth review). Told apart because a person is told
138
+ * which: a best-effort withdraw can fail, and the store can fail to answer at all.
139
+ */
140
+ export var CancelledParkOutcome;
141
+ (function (CancelledParkOutcome) {
142
+ /** The park is gone — withdrawn now, or none was left to withdraw. */
143
+ CancelledParkOutcome["ENDED"] = "ended";
144
+ /** The withdraw failed and the question is still waiting. */
145
+ CancelledParkOutcome["STILL_WAITING"] = "still-waiting";
146
+ /** Neither could be confirmed: the run could not be read. */
147
+ CancelledParkOutcome["UNCONFIRMED"] = "unconfirmed";
148
+ })(CancelledParkOutcome || (CancelledParkOutcome = {}));
149
+ /**
150
+ * A read that found NO park — the task, its execution or its wait is absent — as opposed to a read that
151
+ * failed. The store's `NOT_FOUND` and the driver's `ACTOR_EXECUTION_NOT_SUSPENDED` are the only answers
152
+ * that mean "nothing is waiting here"; anything else means "could not tell" (#1581, tenth review R10-1).
153
+ */
154
+ function isAbsentParkRead(error) {
155
+ return error?.customMessageReference === ErrorCustomMessageReference.NOT_FOUND
156
+ || isActorExecutionNotSuspendedError(error);
157
+ }
158
+ /**
159
+ * How a parked run's resume went (#1581, seventh review). The two answerers act on it: only a resume
160
+ * that RAN can have parked again, and a person whose answer resumed nothing is told why.
161
+ */
162
+ var ParkedRunResumeOutcome;
163
+ (function (ParkedRunResumeOutcome) {
164
+ /** The driver admitted the resume and the continued turn ran, however it then ended. */
165
+ ParkedRunResumeOutcome["RAN"] = "ran";
166
+ /** An operator's cancel was found before any turn — before the driver moved anything, or just after, when the question is handed back — and the chain withdraws the park. */
167
+ ParkedRunResumeOutcome["CANCELLED"] = "cancelled";
168
+ /** The driver refused before moving anything — the run no longer waits on this decision, or another run holds its subject. The park is as it was. */
169
+ ParkedRunResumeOutcome["REFUSED"] = "refused";
170
+ })(ParkedRunResumeOutcome || (ParkedRunResumeOutcome = {}));
127
171
  /**
128
172
  * How one coding run's executor ENDED, as the engine's execution driver is told to record it.
129
173
  *
@@ -152,6 +196,28 @@ var CodingRunEnding;
152
196
  * because that is what made the judge answer INDETERMINATE about work it could not see.
153
197
  */
154
198
  const CHANGE_SET_SUMMARY_FILE_LIMIT = 40;
199
+ /**
200
+ * Where this process says "a coding agent is running", app-root-relative. Beaten while ANY run is in
201
+ * {@link CodingAgentDispatchCompanionService}'s active set — single-flight or concurrent, fresh or
202
+ * resumed — and removed when none is.
203
+ *
204
+ * ## Why the lock is not enough
205
+ *
206
+ * The dev supervisor holds a restart while a coding run is in flight, because a restart kills the
207
+ * agent with the companion (#1026). It used to know that from the workspace-mutation lock's heartbeat
208
+ * alone. Since #1528 a CONCURRENT run holds no lock — it takes one only around its commit — so a
209
+ * parallel build wave was invisible to the hold. Measured 2026-09-27 on Wonder Todos: a
210
+ * `bottom_up.build-dispatch` ran five concurrent children, two of them edited the frontend, the
211
+ * frontend's rebuild made the supervisor restart the companion onto it, and every child still running
212
+ * was killed; the run ended "the host running this execution stopped" with no measurement.
213
+ *
214
+ * A COPY of `CODING_RUN_HEARTBEAT_RELATIVE_PATH` in
215
+ * `scripts/dev-orchestrator/runtime-supervisor-lifecycle.mjs`, which cannot import this source; pinned
216
+ * equal by `scripts/__tests__/runtime-supervisor-workspace-mutation-hold.test.mjs`.
217
+ */
218
+ const CODING_RUN_HEARTBEAT_RELATIVE_PATH = '.wildo-saas/state/coding-run.heartbeat';
219
+ /** How often that file's mtime is refreshed; the supervisor judges it stale at three times this (`AGENT_RUN_HEARTBEAT_STALE_MS`). */
220
+ const CODING_RUN_HEARTBEAT_INTERVAL_MS = 5_000;
155
221
  /** Local narrow: is this an indexable object (not null, not an array)? */
156
222
  function isRecordValue(value) {
157
223
  return typeof value === 'object' && value !== null && !Array.isArray(value);
@@ -251,9 +317,7 @@ function assessApplicationCodingTaskMutationScope(changeSet, allowedPrefixes, pr
251
317
  * excluded three classes and reported one, which is how the judge came to read an unexplained gap
252
318
  * twice in an hour, about a different class each time.
253
319
  */
254
- const isExcludedFromScopeAssessment = (attribution) => attribution === ChangeSetAttributionClass.COMMITTED_DURING_RUN
255
- || attribution === ChangeSetAttributionClass.CONCURRENT_HOST_LANE
256
- || attribution === ChangeSetAttributionClass.OUTSIDE_APPLICATION_ROOT;
320
+ const isExcludedFromScopeAssessment = isAttributedToAnotherWriter;
257
321
  const outOfScopePaths = [
258
322
  ...changeSet.files
259
323
  .filter((entry) => !isExcludedFromScopeAssessment(entry.attribution))
@@ -398,6 +462,8 @@ function normalizeApplicationRelativePrefix(value) {
398
462
  function matchesApplicationRelativePrefix(path, prefix) {
399
463
  return path === prefix || path.startsWith(`${prefix}/`);
400
464
  }
465
+ /** How long one read of the coding agent's login serves the polled status route (#1637). */
466
+ const CODING_AGENT_LOGIN_CACHE_MS = 60_000;
401
467
  let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionService {
402
468
  logger;
403
469
  errorBuilder;
@@ -410,6 +476,7 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
410
476
  actorsSystem;
411
477
  codingRunWriteRegister;
412
478
  acceptedChangeCommit;
479
+ shutdownManager;
413
480
  logDebug;
414
481
  /**
415
482
  * The CANCEL HANDLE of the coding session this process is driving — nothing more (#1361).
@@ -421,6 +488,51 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
421
488
  * on a row is an `AbortController`, so that is what stays here.
422
489
  */
423
490
  activeRuns = new Map();
491
+ /**
492
+ * The {@link CODING_RUN_HEARTBEAT_RELATIVE_PATH} beat, in step with {@link activeRuns}. Built on first
493
+ * use, because harnesses build this service through `Object.create` and skip field initializers.
494
+ */
495
+ codingRunHeartbeat;
496
+ /**
497
+ * How deeply each task's coding work is in flight — what the heartbeat reads, rather than
498
+ * {@link activeRuns}'s size.
499
+ *
500
+ * `activeRuns` is keyed by task and RE-ENTERED: a run that parks on a question is resumed from inside
501
+ * its own chain (#1559), and that resume swaps its own registration in under the same key and puts the
502
+ * run's back afterwards (#1581). The heartbeat must not follow the set's size through that swap: a
503
+ * resume with no run registered around it would be one entry that appears and disappears unsynced, and
504
+ * a CONCURRENT run with no sibling would have the supervisor restart under it. So the heartbeat counts
505
+ * depth: {@link registerActiveRun} adds one, {@link unregisterActiveRun} takes one, and the resume adds
506
+ * and takes its own. The answer chain is held whole because it is registered whole (#1581). Built
507
+ * lazily for the same `Object.create` reason as the beat itself.
508
+ */
509
+ codingWorkDepth;
510
+ adjustCodingWorkDepth(taskId, delta) {
511
+ this.codingWorkDepth ??= new Map();
512
+ const next = (this.codingWorkDepth.get(taskId) ?? 0) + delta;
513
+ if (next > 0)
514
+ this.codingWorkDepth.set(taskId, next);
515
+ else
516
+ this.codingWorkDepth.delete(taskId);
517
+ this.syncCodingRunHeartbeat();
518
+ }
519
+ syncCodingRunHeartbeat() {
520
+ // No application root, nowhere to beat — a harness, never a running companion. The beat describes
521
+ // the run; it must never be able to fail it.
522
+ const saasRoot = this.companionContext?.saasRoot;
523
+ if (typeof saasRoot !== 'string')
524
+ return;
525
+ this.codingRunHeartbeat ??= new InFlightWorkHeartbeat(join(saasRoot, CODING_RUN_HEARTBEAT_RELATIVE_PATH), CODING_RUN_HEARTBEAT_INTERVAL_MS, (message, error) => this.logDebug(message, { error: describeCaughtError(error) }));
526
+ this.codingRunHeartbeat.sync((this.codingWorkDepth?.size ?? 0) > 0);
527
+ }
528
+ /**
529
+ * Who cancelled a run, keyed by its ABORT CONTROLLER (#1751 review N2). A resumed turn swaps a new
530
+ * registration in that SHARES the run's controller and restores the old one afterwards, so a field on
531
+ * the registration was lost when a person cancelled during that turn; the controller is the one thing
532
+ * both registrations hold. Not the abort REASON: consumers of the signal throw its reason, and the lane
533
+ * classifies a cancelled turn by its AbortError.
534
+ */
535
+ cancellersByController = new WeakMap();
424
536
  /**
425
537
  * Every coding run's time in the tree, kept for the runs that overlap it (#1528): a concurrent run
426
538
  * records which runs shared the tree with it and which paths they both changed. Pruned to
@@ -513,7 +625,7 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
513
625
  * subscriber never touches the run it observes.
514
626
  */
515
627
  codingSessionSubscribers = new Map();
516
- constructor(logger, errorBuilder, companionContext, agentsService, gitChangeSetService, executionsService, traceabilityService, introspectionService, actorsSystem, codingRunWriteRegister, acceptedChangeCommit) {
628
+ constructor(logger, errorBuilder, companionContext, agentsService, gitChangeSetService, executionsService, traceabilityService, introspectionService, actorsSystem, codingRunWriteRegister, acceptedChangeCommit, shutdownManager) {
517
629
  this.logger = logger;
518
630
  this.errorBuilder = errorBuilder;
519
631
  this.companionContext = companionContext;
@@ -525,6 +637,7 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
525
637
  this.actorsSystem = actorsSystem;
526
638
  this.codingRunWriteRegister = codingRunWriteRegister;
527
639
  this.acceptedChangeCommit = acceptedChangeCommit;
640
+ this.shutdownManager = shutdownManager;
528
641
  this.logDebug = this.logger.debugByType('CodingAgentDispatchCompanionService');
529
642
  this.logger.setDebugTypeLogging('CodingAgentDispatchCompanionService', true);
530
643
  }
@@ -562,11 +675,11 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
562
675
  * INTERNAL — indistinguishable from the host being broken. They are
563
676
  * VALIDATION: the request is refused, nothing was locked, created or run.
564
677
  */
565
- const task = this.admitTypedInput(() => MetaWorkflow_ApplicationCodingTaskContractSchema.parse(rawTask), 'Application coding task contract is not valid.');
678
+ const task = this.admitTypedInput(() => MetaWorkflow_ApplicationCodingTaskContractSchema.parse(rawTask), 'Application coding task contract is not valid.', { refusesTaskContract: true });
566
679
  // Resolve before acquiring the lock or creating a task. A semantic check
567
680
  // name is not a command and cannot silently fall back to an arbitrary
568
681
  // workspace typecheck.
569
- const verificationPlans = this.admitTypedInput(() => resolveApplicationCodingTaskVerificationPlans(task.verificationIntent.requiredChecks), 'Application coding task names an unregistered verification check.');
682
+ const verificationPlans = this.admitTypedInput(() => resolveApplicationCodingTaskVerificationPlans(task.verificationIntent.requiredChecks), 'Application coding task names an unregistered verification check.', { refusesTaskContract: true });
570
683
  const traceStep = this.createOperationTraceStep(sessionContext, 'application-coding-task-admission');
571
684
  const renderedPrompt = renderApplicationCodingTaskAgentPrompt(task);
572
685
  await this.traceOperationStart({
@@ -587,6 +700,19 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
587
700
  const admission = createDeferred();
588
701
  const runBody = async () => {
589
702
  let admitted;
703
+ /*
704
+ * Not while this process is going away (#1026). The supervisor's restart HOLD reads the
705
+ * workspace lock, so it protects a run that already holds it — but a dispatch still waiting
706
+ * (the compile-quiet wait before admission) holds none, the supervisor restarts, and the SIGTERM
707
+ * grace lets this process admit it anyway: measured 2026-09-25, a run was admitted at 11:18:12,
708
+ * five seconds after the supervisor's stop began, and was SIGKILLed with the companion. Checked
709
+ * here, under the lock and before anything is opened, so the refusal leaves no row behind and is
710
+ * a HOST refusal (it counts against no attempt budget, #1581).
711
+ */
712
+ if (this.shutdownManager?.isShutdownInProgress() === true) {
713
+ admission.reject(this.buildDispatchConflictError(`Coding task ${task.taskRef} was not started: the companion is shutting down. Dispatch it again once it is back.`));
714
+ return;
715
+ }
590
716
  // Before the baseline, never inside the run: a playbook file left uncommitted here would be
591
717
  // dirty at this run's baseline, and this run's own accept would then refuse it (#1534). A
592
718
  // concurrent run holds no lock, so it takes one for this commit only.
@@ -600,7 +726,7 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
600
726
  const opened = selected
601
727
  ? await this.startSelectedApplicationCodingExecution(selected, task, baseline, sessionContext, origin)
602
728
  : await this.openApplicationCodingExecution(task, baseline, sessionContext, origin, mode);
603
- this.activeRuns.set(opened.taskId, {
729
+ this.registerActiveRun({
604
730
  taskId: opened.taskId,
605
731
  startedAt: new Date().toISOString(),
606
732
  abortController: new AbortController(),
@@ -629,7 +755,11 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
629
755
  }
630
756
  finally {
631
757
  this.endCodingRunWindow(admitted.opened.taskId);
632
- this.activeRuns.delete(admitted.opened.taskId);
758
+ // A run cancelled while its question was handled ends here rather than staying parked (#1581). Awaited
759
+ // only when cancelled, so a chain that was not unregisters in the same synchronous step as its check.
760
+ if (this.isRunCancelled(admitted.opened.taskId))
761
+ await this.withdrawCancelledRunChain(admitted.opened.taskId, sessionContext);
762
+ this.unregisterActiveRun(admitted.opened.taskId);
633
763
  this.applicationCodingTaskSettlements.get(admitted.opened.taskId)?.resolve();
634
764
  this.announceRunStateChanged();
635
765
  }
@@ -760,7 +890,7 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
760
890
  * or one whose checkpoint cannot be read ({@link isParkedCodingRunAnswerable}). A park is NOT
761
891
  * aborted for its age: that reaped every question that waited longer than fifteen minutes (#1533).
762
892
  */
763
- async reconcileInterruptedApplicationCodingTasks(sessionContext) {
893
+ async reconcileInterruptedApplicationCodingTasks(sessionContext, options) {
764
894
  const reconciledTaskIds = [];
765
895
  const interruptedWhileRunning = [];
766
896
  await this.actorsSystem.reconcileOrphanedActorExecutions(APPLICATION_CODING_SYSTEM_REF, sessionContext, {
@@ -775,23 +905,40 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
775
905
  if (orphan.status === FlowsActors_Status.PENDING) {
776
906
  return { failure: { message: 'Selected, and the companion stopped before the run was admitted; nothing ran.' } };
777
907
  }
778
- interruptedWhileRunning.push(...orphan.tasks.map((task) => task._id));
908
+ // A concurrent run held only its own task, so siblings wrote in the tree beside it (#1528).
909
+ const sharedTree = isConcurrentRunSubject(orphan.exclusiveSubject);
910
+ for (const task of orphan.tasks) {
911
+ const run = { taskId: task._id, sharedTree };
912
+ interruptedWhileRunning.push(run);
913
+ options?.onInterrupted?.(run);
914
+ }
779
915
  return this.describeInterruptedCodingRun();
780
916
  },
781
917
  });
782
- await this.recoverInterruptedRunWrites(interruptedWhileRunning, sessionContext);
783
918
  const waiting = await this.actorsSystem.listSuspendedActorExecutions(APPLICATION_CODING_SYSTEM_REF, sessionContext);
784
919
  for (const row of waiting) {
785
920
  const checkpoint = ApplicationCodingRunCheckpointSchema.safeParse(row.checkpoint?.context);
786
921
  if (checkpoint.success && isParkedCodingRunAnswerable(checkpoint.data))
787
922
  continue;
788
- await this.actorsSystem.abortSuspendedActorExecution(row._id, await this.describeInterruptedCodingRun(), sessionContext);
923
+ try {
924
+ await this.actorsSystem.abortSuspendedActorExecution(row._id, await this.describeInterruptedCodingRun(), sessionContext);
925
+ }
926
+ catch (error) {
927
+ /*
928
+ * A lost swap (#1586): something else moved this run out of waiting between the listing and the
929
+ * abort — it is settled already, so there is nothing left to reconcile. Refusing the rest of the
930
+ * sweep for it would leave every later unanswerable park in place. Anything else still throws.
931
+ */
932
+ if (isActorExecutionNotSuspendedError(error))
933
+ continue;
934
+ throw error;
935
+ }
789
936
  reconciledTaskIds.push(...row.tasks.map((task) => task._id));
790
937
  }
791
- return { reconciledTaskIds };
938
+ return { reconciledTaskIds, interruptedWhileRunning };
792
939
  }
793
940
  /**
794
- * Give a run the host stopped under an OWNER for what it wrote, and accept that under the posture.
941
+ * Record what the runs a restart stopped had written, and accept it under the posture (#1805).
795
942
  *
796
943
  * ## Why this exists
797
944
  *
@@ -809,20 +956,39 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
809
956
  * The run's task input now carries its baseline's dirty files, so the change set is the same
810
957
  * capture a finished run gets, against the same baseline, recorded in the same write register.
811
958
  * Then the ordinary posture decides: under notify-and-proceed it is committed with the
812
- * INTERRUPTED_RUN_RECOVERY origin (forced, like the end-of-wave repair, because "already dirty"
813
- * and "edited since" are exactly what an interruption produces); under a posture that keeps
814
- * acceptance with a person, the record simply waits for the workbench's Accept, which could not
815
- * act on an interrupted run before because there was no record.
959
+ * INTERRUPTED_RUN_RECOVERY origin (forced, because "already dirty" and "edited since" are exactly
960
+ * what an interruption produces); under a posture that keeps acceptance with a person, the record
961
+ * simply waits for the workbench's Accept, which could not act on an interrupted run before because
962
+ * there was no record.
963
+ *
964
+ * ## Whose name the commit carries
965
+ *
966
+ * A run keeps its own commit only when it is the SOLE KNOWN WRITER of what it left: the only run the
967
+ * restart stopped, not a concurrent run, no concurrent run recorded writes during its window, none of its
968
+ * own files already dirty at its baseline, and no other recorded run may carry any of its uncommitted
969
+ * paths. Any other case is one commit, writer unknown, over
970
+ * what the interrupted runs and the concurrent runs recorded since the earliest of them began left
971
+ * uncommitted, naming every recorded run that may carry each file, failed runs included
972
+ * (`acceptSharedTreeRunsTogether`; the window picks the paths, never the names). That includes the
973
+ * finished siblings whose end-of-wave reconciliation the restart skipped — their leftovers are part of
974
+ * the same unattributable result, and committing them under their own names alone was the defect.
816
975
  *
817
976
  * A run started before its input carried `files` has no baseline to diff against and is left as
818
977
  * it was. BEST-EFFORT throughout: this runs on the boot path, and a boot path must not fail closed
819
978
  * on a repair (`continuity-drift-and-cas-basis.md`, Rule 3).
820
979
  */
821
- async recoverInterruptedRunWrites(taskIds, sessionContext) {
822
- const recoveredTaskRefs = [];
823
- for (const taskId of taskIds) {
980
+ async recoverInterruptedRunWrites(reported, sessionContext) {
981
+ const runs = await this.withRunsStillMarkedRunning(reported, sessionContext);
982
+ const recovered = [];
983
+ for (const run of runs) {
824
984
  try {
825
- const row = await this.executionsService.getActorTask(taskId, sessionContext);
985
+ /*
986
+ * Already recovered on an earlier boot (#1805 review N4): a run whose abort did not persist is found
987
+ * running again, and capturing it anew would overwrite the record that names its recovery commit.
988
+ */
989
+ if ((await this.codingRunWriteRegister.read(run.taskId))?.acceptedCommitSha !== undefined)
990
+ continue;
991
+ const row = await this.executionsService.getActorTask(run.taskId, sessionContext);
826
992
  const input = isRecordValue(row.input) ? row.input : undefined;
827
993
  const baseline = input && isRecordValue(input.baseline) ? input.baseline : undefined;
828
994
  const taskRef = input && typeof input.taskRef === 'string' ? input.taskRef : undefined;
@@ -837,19 +1003,76 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
837
1003
  const changeSet = await this.gitChangeSetService.captureChangeSet(snapshot);
838
1004
  if (changeSet.files.length === 0)
839
1005
  continue;
840
- await this.codingRunWriteRegister.record({ taskId, taskRef, changeSet });
841
- recoveredTaskRefs.push(taskRef);
1006
+ /*
1007
+ * A run that shared the tree is recorded CONCURRENT with no claims: nothing survived the restart
1008
+ * that says which of its captured files it wrote. So even the workbench's per-run Accept refuses
1009
+ * them unless forced — the refusal the recovery commit itself is forced past, and names.
1010
+ */
1011
+ await this.codingRunWriteRegister.record({ taskId: run.taskId, taskRef, changeSet, ...(run.sharedTree ? { claimedPaths: [] } : {}) });
1012
+ recovered.push({ ...run, startedAt: baseline.capturedAt });
842
1013
  }
843
1014
  catch (error) {
844
1015
  this.logger.warn('Could not recover the writes of an interrupted coding run; it stays for review', {
845
- taskId, error: describeCaughtError(error),
1016
+ taskId: run.taskId, error: describeCaughtError(error),
846
1017
  });
847
1018
  }
848
1019
  }
849
- if (recoveredTaskRefs.length === 0)
1020
+ if (recovered.length === 0)
850
1021
  return;
851
- const results = await this.reconcileAcceptance(recoveredTaskRefs, AcceptOrigin.INTERRUPTED_RUN_RECOVERY);
852
- this.logger.warn('Recovered the writes of coding run(s) interrupted by a restart', { recoveredTaskRefs, results });
1022
+ const recoveredIds = new Set(recovered.map((run) => run.taskId));
1023
+ const windowStartedAt = recovered.map((run) => run.startedAt).sort()[0];
1024
+ // Concurrent runs that recorded writes while the interrupted ones ran: the finishers of the same wave.
1025
+ const siblings = (await this.codingRunWriteRegister.list())
1026
+ .filter((record) => record.concurrent === true && !recoveredIds.has(record.taskId) && record.at >= windowStartedAt);
1027
+ /*
1028
+ * SOLE KNOWN WRITER only when nothing else may carry what it left: not concurrent, no concurrent run
1029
+ * recorded in its window, and — asked of every recorded run by the door's own test — no other run may
1030
+ * carry any of its uncommitted paths (#1805 review 5 F2: a leftover dirty at its baseline from a run
1031
+ * outside the window was committed under this run's name alone).
1032
+ *
1033
+ * Nor when a file of its OWN was already dirty at its baseline (#1805 review 6 O2): those earlier hunks
1034
+ * are a person's, a tool's or an earlier run's, and the run's own commit, "accept the coding run", would
1035
+ * present them as its writes. The joint commit carries them as what they are: writer unknown. A file the
1036
+ * capture attributes elsewhere (committed during the run, another lane's) is not this run's to judge
1037
+ * (review 7 I2).
1038
+ *
1039
+ * With that condition, `anotherRunMayCarry` decides nothing a live leftover can reach: a single-flight run
1040
+ * has no sibling in its window, so another record's uncommitted leftover was already dirty at its
1041
+ * baseline. It is kept deliberately (review 7 I1) as the same test the shared-tree door names runs by, so
1042
+ * recovery and the door cannot disagree if the baseline capture ever stops seeing a leftover.
1043
+ */
1044
+ const lone = recovered.length === 1 && !recovered[0].sharedTree && siblings.length === 0 ? recovered[0] : undefined;
1045
+ const loneRecord = lone === undefined ? undefined : await this.codingRunWriteRegister.read(lone.taskId);
1046
+ const sole = lone !== undefined && loneRecord !== undefined
1047
+ && !loneRecord.files.some((file) => file.dirtyAtBaseline && !isAttributedToAnotherWriter(file.attribution))
1048
+ && !(await this.acceptedChangeCommit.anotherRunMayCarry(lone.taskId).catch(() => true)) ? lone : undefined;
1049
+ const results = sole
1050
+ ? await this.reconcileAcceptance([loneRecord.taskRef], AcceptOrigin.INTERRUPTED_RUN_RECOVERY)
1051
+ : await this.reconcileAcceptanceTogether([...recoveredIds, ...siblings.map((record) => record.taskId)], AcceptOrigin.INTERRUPTED_RUN_RECOVERY);
1052
+ this.logger.warn('Recovered the writes of coding run(s) interrupted by a restart', { recoveredTaskIds: [...recoveredIds], results });
1053
+ }
1054
+ /**
1055
+ * The reported runs, plus any coding run STILL marked running (#1805 review N4). At this point in startup
1056
+ * nothing is running, so such a row is an orphan whose abort did not persist — or one the sweep never
1057
+ * reached because it threw first. Either way its writes are in the tree, and leaving it out would put
1058
+ * them into the recovery commit without its name. Concurrent by its subject, like the sweep decides.
1059
+ */
1060
+ async withRunsStillMarkedRunning(reported, sessionContext) {
1061
+ const byTaskId = new Map(reported.map((run) => [run.taskId, run]));
1062
+ try {
1063
+ for (const live of await this.listInFlightCodingRuns(sessionContext)) {
1064
+ const execution = await this.executionsService.getActorExecution(live.executionId, sessionContext);
1065
+ for (const task of execution.standaloneTasks ?? []) {
1066
+ const taskId = String(task._id);
1067
+ if (!byTaskId.has(taskId))
1068
+ byTaskId.set(taskId, { taskId, sharedTree: isConcurrentRunSubject(live.exclusiveSubject) });
1069
+ }
1070
+ }
1071
+ }
1072
+ catch (error) {
1073
+ this.logger.warn('Could not list the coding runs still marked running; recovering the reported ones', { error: describeCaughtError(error) });
1074
+ }
1075
+ return [...byTaskId.values()];
853
1076
  }
854
1077
  /**
855
1078
  * Write a run's baseline onto its own task, for a run whose task was opened before the baseline
@@ -880,16 +1103,39 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
880
1103
  * them as fresh, so they never enter any later change set. Measured 2026-09-24: an interrupted
881
1104
  * `i18n-labels` pass left ten label files uncommitted that no later run would ever commit.
882
1105
  */
883
- async reconcileInterruptedBuildGenerationSteps(buildSystemRef, sessionContext) {
1106
+ async reconcileInterruptedBuildGenerationSteps(buildSystemRef, sessionContext,
1107
+ /** As on the coding sweep: told each interrupted step as it is found; the caller recovers the writes. */
1108
+ options) {
884
1109
  const interrupted = [];
885
1110
  const { aborted } = await this.actorsSystem.reconcileOrphanedActorExecutions(buildSystemRef, sessionContext, {
886
1111
  describeOrphan: async (orphan) => {
887
- interrupted.push(...orphan.tasks.map((task) => task._id));
1112
+ /*
1113
+ * Not concurrent by its own subject. Whether it ran beside concurrent coding runs is decided at
1114
+ * recovery from the evidence: another run the same restart stopped, or a concurrent run that
1115
+ * recorded writes during the step's window (a wave runs a step inline while its runs write).
1116
+ */
1117
+ for (const task of orphan.tasks) {
1118
+ const run = { taskId: task._id, sharedTree: false };
1119
+ interrupted.push(run);
1120
+ options?.onInterrupted?.(run);
1121
+ }
888
1122
  return { failure: { message: 'The host running this generation step stopped before it concluded.' } };
889
1123
  },
890
1124
  });
891
- await this.recoverInterruptedRunWrites(interrupted, sessionContext);
892
- return { aborted };
1125
+ return { aborted, interrupted };
1126
+ }
1127
+ /**
1128
+ * Recover the writes of EVERY run one restart interrupted, coding runs and generation steps alike,
1129
+ * in one pass (#1805). A build wave runs a generation step beside its coding runs, so runs of both
1130
+ * kinds share the tree; recovered by two separate sweeps, the first would commit the other kind's
1131
+ * files under its own run's name. The sweeps only settle and report; startup collects what both
1132
+ * report and calls this once with the union.
1133
+ */
1134
+ async recoverWritesOfInterruptedRuns(runs, sessionContext) {
1135
+ const byTaskId = new Map();
1136
+ for (const run of runs)
1137
+ byTaskId.set(run.taskId, { taskId: run.taskId, sharedTree: run.sharedTree || byTaskId.get(run.taskId)?.sharedTree === true });
1138
+ await this.recoverInterruptedRunWrites([...byTaskId.values()], sessionContext);
893
1139
  }
894
1140
  /**
895
1141
  * What a reviewer needs to see on a coding run the host stopped under: where HEAD is and how
@@ -947,7 +1193,8 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
947
1193
  */
948
1194
  cancelActiveApplicationCodingTask() {
949
1195
  // Every run this process drives: a wave is cancelled as one (#1528). The first is named, as before.
950
- const active = [...this.activeRuns.values()];
1196
+ // An entry whose park is being WITHDRAWN runs nothing: it was cancelled already (#1581).
1197
+ const active = [...this.activeRuns.values()].filter((run) => run.withdrawal === undefined);
951
1198
  if (active.length === 0) {
952
1199
  return null;
953
1200
  }
@@ -957,6 +1204,90 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
957
1204
  }
958
1205
  return { taskId: active[0].taskId, startedAt: active[0].startedAt };
959
1206
  }
1207
+ /**
1208
+ * Cancel ONE coding run, named by its task id — the parked-question row's own verb (#1581, seventh
1209
+ * review F2). {@link cancelActiveApplicationCodingTask} ends everything this process drives, so from
1210
+ * a parked row it did nothing when no chain held that run, and otherwise stopped OTHER runs while
1211
+ * leaving the row's own run parked.
1212
+ *
1213
+ * Three answers, and what each promises (#1581, seventh to eleventh reviews):
1214
+ *
1215
+ * - A run this process is still handling — a turn, or its question being offered to the answering
1216
+ * agent — is SIGNALLED, exactly as the process-wide cancel signals it: `cancelled: true` means the
1217
+ * signal was given, and its chain withdraws the park on its way out. That withdraw's outcome is
1218
+ * recorded on the entry, so a second cancel meanwhile AWAITS it and reports it; a cancel after the
1219
+ * chain has gone finds the park (if the withdraw failed) and withdraws it itself.
1220
+ * - A run no chain holds here is WAITING, and is withdrawn at once under a guard entry: `cancelled:
1221
+ * true` only once it is gone, else a 409 saying the question is still waiting or could not be read.
1222
+ * - `cancelled: false` when the task is neither — no chain, and no park after reading twice (a chain
1223
+ * ending during the first read may have left one).
1224
+ *
1225
+ * A park read that FAILS is never taken for "nothing is waiting": with a live chain the chain is still
1226
+ * signalled, since that needs no read; without one the answer is the UNCONFIRMED 409.
1227
+ */
1228
+ async cancelApplicationCodingTask(taskId, sessionContext,
1229
+ /** The signed-in person cancelling (#1751), when the door has one: the withdrawal records them as the decider. */
1230
+ options) {
1231
+ // Read FIRST, then look for a chain: one that began meanwhile (a person's answer) owns the run by now.
1232
+ // A failed read stops nothing here: a live chain is signalled without one (#1581, eleventh review R11-1).
1233
+ const readPark = () => this.readParkedCodingRun(taskId, sessionContext, { strict: true })
1234
+ .then((parked) => ({ parked, failed: false }), (error) => {
1235
+ this.logger.warn('A per-run cancel could not read the coding run\'s park', { taskId, error: describeCaughtError(error) });
1236
+ return { parked: null, failed: true };
1237
+ });
1238
+ let read = await readPark();
1239
+ let live = this.activeRuns.get(taskId);
1240
+ if (!live && !read.parked && !read.failed) {
1241
+ // A chain that ended during the read may have left the run parked: read once more (#1581, tenth review R10-7).
1242
+ read = await readPark();
1243
+ live = this.activeRuns.get(taskId);
1244
+ }
1245
+ const { parked } = read;
1246
+ if (live) {
1247
+ // Already cancelled, its park being withdrawn: answer with THAT withdraw's outcome, never a second one (R9-4, R10-4).
1248
+ if (live.withdrawal)
1249
+ return this.reportCancelledPark(taskId, await live.withdrawal, live.startedAt);
1250
+ // Signal the chain; it ends the run on its way out, naming the canceller when there is one.
1251
+ this.logDebug('Cancelling one application coding task', { taskId });
1252
+ if (options?.actingUserId && !this.cancellersByController.has(live.abortController)) {
1253
+ this.cancellersByController.set(live.abortController, options.actingUserId);
1254
+ }
1255
+ live.abortController.abort();
1256
+ return { cancelled: true, taskId, startedAt: live.startedAt };
1257
+ }
1258
+ if (read.failed)
1259
+ return this.reportCancelledPark(taskId, CancelledParkOutcome.UNCONFIRMED);
1260
+ if (!parked)
1261
+ return { cancelled: false };
1262
+ /*
1263
+ * No chain will end it, so this door does (#1581, eighth review R8-2). Guarded by a registration taken
1264
+ * in the same synchronous step as the check above: a person's answer arriving meanwhile is refused 409
1265
+ * by `refuseWhileRunChainIsLive` rather than racing the withdraw in the driver, which takes no lock
1266
+ * between reading a run as waiting and moving it; and a second cancel awaits this withdraw.
1267
+ */
1268
+ const guard = { taskId, startedAt: new Date().toISOString(), abortController: new AbortController(), mode: parked.mode, withdrawalGuard: true };
1269
+ guard.abortController.abort();
1270
+ this.activeRuns.set(taskId, guard);
1271
+ guard.withdrawal = this.endParkIfWaiting(taskId, sessionContext, options?.actingUserId);
1272
+ try {
1273
+ const outcome = await guard.withdrawal;
1274
+ if (outcome === CancelledParkOutcome.ENDED)
1275
+ this.announceRunStateChanged();
1276
+ return this.reportCancelledPark(taskId, outcome);
1277
+ }
1278
+ finally {
1279
+ if (this.activeRuns.get(taskId) === guard)
1280
+ this.activeRuns.delete(taskId);
1281
+ }
1282
+ }
1283
+ /** A cancel's answer from what became of the park: ended, or a 409 that says why it is not (#1581, tenth review). */
1284
+ reportCancelledPark(taskId, outcome, startedAt) {
1285
+ if (outcome === CancelledParkOutcome.ENDED)
1286
+ return { cancelled: true, taskId, ...(startedAt !== undefined ? { startedAt } : {}) };
1287
+ throw this.buildDispatchConflictError(outcome === CancelledParkOutcome.STILL_WAITING
1288
+ ? `Coding task ${taskId} could not be cancelled: its question could not be withdrawn and is still waiting. Try again.`
1289
+ : `Coding task ${taskId} could not be confirmed cancelled: the run could not be read. Check it, and cancel it again if it is still waiting.`);
1290
+ }
960
1291
  /**
961
1292
  * The run holding the worktree right now, from the actor plane (#1361) — what the creation board's
962
1293
  * coding-lane badge shows. It read this process's cancel handle until 2026-09-20, so a run driven
@@ -969,10 +1300,36 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
969
1300
  return holder ? { taskId: holder.tasks[0]?._id ?? holder._id, startedAt: holder.createdAt ?? new Date().toISOString() } : null;
970
1301
  }
971
1302
  catch {
972
- const active = this.activeRuns.values().next().value;
1303
+ const active = [...this.activeRuns.values()].find((run) => run.withdrawal === undefined);
973
1304
  return active ? { taskId: active.taskId, startedAt: active.startedAt } : null;
974
1305
  }
975
1306
  }
1307
+ /** The last login read, shared by every status poll inside {@link CODING_AGENT_LOGIN_CACHE_MS}. */
1308
+ codingAgentLoginRead = null;
1309
+ /**
1310
+ * The selected agent's login on this host (#1637); `null` when the selection or its declaration is
1311
+ * unavailable.
1312
+ *
1313
+ * CACHED, because `getStatus` is polled — the creation board re-derives its watched boards every 15 s
1314
+ * and the status route is on the trace-exempt polling list — and the probe runs the agent's own status
1315
+ * command, which can take seconds. One read serves every poll inside the window, and concurrent polls
1316
+ * share the same in-flight read. Signing in shows up within the window, which is the cost.
1317
+ */
1318
+ readSelectedCodingAgentLogin() {
1319
+ const now = Date.now();
1320
+ if (this.codingAgentLoginRead && now - this.codingAgentLoginRead.at < CODING_AGENT_LOGIN_CACHE_MS)
1321
+ return this.codingAgentLoginRead.value;
1322
+ const value = (async () => {
1323
+ try {
1324
+ return await this.agentsService.readCodingAgentHostLogin(resolveSelectedApplicationCodingAgentBinding().providerRef);
1325
+ }
1326
+ catch {
1327
+ return null;
1328
+ }
1329
+ })();
1330
+ this.codingAgentLoginRead = { at: now, value };
1331
+ return value;
1332
+ }
976
1333
  async getStatus() {
977
1334
  return {
978
1335
  // Reports a fact this service can actually establish: whether the coding
@@ -983,6 +1340,7 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
983
1340
  // Every declared agent must resolve, not merely the default: a registry
984
1341
  // missing the SELECTED agent reports healthy while dispatch refuses.
985
1342
  codingAgentRegistered: APPLICATION_CODING_AGENT_REFS.every((ref) => this.agentsService.getAgent(ref) !== undefined),
1343
+ codingAgentLogin: await this.readSelectedCodingAgentLogin(),
986
1344
  activeRun: await this.readActiveCodingRun(),
987
1345
  // The answerable set: what is parked waiting for an operator response.
988
1346
  pendingQuestions: await this.listPendingCodingQuestions(),
@@ -1064,23 +1422,80 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
1064
1422
  retries: { retries: 120, minTimeout: 500, maxTimeout: 5_000 },
1065
1423
  });
1066
1424
  }
1425
+ /** Whether a CONCURRENT coding run is live now (#1528): it writes in the tree without holding the workspace lock. */
1426
+ async concurrentCodingRunsLive(sessionContext) {
1427
+ if (this.concurrentRunLiveInProcess())
1428
+ return true;
1429
+ // The actor plane also sees a run another process drives. Asked twice; if it cannot answer, this
1430
+ // process's own runs are the answer (#1805 review R5), never a blanket "shared" nothing would ever settle.
1431
+ for (let attempt = 0; attempt < 2; attempt += 1) {
1432
+ try {
1433
+ return (await this.listInFlightCodingRuns(sessionContext)).some((run) => isConcurrentRunSubject(run.exclusiveSubject));
1434
+ }
1435
+ catch (error) {
1436
+ if (attempt === 1) {
1437
+ this.logger.warn('Could not list the live coding runs; judging sharing by this process\'s own runs', { error: describeCaughtError(error) });
1438
+ }
1439
+ }
1440
+ }
1441
+ return false;
1442
+ }
1443
+ /** Whether this process drives a CONCURRENT run now — one writing the tree without holding the workspace lock. */
1444
+ concurrentRunLiveInProcess(exceptTaskIds = []) {
1445
+ return [...this.activeRuns.values()].some((run) => run.mode === CodingRunConcurrency.CONCURRENT && run.withdrawalGuard !== true && !exceptTaskIds.includes(run.taskId));
1446
+ }
1067
1447
  /**
1068
- * The live coding runs — selected, admitted or running — from the actor plane, so the answer holds
1069
- * across processes and restarts (#1528). A parked run is not live: its agent is closed.
1448
+ * When the current SHARING EPISODE began: the first instant, since the tree was last written by one run
1449
+ * at a time, that a concurrent run (or a step beside one) wrote it (#1805 review R5, R9). Process-local:
1450
+ * a restart ends every episode, and restart recovery covers what it interrupted.
1070
1451
  */
1071
- async listInFlightCodingRuns(sessionContext) {
1072
- const rows = (await Promise.all([FlowsActors_Status.PENDING, FlowsActors_Status.PROCESSING].map((status) => this.executionsService.listActorExecutions(CompanionExecutionsListQuerySchema.parse({ systemRef: APPLICATION_CODING_SYSTEM_REF, status, limit: 200 }), sessionContext)))).flat();
1073
- return rows.map((row) => {
1074
- const execution = row;
1075
- const input = execution.standaloneTasks?.[0]?.input;
1076
- return {
1077
- executionId: String(execution._id),
1078
- taskRef: isRecordValue(input) && typeof input.taskRef === 'string' ? input.taskRef : null,
1079
- ...(execution.exclusiveSubject ? { exclusiveSubject: execution.exclusiveSubject } : {}),
1080
- ...(execution.createdAt ? { createdAt: execution.createdAt } : {}),
1081
- };
1452
+ sharingEpisodeStartedAt;
1453
+ markSharingEpisodeStarted(at) {
1454
+ if (this.sharingEpisodeStartedAt === undefined || at < this.sharingEpisodeStartedAt)
1455
+ this.sharingEpisodeStartedAt = at;
1456
+ }
1457
+ /**
1458
+ * Register a run; a CONCURRENT one opens a sharing episode when none is open. One of the two doors that
1459
+ * keep the dev supervisor's view of "a coding agent is running" in step with this process's own
1460
+ * (see {@link CODING_RUN_HEARTBEAT_RELATIVE_PATH}).
1461
+ */
1462
+ registerActiveRun(run) {
1463
+ if (run.mode === CodingRunConcurrency.CONCURRENT)
1464
+ this.markSharingEpisodeStarted(new Date().toISOString());
1465
+ this.activeRuns.set(run.taskId, run);
1466
+ this.adjustCodingWorkDepth(run.taskId, 1);
1467
+ }
1468
+ /**
1469
+ * Unregister a run. When it was the last CONCURRENT run live, the sharing episode has ended and nothing
1470
+ * is writing beside anything: what the episode's runs left is committed together, as a wave's end does
1471
+ * (#1805 review R5). That is what commits a generation step, or a resumed parked run, that shared the tree
1472
+ * outside any wave — no wave's end would ever reach them.
1473
+ */
1474
+ unregisterActiveRun(taskId) {
1475
+ const was = this.activeRuns.get(taskId);
1476
+ this.activeRuns.delete(taskId);
1477
+ this.adjustCodingWorkDepth(taskId, -1);
1478
+ if (was?.mode !== CodingRunConcurrency.CONCURRENT || this.concurrentRunLiveInProcess())
1479
+ return;
1480
+ const startedAt = this.sharingEpisodeStartedAt;
1481
+ this.sharingEpisodeStartedAt = undefined;
1482
+ if (startedAt === undefined)
1483
+ return;
1484
+ this.sharingEpisodeReconciliation = this.reconcileSharedTree({ startedAt, taskIds: [] }).then(
1485
+ // Deferred (a run began writing while this waited for the lock), or the door failed: the episode goes on,
1486
+ // from the same start, for the next reconciliation (#1805 review 5 F3).
1487
+ ({ deferred, failed }) => { if (deferred || failed)
1488
+ this.markSharingEpisodeStarted(startedAt); }, (error) => {
1489
+ this.markSharingEpisodeStarted(startedAt);
1490
+ this.logger.warn('Could not commit what a sharing episode left; it is kept for the next reconciliation', { error: describeCaughtError(error) });
1082
1491
  });
1083
1492
  }
1493
+ /** The reconciliation the last sharing episode's end started, for a caller that must see its commit. */
1494
+ sharingEpisodeReconciliation = Promise.resolve();
1495
+ /** The live coding runs — selected, admitted or running — from the actor plane; see {@link listInFlightCodingRuns}. */
1496
+ async listInFlightCodingRuns(sessionContext) {
1497
+ return listInFlightCodingRuns(this.executionsService, sessionContext);
1498
+ }
1084
1499
  /** The live run of one build task, or `null` — what the wave skips, so no task is built twice at once. */
1085
1500
  async findInFlightRunForBuildTask(buildTaskRef, sessionContext) {
1086
1501
  const live = (await this.listInFlightCodingRuns(sessionContext)).find((run) => run.taskRef === buildTaskRef);
@@ -1133,24 +1548,51 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
1133
1548
  return record.overlappingTaskRefs.length > 0 ? record : null;
1134
1549
  }
1135
1550
  /**
1136
- * REPAIR at the end of a wave (#1528): accept each finished run's writes again, now that nothing is
1137
- * writing, with the door's WAVE_RECONCILIATION origin.
1551
+ * REPAIR at the end of a wave (#1528, #1805): commit what the wave's runs left in the tree, now that
1552
+ * nothing is writing, as ONE change naming every run whose writes it may carry.
1138
1553
  *
1139
- * Under concurrency the ordinary accept refuses exactly what siblings in one tree produce — a path
1140
- * already dirty when the run started, a path edited since — and those tasks would sit unlanded with
1141
- * their work done. At the end of the wave the tree holds the merged result of every run, so
1142
- * committing each run's registered paths commits that result. Only paths the register holds, only
1143
- * under the posture that lets the system accept, and never a path another lane produced.
1554
+ * Under concurrency each run's own accept commits only what it claimed, and refuses the rest, so the
1555
+ * tree ends holding the merged remainder. That remainder cannot be attributed: an agent writing through
1556
+ * a shell claims nothing, so a file one run's capture holds may be a sibling's — measured 2026-09-27, a
1557
+ * FAILED run's files committed under a finisher's name by the per-task reconciliation this replaces. So
1558
+ * it is committed together, writer unknown (`acceptSharedTreeRunsTogether`).
1559
+ *
1560
+ * Which runs: every run the wave dispatched (`taskIds`, failed runs included) and every concurrent run
1561
+ * that recorded writes since the wave began (`startedAt`) — which brings in a generation step the wave
1562
+ * ran inline while its coding runs wrote. Only under the posture that lets the system accept, and never
1563
+ * a path another lane produced.
1144
1564
  */
1145
- async reconcileWaveAcceptance(taskRefs) {
1146
- return this.reconcileAcceptance(taskRefs, AcceptOrigin.WAVE_RECONCILIATION);
1565
+ async reconcileWaveAcceptance(input) {
1566
+ return (await this.reconcileSharedTree(input)).results;
1567
+ }
1568
+ /**
1569
+ * {@link reconcileWaveAcceptance}, saying whether it DEFERRED — the sharing episode's end needs to know, so a
1570
+ * deferred or failed reconcile does not lose the episode it was asked for (#1805 review F5).
1571
+ *
1572
+ * Everything that decides what to commit is read INSIDE the workspace lock: whether a concurrent run
1573
+ * outside these runs is still writing (R9 — its partial files sit in these runs' captures), and which
1574
+ * concurrent runs recorded writes since `startedAt`. Read before the lock, a run admitted or recorded while
1575
+ * this one waited for the lock was invisible to it.
1576
+ */
1577
+ async reconcileSharedTree(input) {
1578
+ let deferred = false;
1579
+ const results = await this.reconcileAcceptanceTogether(async () => {
1580
+ if (this.concurrentRunLiveInProcess(input.taskIds)) {
1581
+ deferred = true;
1582
+ this.logDebug('Deferred a reconciliation: a concurrent run outside it is still writing', { taskIds: input.taskIds });
1583
+ return [];
1584
+ }
1585
+ const during = (await this.codingRunWriteRegister.list())
1586
+ .filter((record) => record.concurrent === true && record.at >= input.startedAt)
1587
+ .map((record) => record.taskId);
1588
+ return [...new Set([...input.taskIds, ...during])];
1589
+ }, AcceptOrigin.WAVE_RECONCILIATION, input.lock);
1590
+ return { deferred, failed: results.some((result) => result.error !== undefined), results };
1147
1591
  }
1148
1592
  /** Force-accept each task's latest registered run, under the posture, with the caller's origin. */
1149
1593
  async reconcileAcceptance(taskRefs, origin) {
1150
- if (laneBoundaryTreatmentFor(APPLICATION_CREATION_AUTONOMY_POSTURE, PlaybookLaneBoundaryDecision.APPROVE_RESULT) !== LaneBoundaryTreatment.NOTIFY_AND_PROCEED)
1151
- return [];
1152
- const results = [];
1153
- await this.underBriefWorktreeLock(async () => {
1594
+ return this.underAcceptancePosture(async () => {
1595
+ const results = [];
1154
1596
  for (const taskRef of taskRefs) {
1155
1597
  try {
1156
1598
  const outcome = await this.acceptedChangeCommit.acceptCodingRun({ taskRef, force: true, origin });
@@ -1162,7 +1604,65 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
1162
1604
  results.push({ taskRef, committedPaths: 0, ...(error instanceof NothingToAcceptError ? {} : { error: describeCaughtError(error) }) });
1163
1605
  }
1164
1606
  }
1607
+ return results;
1608
+ });
1609
+ }
1610
+ /**
1611
+ * {@link reconcileAcceptance} for runs whose writer is not known (#1805): one forced commit naming every
1612
+ * run that contributed a file. A run that contributed reports that commit's path count; one that did
1613
+ * not reports 0, so the log never reads as if every run committed something.
1614
+ */
1615
+ async reconcileAcceptanceTogether(
1616
+ /** The runs, or how to find them INSIDE the lock (#1805 review F5). */
1617
+ runs, origin,
1618
+ /** `takeLock: false` when the caller already holds the workspace lock. */
1619
+ lock = {}) {
1620
+ return this.underAcceptancePosture(async () => {
1621
+ const taskIds = typeof runs === 'function' ? await runs() : runs;
1622
+ if (taskIds.length === 0)
1623
+ return [];
1624
+ try {
1625
+ const outcome = await this.acceptedChangeCommit.acceptSharedTreeRunsTogether({ taskIds, origin });
1626
+ this.warnOfFilesNoRunLeft(outcome.refusedPaths, taskIds);
1627
+ const contributed = new Set(outcome.taskIds);
1628
+ const committedPaths = outcome.alreadyCommitted ? 0 : outcome.committedPaths.length;
1629
+ return taskIds.map((taskId) => ({ taskId, committedPaths: contributed.has(taskId) ? committedPaths : 0 }));
1630
+ }
1631
+ catch (error) {
1632
+ if (error instanceof NothingToAcceptError)
1633
+ this.warnOfFilesNoRunLeft(error.refusedPaths ?? [], taskIds);
1634
+ const detail = error instanceof NothingToAcceptError ? {} : { error: describeCaughtError(error) };
1635
+ return taskIds.map((taskId) => ({ taskId, committedPaths: 0, ...detail }));
1636
+ }
1637
+ }, lock);
1638
+ }
1639
+ /**
1640
+ * A file whose current state no run left — edited after every capture, by a person or a watcher — stays
1641
+ * uncommitted, which is right (#1805 review F6). But it stays dirty at every later run's baseline, and a
1642
+ * task declaring it never lands, so it is said at WARN, by name, where an operator reads.
1643
+ */
1644
+ warnOfFilesNoRunLeft(refusedPaths, taskIds) {
1645
+ const nobodys = refusedPaths.filter((entry) => entry.reason === AcceptRefusalReason.EDITED_SINCE_THE_RUN);
1646
+ if (nobodys.length === 0)
1647
+ return;
1648
+ this.logger.warn('Files changed after every run that shared the tree recorded them stay uncommitted: commit or revert them by hand', {
1649
+ paths: nobodys.map((entry) => entry.path), taskIds,
1165
1650
  });
1651
+ }
1652
+ /**
1653
+ * What every automatic acceptance shares: nothing under a posture that keeps acceptance with a person,
1654
+ * the worktree lock while committing, and the run-accepted listeners told once something was committed.
1655
+ */
1656
+ async underAcceptancePosture(accept,
1657
+ /** FALSE when the caller already holds the workspace lock, as a single-flight run's own accept does. */
1658
+ options = {}) {
1659
+ if (laneBoundaryTreatmentFor(APPLICATION_CREATION_AUTONOMY_POSTURE, PlaybookLaneBoundaryDecision.APPROVE_RESULT) !== LaneBoundaryTreatment.NOTIFY_AND_PROCEED)
1660
+ return [];
1661
+ let results = [];
1662
+ if (options.takeLock === false)
1663
+ results = await accept();
1664
+ else
1665
+ await this.underBriefWorktreeLock(async () => { results = await accept(); });
1166
1666
  if (results.some((result) => result.committedPaths > 0)) {
1167
1667
  for (const listener of this.runAcceptedListeners) {
1168
1668
  try {
@@ -1340,48 +1840,37 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
1340
1840
  * the stall this exists to remove.
1341
1841
  */
1342
1842
  async acceptUnderAutonomyPosture(taskRef, taskId) {
1343
- const treatment = laneBoundaryTreatmentFor(APPLICATION_CREATION_AUTONOMY_POSTURE, PlaybookLaneBoundaryDecision.APPROVE_RESULT);
1344
- if (treatment !== LaneBoundaryTreatment.NOTIFY_AND_PROCEED)
1345
- return;
1346
- try {
1347
- const accept = () => this.acceptedChangeCommit.acceptCodingRun({
1348
- taskRef,
1349
- origin: AcceptOrigin.AUTONOMY_POSTURE,
1350
- });
1351
- // A concurrent run holds no lock (#1528), and git's index takes one writer: the commit is serialized.
1352
- const outcome = this.activeRuns.get(taskId)?.mode === CodingRunConcurrency.CONCURRENT
1353
- ? await this.underBriefWorktreeLock(accept)
1354
- : await accept();
1355
- this.logger.info('Accepted a build-task run under the autonomy posture', {
1356
- taskId,
1357
- taskRef,
1358
- posture: APPLICATION_CREATION_AUTONOMY_POSTURE,
1359
- commitSha: outcome.commitSha,
1360
- committedPaths: outcome.committedPaths.length,
1361
- refusedPaths: outcome.refusedPaths,
1362
- alreadyCommitted: outcome.alreadyCommitted,
1363
- });
1364
- for (const listener of this.runAcceptedListeners) {
1365
- try {
1366
- listener();
1367
- }
1368
- catch (error) {
1369
- this.logDebug('A run-accepted listener threw', { error: describeCaughtError(error) });
1370
- }
1843
+ // A concurrent run holds no lock (#1528), and git's index takes one writer: its commit is serialized.
1844
+ // A single-flight run already holds the workspace lock around this call.
1845
+ await this.underAcceptancePosture(async () => {
1846
+ try {
1847
+ const outcome = await this.acceptedChangeCommit.acceptCodingRun({ taskRef, origin: AcceptOrigin.AUTONOMY_POSTURE });
1848
+ this.logger.info('Accepted a build-task run under the autonomy posture', {
1849
+ taskId,
1850
+ taskRef,
1851
+ posture: APPLICATION_CREATION_AUTONOMY_POSTURE,
1852
+ commitSha: outcome.commitSha,
1853
+ committedPaths: outcome.committedPaths.length,
1854
+ refusedPaths: outcome.refusedPaths,
1855
+ alreadyCommitted: outcome.alreadyCommitted,
1856
+ });
1857
+ // Counted even when already at HEAD: the run is now recorded accepted, which the boards show.
1858
+ return [{ committedPaths: Math.max(outcome.committedPaths.length, 1) }];
1371
1859
  }
1372
- }
1373
- catch (error) {
1374
- if (error instanceof NothingToAcceptError) {
1375
- // An empty run, or every path refused by name. The refusals are the finding; they stay visible.
1376
- this.logger.warn('A build-task run concluded with nothing the posture could accept', {
1377
- taskId, taskRef, reason: error.message, refusedPaths: error.refusedPaths,
1860
+ catch (error) {
1861
+ if (error instanceof NothingToAcceptError) {
1862
+ // An empty run, or every path refused by name. The refusals are the finding; they stay visible.
1863
+ this.logger.warn('A build-task run concluded with nothing the posture could accept', {
1864
+ taskId, taskRef, reason: error.message, refusedPaths: error.refusedPaths,
1865
+ });
1866
+ return [];
1867
+ }
1868
+ this.logger.warn('Could not accept a build-task run under the autonomy posture; its task stays unlanded', {
1869
+ taskId, taskRef, error: describeCaughtError(error),
1378
1870
  });
1379
- return;
1871
+ return [];
1380
1872
  }
1381
- this.logger.warn('Could not accept a build-task run under the autonomy posture; its task stays unlanded', {
1382
- taskId, taskRef, error: describeCaughtError(error),
1383
- });
1384
- }
1873
+ }, { takeLock: this.activeRuns.get(taskId)?.mode === CodingRunConcurrency.CONCURRENT });
1385
1874
  }
1386
1875
  /**
1387
1876
  * Accept every pending PLAYBOOK run under the posture, from inside the worktree window and before a
@@ -1444,10 +1933,27 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
1444
1933
  await this.acceptPendingPlaybookRunsBeforeBaseline();
1445
1934
  const baseline = await this.gitChangeSetService.captureWorktreeSnapshot();
1446
1935
  await this.recordRunBaselineOnTask(input.taskId, baseline, input.sessionContext);
1936
+ const concurrentAtStart = await this.concurrentCodingRunsLive(input.sessionContext);
1937
+ // Beside a concurrent run, the step is part of that sharing episode from its own baseline (#1805).
1938
+ if (concurrentAtStart)
1939
+ this.markSharingEpisodeStarted(baseline.capturedAt);
1447
1940
  const result = await input.execute();
1941
+ let shared = concurrentAtStart;
1448
1942
  try {
1449
1943
  const changeSet = await this.gitChangeSetService.captureChangeSet(baseline);
1450
- await this.codingRunWriteRegister.record({ taskId: input.taskId, taskRef: input.taskRef, changeSet });
1944
+ /*
1945
+ * A step holds the workspace lock, but a CONCURRENT coding run takes that lock only to commit, so
1946
+ * a wave's runs keep writing while the step runs inline (#1805 review N2). Its capture then holds
1947
+ * their writes too. So when concurrent runs were live at either end of its window, or one recorded
1948
+ * writes during it, the step is recorded as a sharing run with no claims and does not accept
1949
+ * alone: the wave's end commits it with its siblings, writer unknown.
1950
+ */
1951
+ const concurrentAtEnd = await this.concurrentCodingRunsLive(input.sessionContext);
1952
+ if (concurrentAtEnd)
1953
+ this.markSharingEpisodeStarted(baseline.capturedAt);
1954
+ shared = shared || concurrentAtEnd
1955
+ || (await this.codingRunWriteRegister.list()).some((record) => record.concurrent === true && record.at >= baseline.capturedAt);
1956
+ await this.codingRunWriteRegister.record({ taskId: input.taskId, taskRef: input.taskRef, changeSet, ...(shared ? { claimedPaths: [] } : {}) });
1451
1957
  }
1452
1958
  catch (error) {
1453
1959
  this.logger.warn('Could not register a generation step\'s writes; it stays unlanded until they are committed', {
@@ -1455,7 +1961,19 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
1455
1961
  });
1456
1962
  return result;
1457
1963
  }
1458
- await this.acceptUnderAutonomyPosture(input.taskRef, input.taskId);
1964
+ if (!shared)
1965
+ await this.acceptUnderAutonomyPosture(input.taskRef, input.taskId);
1966
+ else if (!this.concurrentRunLiveInProcess()) {
1967
+ /*
1968
+ * Shared, and nothing of this process is writing any more — the concurrent run finished during the
1969
+ * step: no episode will end after this, so the step and the runs recorded in its window are
1970
+ * committed together now. Inside the workspace lock this window already holds.
1971
+ */
1972
+ const since = this.sharingEpisodeStartedAt !== undefined && this.sharingEpisodeStartedAt < baseline.capturedAt
1973
+ ? this.sharingEpisodeStartedAt
1974
+ : baseline.capturedAt;
1975
+ await this.reconcileSharedTree({ startedAt: since, taskIds: [input.taskId], lock: { takeLock: false } });
1976
+ }
1459
1977
  return result;
1460
1978
  }, { retries: { retries: 0 } }).catch((error) => { throw this.mapLockError(error); });
1461
1979
  }
@@ -1482,10 +2000,10 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
1482
2000
  if (returned === null) {
1483
2001
  // Two ways to get here with no result: the executor threw (the engine settled the run
1484
2002
  // FAILED with the message), or the engine refused to START it — a resume of an execution
1485
- // that is no longer waiting. Neither leaves anything for this method to record.
1486
- this.logger.error('Application coding run ended without a result', {
1487
- taskId, taskRef, error: describeCaughtError(error),
1488
- });
2003
+ // that is no longer waiting. Neither leaves anything for this method to record. The two
2004
+ // refusals a person's late or concurrent answer meets are routine 409s, not errors (#1581, R10-2).
2005
+ const routineRefusal = isActorExecutionNotSuspendedError(error) || isActorExecutionSubjectBusyError(error);
2006
+ (routineRefusal ? this.logger.info.bind(this.logger) : this.logger.error.bind(this.logger))(routineRefusal ? 'Application coding run was not started or resumed: the driver refused it' : 'Application coding run ended without a result', { taskId, taskRef, error: describeCaughtError(error) });
1489
2007
  return;
1490
2008
  }
1491
2009
  this.logger.error('Failed to persist application coding-task result', { taskId, taskRef, error: describeCaughtError(error) });
@@ -1679,6 +2197,12 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
1679
2197
  catch (error) {
1680
2198
  runError = error;
1681
2199
  }
2200
+ /*
2201
+ * Whether an operator took this turn away, read the moment the turn ENDED (#1581, seventh review F8):
2202
+ * a wave cancel landing later, while the change set is captured, did not end a turn that had already
2203
+ * failed on its own — a timed-out turn is the task's.
2204
+ */
2205
+ const turnCancelledByOperator = this.activeRuns.get(taskId)?.abortController.signal.aborted === true;
1682
2206
  let changeSet = null;
1683
2207
  let captureError = null;
1684
2208
  try {
@@ -1851,7 +2375,7 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
1851
2375
  * turn also ends `cancelled`, and it is the task's — it needed more than a turn.
1852
2376
  */
1853
2377
  const runErrorMessage = runError ? describeCaughtError(runError) : '';
1854
- const agentTurnTakenByHost = this.activeRuns.get(taskId)?.abortController.signal.aborted === true
2378
+ const agentTurnTakenByHost = turnCancelledByOperator
1855
2379
  || isInfrastructureShapedAgentFailure(runErrorMessage)
1856
2380
  || isProviderAccountAgentFailure(runErrorMessage);
1857
2381
  const failureAttribution = deriveCodingRunFailureAttribution({ disposition, agentTurnTakenByHost });
@@ -2082,6 +2606,7 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
2082
2606
  parkedAt: parked.checkpoint.parkedAt,
2083
2607
  resumable: parked.checkpoint.suspension.resumable,
2084
2608
  decision: parked.decision,
2609
+ suspensionRef: parked.suspensionRef,
2085
2610
  }));
2086
2611
  }
2087
2612
  /**
@@ -2103,7 +2628,7 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
2103
2628
  const task = row.tasks[0];
2104
2629
  if (!checkpoint.success || !task || !row.suspension)
2105
2630
  continue;
2106
- parked.push({ executionId: row._id, taskId: task._id, checkpoint: checkpoint.data, decision: row.suspension.decision });
2631
+ parked.push({ executionId: row._id, taskId: task._id, checkpoint: checkpoint.data, decision: row.suspension.decision, suspensionRef: actorExecutionSuspensionRef(row.suspension) });
2107
2632
  }
2108
2633
  return parked;
2109
2634
  }
@@ -2151,6 +2676,14 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
2151
2676
  };
2152
2677
  return {
2153
2678
  kind: CodingRunEnding.PARKED,
2679
+ /*
2680
+ * UNROUTED, deliberately (#1751). Under the notify-and-proceed posture the ANSWERING AGENT settles
2681
+ * the questions it can before a person sees them (#1559), and an OWNER route admits only its
2682
+ * requester as a signed-in person: routed, every one of those answers would be refused and every
2683
+ * question would fall to the creator. A coding question is routed only once the route model can
2684
+ * express "the agent acting within the posture the owner chose" — until then its door is its
2685
+ * authority, and each settle still records its answer.
2686
+ */
2154
2687
  suspension: {
2155
2688
  decision: projectParkedCodingQuestionAsDecision({ taskId, taskRef: task.taskRef, suspension, parkedAt }),
2156
2689
  checkpointContext: checkpoint,
@@ -2194,7 +2727,8 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
2194
2727
  /**
2195
2728
  * Put a build task back in the queue after the reason it did not land has been fixed (#1535).
2196
2729
  *
2197
- * Every completed or failed run of the task that still counts gets a re-arm recorded on its own row, in its
2730
+ * Every completed run the anti-loop guard still counts, and every failed run not yet re-armed (a forgiven
2731
+ * one included, #1581), gets a re-arm recorded on its own row, in its
2198
2732
  * long-term memory, with the reason and a note. Nothing about the run is rewritten: it still reads
2199
2733
  * as the run it was, and it now also reads as a run that was superseded, and why.
2200
2734
  *
@@ -2202,13 +2736,21 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
2202
2736
  * let an operator believe a task was released when it was never held.
2203
2737
  */
2204
2738
  async rearmBuildTask(buildTaskRef, request, sessionContext) {
2205
- // Completed runs hold a task through the anti-loop guard; failed ones through its attempt budget (#1536).
2739
+ /*
2740
+ * Completed runs hold a task through the anti-loop guard; failed ones through its attempt budget
2741
+ * (#1536). EVERY failed run not yet re-armed is re-armed, including the ones the budget currently
2742
+ * FORGIVES (a host failure, suspected interference): forgiveness is bounded per task, and a re-arm
2743
+ * that left the forgiven runs in place would leave their slots used for good, so the first host
2744
+ * failure after the re-arm would already count (#1581, third review F-1).
2745
+ */
2746
+ const failedNotRearmed = (await this.listAttributableFailedRunsForBuildTask(buildTaskRef, sessionContext, { includeRearmed: true }))
2747
+ .filter((run) => readBuildTaskRearm(run.memory) === undefined);
2206
2748
  const runs = [
2207
2749
  ...(await this.listCountingCompletedRunsForBuildTask(buildTaskRef, sessionContext)),
2208
- ...(await this.listAttributableFailedRunsForBuildTask(buildTaskRef, sessionContext)),
2750
+ ...failedNotRearmed,
2209
2751
  ];
2210
2752
  if (runs.length === 0) {
2211
- throw new NothingToRearmError(`Build task "${buildTaskRef}" has no completed or failed coding run that still counts, so there is nothing to re-arm: `
2753
+ throw new NothingToRearmError(`Build task "${buildTaskRef}" has no completed coding run that still counts and no failed one not yet re-armed, so there is nothing to re-arm: `
2212
2754
  + 'it was never run, or every run is already re-armed. A task in that state is '
2213
2755
  + 'offered by the next dispatch on its own.');
2214
2756
  }
@@ -2232,11 +2774,12 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
2232
2774
  *
2233
2775
  * Only the task's OWN failures count. Since `703d07c3` a check that was red before the run started
2234
2776
  * no longer fails it (the run completes and records `carriedVerificationFailures`). A CANCELLED or
2235
- * ABORTED run is an operator's or a host's act, not an attempt, and is not listed — which includes a
2236
- * dispatch refused before admission, settled ABORTED (#1581). A FAILED run the HOST caused
2237
- * (`failureAttribution`, {@link deriveCodingRunFailureAttribution}) is forgiven, up to
2238
- * `MAXIMUM_HOST_FAILURE_EXCLUSIONS`, like suspected interference: past the bound it counts, so a
2239
- * host condition that fails every attempt still retires the task. A row older than the field counts.
2777
+ * ABORTED run is not an attempt and is not listed — which includes a dispatch refused before
2778
+ * admission, settled ABORTED (#1581), and a FAILED row written before that which never started. A FAILED run the HOST caused (`failureAttribution`,
2779
+ * {@link deriveCodingRunFailureAttribution}) — an operator's cancel of a running turn among them — is
2780
+ * forgiven up to `MAXIMUM_HOST_FAILURE_EXCLUSIONS`, like suspected interference: past the bound it
2781
+ * counts, so a host condition that fails every attempt still retires the task. A re-arm releases the
2782
+ * forgiven runs too (`rearmBuildTask`). A row older than the field counts.
2240
2783
  */
2241
2784
  async listAttributableFailedRunsForBuildTask(buildTaskRef, sessionContext, options = {}) {
2242
2785
  const failed = await this.executionsService.listActorTasks(CompanionActorTasksListQuerySchema.parse({
@@ -2255,9 +2798,20 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
2255
2798
  if (options.includeRearmed !== true && readBuildTaskRearm(row.memory) !== undefined)
2256
2799
  continue;
2257
2800
  const output = isRecordValue(row.output) ? row.output : {};
2801
+ /*
2802
+ * A run the HOST declined to start is no attempt (#1581, seventh review F7): the build board and the
2803
+ * retry context already read it so through `deriveCodingRunStart`, and the budget is the third reader
2804
+ * of that question. Only a row written before #1581 is FAILED and never started; today it is ABORTED.
2805
+ */
2806
+ if (options.includeRearmed !== true
2807
+ && deriveCodingRunStart({ status: FlowsActors_Status.FAILED, ...(row.startedAt ? { startedAt: row.startedAt } : {}), output }) === CodingRunStart.REFUSED_BY_HOST) {
2808
+ continue;
2809
+ }
2258
2810
  counting.push({
2259
2811
  taskId: String(row._id),
2260
2812
  ...(row.completedAt ? { settledAt: row.completedAt } : {}),
2813
+ // Whether the run STARTED is what tells a retry that nothing ran (`deriveCodingRunStart`).
2814
+ ...(row.startedAt ? { startedAt: row.startedAt } : {}),
2261
2815
  memory: row.memory,
2262
2816
  output,
2263
2817
  interferenceSuspected: output.interferenceSuspected === true,
@@ -2348,10 +2902,19 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
2348
2902
  * The task id is the lane's handle and the execution is the engine's, so this is the join: the
2349
2903
  * task row names its execution, and the driver says whether that execution is waiting. Every way
2350
2904
  * of not being a parked coding run answers `null` — not a coding task, no execution, not waiting,
2351
- * a checkpoint that no longer parses — because the caller's response to all of them is the same
2352
- * refusal, and none of them is an error in the request.
2905
+ * a checkpoint that no longer parses. A read that FAILS answers `null` too in the lenient default,
2906
+ * for the one caller that treats every miss alike (the answering-agent loop, whose miss sends the
2907
+ * question to the creator); a
2908
+ * STRICT read throws it instead, for a caller that must not tell a person "nothing is waiting" when
2909
+ * nothing was read (#1581, tenth and eleventh reviews).
2353
2910
  */
2354
- async readParkedCodingRun(taskId, sessionContext) {
2911
+ async readParkedCodingRun(taskId, sessionContext,
2912
+ /**
2913
+ * STRICT: a read that FAILED throws instead of answering `null` — for a caller that must tell "nothing
2914
+ * is waiting" from "could not tell" (#1581, tenth review R10-1): every door that answers a person (the
2915
+ * answer door, the per-run cancel, a chain's withdraw) reads strictly.
2916
+ */
2917
+ options = {}) {
2355
2918
  let executionId;
2356
2919
  try {
2357
2920
  const row = await this.executionsService.getActorTask(taskId, sessionContext);
@@ -2359,7 +2922,9 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
2359
2922
  return null;
2360
2923
  executionId = row.wildoApplicationActorSystemExecutionId;
2361
2924
  }
2362
- catch {
2925
+ catch (error) {
2926
+ if (options.strict === true && !isAbsentParkRead(error))
2927
+ throw error;
2363
2928
  return null;
2364
2929
  }
2365
2930
  if (!executionId)
@@ -2369,30 +2934,17 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
2369
2934
  const checkpoint = ApplicationCodingRunCheckpointSchema.safeParse(waiting.row.checkpoint?.context);
2370
2935
  // A run parked from a wave resumes as one: it holds only its task, never the tree (#1528).
2371
2936
  const mode = isConcurrentRunSubject(waiting.row.exclusiveSubject) ? CodingRunConcurrency.CONCURRENT : CodingRunConcurrency.SINGLE_FLIGHT;
2372
- return checkpoint.success ? { executionId, checkpoint: checkpoint.data, mode } : null;
2937
+ // The suspension it waits on NOW: a resume carries it, so an answer read against one question cannot continue the next (#1581, seventh review F9).
2938
+ return checkpoint.success ? { executionId, suspensionRef: actorExecutionSuspensionRef(waiting.suspension), checkpoint: checkpoint.data, mode } : null;
2373
2939
  }
2374
- catch {
2940
+ catch (error) {
2375
2941
  // `readSuspendedActorExecution` refuses an execution that is not waiting — already answered,
2376
- // cancelled, settled. For this door that is "nothing to answer", not a fault.
2942
+ // cancelled, settled. For this door that is "nothing to answer", not a fault; a failed read is.
2943
+ if (options.strict === true && !isAbsentParkRead(error))
2944
+ throw error;
2377
2945
  return null;
2378
2946
  }
2379
2947
  }
2380
- /**
2381
- * Answer a parked coding task's question, resuming the SAME agent session.
2382
- *
2383
- * ONE door, in-process or after a restart (#1359). The run's execution is `AWAITING_APPROVAL`
2384
- * with the contract, the original baseline and the agent session on its checkpoint, and the
2385
- * engine's `resumeActorExecution` continues it under the same ids: it refuses an execution that is
2386
- * no longer waiting BEFORE moving anything — so a second answer to one question cannot run the
2387
- * work twice — moves the rows back to `PROCESSING`, and settles whatever the continued run does,
2388
- * including parking again on a second question.
2389
- *
2390
- * Runs under the worktree mutation lock exactly like a fresh dispatch (a resume
2391
- * mutates the same worktree) and re-enters the turn ladder through
2392
- * `session/load`, so the agent continues with its full context. The mutation
2393
- * scope and verification plan are the parked contract's; a resume is held to the
2394
- * same bounds as the first run, and its change set is measured from the first run's baseline.
2395
- */
2396
2948
  /**
2397
2949
  * Append one answer to `src/build-plan/CODING-ANSWERS.md` — the record of what a person told a
2398
2950
  * parked coding run (#1454, Step 6). Until then the answer lived only in the agent session and
@@ -2420,7 +2972,29 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
2420
2972
  this.logDebug('Could not record the coding-question answer beside the build plan (the answer still resumes the run)', { taskRef, error: String(error) });
2421
2973
  }
2422
2974
  }
2423
- async respondToApplicationCodingTaskQuestion(taskId, answer, sessionContext) {
2975
+ /**
2976
+ * Answer a parked coding task's question, resuming the SAME agent session.
2977
+ *
2978
+ * ONE door, in-process or after a restart (#1359). The run's execution is `AWAITING_APPROVAL`
2979
+ * with the contract, the original baseline and the agent session on its checkpoint, and the
2980
+ * engine's `resumeActorExecution` continues it under the same ids: it refuses an execution that is
2981
+ * no longer waiting on the question this answer names BEFORE moving anything — so a second answer
2982
+ * to one question cannot run the work twice — moves the rows back to `PROCESSING`, and settles
2983
+ * whatever the continued run does, including parking again on a second question.
2984
+ *
2985
+ * WHICH question the answer names is the caller's to say, and it is required (`expected.suspensionRef`,
2986
+ * the value a pending question and its workbench row carry): an answer that named nothing would
2987
+ * continue whichever question the run waits on when the request lands, which is not necessarily the
2988
+ * one its person read (#1581, eighth and ninth reviews).
2989
+ *
2990
+ * A single-flight run resumes under the worktree mutation lock, exactly like a fresh dispatch (a
2991
+ * resume mutates the same worktree); a run parked from a wave resumes beside it, holding no lock, as
2992
+ * it ran (#1528). Either way it re-enters the turn ladder through `session/load`, so the agent
2993
+ * continues with its full context. The mutation scope and verification plan are the parked
2994
+ * contract's; a resume is held to the same bounds as the first run, and its change set is measured
2995
+ * from the first run's baseline.
2996
+ */
2997
+ async respondToApplicationCodingTaskQuestion(taskId, answer, sessionContext, expected) {
2424
2998
  // A missing answer is a VALIDATION 400 regardless of whether a task is parked
2425
2999
  // — it is a malformed request, not a state conflict.
2426
3000
  const trimmedAnswer = this.admitTypedInput(() => {
@@ -2429,12 +3003,30 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
2429
3003
  throw new Error('empty answer');
2430
3004
  return value;
2431
3005
  }, 'An answer is required to resume a parked coding task.');
2432
- const parked = await this.readParkedCodingRun(taskId, sessionContext);
3006
+ // Which question it answers: required, and a blank reference names none — a 400 at every door (#1581, R12-1).
3007
+ const answeredRef = this.admitTypedInput(() => {
3008
+ const value = expected.suspensionRef.trim();
3009
+ if (value.length === 0)
3010
+ throw new Error('empty suspensionRef');
3011
+ return value;
3012
+ }, 'An answer must name the question it answers (`suspensionRef`, as the pending question carries it).');
3013
+ // STRICT: a failed read must not tell a person their question is gone (#1581, eleventh review R11-5).
3014
+ const parked = await this.readParkedCodingRun(taskId, sessionContext, { strict: true }).catch((error) => {
3015
+ this.logger.warn('The answer door could not read the coding run\'s park', { taskId, error: describeCaughtError(error) });
3016
+ throw this.buildDispatchConflictError(`Coding task ${taskId} could not be read, so your answer was not applied. Its question may still be waiting; try again.`);
3017
+ });
2433
3018
  if (!parked) {
2434
3019
  throw this.buildDispatchConflictError(`No coding task is awaiting an answer under id ${taskId}. It was already answered, cancelled or settled, `
2435
3020
  + 'or it is not a coding run.');
2436
3021
  }
2437
3022
  const { checkpoint, executionId, mode } = parked;
3023
+ // The fast 409: the run has asked again since the caller read its question. The driver re-checks the
3024
+ // same suspension reference when it resumes, so a question asked after this point is refused there too.
3025
+ if (answeredRef !== parked.suspensionRef) {
3026
+ throw this.buildDispatchConflictError(`Coding task ${taskId} has asked another question since the one you answered. Read its current question and answer that.`);
3027
+ }
3028
+ // Past that check the caller's reference IS this one; the driver holds the resume to it.
3029
+ const { suspensionRef } = parked;
2438
3030
  if (!checkpoint.suspension.resumable) {
2439
3031
  throw this.buildDispatchConflictError(`Coding task ${taskId} parked on a question, but its agent does not support session resume, `
2440
3032
  + 'so the answer cannot be delivered to the same session. Re-dispatch the task with the answer folded into the objective.');
@@ -2445,33 +3037,58 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
2445
3037
  if (mode === CodingRunConcurrency.SINGLE_FLIGHT)
2446
3038
  await this.refuseWhileConcurrentRunsInFlight(sessionContext);
2447
3039
  const task = checkpoint.contract;
2448
- // The answer is a DECISION the change set will rest on: recorded beside the build plan before the
2449
- // run resumes, so a resume that then fails still leaves the decision where a reviewer reads (#1454, Step 6).
2450
- await this.recordCodingQuestionAnswer(task.taskRef, checkpoint.suspension.question, trimmedAnswer);
2451
3040
  const verificationPlans = this.admitTypedInput(() => resolveApplicationCodingTaskVerificationPlans(task.verificationIntent.requiredChecks), 'The parked coding task names a verification check this host no longer registers.');
2452
3041
  const admission = createDeferred();
2453
3042
  const resumeBody = async () => {
3043
+ /*
3044
+ * Refused while THIS process still runs a chain for the task (#1581, fifth review R5-1/R5-2). A
3045
+ * run that parked is still registered while its own chain offers the question to the answering
3046
+ * agent (#1559). Under single-flight the worktree lock already excludes a person's answer there;
3047
+ * a CONCURRENT run holds no lock, so without this a person's resume would take over the chain's
3048
+ * registration and settlement, and the chain's ending would delete the one and strand the other.
3049
+ * Checked HERE, where it is followed by the registration with nothing awaited in between, and
3050
+ * nowhere earlier: a second, earlier check could only ever repeat this one.
3051
+ */
3052
+ this.refuseWhileRunChainIsLive(taskId);
2454
3053
  // ONE settlement for the whole chain: the resumed turn, and any questions the answering agent
2455
3054
  // then answers under the same hold (#1559) — a caller awaiting it sees the chain's final state.
2456
3055
  const settlement = createDeferred();
2457
3056
  this.applicationCodingTaskSettlements.set(taskId, { promise: settlement.promise, resolve: () => settlement.resolve(undefined) });
3057
+ /*
3058
+ * Registered for the WHOLE chain, as a dispatched run is (#1581, fourth review A-1): each resume
3059
+ * inherits this entry, so an operator's cancel reaches the resumed turn, and a cancel made while
3060
+ * the answering agent decides a follow-up question still finds the run rather than "nothing is
3061
+ * running". Removed when the chain settles.
3062
+ */
3063
+ this.registerActiveRun({ taskId, startedAt: new Date().toISOString(), abortController: new AbortController(), mode: mode ?? CodingRunConcurrency.SINGLE_FLIGHT });
3064
+ let resumed;
2458
3065
  try {
2459
- await this.resumeParkedRunHoldingLock({
3066
+ resumed = await this.resumeParkedRunHoldingLock({
2460
3067
  taskId,
2461
3068
  executionId,
3069
+ suspensionRef,
2462
3070
  checkpoint,
2463
3071
  answer: trimmedAnswer,
3072
+ answerSource: expected.answeredByRef?.trim() ? { answeredByRef: expected.answeredByRef.trim() } : {},
3073
+ ...(expected.actingUserId ? { actingUserId: expected.actingUserId } : {}),
2464
3074
  verificationPlans,
2465
3075
  sessionContext,
2466
3076
  mode,
2467
3077
  onAdmitted: (admitted) => admission.resolve(admitted),
2468
3078
  });
2469
- await this.answerParkedQuestionsHoldingLock(taskId, sessionContext);
3079
+ // Only a resume that RAN can have parked again: a refused one left the person's question where
3080
+ // it was, and it is still theirs, not the answering agent's (#1581, seventh review F5).
3081
+ if (resumed.outcome === ParkedRunResumeOutcome.RAN)
3082
+ await this.answerParkedQuestionsHoldingLock(taskId, sessionContext);
2470
3083
  }
2471
3084
  finally {
3085
+ // Awaited ONLY when cancelled: a chain that was not checks and unregisters in one synchronous step,
3086
+ // so no cancel can land between the two and be lost (#1581, ninth review R9-4).
3087
+ const ending = this.isRunCancelled(taskId) ? await this.withdrawCancelledRunChain(taskId, sessionContext) : null;
3088
+ this.unregisterActiveRun(taskId);
2472
3089
  this.applicationCodingTaskSettlements.get(taskId)?.resolve();
2473
- // A resume the driver refused never reached the executor, so nobody answered the caller.
2474
- admission.reject(this.buildDispatchConflictError(`Coding task ${taskId} could not be resumed: it is no longer awaiting an answer.`));
3090
+ // A resume that never reached the executor answered nobody: the caller is told why, in its own terms.
3091
+ admission.reject(this.buildDispatchConflictError(this.describeUnresumedAnswer(taskId, resumed, ending)));
2475
3092
  this.announceRunStateChanged();
2476
3093
  }
2477
3094
  };
@@ -2489,38 +3106,192 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
2489
3106
  return admission.promise;
2490
3107
  }
2491
3108
  /**
2492
- * Continue one parked run with an answer. The CALLER holds the worktree mutation lock and owns the
2493
- * run's settlement — which is what lets the answering agent resume a run from inside the hold of
2494
- * the run that parked, without a second acquire (the lock is not re-entrant) and without the build
2495
- * loop taking the worktree in between (#1559).
3109
+ * Why a person's answer resumed nothing (#1581, seventh review F5; eighth review R8-5), in the terms of
3110
+ * what actually happened. A cancel wins over any refusal: the run is withdrawn either way. A held subject
3111
+ * leaves the question WAITING, so the person may answer again; only the driver's NOT_SUSPENDED means the
3112
+ * question is gone; anything else is a failure to ask, and says so.
3113
+ */
3114
+ describeUnresumedAnswer(taskId, resumed, ending) {
3115
+ if (ending !== null || resumed?.outcome === ParkedRunResumeOutcome.CANCELLED) {
3116
+ if (ending === CancelledParkOutcome.STILL_WAITING) {
3117
+ return `Coding task ${taskId} was cancelled before your answer could resume it, but its question could not be withdrawn and is still waiting. Cancel it again.`;
3118
+ }
3119
+ if (ending === CancelledParkOutcome.UNCONFIRMED) {
3120
+ return `Coding task ${taskId} was cancelled before your answer could resume it, but the run could not be read to confirm it was withdrawn. Check it, and cancel it again if it is still waiting.`;
3121
+ }
3122
+ return `Coding task ${taskId} was cancelled before your answer could resume it; it no longer waits, and your answer ran nothing.`;
3123
+ }
3124
+ if (resumed?.outcome === ParkedRunResumeOutcome.REFUSED) {
3125
+ if (isActorExecutionSubjectBusyError(resumed.refusal)) {
3126
+ return `Coding task ${taskId} could not be resumed yet: another run holds its worktree. Its question is still waiting — answer again once that run finishes.`;
3127
+ }
3128
+ if (isActorExecutionNotSuspendedError(resumed.refusal)) {
3129
+ return `Coding task ${taskId} could not be resumed: it is no longer awaiting this answer (it was answered, cancelled, or has asked again).`;
3130
+ }
3131
+ return `Coding task ${taskId} could not be resumed (${describeCaughtError(resumed.refusal)}). Its question is still waiting; answer again.`;
3132
+ }
3133
+ return `Coding task ${taskId} could not be resumed. Its question is still waiting; answer again.`;
3134
+ }
3135
+ /**
3136
+ * The terminal record of a resume a cancel stopped before any turn (#1581, ninth review R9-6): its trace
3137
+ * session was opened for a turn that never ran, and must say why it holds nothing else. Best effort.
3138
+ */
3139
+ async recordCancelledBeforeTurn(trace, taskRef, taskId) {
3140
+ await trace.traceBestEffort('record-cancelled-before-turn', () => this.traceOperationStart({
3141
+ sessionContext: trace.runSession,
3142
+ step: trace.runStep,
3143
+ type: 'application-coding-task-cancelled-before-turn',
3144
+ summary: `Application coding task ${taskRef} was cancelled before its answer resumed a turn`,
3145
+ payload: { taskId },
3146
+ }));
3147
+ }
3148
+ /** The terminal record of a resume the DRIVER refused before any turn (#1581, tenth review R10-2). Best effort. */
3149
+ async recordResumeRefused(trace, taskRef, taskId, refusal) {
3150
+ await trace.traceBestEffort('record-resume-refused', () => this.traceOperationStart({
3151
+ sessionContext: trace.runSession,
3152
+ step: trace.runStep,
3153
+ type: 'application-coding-task-resume-refused',
3154
+ summary: `Application coding task ${taskRef} could not be resumed: ${describeCaughtError(refusal)}`,
3155
+ payload: { taskId },
3156
+ }));
3157
+ }
3158
+ /**
3159
+ * Refuse (409) to start a person's resume while this process still runs a chain for the task — the
3160
+ * park's own chain offering its question to the answering agent (#1559, #1581).
3161
+ */
3162
+ refuseWhileRunChainIsLive(taskId) {
3163
+ if (!this.activeRuns.has(taskId))
3164
+ return;
3165
+ throw this.buildDispatchConflictError(`Coding task ${taskId} is still being handled here: its own run is deciding whether it can answer the question `
3166
+ + 'it parked on, or it is being cancelled. Answer once it reports the question as waiting for you.');
3167
+ }
3168
+ /**
3169
+ * Continue one parked run with an answer. The CALLER holds the worktree mutation lock (a concurrent
3170
+ * run holds none) and owns the run's settlement — which is what lets the answering agent resume a
3171
+ * run from inside the hold of the run that parked, without a second acquire (the lock is not
3172
+ * re-entrant) and without the build loop taking the worktree in between (#1559).
3173
+ *
3174
+ * Says how it went ({@link ParkedRunResumeOutcome}); a caller must not treat a refused or cancelled
3175
+ * resume as a run that happened.
2496
3176
  */
2497
3177
  async resumeParkedRunHoldingLock(input) {
2498
3178
  const { taskId, checkpoint } = input;
2499
3179
  const task = checkpoint.contract;
2500
3180
  const baseline = checkpoint.baseline;
2501
- this.activeRuns.set(taskId, { taskId, startedAt: new Date().toISOString(), abortController: new AbortController(), mode: input.mode ?? CodingRunConcurrency.SINGLE_FLIGHT });
3181
+ /*
3182
+ * INHERIT the run's registration when there is one (#1581, third review). Answered inside the hold of
3183
+ * the run that parked (#1559), the run is still registered, and an operator may have cancelled it
3184
+ * while the answering agent was deciding: a fresh controller dropped that cancel and ran the resumed
3185
+ * turn anyway. The entry is restored afterwards rather than deleted, so a cancel between chained
3186
+ * resumes still finds the run instead of answering "nothing is running".
3187
+ */
3188
+ const inherited = this.activeRuns.get(taskId);
3189
+ this.activeRuns.set(taskId, {
3190
+ taskId,
3191
+ startedAt: inherited?.startedAt ?? new Date().toISOString(),
3192
+ abortController: inherited?.abortController ?? new AbortController(),
3193
+ mode: input.mode ?? inherited?.mode ?? CodingRunConcurrency.SINGLE_FLIGHT,
3194
+ });
3195
+ // The resumed turn is coding work in its own right, registered or not around it: it holds the beat.
3196
+ this.adjustCodingWorkDepth(taskId, 1);
2502
3197
  this.openCodingRunWindow(taskId, task.taskRef);
3198
+ let admitted = false;
3199
+ let cancelledAfterAdmission = false;
3200
+ let refusal;
2503
3201
  try {
3202
+ // A cancel already made opens no trace for a turn that will not run (#1581, eighth review R8-6).
3203
+ if (this.isRunCancelled(taskId))
3204
+ return { outcome: ParkedRunResumeOutcome.CANCELLED };
2504
3205
  const trace = await this.openCodingRunTrace(taskId, task.taskRef);
2505
- await this.superviseCodingRun(task.taskRef, taskId, trace, (capture) => this.actorsSystem.resumeActorExecution(input.executionId, async (opened) => {
2506
- // Admitted HERE, once the engine has moved the rows back to PROCESSING: a resume the
2507
- // driver refuses (somebody answered first) rejects the admission instead of claiming it.
2508
- input.onAdmitted?.({
2509
- taskId,
2510
- status: FlowsActors_Status.PROCESSING,
2511
- taskRef: task.taskRef,
2512
- baselineHeadSha: baseline.headSha,
2513
- baselineDirtyFileCount: Object.keys(baseline.files).length,
2514
- });
2515
- // Started again, announced only NOW that the engine has moved its rows back to PROCESSING:
2516
- // a read that re-derived before that would still see the run as parked.
2517
- this.announceRunStateChanged();
2518
- return capture(await this.executeApplicationCodingTask(task, renderApplicationCodingTaskAgentPrompt(task), input.verificationPlans, opened, baseline, trace, { continuationOfSessionId: checkpoint.suspension.sessionId, answerPrompt: input.answer }));
2519
- }, trace.runSession, this.codingRunOptions));
3206
+ /*
3207
+ * The cancel check before a turn starts, for both answerers (#1581, seventh review F3): after the
3208
+ * last thing this chain awaits before the driver's resume. A cancel found here starts no turn and
3209
+ * spends nothing, and the chain that owns the run withdraws the park. One landing later — inside
3210
+ * the driver's own read-and-take — is caught by the executor, which hands the question back.
3211
+ */
3212
+ if (this.isRunCancelled(taskId)) {
3213
+ await this.recordCancelledBeforeTurn(trace, task.taskRef, taskId);
3214
+ return { outcome: ParkedRunResumeOutcome.CANCELLED };
3215
+ }
3216
+ await this.superviseCodingRun(task.taskRef, taskId, trace, async (capture) => {
3217
+ try {
3218
+ return await this.actorsSystem.resumeActorExecution(input.executionId, async (opened, resumed) => {
3219
+ admitted = true;
3220
+ /*
3221
+ * A cancel landing inside the driver's own read-and-take (#1581, eighth review R8-7): the rows
3222
+ * are PROCESSING already, so the SAME question is handed back — its decision and resume
3223
+ * inputs, the task's output left as it was, under a new suspension reference as every
3224
+ * suspension gets — and the chain withdraws the park CANCELLED on its way out, like any
3225
+ * cancelled park. No answer recorded, no turn started, no attempt spent.
3226
+ */
3227
+ if (this.isRunCancelled(taskId)) {
3228
+ cancelledAfterAdmission = true;
3229
+ return capture({
3230
+ kind: CodingRunEnding.PARKED,
3231
+ suspension: { decision: resumed.suspension.decision, checkpointContext: checkpoint },
3232
+ output: undefined,
3233
+ afterSettle: () => this.recordCancelledBeforeTurn(trace, task.taskRef, taskId),
3234
+ });
3235
+ }
3236
+ // Admitted HERE, once the engine has moved the rows back to PROCESSING: a resume the
3237
+ // driver refuses (somebody answered first) rejects the admission instead of claiming it.
3238
+ input.onAdmitted?.({
3239
+ taskId,
3240
+ status: FlowsActors_Status.PROCESSING,
3241
+ taskRef: task.taskRef,
3242
+ baselineHeadSha: baseline.headSha,
3243
+ baselineDirtyFileCount: Object.keys(baseline.files).length,
3244
+ });
3245
+ // Started again, announced only NOW that the engine has moved its rows back to PROCESSING:
3246
+ // a read that re-derived before that would still see the run as parked.
3247
+ this.announceRunStateChanged();
3248
+ /*
3249
+ * The answer is a DECISION the change set will rest on: recorded beside the build plan
3250
+ * before the turn, so a turn that then fails still leaves the decision where a reviewer
3251
+ * reads (#1454, Step 6) — and only once the driver ADMITTED the resume, so an answer that
3252
+ * resumed nothing is never recorded as one that did (#1581, seventh review F5).
3253
+ */
3254
+ await this.recordCodingQuestionAnswer(task.taskRef, checkpoint.suspension.question, input.answer, input.answerSource);
3255
+ return capture(await this.executeApplicationCodingTask(task, renderApplicationCodingTaskAgentPrompt(task), input.verificationPlans, opened, baseline, trace, { continuationOfSessionId: checkpoint.suspension.sessionId, answerPrompt: input.answer }));
3256
+ }, trace.runSession, {
3257
+ ...this.codingRunOptions,
3258
+ expectedSuspensionRef: input.suspensionRef,
3259
+ /*
3260
+ * The answer, so the status change that ends the wait records its outcome (#1751), whoever
3261
+ * answered — the person, or the answering agent (#1559). A coding park is deliberately NOT
3262
+ * routed (see where it parks), so `actor` only feeds the record.
3263
+ */
3264
+ decision: {
3265
+ ...(input.actingUserId ? { actor: humanDecisionSettler(input.actingUserId) } : {}),
3266
+ answer: {
3267
+ decisionId: taskId,
3268
+ optionRef: Workbench_ParkedCodingQuestionOptionRef.ANSWER,
3269
+ values: [{ ref: WORKBENCH_PARKED_CODING_QUESTION_FIELD_REF, value: input.answer }],
3270
+ },
3271
+ },
3272
+ });
3273
+ }
3274
+ catch (error) {
3275
+ if (!admitted)
3276
+ refusal = error;
3277
+ throw error;
3278
+ }
3279
+ });
3280
+ if (cancelledAfterAdmission)
3281
+ return { outcome: ParkedRunResumeOutcome.CANCELLED };
3282
+ if (admitted)
3283
+ return { outcome: ParkedRunResumeOutcome.RAN };
3284
+ // The trace opened for this resume holds no turn: it says why (#1581, tenth review R10-2).
3285
+ await this.recordResumeRefused(trace, task.taskRef, taskId, refusal);
3286
+ return { outcome: ParkedRunResumeOutcome.REFUSED, refusal };
2520
3287
  }
2521
3288
  finally {
2522
3289
  this.endCodingRunWindow(taskId);
2523
- this.activeRuns.delete(taskId);
3290
+ if (inherited)
3291
+ this.activeRuns.set(taskId, inherited);
3292
+ else
3293
+ this.activeRuns.delete(taskId);
3294
+ this.adjustCodingWorkDepth(taskId, -1);
2524
3295
  // NOT announced here: this runs inside a chain its CALLER settles (`resumeBody`, or a fresh run
2525
3296
  // answering its parked questions), and that caller announces once the whole chain has settled.
2526
3297
  }
@@ -2537,14 +3308,21 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
2537
3308
  * Bounded three ways, all in `decideAgentAnswerAttempt`: the posture (GUIDED keeps every question with
2538
3309
  * the person), one verdict per question, and {@link MAXIMUM_AGENT_ANSWERS_PER_RUN} answers per run.
2539
3310
  * Every verdict is written to the run's task memory BEFORE anything acts on it, so a wrong
2540
- * self-answer can be audited and a restart cannot ask the same question twice.
3311
+ * self-answer can be audited and a restart cannot ask the same question twice — except a verdict the
3312
+ * agent reaches after an operator cancelled the run, which is dropped: it would record an answer
3313
+ * nothing applied.
2541
3314
  *
2542
- * Never fails the run. Every refusal, a failed model call, an unparseable answer or a failed resume
2543
- * leaves the park exactly as it was, and the question reaches the creator as it always did.
3315
+ * Never fails the run. A refusal, a failed model call, an unparseable answer or a resume the driver
3316
+ * refused leaves the park as it was, and the question reaches the creator. A CANCEL is the one
3317
+ * exception, and it is not handled here: whichever way this returns, the chain that owns the run
3318
+ * withdraws a cancelled park when it ends ({@link withdrawCancelledRunChain}).
2544
3319
  */
2545
3320
  async answerParkedQuestionsHoldingLock(taskId, sessionContext) {
2546
3321
  try {
2547
3322
  for (;;) {
3323
+ // A cancel stops the handling at once: no model call is spent on a run that is ending (#1581).
3324
+ if (this.isRunCancelled(taskId))
3325
+ return;
2548
3326
  const parked = await this.readParkedCodingRun(taskId, sessionContext);
2549
3327
  if (!parked || !parked.checkpoint.suspension.resumable)
2550
3328
  return;
@@ -2564,6 +3342,9 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
2564
3342
  const output = await this.askAnsweringAgent({ brief: renderApplicationCodingTaskAgentPrompt(task), question, agentOutputTail });
2565
3343
  if (!output)
2566
3344
  return;
3345
+ // Cancelled while the agent decided: its verdict is NOT recorded — it would describe an answer never applied.
3346
+ if (this.isRunCancelled(taskId))
3347
+ return;
2567
3348
  const answer = output.verdict === ParkedQuestionAnswerVerdict.ANSWERED ? output.answer.trim() : '';
2568
3349
  const record = {
2569
3350
  // An `answered` with no answer is not an answer; the creator is asked.
@@ -2579,25 +3360,76 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
2579
3360
  });
2580
3361
  if (record.verdict !== ParkedQuestionAnswerVerdict.ANSWERED)
2581
3362
  return;
2582
- await this.recordCodingQuestionAnswer(task.taskRef, question, answer, { answeredBy: CodingQuestionAnswerer.ANSWERING_AGENT, basis: record.basis });
2583
- await this.resumeParkedRunHoldingLock({
3363
+ const resumed = await this.resumeParkedRunHoldingLock({
2584
3364
  taskId,
2585
3365
  executionId: parked.executionId,
3366
+ suspensionRef: parked.suspensionRef,
2586
3367
  checkpoint: parked.checkpoint,
2587
3368
  answer,
3369
+ answerSource: { answeredBy: CodingQuestionAnswerer.ANSWERING_AGENT, basis: record.basis },
2588
3370
  verificationPlans: resolveApplicationCodingTaskVerificationPlans(task.verificationIntent.requiredChecks),
2589
3371
  sessionContext,
2590
3372
  mode: parked.mode,
2591
3373
  });
3374
+ // Only a resume that RAN can have parked again on a question worth offering.
3375
+ if (resumed.outcome !== ParkedRunResumeOutcome.RAN)
3376
+ return;
2592
3377
  }
2593
3378
  }
2594
3379
  catch (error) {
2595
- this.logger.warn('The answering agent could not handle a parked coding question; it stays with the creator', {
3380
+ this.logger.warn('The answering agent could not handle a parked coding question; it goes to the creator unless the run was cancelled', {
2596
3381
  taskId,
2597
3382
  error: describeCaughtError(error),
2598
3383
  });
2599
3384
  }
2600
3385
  }
3386
+ /** Whether an operator cancelled the run this process is handling for `taskId`. */
3387
+ isRunCancelled(taskId) {
3388
+ return this.activeRuns.get(taskId)?.abortController.signal.aborted === true;
3389
+ }
3390
+ /**
3391
+ * End a run an operator cancelled while its chain was handling it (#1581, sixth to tenth reviews): a run
3392
+ * PARKED at this point is withdrawn, `CANCELLED`, "the person chose not to continue". Called from each
3393
+ * chain's ONE exit path, and only when the chain was cancelled, so no way of leaving the question handling
3394
+ * (a refusal, a failed or unparseable model call, a resume the driver refused) leaves a cancelled run
3395
+ * parked. The withdraw is recorded on the entry, which stays registered until the caller deletes it, so a
3396
+ * person's answer is refused until it is done and a second cancel answers with its outcome. A
3397
+ * `CANCELLED` run is no attempt of the task's.
3398
+ */
3399
+ withdrawCancelledRunChain(taskId, sessionContext) {
3400
+ const entry = this.activeRuns.get(taskId);
3401
+ const withdrawal = this.endParkIfWaiting(taskId, sessionContext, entry ? this.cancellersByController.get(entry.abortController) : undefined);
3402
+ if (entry)
3403
+ entry.withdrawal = withdrawal;
3404
+ return withdrawal;
3405
+ }
3406
+ /**
3407
+ * Withdraw the task's park if one is waiting — `CANCELLED` — and say what became of it. Reads STRICTLY,
3408
+ * so a store that cannot be read is reported as UNCONFIRMED rather than as "nothing was waiting"
3409
+ * (#1581, tenth review R10-1). Never throws: its callers run in a `finally` or answer a person.
3410
+ */
3411
+ async endParkIfWaiting(taskId, sessionContext,
3412
+ /** Who withdrew it (#1751), when a signed-in person did: recorded as the decider of the withdrawn question. */
3413
+ withdrawnByUserId) {
3414
+ try {
3415
+ const parked = await this.readParkedCodingRun(taskId, sessionContext, { strict: true });
3416
+ if (!parked)
3417
+ return CancelledParkOutcome.ENDED;
3418
+ await this.actorsSystem.cancelSuspendedActorExecution(parked.executionId, sessionContext, withdrawnByUserId ? { decision: { actor: humanDecisionSettler(withdrawnByUserId) } } : undefined);
3419
+ this.logDebug('A cancelled coding run was withdrawn from its park', { taskId, executionId: parked.executionId });
3420
+ return CancelledParkOutcome.ENDED;
3421
+ }
3422
+ catch (error) {
3423
+ this.logger.warn('A cancelled coding run could not be withdrawn from its park', { taskId, error: describeCaughtError(error) });
3424
+ try {
3425
+ // Refused because it is no longer waiting (withdrawn meanwhile) ends it as surely as withdrawing it.
3426
+ return (await this.readParkedCodingRun(taskId, sessionContext, { strict: true })) ? CancelledParkOutcome.STILL_WAITING : CancelledParkOutcome.ENDED;
3427
+ }
3428
+ catch {
3429
+ return CancelledParkOutcome.UNCONFIRMED;
3430
+ }
3431
+ }
3432
+ }
2601
3433
  /** ONE structured call to the answering agent; `null` when it produced nothing usable, which leaves the question with the creator. */
2602
3434
  async askAnsweringAgent(input) {
2603
3435
  const invocation = {
@@ -2888,6 +3720,9 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
2888
3720
  catch (error) {
2889
3721
  infrastructureError ??= error;
2890
3722
  unrunCheckRefs.push(plan.checkRef);
3723
+ // A check that threw out of a subprocess still carries what that subprocess printed; keep it, or
3724
+ // the record says only "Bounded subprocess failed" while the cause is in hand.
3725
+ const details = error?.details;
2891
3726
  verification.push({
2892
3727
  checkRef: plan.checkRef,
2893
3728
  outcome: {
@@ -2895,8 +3730,8 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
2895
3730
  path: plan.path,
2896
3731
  success: false,
2897
3732
  message: describeCaughtError(error),
2898
- stdoutTail: '',
2899
- stderrTail: '',
3733
+ stdoutTail: (details?.stdout ?? '').slice(-OUTPUT_TAIL_CHARS),
3734
+ stderrTail: (details?.stderr ?? '').slice(-OUTPUT_TAIL_CHARS),
2900
3735
  },
2901
3736
  });
2902
3737
  }
@@ -2984,7 +3819,13 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
2984
3819
  * and a future admission check gets the same classification by being placed
2985
3820
  * here rather than by remembering to.
2986
3821
  */
2987
- admitTypedInput(validate, message) {
3822
+ /**
3823
+ * `refusesTaskContract` marks the refusal as the task's OWN (#1581): set only by admission's two checks
3824
+ * of the task contract, so a dispatcher counts it as the task's attempt rather than the host's refusal.
3825
+ * The resume path's checks (an empty answer, a check the host no longer registers) are not the task
3826
+ * being dispatched and carry no mark.
3827
+ */
3828
+ admitTypedInput(validate, message, options = {}) {
2988
3829
  try {
2989
3830
  return validate();
2990
3831
  }
@@ -2995,7 +3836,7 @@ let CodingAgentDispatchCompanionService = class CodingAgentDispatchCompanionServ
2995
3836
  message,
2996
3837
  validationError: describeCaughtError(error),
2997
3838
  // The task's own contract was refused: a dispatcher counts this as its attempt (#1581).
2998
- [APPLICATION_CODING_CONTRACT_REFUSAL_MARKER]: true,
3839
+ ...(options.refusesTaskContract === true ? { [APPLICATION_CODING_CONTRACT_REFUSAL_MARKER]: true } : {}),
2999
3840
  },
3000
3841
  });
3001
3842
  }
@@ -3161,6 +4002,8 @@ CodingAgentDispatchCompanionService = __decorate([
3161
4002
  __param(8, inject(SAAS_SERVICE_TYPES.ActorsSystemBackendService)),
3162
4003
  __param(9, inject(COMPANION_SERVICE_TYPES.CodingRunWriteRegisterService)),
3163
4004
  __param(10, inject(COMPANION_SERVICE_TYPES.AcceptedChangeCommitService)),
4005
+ __param(11, inject(SAAS_SERVICE_TYPES.WorkerShutdownManagerService)),
4006
+ __param(11, optional()),
3164
4007
  __metadata("design:paramtypes", [LoggerService,
3165
4008
  ErrorBuilderBackendService, Object, AgentsBackendService,
3166
4009
  GitChangeSetCompanionService,
@@ -3169,7 +4012,8 @@ CodingAgentDispatchCompanionService = __decorate([
3169
4012
  CompanionIntrospectionService,
3170
4013
  ActorsSystemBackendService,
3171
4014
  CodingRunWriteRegisterCompanionService,
3172
- AcceptedChangeCommitCompanionService])
4015
+ AcceptedChangeCommitCompanionService,
4016
+ WorkerShutdownManagerBackendService])
3173
4017
  ], CodingAgentDispatchCompanionService);
3174
4018
  export { CodingAgentDispatchCompanionService };
3175
4019
  /**