@wildo-ai/dev-companion 1.1.12 → 1.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/claude-cli/models/coding-agent-dispatch.models.d.ts +21 -0
- package/dist/esm/claude-cli/models/coding-agent-dispatch.models.d.ts.map +1 -1
- package/dist/esm/claude-cli/models/coding-agent-dispatch.models.js +37 -4
- package/dist/esm/claude-cli/models/coding-agent-dispatch.models.js.map +1 -1
- package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.d.ts.map +1 -1
- package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.js +9 -2
- package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.js.map +1 -1
- package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.d.ts +66 -0
- package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.d.ts.map +1 -1
- package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.js +191 -13
- package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.js.map +1 -1
- package/dist/esm/claude-cli/services/git-change-set.companion.service.d.ts +6 -2
- package/dist/esm/claude-cli/services/git-change-set.companion.service.d.ts.map +1 -1
- package/dist/esm/claude-cli/services/git-change-set.companion.service.js +16 -39
- package/dist/esm/claude-cli/services/git-change-set.companion.service.js.map +1 -1
- package/dist/esm/code-compliance-check/check-raw-feature-id-literals.companion.js +31 -2
- package/dist/esm/code-compliance-check/check-raw-feature-id-literals.companion.js.map +1 -1
- package/dist/esm/companion-api/companion-api.schemas.d.ts +2 -0
- package/dist/esm/companion-api/companion-api.schemas.d.ts.map +1 -1
- package/dist/esm/companion-api/companion-api.schemas.js +8 -0
- package/dist/esm/companion-api/companion-api.schemas.js.map +1 -1
- package/dist/esm/companion-api/controllers/companion.controller.d.ts +13 -0
- package/dist/esm/companion-api/controllers/companion.controller.d.ts.map +1 -1
- package/dist/esm/companion-api/controllers/companion.controller.js +39 -13
- package/dist/esm/companion-api/controllers/companion.controller.js.map +1 -1
- package/dist/esm/companion-api/controllers/long-held-request.companion.d.ts +17 -0
- package/dist/esm/companion-api/controllers/long-held-request.companion.d.ts.map +1 -0
- package/dist/esm/companion-api/controllers/long-held-request.companion.js +33 -0
- package/dist/esm/companion-api/controllers/long-held-request.companion.js.map +1 -0
- package/dist/esm/core/introspection/resources/creation-home-projection.companion.d.ts +9 -0
- package/dist/esm/core/introspection/resources/creation-home-projection.companion.d.ts.map +1 -1
- package/dist/esm/core/introspection/resources/creation-home-projection.companion.js +19 -0
- package/dist/esm/core/introspection/resources/creation-home-projection.companion.js.map +1 -1
- package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.d.ts.map +1 -1
- package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.js +7 -1
- package/dist/esm/core/introspection/resources/creation-plane-projection.companion.service.js.map +1 -1
- package/dist/esm/core/introspection/resources/launch-blockers.companion.d.ts +5 -1
- package/dist/esm/core/introspection/resources/launch-blockers.companion.d.ts.map +1 -1
- package/dist/esm/core/introspection/resources/launch-blockers.companion.js +37 -4
- package/dist/esm/core/introspection/resources/launch-blockers.companion.js.map +1 -1
- package/dist/esm/core/introspection/services/companion-introspection.companion.service.d.ts +14 -0
- package/dist/esm/core/introspection/services/companion-introspection.companion.service.d.ts.map +1 -1
- package/dist/esm/core/introspection/services/companion-introspection.companion.service.js +48 -0
- package/dist/esm/core/introspection/services/companion-introspection.companion.service.js.map +1 -1
- package/dist/esm/core/introspection/services/introspection-dependency-tree.companion.d.ts +128 -0
- package/dist/esm/core/introspection/services/introspection-dependency-tree.companion.d.ts.map +1 -0
- package/dist/esm/core/introspection/services/introspection-dependency-tree.companion.js +180 -0
- package/dist/esm/core/introspection/services/introspection-dependency-tree.companion.js.map +1 -0
- package/dist/esm/core/introspection/services/introspection-source-state.companion.service.d.ts +8 -20
- package/dist/esm/core/introspection/services/introspection-source-state.companion.service.d.ts.map +1 -1
- package/dist/esm/core/introspection/services/introspection-source-state.companion.service.js +37 -142
- package/dist/esm/core/introspection/services/introspection-source-state.companion.service.js.map +1 -1
- package/dist/esm/core/introspection/services/introspection-source-walk.worker.d.ts +64 -0
- package/dist/esm/core/introspection/services/introspection-source-walk.worker.d.ts.map +1 -0
- package/dist/esm/core/introspection/services/introspection-source-walk.worker.js +304 -0
- package/dist/esm/core/introspection/services/introspection-source-walk.worker.js.map +1 -0
- package/dist/esm/core/introspection/services/introspection-worker-pool.companion.d.ts +9 -0
- package/dist/esm/core/introspection/services/introspection-worker-pool.companion.d.ts.map +1 -1
- package/dist/esm/core/introspection/services/introspection-worker-pool.companion.js +25 -3
- package/dist/esm/core/introspection/services/introspection-worker-pool.companion.js.map +1 -1
- package/dist/esm/core/runtime/companion-language-model-route.d.ts +16 -1
- package/dist/esm/core/runtime/companion-language-model-route.d.ts.map +1 -1
- package/dist/esm/core/runtime/companion-language-model-route.js +23 -1
- package/dist/esm/core/runtime/companion-language-model-route.js.map +1 -1
- package/dist/esm/core/runtime/restart-drain.companion.d.ts +107 -0
- package/dist/esm/core/runtime/restart-drain.companion.d.ts.map +1 -0
- package/dist/esm/core/runtime/restart-drain.companion.js +237 -0
- package/dist/esm/core/runtime/restart-drain.companion.js.map +1 -0
- package/dist/esm/core/runtime/services/start-companion-application.service.d.ts.map +1 -1
- package/dist/esm/core/runtime/services/start-companion-application.service.js +3 -2
- package/dist/esm/core/runtime/services/start-companion-application.service.js.map +1 -1
- package/dist/esm/core/utils/git-read-broker.companion.d.ts +62 -0
- package/dist/esm/core/utils/git-read-broker.companion.d.ts.map +1 -0
- package/dist/esm/core/utils/git-read-broker.companion.js +282 -0
- package/dist/esm/core/utils/git-read-broker.companion.js.map +1 -0
- package/dist/esm/core/utils/local-write-recording.companion.d.ts +8 -1
- package/dist/esm/core/utils/local-write-recording.companion.d.ts.map +1 -1
- package/dist/esm/core/utils/local-write-recording.companion.js +7 -23
- package/dist/esm/core/utils/local-write-recording.companion.js.map +1 -1
- package/dist/esm/executions/services/companion-executions.companion.service.d.ts +18 -1
- package/dist/esm/executions/services/companion-executions.companion.service.d.ts.map +1 -1
- package/dist/esm/executions/services/companion-executions.companion.service.js +34 -8
- package/dist/esm/executions/services/companion-executions.companion.service.js.map +1 -1
- package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.en.d.ts +29 -0
- package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.en.d.ts.map +1 -0
- package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.en.js +29 -0
- package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.en.js.map +1 -0
- package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.fr.d.ts +29 -0
- package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.fr.d.ts.map +1 -0
- package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.fr.js +29 -0
- package/dist/esm/i18n/components/HIGH_LEVEL_VIEWS_CHART_DASHBOARD_LAYOUT_EDITOR.fr.js.map +1 -0
- package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.en.d.ts +1 -0
- package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.en.d.ts.map +1 -1
- package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.en.js +2 -1
- package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.en.js.map +1 -1
- package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.fr.d.ts +1 -0
- package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.fr.d.ts.map +1 -1
- package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.fr.js +2 -1
- package/dist/esm/i18n/components/LOW_LEVEL_AI_APPROVAL.fr.js.map +1 -1
- package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.en.d.ts +5 -2
- package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.en.d.ts.map +1 -1
- package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.en.js +5 -2
- package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.en.js.map +1 -1
- package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.fr.d.ts +5 -2
- package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.fr.d.ts.map +1 -1
- package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.fr.js +5 -2
- package/dist/esm/i18n/components/LOW_LEVEL_AI_CONVERSATION_THREAD.fr.js.map +1 -1
- package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.en.d.ts +41 -0
- package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.en.d.ts.map +1 -0
- package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.en.js +41 -0
- package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.en.js.map +1 -0
- package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.fr.d.ts +41 -0
- package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.fr.d.ts.map +1 -0
- package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.fr.js +41 -0
- package/dist/esm/i18n/components/LOW_LEVEL_APPROVAL_SEAL.fr.js.map +1 -0
- package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.en.d.ts +1 -0
- package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.en.d.ts.map +1 -1
- package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.en.js +2 -1
- package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.en.js.map +1 -1
- package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.fr.d.ts +1 -0
- package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.fr.d.ts.map +1 -1
- package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.fr.js +2 -1
- package/dist/esm/i18n/components/LOW_LEVEL_CONTENT_SECTION_CONTAINER.fr.js.map +1 -1
- package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.en.d.ts +1 -0
- package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.en.d.ts.map +1 -1
- package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.en.js +2 -1
- package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.en.js.map +1 -1
- package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.fr.d.ts +1 -0
- package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.fr.d.ts.map +1 -1
- package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.fr.js +2 -1
- package/dist/esm/i18n/components/LOW_LEVEL_FORM_FIELD_STRING.fr.js.map +1 -1
- package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.en.d.ts +1 -0
- package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.en.d.ts.map +1 -1
- package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.en.js +2 -1
- package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.en.js.map +1 -1
- package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.fr.d.ts +1 -0
- package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.fr.d.ts.map +1 -1
- package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.fr.js +2 -1
- package/dist/esm/i18n/components/PUBLIC_LAYOUTS_MFA_CHALLENGE.fr.js.map +1 -1
- package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.en.d.ts +2 -0
- package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.en.d.ts.map +1 -1
- package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.en.js +3 -1
- package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.en.js.map +1 -1
- package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.fr.d.ts +2 -0
- package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.fr.d.ts.map +1 -1
- package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.fr.js +3 -1
- package/dist/esm/i18n/components/PUBLIC_LAYOUTS_TERMS.fr.js.map +1 -1
- package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_AUTH.en.d.ts +1 -1
- package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_AUTH.en.js +1 -1
- package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_AUTH.en.js.map +1 -1
- package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_AUTH.fr.d.ts +1 -1
- package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_AUTH.fr.js +1 -1
- package/dist/esm/i18n/components/PUBLIC_LAYOUTS_USER_AUTH.fr.js.map +1 -1
- package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.en.d.ts +2 -0
- package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.en.d.ts.map +1 -1
- package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.en.js +3 -1
- package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.en.js.map +1 -1
- package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.fr.d.ts +3 -1
- package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.fr.d.ts.map +1 -1
- package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.fr.js +4 -2
- package/dist/esm/i18n/components/RESOURCES_LAYOUTS_FILTERS.fr.js.map +1 -1
- package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.en.d.ts +17 -0
- package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.en.d.ts.map +1 -1
- package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.en.js +18 -1
- package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.en.js.map +1 -1
- package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.fr.d.ts +17 -0
- package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.fr.d.ts.map +1 -1
- package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.fr.js +18 -1
- package/dist/esm/i18n/components/RESOURCES_LAYOUTS_LIST.fr.js.map +1 -1
- package/dist/esm/i18n/composite_views/app.creation-conversation.fr.d.ts +206 -195
- package/dist/esm/i18n/composite_views/app.creation-conversation.fr.d.ts.map +1 -1
- package/dist/esm/i18n/composite_views/app.creation-conversation.fr.js +206 -195
- package/dist/esm/i18n/composite_views/app.creation-conversation.fr.js.map +1 -1
- package/dist/esm/i18n/composite_views/app.creation-dossier.fr.d.ts +10 -0
- package/dist/esm/i18n/composite_views/app.creation-dossier.fr.d.ts.map +1 -1
- package/dist/esm/i18n/composite_views/app.creation-dossier.fr.js +12 -2
- package/dist/esm/i18n/composite_views/app.creation-dossier.fr.js.map +1 -1
- package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.fr.d.ts +70 -0
- package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.fr.d.ts.map +1 -1
- package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.fr.js +70 -0
- package/dist/esm/i18n/resources/wildoApplicationActorSystemExecutions.fr.js.map +1 -1
- package/dist/esm/i18n/resources/wildoApplicationActorTasks.fr.d.ts +12 -2
- package/dist/esm/i18n/resources/wildoApplicationActorTasks.fr.d.ts.map +1 -1
- package/dist/esm/i18n/resources/wildoApplicationActorTasks.fr.js +12 -2
- package/dist/esm/i18n/resources/wildoApplicationActorTasks.fr.js.map +1 -1
- package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.fr.d.ts +10 -0
- package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.fr.d.ts.map +1 -1
- package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.fr.js +10 -0
- package/dist/esm/i18n/resources/wildoApplicationFlowSystemExecutions.fr.js.map +1 -1
- package/dist/esm/i18n/resources/workbenchBuildDispatchPlan.fr.d.ts +25 -20
- package/dist/esm/i18n/resources/workbenchBuildDispatchPlan.fr.d.ts.map +1 -1
- package/dist/esm/i18n/resources/workbenchBuildDispatchPlan.fr.js +25 -20
- package/dist/esm/i18n/resources/workbenchBuildDispatchPlan.fr.js.map +1 -1
- package/dist/esm/i18n/resources/workbenchBuildPlanTasks.fr.d.ts +32 -32
- package/dist/esm/i18n/resources/workbenchBuildPlanTasks.fr.js +32 -32
- package/dist/esm/i18n/resources/workbenchBuildPlanTasks.fr.js.map +1 -1
- package/dist/esm/i18n/resources/workbenchBuildTaskRecords.fr.d.ts +65 -65
- package/dist/esm/i18n/resources/workbenchBuildTaskRecords.fr.js +65 -65
- package/dist/esm/i18n/resources/workbenchBuildTaskRecords.fr.js.map +1 -1
- package/dist/esm/i18n/resources/workbenchDossierEntries.fr.d.ts +20 -0
- package/dist/esm/i18n/resources/workbenchDossierEntries.fr.d.ts.map +1 -1
- package/dist/esm/i18n/resources/workbenchDossierEntries.fr.js +20 -0
- package/dist/esm/i18n/resources/workbenchDossierEntries.fr.js.map +1 -1
- package/dist/esm/i18n/resources/workbenchGovernanceQuestions.fr.d.ts +12 -0
- package/dist/esm/i18n/resources/workbenchGovernanceQuestions.fr.d.ts.map +1 -1
- package/dist/esm/i18n/resources/workbenchGovernanceQuestions.fr.js +13 -1
- package/dist/esm/i18n/resources/workbenchGovernanceQuestions.fr.js.map +1 -1
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.d.ts +40 -0
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.d.ts.map +1 -1
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.js +13 -0
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.js.map +1 -1
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.fr.d.ts +40 -0
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.fr.d.ts.map +1 -1
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.fr.js +40 -0
- package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.fr.js.map +1 -1
- package/dist/esm/i18n/system_enums/application-creation.en.d.ts +5 -0
- package/dist/esm/i18n/system_enums/application-creation.en.d.ts.map +1 -1
- package/dist/esm/i18n/system_enums/application-creation.en.js +6 -0
- package/dist/esm/i18n/system_enums/application-creation.en.js.map +1 -1
- package/dist/esm/i18n/system_enums/application-creation.fr.d.ts +175 -170
- package/dist/esm/i18n/system_enums/application-creation.fr.d.ts.map +1 -1
- package/dist/esm/i18n/system_enums/application-creation.fr.js +175 -170
- package/dist/esm/i18n/system_enums/application-creation.fr.js.map +1 -1
- package/dist/esm/i18n/system_enums/flows-actors.fr.d.ts +22 -22
- package/dist/esm/i18n/system_enums/flows-actors.fr.js +22 -22
- package/dist/esm/i18n/system_enums/flows-actors.fr.js.map +1 -1
- package/dist/esm/i18n/system_enums/run-records.fr.d.ts +21 -21
- package/dist/esm/i18n/system_enums/run-records.fr.js +21 -21
- package/dist/esm/i18n/system_enums/run-records.fr.js.map +1 -1
- package/dist/esm/i18n/system_enums/workbench-build.en.d.ts +3 -0
- package/dist/esm/i18n/system_enums/workbench-build.en.d.ts.map +1 -1
- package/dist/esm/i18n/system_enums/workbench-build.en.js +3 -0
- package/dist/esm/i18n/system_enums/workbench-build.en.js.map +1 -1
- package/dist/esm/i18n/system_enums/workbench-build.fr.d.ts +37 -33
- package/dist/esm/i18n/system_enums/workbench-build.fr.d.ts.map +1 -1
- package/dist/esm/i18n/system_enums/workbench-build.fr.js +37 -33
- package/dist/esm/i18n/system_enums/workbench-build.fr.js.map +1 -1
- package/dist/esm/i18n/system_enums/workbench-creation-home.en.d.ts +1 -0
- package/dist/esm/i18n/system_enums/workbench-creation-home.en.d.ts.map +1 -1
- package/dist/esm/i18n/system_enums/workbench-creation-home.en.js +1 -0
- package/dist/esm/i18n/system_enums/workbench-creation-home.en.js.map +1 -1
- package/dist/esm/i18n/system_enums/workbench-creation-home.fr.d.ts +18 -17
- package/dist/esm/i18n/system_enums/workbench-creation-home.fr.d.ts.map +1 -1
- package/dist/esm/i18n/system_enums/workbench-creation-home.fr.js +18 -17
- package/dist/esm/i18n/system_enums/workbench-creation-home.fr.js.map +1 -1
- package/dist/esm/i18n/system_enums/workbench-dossier.fr.d.ts +7 -5
- package/dist/esm/i18n/system_enums/workbench-dossier.fr.d.ts.map +1 -1
- package/dist/esm/i18n/system_enums/workbench-dossier.fr.js +8 -6
- package/dist/esm/i18n/system_enums/workbench-dossier.fr.js.map +1 -1
- package/dist/esm/i18n/system_enums/workbench-secrets.fr.d.ts +12 -12
- package/dist/esm/i18n/system_enums/workbench-secrets.fr.js +12 -12
- package/dist/esm/i18n/system_enums/workbench-secrets.fr.js.map +1 -1
- package/dist/esm/i18n/system_enums/workbench-specification-artifact.fr.d.ts +1 -0
- package/dist/esm/i18n/system_enums/workbench-specification-artifact.fr.d.ts.map +1 -1
- package/dist/esm/i18n/system_enums/workbench-specification-artifact.fr.js +2 -1
- package/dist/esm/i18n/system_enums/workbench-specification-artifact.fr.js.map +1 -1
- package/dist/esm/i18n-labelling/services/labelling-planner.companion.service.d.ts.map +1 -1
- package/dist/esm/i18n-labelling/services/labelling-planner.companion.service.js +3 -4
- package/dist/esm/i18n-labelling/services/labelling-planner.companion.service.js.map +1 -1
- package/dist/esm/i18n-labelling/utils/declared-refusal-codes.utils.d.ts +11 -0
- package/dist/esm/i18n-labelling/utils/declared-refusal-codes.utils.d.ts.map +1 -1
- package/dist/esm/i18n-labelling/utils/declared-refusal-codes.utils.js +21 -0
- package/dist/esm/i18n-labelling/utils/declared-refusal-codes.utils.js.map +1 -1
- package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.d.ts +5 -1
- package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.d.ts.map +1 -1
- package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.js +5 -1
- package/dist/esm/meta-workflows/models/application-coding-agent.actors-system.definitions.js.map +1 -1
- package/dist/esm/meta-workflows/models/playbook-run-record.models.d.ts +12 -0
- package/dist/esm/meta-workflows/models/playbook-run-record.models.d.ts.map +1 -1
- package/dist/esm/meta-workflows/models/playbook-run-record.models.js +9 -0
- package/dist/esm/meta-workflows/models/playbook-run-record.models.js.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts +200 -20
- package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js +1107 -230
- package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.d.ts +158 -16
- package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.js +381 -46
- package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.js.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.d.ts +58 -0
- package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.js +116 -2
- package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-landing-projection.companion.d.ts +3 -3
- package/dist/esm/meta-workflows/services/application-build-landing-projection.companion.js +3 -3
- package/dist/esm/meta-workflows/services/application-build-landing-projection.companion.js.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-task-closure.companion.d.ts +9 -0
- package/dist/esm/meta-workflows/services/application-build-task-closure.companion.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-task-closure.companion.js +19 -0
- package/dist/esm/meta-workflows/services/application-build-task-closure.companion.js.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.d.ts +12 -0
- package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.js +31 -7
- package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/creation-intervention-ledger.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/creation-intervention-ledger.companion.service.js +4 -5
- package/dist/esm/meta-workflows/services/creation-intervention-ledger.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/creation-run-report.companion.service.d.ts +2 -2
- package/dist/esm/meta-workflows/services/creation-run-report.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/creation-run-report.companion.service.js +10 -8
- package/dist/esm/meta-workflows/services/creation-run-report.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/foundation-executor.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/foundation-executor.companion.service.js +6 -3
- package/dist/esm/meta-workflows/services/foundation-executor.companion.service.js.map +1 -1
- package/dist/esm/meta-workflows/services/playbook-run-write-register-window.companion.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/playbook-run-write-register-window.companion.js +3 -5
- package/dist/esm/meta-workflows/services/playbook-run-write-register-window.companion.js.map +1 -1
- package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts +68 -3
- package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts.map +1 -1
- package/dist/esm/meta-workflows/services/playbook-run.companion.service.js +281 -69
- package/dist/esm/meta-workflows/services/playbook-run.companion.service.js.map +1 -1
- package/package.json +18 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"companion-executions.companion.service.js","sourceRoot":"","sources":["../../../../src/executions/services/companion-executions.companion.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EACL,0BAA0B,EAE1B,qCAAqC,EACrC,aAAa,EACb,yCAAyC,EACzC,2CAA2C,EAC3C,gCAAgC,EAChC,+BAA+B,EAC/B,kBAAkB,EAClB,gBAAgB,EAChB,iCAAiC,EACjC,mCAAmC,EACnC,iCAAiC,GAElC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEL,yBAAyB,EACzB,qBAAqB,EACrB,kBAAkB,EAClB,2BAA2B,EAC3B,SAAS,EACT,uBAAuB,EACvB,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,0BAA0B,EAC1B,mBAAmB,EACnB,SAAS,EACT,kDAAkD,EAClD,mBAAmB,GAEpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,yBAAyB,GAK1B,MAAM,gCAAgC,CAAC;AAWxC,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,4BAA4B,EAAE,MAAM,wDAAwD,CAAC;AACtG,OAAO,EAAE,0BAA0B,EAAE,uBAAuB,EAAyC,MAAM,uDAAuD,CAAC;AACnK,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,2BAA2B,EAAE,uBAAuB,EAAE,2BAA2B,EAAE,MAAM,0CAA0C,CAAC;AAC7I;;;GAGG;AACH,MAAM,iCAAiC,GAAG,GAAG,CAAC;AAE9C,mHAAmH;AACnH,MAAM,kCAAkC,GAAG,GAAG,CAAC;AAE/C;;;;GAIG;AACH,MAAM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,SAAS,CAAC,SAAS,EAAE,SAAS,EAAE;YAClE,sBAAsB,EAAE,2BAA2B,CAAC,SAAS;YAC7D,OAAO,EAAE;gBACP,OAAO,EAAE,wDAAwD;gBACjE,MAAM;gBACN,OAAO,EAAE,IAAI,CAAC,gBAAgB,CAAC,UAAU,CAAC,IAAI;aAC/C;SACF,CAAC,CAAC;IACL,CAAC;CACF,CAAA;AA98EY,mCAAmC;IAD/C,UAAU,EAAE;IAMR,WAAA,MAAM,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAA;IACjC,WAAA,MAAM,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAA;IAY9C,WAAA,MAAM,CAAC,kBAAkB,CAAC,oCAAoC,CAAC,CAAA;IAE/D,WAAA,MAAM,CAAC,kBAAkB,CAAC,kCAAkC,CAAC,CAAA;IAE7D,WAAA,MAAM,CAAC,kBAAkB,CAAC,uBAAuB,CAAC,CAAA;IAElD,WAAA,MAAM,CAAC,kBAAkB,CAAC,qCAAqC,CAAC,CAAA;IAEhE,WAAA,MAAM,CAAC,uBAAuB,CAAC,gBAAgB,CAAC,CAAA;IAEhD,WAAA,MAAM,CAAC,uBAAuB,CAAC,mBAAmB,CAAC,CAAA;IAMnD,WAAA,MAAM,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAA;qCA7BgB,aAAa;QAE1C,0BAA0B;QAYT,2CAA2C;QAEpD,yCAAyC;QAE5C,+BAA+B;QAEzB,qCAAqC,UAIzC,4BAA4B;QAM/B,gBAAgB;GAnC1C,mCAAmC,CA88E/C","sourcesContent":["import { inject, injectable } from \"inversify\";\nimport { z } from \"zod\";\nimport {\n ErrorBuilderBackendService,\n ExecutionContext,\n ExecutionContextCreatorBackendService,\n LoggerService,\n RepositoriesRegistryHandlerBackendService,\n ResourcePersistenceUnitOfWorkBackendService,\n RepositoryArrayAdditionPlacement,\n ResourcesRegistryBackendService,\n SAAS_SERVICE_TYPES,\n WebSocketService,\n buildScopeRoomNotificationPayload,\n registerTransactionPostCommitEffect,\n withActorSuspensionStageMarkersOf,\n type TransactionContext,\n} from \"@wildo-ai/saas-backend-lib\";\nimport {\n type ActorExecution_Suspension,\n DEFAULT_LIST_PAGE_CEILING,\n CoreResourceOperation,\n CoreWebSocketEvent,\n ErrorCustomMessageReference,\n ErrorType,\n FlowsActors_ElementKind,\n FlowsActors_Status,\n ResourceAction,\n ResourceScopeRoomKey,\n ResourceSerializationUtils,\n ReviewDeadlineStage,\n SortOrder,\n deriveTrustedSystemWritePreservedFieldsForResource,\n isWildoBackendError,\n type ResourceType,\n} from '@wildo-ai/saas-models';\nimport {\n CustomShared_ResourceType,\n type Wildo_Application,\n type Wildo_Application_Actor_Task,\n type Wildo_Application_ActorSystem_Execution,\n type Wildo_Application_FlowSystem_Execution,\n} from \"@wildo-ai/platform-core-shared\";\nimport type {\n CompanionActorTasksListQuery,\n CompanionCreateActorTaskRequest,\n CompanionCreateActorExecutionRequest,\n CompanionCreateFlowExecutionRequest,\n CompanionExecutionsListQuery,\n CompanionUpdateActorExecutionRequest,\n CompanionUpdateActorTaskRequest,\n} from \"../../companion-api/companion-api.schemas\";\nimport type { CompanionContext } from \"../../core/context/companion-context\";\nimport { COMPANION_SERVICE_TYPES } from \"../../core/inject/models/service-types\";\nimport { CompanionTraceabilityService } from \"../../core/traceability/companion-traceability.service\";\nimport { CompanionTraceabilityLevel, CompanionTraceAliasKind, type CompanionExecutionSessionContext } from \"../../core/traceability/companion-traceability.models\";\nimport { describeCaughtError } from '@wildo-ai/saas-backend-lib';\nimport { summarizeListedRowsForTrace, toExecutionTaskSnapshot, toExecutionWithTaskSnapshot } from \"../models/execution-task-snapshot.models\";\n/**\n * How many owing executions one repair sweep reads (#1922). A row past it is found by the next sweep: nothing clears a\n * marker but its record, and a review owes at most one per run at a time.\n */\nconst OWED_CORRECTION_RECORD_SCAN_LIMIT = 200;\n\n/** How many waiting executions one page of the question deadline sweep reads (#2807); the sweep pages by `_id`. */\nconst WAITING_ACTOR_EXECUTION_PAGE_LIMIT = 100;\n\n/**\n * How many times a route move re-reads the stored question when a deadline stage was marked between its read and its\n * write (#2807, the application persistence's #1863 review H1 guard). Only a stage marker can change the question\n * without moving its route version, and a question has four stages, so a few attempts always suffice.\n */\nconst MOVE_ATTEMPTS_AROUND_STAGE_MARKERS = 5;\n\n/** The suspension path one deadline stage's FIRED marker is stored at (`ActorExecution_SuspensionDeadlines.firedAt`). */\nfunction stageMarkerPath(stage: ReviewDeadlineStage): string {\n return `suspension.deadlines.firedAt.${stage}`;\n}\n\n/**\n * The filter that holds a stored question's deadline stage markers exactly as read (#2807): each fired stage at the\n * instant it fired, each unfired stage still absent. A write guarded on it matches nothing once a sweep has fired a stage\n * since the read. Empty for a question with no clocks, on which no stage can be marked.\n */\nfunction stageMarkersAsReadFilter(stored: ActorExecution_Suspension): Record<string, unknown> {\n if (!stored.deadlines) return {};\n const filter: Record<string, unknown> = {};\n for (const stage of Object.values(ReviewDeadlineStage)) {\n const firedAt = stored.deadlines.firedAt[stage];\n filter[stageMarkerPath(stage)] = firedAt !== undefined ? firedAt : { $exists: false };\n }\n return filter;\n}\n\n/** The filter naming the suspension `expected` names: its id, or its instant for one written before ids existed. */\nfunction suspensionIdentityFilter(expected: ActorExecution_Suspension): Record<string, unknown> {\n return expected.suspensionId !== undefined\n ? { 'suspension.suspensionId': expected.suspensionId }\n : { 'suspension.suspendedAt': expected.suspendedAt };\n}\n\n/** Does the stored question still name the one `expected` names, by the same identity rule as the filter? */\nfunction isSameSuspension(stored: ActorExecution_Suspension, expected: ActorExecution_Suspension): boolean {\n return expected.suspensionId !== undefined ? stored.suspensionId === expected.suspensionId : stored.suspendedAt === expected.suspendedAt;\n}\n\n/**\n * Which of an application's actor tasks a listing answers: the caller's LANE first, then the most\n * recently updated `limit` of it.\n *\n * The order of those two steps is the whole point (#1359). Trimming first makes the window the whole\n * application's — a caller asking for coding runs read the N most recent tasks of EVERY actor, so a\n * busy judge or labelling lane could push a coding row out and the caller would conclude it never\n * existed, which is how a loop guard comes to answer \"never ran\" about work that ran. The set is\n * already materialised here, so scoping is an in-memory filter rather than a nested-path query a\n * store might silently not honour.\n */\nexport function selectListedActorTasks<TTask extends { readonly updatedAt: Date; readonly actors?: { readonly actorRef?: string } }>(\n tasks: readonly TTask[],\n query: { readonly actorRefs?: readonly string[]; readonly limit: number },\n): TTask[] {\n const scoped = query.actorRefs\n ? tasks.filter((task) => query.actorRefs!.includes(task.actors?.actorRef ?? ''))\n : [...tasks];\n return scoped.sort(newestUpdatedFirst).slice(0, query.limit);\n}\n\n/**\n * Read a listing's rows newest-first FROM THE DATABASE, a page at a time, until `enough` says the rows held\n * answer the caller (#2186, #2484). The one page loop both the execution and the actor-task listings use.\n *\n * - A page holds at most the LIST operation's ceiling (`DEFAULT_LIST_PAGE_CEILING`, 100). Pages are addressed\n * by NUMBER and the repository computes the offset from the page size it actually applied, so a lower\n * ceiling cannot misalign them.\n * - It stops on an EMPTY page, never a short one: a short page says only that the ceiling was lower than asked.\n * - Offset pages over a moving column can shift: a row updated between two page reads moves to the head and\n * pushes its neighbours one place down, so one row is read twice and the moved row is not read at all.\n * Duplicates are dropped by `_id`, keeping the fresher copy; the moved row is the newest change and the\n * next listing returns it. A listing is a snapshot either way.\n * - The order ends on `_id` in both adapters, so ties on `updatedAt` do not skip or repeat rows.\n * - A page that adds no new row ends the read: it cannot be followed by one that does, unless the repository\n * ignored `page`, and then the loop would re-read the same rows forever.\n */\n/**\n * One page of a newest-first read. Typed to the repository's `_doList` contract (`listOptions.sort`), which the\n * public `list` overload's narrower type does not name — the same pattern as the audit-log and pipeline-run readers.\n */\ninterface NewestFirstPage { page: number; limit: number; sort: Record<string, 1 | -1> }\n\nasync function readNewestRowsByPage<TRow extends { updatedAt: Date }>(\n readPage: (listOptions: NewestFirstPage) => Promise<readonly TRow[]>,\n enough: (rows: readonly TRow[]) => boolean,\n): Promise<TRow[]> {\n const byId = new Map<string, TRow>();\n for (let page = 1; !enough([...byId.values()]); page += 1) {\n const data = await readPage({ page, limit: DEFAULT_LIST_PAGE_CEILING, sort: { updatedAt: -1 } });\n if (data.length === 0) break;\n const before = byId.size;\n for (const row of data) {\n const id = String((row as { _id?: unknown })._id);\n const seen = byId.get(id);\n if (seen === undefined || seen.updatedAt.getTime() < row.updatedAt.getTime()) byId.set(id, row);\n }\n if (byId.size === before) break;\n }\n return [...byId.values()];\n}\n\n/**\n * An instant as a persisted row stores it (#2187). The companion's wire contracts and the in-memory\n * runtime carry ISO strings, and so do the jsonb parts of a row (`statusChanges`, `standaloneTaskStates`,\n * the task snapshot); the row's own `createdAt` / `updatedAt` / `finishedAt` / `startedAt` /\n * `completedAt` columns are dates. Every write of one of those columns goes through here.\n */\nfunction persistedInstant(iso: string): Date {\n return new Date(iso);\n}\n\n/**\n * The finish instant a TERMINAL write records (#3235 c).\n *\n * A write that moves nothing keeps the instant the row ENDED. Clearing the checkpoint of a run that ended long ago is\n * such a write: it carries the status the row already has (`updateExecution` reads it for a checkpoint-only patch), so\n * it used to stamp the WRITE's instant as the run's end. Measured on app-creation-test-007: a relaunch at 13:14Z adopted\n * the checkpoint of a lane refused at 00:59Z, the adoption cleared the old row's checkpoint, and the old refusal was\n * re-dated to 13:14:34Z — so the feed and the monitor announced it as a new refusal one second after the lane resumed.\n * A write that ENDS the row (a status move into a terminal state) still records its own instant, or the one it names.\n */\nfunction settledFinishInstant(input: {\n readonly existing: { readonly status: string; readonly finishedAt?: Date | string | null };\n readonly payload: { readonly status: string; readonly finishedAt?: string };\n readonly updatedAt: string;\n}): Date {\n if (input.payload.finishedAt !== undefined) return persistedInstant(input.payload.finishedAt);\n const ended = input.existing.finishedAt;\n if (input.existing.status === input.payload.status && ended !== undefined && ended !== null) {\n return ended instanceof Date ? ended : persistedInstant(ended);\n }\n return persistedInstant(input.updatedAt);\n}\n\n/**\n * Newest `updatedAt` first, compared as INSTANTS (#2187). The stored rows carried local-offset text and\n * were ordered with `localeCompare`, which agrees with time only while every value has the same offset.\n */\nfunction newestUpdatedFirst(left: { readonly updatedAt: Date }, right: { readonly updatedAt: Date }): number {\n return right.updatedAt.getTime() - left.updatedAt.getTime();\n}\n\n/**\n * The room and payload for one repository-direct control-plane mutation (issue #286).\n *\n * Exported and pure so the two properties that MATTER can be pinned without standing up the whole\n * service: which room the event goes to, and what it carries.\n *\n * ## The ORGANIZATION room is a tenant-isolation decision, not a detail\n *\n * `wildoApplicationActorTasks` and both execution resources declare `isPrimaryScope: true` on their\n * ORGANIZATIONS relationship, so a row belongs to ONE tenant. The sibling introspection notifier\n * legitimately broadcasts to the APPLICATION room because every resource it serves is\n * APPLICATION-anchored; doing that here would carry one tenant's row ids to every user of the\n * application.\n *\n * ## Notification-grade, never row data\n *\n * `currentObject` is deliberately absent. A scope room fans out to every member of the tenant, and\n * these rows carry coding-agent input and output that a collection event has no business\n * broadcasting. Subscribers learn WHAT moved and refetch through their own authorization — the same\n * contract the introspection notifier's collection lane uses.\n */\nexport function buildControlPlaneMutationNotification(\n resourceType: string,\n ownership: CompanionExecutionOwnership,\n resourceId: string,\n action: ResourceAction,\n) {\n return {\n resourceType,\n rooms: [{ scopeKey: ResourceScopeRoomKey.ORGANIZATION, scopeId: ownership.organizationId }],\n event: CoreWebSocketEvent.RESOURCE_UPDATED,\n payload: {\n resourceType,\n resourceId,\n contextResourceIdentifiers: {\n organizationId: ownership.organizationId,\n applicationId: ownership.wildoApplicationId,\n },\n action,\n affectedIds: [resourceId],\n operationIdentifier: CoreResourceOperation.LIST,\n currentObject: undefined,\n },\n };\n}\n\ninterface CompanionExecutionOwnership {\n organizationId: string;\n wildoApplicationId: string;\n}\n\n/*\n * The stored rows are the PERSISTED platform types, imported rather than restated (#2187). This file used\n * to declare its own three, built from the in-memory schemas, so when the persisted instants became dates\n * the service still typed them as strings and compared them with `localeCompare` — a second description of\n * one row that had already drifted from the first.\n */\n\n/**\n * One entry of an execution's `standaloneTasks` snapshot: the IN-MEMORY task form, ISO-string instants,\n * stored as jsonb. Distinct from the persisted task row (`Wildo_Application_Actor_Task`, dated instants);\n * a row enters the snapshot only through `toExecutionTaskSnapshot`.\n */\ntype ExecutionTaskSnapshotEntry = Wildo_Application_ActorSystem_Execution[\"standaloneTasks\"][number];\n\nconst WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE: ResourceType = \"wildoApplicationActorSystemExecutions\";\n\nconst WILDO_APPLICATION_FLOW_SYSTEM_EXECUTIONS_RESOURCE_TYPE: ResourceType = \"wildoApplicationFlowSystemExecutions\";\n\nconst WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE: ResourceType = \"wildoApplicationActorTasks\";\n\n/**\n * The persistence participants of every companion execution boundary.\n *\n * Executions and their tasks are written together — creating an execution persists its\n * standalone tasks, and both task verbs read the owning execution back inside the same\n * transaction — so the two resources belong to ONE boundary. Declaring them is what lets the\n * unit of work resolve a single adapter and refuse the split-store case outright, instead of\n * discovering it at commit time on whichever adapter happened to open the transaction.\n */\nconst COMPANION_EXECUTION_PERSISTENCE_PARTICIPANTS: Readonly<Record<string, string>> = Object.freeze({\n actorExecution: WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n actorTask: WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE,\n});\n\ntype ExecutionCreateEnvelope = {\n status: FlowsActors_Status;\n statusChanges: Array<{ status: FlowsActors_Status; timestamp: string }>;\n createdAt?: string;\n updatedAt?: string;\n finishedAt?: string;\n};\n\n/** How many times a status-less task write re-reads a row whose status moved under it (#1586 review F6). */\nconst TASK_STATUS_GUARD_ATTEMPTS = 3;\n\ntype CompanionRepositoryOptions = {\n transaction?: TransactionContext;\n};\n\ntype PersistedExecutionTask = {\n sourceTaskId: string;\n task: Wildo_Application_Actor_Task;\n};\n\n/** The most runs of one build task in one status a per-task read returns (#3204): far above any task's real count. */\nconst BUILD_TASK_RUN_ROWS_LIMIT = 200;\n\n/** The longest one execution listing is shared, whatever else happens (#3204, {@link CompanionExecutionsCompanionService}). */\nconst EXECUTION_LISTING_HOLD_MS = 3_000;\n\n@injectable()\nexport class CompanionExecutionsCompanionService {\n private readonly logDebug: (message: string, context?: Record<string, unknown>) => void;\n private ownershipPromise?: Promise<CompanionExecutionOwnership>;\n\n constructor(\n @inject(SAAS_SERVICE_TYPES.Logger) private readonly logger: LoggerService,\n @inject(SAAS_SERVICE_TYPES.ErrorBuilderService)\n private readonly errorBuilder: ErrorBuilderBackendService,\n /*\n * The ADAPTER-NEUTRAL transaction seam, not `MongoDBService`.\n *\n * These three boundaries used `mongoDBService.executeTransaction` until 2026-08-28, which\n * is one half of why the companion could not run on a PostgreSQL platform (issue #94):\n * even once the right store is connected, a Mongo-specific transaction cannot wrap a write\n * to a PostgreSQL-resolved repository. The unit of work resolves the adapter from the\n * DECLARED participants and refuses a boundary whose resources are split across two stores,\n * which is a configuration error rather than something to discover at commit time.\n */\n @inject(SAAS_SERVICE_TYPES.ResourcePersistenceUnitOfWorkService)\n private readonly resourcePersistenceUnitOfWork: ResourcePersistenceUnitOfWorkBackendService,\n @inject(SAAS_SERVICE_TYPES.RepositoriesRegistryHandlerService)\n private readonly repositoriesRegistry: RepositoriesRegistryHandlerBackendService,\n @inject(SAAS_SERVICE_TYPES.ResourceRegistryService)\n private readonly resourcesRegistry: ResourcesRegistryBackendService,\n @inject(SAAS_SERVICE_TYPES.ExecutionContextCreatorBackendService)\n private readonly executionContextCreator: ExecutionContextCreatorBackendService,\n @inject(COMPANION_SERVICE_TYPES.CompanionContext)\n private readonly companionContext: CompanionContext,\n @inject(COMPANION_SERVICE_TYPES.TraceabilityService)\n private readonly traceabilityService: CompanionTraceabilityService,\n /*\n * The companion MOUNTS the engine WebSocket server, and these control-plane writes were the\n * one lane that never used it (issue #286). See `publishControlPlaneMutation`.\n */\n @inject(SAAS_SERVICE_TYPES.WebSocketService)\n private readonly websocketService: WebSocketService,\n ) {\n this.logDebug = this.logger.debugByType(\"CompanionExecutionsCompanionService\");\n this.logger.setDebugTypeLogging(\"CompanionExecutionsCompanionService\", true);\n }\n\n public async createActorExecution(\n payload: CompanionCreateActorExecutionRequest,\n sessionContext?: CompanionExecutionSessionContext,\n ): Promise<Wildo_Application_ActorSystem_Execution> {\n this.noteExecutionWrite();\n try {\n const traceStep = this.createOperationTraceStep(sessionContext, \"create-actor-execution\");\n await this.traceOperationStart({\n sessionContext,\n step: traceStep,\n type: \"actor-execution-create-start\",\n summary: `Create persisted actor execution for ${payload.systemRef}`,\n payload: {\n systemRef: payload.systemRef,\n status: payload.status,\n standaloneTaskCount: payload.standaloneTasks.length,\n },\n artifactFileName: \"actor-execution-create-request.json\",\n artifactContent: payload,\n });\n\n try {\n this.assertStandaloneTaskStateConsistency(payload);\n const execution = await this.resourcePersistenceUnitOfWork.executeTransaction(\n {\n boundary: 'companion-executions.create-actor-execution',\n participants: COMPANION_EXECUTION_PERSISTENCE_PARTICIPANTS,\n },\n async ({ transaction }) => {\n const ownership = await this.resolveOwnership(sessionContext);\n const repository = this.repositoriesRegistry.getRepositoryOrThrow(WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE);\n const executionContext = await this.createInternalExecutionContext(\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n CoreResourceOperation.CREATE,\n sessionContext,\n );\n const normalizedPayload = this.normalizeCreateEnvelope(payload);\n // The execution's task snapshot never carries a transcript, whichever door writes it (see\n // `execution-task-snapshot.models.ts`).\n const createData = toExecutionWithTaskSnapshot({\n ...payload,\n ...normalizedPayload,\n organizationId: ownership.organizationId,\n wildoApplicationId: ownership.wildoApplicationId,\n });\n\n const createdExecution = await repository.create<Wildo_Application_ActorSystem_Execution>(executionContext, createData, {\n ...this.buildRepositoryOptions(transaction),\n preserveServerInjectedFields: this.deriveServerInjectedPreserveFields(\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n createData,\n CoreResourceOperation.CREATE,\n ),\n });\n\n this.publishControlPlaneMutation(\n transaction,\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n ownership,\n String(createdExecution._id),\n ResourceAction.CREATED,\n );\n // Announced ONCE, here, because both return paths below concern this same row — the\n // snapshot update that may follow is the same execution, not a second one.\n if (payload.standaloneTasks.length === 0) {\n return createdExecution;\n }\n\n const persistedTasks = await this.persistExecutionTasks(\n ownership,\n createdExecution._id,\n payload.standaloneTasks,\n payload.standaloneTaskStates,\n transaction,\n sessionContext,\n );\n\n const updatedExecution = await this.updateActorExecutionTaskSnapshot(\n createdExecution,\n ownership,\n persistedTasks.map(({ task }) => toExecutionTaskSnapshot(task)),\n transaction,\n this.buildPersistedStandaloneTaskStates(persistedTasks, payload.standaloneTaskStates),\n sessionContext,\n );\n return updatedExecution;\n },\n );\n\n if (sessionContext) {\n await this.traceabilityService.registerAlias(sessionContext, CompanionTraceAliasKind.ACTOR_EXECUTION,execution._id);\n }\n\n await this.traceOperationSuccess({\n sessionContext,\n step: traceStep,\n type: \"actor-execution-create-success\",\n summary: `Created persisted actor execution ${execution._id}`,\n payload: {\n executionId: execution._id,\n status: execution.status,\n standaloneTaskCount: execution.standaloneTasks.length,\n },\n artifactFileName: \"actor-execution-create-result.json\",\n artifactContent: execution,\n });\n return execution;\n } catch (error) {\n await this.traceOperationFailure({\n sessionContext,\n step: traceStep,\n type: \"actor-execution-create-failure\",\n summary: `Failed to create persisted actor execution for ${payload.systemRef}`,\n error,\n payload: {\n systemRef: payload.systemRef,\n status: payload.status,\n standaloneTaskCount: payload.standaloneTasks.length,\n },\n });\n throw error;\n }\n } finally {\n this.noteExecutionWrite();\n }\n }\n\n /**\n * SETTLE an execution — the write that did not exist until 2026-09-19 (#1343).\n *\n * `createActorExecution` could open one and nothing could close it: `syncTaskIntoExecutionSnapshot`\n * maintains `standaloneTasks`/`standaloneTaskStates` and never the execution's own `status`, so an\n * execution opened as PROCESSING stayed PROCESSING while its tasks finished underneath it. A\n * control-plane row that looks like it tracks a run and does not is the defect this lane already\n * has once; a second one is not worth having.\n *\n * `statusChanges` is APPENDED to rather than replaced, because it is a history and a caller that\n * had to send the whole list would have to read it first — and two settlers racing would then each\n * write a list missing the other's entry.\n */\n public async updateActorExecution(\n executionId: string,\n payload: CompanionUpdateActorExecutionRequest,\n sessionContext?: CompanionExecutionSessionContext,\n ): Promise<Wildo_Application_ActorSystem_Execution> {\n this.noteExecutionWrite();\n try {\n const traceStep = this.createOperationTraceStep(sessionContext, \"update-actor-execution\");\n await this.traceOperationStart({\n sessionContext,\n step: traceStep,\n type: \"actor-execution-update-start\",\n summary: `Update persisted actor execution ${executionId}`,\n payload: { executionId, status: payload.status },\n artifactFileName: \"actor-execution-update-request.json\",\n artifactContent: { executionId, payload },\n });\n\n try {\n const execution = await this.resourcePersistenceUnitOfWork.executeTransaction(\n {\n boundary: 'companion-executions.update-actor-execution',\n participants: COMPANION_EXECUTION_PERSISTENCE_PARTICIPANTS,\n },\n async ({ transaction }) => {\n const ownership = await this.resolveOwnership(sessionContext);\n const existing = await this.readActorExecutionOrThrow(executionId, ownership.wildoApplicationId, transaction, sessionContext);\n const repository = this.repositoriesRegistry.getRepositoryOrThrow(WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE);\n const executionContext = await this.createInternalExecutionContext(\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n CoreResourceOperation.UPDATE,\n sessionContext,\n );\n const updatedAt = new Date().toISOString();\n const isTerminal = this.isTerminalStatus(payload.status);\n const updated = await repository.update<Wildo_Application_ActorSystem_Execution>(\n executionContext,\n { _id: executionId, wildoApplicationId: ownership.wildoApplicationId },\n {\n status: payload.status,\n updatedAt: persistedInstant(updatedAt),\n /*\n * A HISTORY OF MOVES, so a write that moves nothing appends nothing (#1360): a\n * checkpoint-only update carries the status the row already has, and recording it as a\n * change would fill the history with one entry per checkpoint of a long run.\n */\n statusChanges: [\n ...existing.statusChanges,\n ...(payload.statusChanges ?? (payload.status === existing.status ? [] : [{ status: payload.status, timestamp: updatedAt }])),\n ],\n // `null` clears, absent leaves alone — see `CompanionUpdateActorExecutionRequestSchema`.\n ...(payload.suspension !== undefined ? { suspension: payload.suspension } : {}),\n ...(payload.checkpoint !== undefined ? { checkpoint: payload.checkpoint } : {}),\n // A record a put-back settle restores (#1922); its `null` is a clear, below.\n ...(payload.pendingCorrectionRecord ? { pendingCorrectionRecord: payload.pendingCorrectionRecord } : {}),\n // A non-terminal settle must not carry a finish instant, and the request schema already\n // refuses the combination — this is the same rule at the write, where it is enforceable.\n ...(isTerminal ? { finishedAt: settledFinishInstant({ existing, payload, updatedAt }) } : {}),\n },\n this.buildRepositoryOptions(transaction),\n );\n if (updated === null) {\n // Same reading as `updateActorExecutionTaskSnapshot`: the filter matched nothing, which is\n // either a concurrent delete or an ownership violation, and from here they are one shape.\n throw new Error(\n `Actor-system execution '${executionId}' could not be updated: no row matches that id under `\n + `application '${ownership.wildoApplicationId}'. It was removed concurrently, or it belongs to another application.`,\n );\n }\n /*\n * A NON-terminal row has no finish instant — whatever wrote one before. The ordinary update can\n * only set, so a run moved back to waiting after a withdraw was undone kept the withdraw's\n * `finishedAt`, and the run record and the workbench then read a waiting run as finished at\n * that instant (#1586 review N1). Cleared in the same transaction, only when there is one — and\n * announced like every other write: this is the one that tells a watcher the run waits again.\n */\n /*\n * The update can only SET, so a `null` that must clear is applied here, in the same transaction: a stale finish\n * instant (above), and a record a put-back settle no longer owes (#1922) — `null` there is the engine saying\n * the row owed nothing before the swap stamped it.\n */\n let written = updated;\n const cleared = [\n ...(!isTerminal && updated.finishedAt !== undefined ? ['finishedAt'] as const : []),\n ...(payload.pendingCorrectionRecord === null && updated.pendingCorrectionRecord != null ? ['pendingCorrectionRecord'] as const : []),\n ];\n if (cleared.length > 0) {\n await this.repositoriesRegistry.atomicConditionalSet(\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n { _id: executionId, wildoApplicationId: ownership.wildoApplicationId },\n { clear: [...cleared] },\n undefined,\n this.buildRepositoryOptions(transaction),\n );\n const remaining: Record<string, unknown> = { ...updated };\n for (const field of cleared) delete remaining[field];\n written = remaining as Wildo_Application_ActorSystem_Execution;\n }\n this.publishControlPlaneMutation(\n transaction,\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n ownership,\n String(written._id),\n ResourceAction.UPDATED,\n );\n return written;\n },\n );\n\n await this.traceOperationSuccess({\n sessionContext,\n step: traceStep,\n type: \"actor-execution-update-success\",\n summary: `Updated persisted actor execution ${execution._id}`,\n payload: { executionId: execution._id, status: execution.status },\n artifactFileName: \"actor-execution-update-result.json\",\n artifactContent: execution,\n });\n return execution;\n } catch (error) {\n await this.traceOperationFailure({\n sessionContext,\n step: traceStep,\n type: \"actor-execution-update-failure\",\n summary: `Failed to update persisted actor execution ${executionId}`,\n error,\n payload: { executionId, status: payload.status },\n });\n throw error;\n }\n } finally {\n this.noteExecutionWrite();\n }\n }\n\n /**\n * Move a WAITING actor execution out of waiting — the compare-and-swap behind the engine port's\n * `updateSuspendedExecution` (#1586). Answers the moved row, or `null` when the row is no longer\n * waiting on `expected`, in which case NOTHING was written.\n *\n * ONE guarded statement: the predicate (this application, `AWAITING_APPROVAL`, and the suspension\n * `expected` names) travels in the filter of `atomicGuardedMutation`, which compiles to a\n * `findOneAndUpdate` on MongoDB and an `UPDATE … WHERE` on PostgreSQL. `updateActorExecution` is not\n * reused: it reads the row and then writes it, which is exactly the window two decisions raced\n * through. For the same reason the history entry is APPENDED in the statement rather than rebuilt\n * from a read, and the two cleared fields use `clear`, the one spelling both adapters agree on.\n *\n * The suspension is matched by the field its reference was taken from — `suspensionId`, or\n * `suspendedAt` for a row written before ids existed — which is `actorExecutionSuspensionRef`'s own\n * rule, so a decision that names a suspension and the write that honours it cannot disagree.\n */\n public async updateSuspendedActorExecution(\n executionId: string,\n expected: ActorExecution_Suspension,\n payload: CompanionUpdateActorExecutionRequest,\n sessionContext?: CompanionExecutionSessionContext,\n ): Promise<Wildo_Application_ActorSystem_Execution | null> {\n this.noteExecutionWrite();\n try {\n const traceStep = this.createOperationTraceStep(sessionContext, \"update-suspended-actor-execution\");\n await this.traceOperationStart({\n sessionContext,\n step: traceStep,\n type: \"actor-execution-update-start\",\n summary: `Move waiting actor execution ${executionId} out of waiting`,\n payload: { executionId, status: payload.status },\n artifactFileName: \"actor-execution-swap-request.json\",\n artifactContent: { executionId, expected, payload },\n });\n\n try {\n const moved = await this.resourcePersistenceUnitOfWork.executeTransaction(\n {\n boundary: 'companion-executions.update-suspended-actor-execution',\n participants: COMPANION_EXECUTION_PERSISTENCE_PARTICIPANTS,\n },\n async ({ transaction }) => {\n const ownership = await this.resolveOwnership(sessionContext);\n const executionContext = await this.createInternalExecutionContext(\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n CoreResourceOperation.UPDATE,\n sessionContext,\n );\n const updatedAt = new Date().toISOString();\n const cleared = [\n ...(payload.suspension === null ? ['suspension'] : []),\n ...(payload.checkpoint === null ? ['checkpoint'] : []),\n ...(payload.pendingCorrectionRecord === null ? ['pendingCorrectionRecord'] : []),\n // A non-terminal move leaves no finish instant, as `updateActorExecution` guarantees (#1586 review N1).\n ...(this.isTerminalStatus(payload.status) ? [] : ['finishedAt']),\n ];\n const updated = await this.repositoriesRegistry.atomicGuardedMutation<Wildo_Application_ActorSystem_Execution>(\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n {\n _id: executionId,\n wildoApplicationId: ownership.wildoApplicationId,\n status: FlowsActors_Status.AWAITING_APPROVAL,\n ...(expected.suspensionId !== undefined\n ? { 'suspension.suspensionId': expected.suspensionId }\n : { 'suspension.suspendedAt': expected.suspendedAt }),\n // A route moved since the read makes this match nothing (#1594 I5). A suspension written\n // before routes existed carries no version and is matched by its identity alone.\n ...(expected.routeVersion !== undefined ? { 'suspension.routeVersion': expected.routeVersion } : {}),\n },\n {\n set: {\n status: payload.status,\n updatedAt: persistedInstant(updatedAt),\n ...(payload.suspension ? { suspension: payload.suspension } : {}),\n ...(payload.checkpoint ? { checkpoint: payload.checkpoint } : {}),\n // The record a settle of a review owes rides the move it settles (#1599 I3, #1922): one statement.\n ...(payload.pendingCorrectionRecord ? { pendingCorrectionRecord: payload.pendingCorrectionRecord } : {}),\n ...(this.isTerminalStatus(payload.status) ? { finishedAt: persistedInstant(payload.finishedAt ?? updatedAt) } : {}),\n },\n ...(cleared.length > 0 ? { clear: cleared } : {}),\n arrayAdditions: [{\n path: 'statusChanges',\n // How the wait ended rides on the change that ended it, in this statement (#1594 I4).\n values: [{ status: payload.status, timestamp: updatedAt, ...(payload.resolution ? { resolution: payload.resolution } : {}) }],\n placement: RepositoryArrayAdditionPlacement.TAIL,\n distinctOnly: false,\n }],\n },\n executionContext,\n this.buildRepositoryOptions(transaction),\n );\n if (updated !== null) {\n this.publishControlPlaneMutation(\n transaction,\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n ownership,\n String(updated._id),\n ResourceAction.UPDATED,\n );\n }\n return updated;\n },\n );\n\n await this.traceOperationSuccess({\n sessionContext,\n step: traceStep,\n type: \"actor-execution-update-success\",\n summary: moved\n ? `Moved waiting actor execution ${executionId} to ${payload.status}`\n : `Actor execution ${executionId} was no longer waiting on that question; nothing was written`,\n payload: { executionId, status: payload.status, moved: moved !== null },\n artifactFileName: \"actor-execution-swap-result.json\",\n artifactContent: moved ?? { moved: false },\n });\n return moved;\n } catch (error) {\n await this.traceOperationFailure({\n sessionContext,\n step: traceStep,\n type: \"actor-execution-update-failure\",\n summary: `Failed to move waiting actor execution ${executionId}`,\n error,\n payload: { executionId, status: payload.status },\n });\n throw error;\n }\n } finally {\n this.noteExecutionWrite();\n }\n }\n\n public async createFlowExecution(\n payload: CompanionCreateFlowExecutionRequest,\n sessionContext?: CompanionExecutionSessionContext,\n ): Promise<Wildo_Application_FlowSystem_Execution> {\n this.noteExecutionWrite();\n try {\n const traceStep = this.createOperationTraceStep(sessionContext, \"create-flow-execution\");\n await this.traceOperationStart({\n sessionContext,\n step: traceStep,\n type: \"flow-execution-create-start\",\n summary: `Create persisted flow execution for ${payload.systemRef}`,\n payload: {\n systemRef: payload.systemRef,\n status: payload.status,\n },\n artifactFileName: \"flow-execution-create-request.json\",\n artifactContent: payload,\n });\n\n try {\n const ownership = await this.resolveOwnership(sessionContext);\n const repository = this.repositoriesRegistry.getRepositoryOrThrow(WILDO_APPLICATION_FLOW_SYSTEM_EXECUTIONS_RESOURCE_TYPE);\n const executionContext = await this.createInternalExecutionContext(\n WILDO_APPLICATION_FLOW_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n CoreResourceOperation.CREATE,\n sessionContext,\n );\n const normalizedPayload = this.normalizeCreateEnvelope(payload);\n const createData = {\n ...payload,\n ...normalizedPayload,\n organizationId: ownership.organizationId,\n wildoApplicationId: ownership.wildoApplicationId,\n };\n\n const flowExecution = await repository.create<Wildo_Application_FlowSystem_Execution>(executionContext, createData, {\n preserveServerInjectedFields: this.deriveServerInjectedPreserveFields(\n WILDO_APPLICATION_FLOW_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n createData,\n CoreResourceOperation.CREATE,\n ),\n });\n // `null` transaction: this write is NOT wrapped in one, so it is already durable here.\n this.publishControlPlaneMutation(\n null,\n WILDO_APPLICATION_FLOW_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n ownership,\n String(flowExecution._id),\n ResourceAction.CREATED,\n );\n if (sessionContext) {\n await this.traceabilityService.registerAlias(sessionContext, CompanionTraceAliasKind.FLOW_EXECUTION,flowExecution._id);\n }\n await this.traceOperationSuccess({\n sessionContext,\n step: traceStep,\n type: \"flow-execution-create-success\",\n summary: `Created persisted flow execution ${flowExecution._id}`,\n payload: {\n executionId: flowExecution._id,\n status: flowExecution.status,\n },\n artifactFileName: \"flow-execution-create-result.json\",\n artifactContent: flowExecution,\n });\n return flowExecution;\n } catch (error) {\n await this.traceOperationFailure({\n sessionContext,\n step: traceStep,\n type: \"flow-execution-create-failure\",\n summary: `Failed to create persisted flow execution for ${payload.systemRef}`,\n error,\n payload: {\n systemRef: payload.systemRef,\n status: payload.status,\n },\n });\n throw error;\n }\n } finally {\n this.noteExecutionWrite();\n }\n }\n\n /**\n * Move a WAITING actor execution's question to another route — the compare-and-swap behind the engine port's\n * `moveSuspensionRoute` (#2636). Answers whether it moved; `false` means the row no longer waits on `expected` at the\n * route version that was read, and NOTHING was written.\n *\n * ONE guarded statement, like {@link updateSuspendedActorExecution}: the predicate (this application,\n * `AWAITING_APPROVAL`, the suspension `expected` names, its route version) travels in the filter, and the write\n * replaces the stored suspension — whose route and version are the move — and nothing else. The status and its\n * history are untouched: the question was moved, not settled.\n *\n * #2807: the deadline sweep marks a fired stage on the same stored question without moving the route version\n * ({@link markActorExecutionSuspensionDeadlineStage}), so a move built from an earlier read would put back a question\n * whose stage had not fired yet, and that stage would fire again. The move therefore re-reads the stored question,\n * keeps every stage marker it carries (`withActorSuspensionStageMarkersOf`: a stage that fired stays fired), and guards\n * on those markers exactly as read. A stage marked between that read and the write makes the write match nothing; the\n * move then reads again and retries, a bounded number of times, since only a marker can have landed while the version\n * still matches. The application persistence does the same on its serialized column (#1863 review H1).\n */\n public async moveActorExecutionSuspensionRoute(\n executionId: string,\n expected: ActorExecution_Suspension,\n next: ActorExecution_Suspension,\n sessionContext?: CompanionExecutionSessionContext,\n ): Promise<boolean> {\n this.noteExecutionWrite();\n try {\n return this.resourcePersistenceUnitOfWork.executeTransaction(\n {\n boundary: 'companion-executions.move-actor-execution-suspension-route',\n participants: COMPANION_EXECUTION_PERSISTENCE_PARTICIPANTS,\n },\n async ({ transaction }) => {\n const ownership = await this.resolveOwnership(sessionContext);\n const executionContext = await this.createInternalExecutionContext(\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n CoreResourceOperation.UPDATE,\n sessionContext,\n );\n for (let attempt = 0; attempt < MOVE_ATTEMPTS_AROUND_STAGE_MARKERS; attempt += 1) {\n const stored = await this.readStoredActorExecution(executionId, ownership.wildoApplicationId);\n const current = stored?.status === FlowsActors_Status.AWAITING_APPROVAL ? stored.suspension : undefined;\n // A stored question with no version was never routed, and the filter below could never match it (see the version guard).\n if (!current || !isSameSuspension(current, expected) || current.routeVersion === undefined || current.routeVersion !== (expected.routeVersion ?? 0)) return false;\n const moved = await this.repositoriesRegistry.atomicGuardedMutation<Wildo_Application_ActorSystem_Execution>(\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n {\n _id: executionId,\n wildoApplicationId: ownership.wildoApplicationId,\n status: FlowsActors_Status.AWAITING_APPROVAL,\n ...suspensionIdentityFilter(expected),\n // The version that was read (#1594 I5). A routed suspension is written at version 0, so an absent one reads 0:\n // a stored suspension with no version never matches, which refuses the move rather than guessing.\n 'suspension.routeVersion': expected.routeVersion ?? 0,\n // #2807: the stage markers exactly as just read, so a stage marked meanwhile is never overwritten.\n ...stageMarkersAsReadFilter(current),\n },\n { set: { suspension: withActorSuspensionStageMarkersOf(current, next), updatedAt: persistedInstant(new Date().toISOString()) } },\n executionContext,\n this.buildRepositoryOptions(transaction),\n );\n if (moved !== null) {\n this.publishControlPlaneMutation(\n transaction,\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n ownership,\n String(moved._id),\n ResourceAction.UPDATED,\n );\n return true;\n }\n }\n this.logger.warn('A route move kept losing to writes on the same question; it is refused', { executionId });\n return false;\n },\n );\n } finally {\n this.noteExecutionWrite();\n }\n }\n\n /**\n * Record that ONE deadline stage of a waiting actor execution's question FIRED — the compare-and-swap behind the engine\n * port's `markSuspensionDeadlineStage` (#1863 on this plane, #2807). Answers the question as written, or `null` when\n * another writer reached the row first (the stage fired, the question moved, was answered or ended), in which case\n * NOTHING was written.\n *\n * ONE guarded statement: the predicate (this application, `AWAITING_APPROVAL`, the suspension `expected` names, at its\n * route version, with clocks, and with THIS stage's marker still absent) travels in the filter, and the write sets that\n * one marker by its path and stamps `updatedAt`. It never touches the status or the status history, and never the rest\n * of the question: firing a reminder settles nothing. Two sweeps racing on one stage both read it unfired; the first\n * write sets the marker, and the second's filter then matches nothing, so the stage fires once.\n */\n public async markActorExecutionSuspensionDeadlineStage(\n executionId: string,\n expected: ActorExecution_Suspension,\n stage: ReviewDeadlineStage,\n firedAt: Date,\n sessionContext?: CompanionExecutionSessionContext,\n ): Promise<ActorExecution_Suspension | null> {\n this.noteExecutionWrite();\n try {\n return this.resourcePersistenceUnitOfWork.executeTransaction(\n {\n boundary: 'companion-executions.mark-actor-execution-suspension-deadline-stage',\n participants: COMPANION_EXECUTION_PERSISTENCE_PARTICIPANTS,\n },\n async ({ transaction }) => {\n const ownership = await this.resolveOwnership(sessionContext);\n const executionContext = await this.createInternalExecutionContext(\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n CoreResourceOperation.UPDATE,\n sessionContext,\n );\n const marked = await this.repositoriesRegistry.atomicGuardedMutation<Wildo_Application_ActorSystem_Execution>(\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n {\n _id: executionId,\n wildoApplicationId: ownership.wildoApplicationId,\n status: FlowsActors_Status.AWAITING_APPROVAL,\n ...suspensionIdentityFilter(expected),\n // The route the stage was due on: a question moved since (a claim restarts no clock, but it is a new read) is\n // re-read by the next sweep. A suspension written without a version is matched by its identity alone.\n ...(expected.routeVersion !== undefined ? { 'suspension.routeVersion': expected.routeVersion } : {}),\n // A question with clocks: a marker is never written onto one that has none.\n 'suspension.deadlines.decisionDeadlineAt': { $exists: true },\n // The exactly-once guard: this stage not yet fired.\n [stageMarkerPath(stage)]: { $exists: false },\n },\n { set: { [stageMarkerPath(stage)]: firedAt.toISOString(), updatedAt: persistedInstant(new Date().toISOString()) } },\n executionContext,\n this.buildRepositoryOptions(transaction),\n );\n if (marked === null || !marked.suspension) return null;\n this.publishControlPlaneMutation(\n transaction,\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n ownership,\n String(marked._id),\n ResourceAction.UPDATED,\n );\n return marked.suspension;\n },\n );\n } finally {\n this.noteExecutionWrite();\n }\n }\n\n /**\n * One page of this application's actor executions of `systemRef` that wait on a question (#2807): what the companion's\n * question deadline sweep walks. Bounded and ordered by `_id`, starting after `after`, so the sweep pages until a page\n * comes back empty and a row whose clocks keep failing cannot starve the rows behind it. The rows are read raw, as\n * stored: the sweep needs the owning organization and the question exactly as its guarded writes will compare it.\n */\n public async listWaitingActorExecutions(\n systemRef: string,\n after?: string,\n sessionContext?: CompanionExecutionSessionContext,\n ): Promise<Wildo_Application_ActorSystem_Execution[]> {\n const ownership = await this.resolveOwnership(sessionContext);\n const waiting = { wildoApplicationId: ownership.wildoApplicationId, systemRef, status: FlowsActors_Status.AWAITING_APPROVAL };\n return this.repositoriesRegistry.findManyForInfrastructure<Wildo_Application_ActorSystem_Execution>(\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n after === undefined ? waiting : { $and: [waiting, { _id: { $gt: after } }] },\n undefined,\n undefined,\n { sort: [{ field: '_id', order: SortOrder.ASC }], limit: WAITING_ACTOR_EXECUTION_PAGE_LIMIT },\n );\n }\n\n /** One stored actor execution of this application, read raw (as the guarded writes compare it), or `undefined`. */\n private async readStoredActorExecution(executionId: string, wildoApplicationId: string): Promise<Wildo_Application_ActorSystem_Execution | undefined> {\n const [stored] = await this.repositoriesRegistry.findManyForInfrastructure<Wildo_Application_ActorSystem_Execution>(\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n { _id: executionId, wildoApplicationId },\n undefined,\n undefined,\n { sort: [{ field: '_id', order: SortOrder.ASC }], limit: 1 },\n );\n return stored;\n }\n\n /**\n * Clear an execution's owed agent-work record only while it still names `recordRef` — the compare-and-swap behind the\n * engine port's `clearPendingCorrectionRecord` (#1599 review F3, #1922). One guarded statement: the predicate travels\n * in the filter. A marker a later settle replaced names another decision and is left alone; matching nothing is not\n * an error. Announces nothing: it changes no state a watcher shows.\n */\n public async clearActorExecutionPendingCorrectionRecord(\n executionId: string,\n recordRef: string,\n sessionContext?: CompanionExecutionSessionContext,\n ): Promise<void> {\n const ownership = await this.resolveOwnership(sessionContext);\n await this.repositoriesRegistry.atomicConditionalSet(\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n { _id: executionId, wildoApplicationId: ownership.wildoApplicationId, 'pendingCorrectionRecord.recordRef': recordRef },\n { clear: ['pendingCorrectionRecord'] },\n );\n }\n\n /**\n * One page of this application's actor executions that still owe an agent-work record (#1922): what the engine's\n * repair sweep walks. Bounded and ordered by `_id`, starting after `after` (#2189): the sweep pages until a page comes\n * back empty, so rows that keep failing cannot starve the rows behind them.\n */\n public async listActorExecutionsOwingCorrectionRecord(\n sessionContext?: CompanionExecutionSessionContext,\n after?: string,\n ): Promise<Wildo_Application_ActorSystem_Execution[]> {\n const ownership = await this.resolveOwnership(sessionContext);\n const owing = { wildoApplicationId: ownership.wildoApplicationId, 'pendingCorrectionRecord.recordRef': { $ne: null } };\n return this.repositoriesRegistry.findManyForInfrastructure<Wildo_Application_ActorSystem_Execution>(\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n after === undefined ? owing : { $and: [owing, { _id: { $gt: after } }] },\n undefined,\n undefined,\n { sort: [{ field: '_id', order: SortOrder.ASC }], limit: OWED_CORRECTION_RECORD_SCAN_LIMIT },\n );\n }\n\n public async getActorExecution(executionId: string, _sessionContext?: CompanionExecutionSessionContext): Promise<Wildo_Application_ActorSystem_Execution> {\n const traceStep = this.createOperationTraceStep(_sessionContext, \"read-actor-execution\");\n await this.traceOperationStart({\n sessionContext: _sessionContext,\n step: traceStep,\n type: \"actor-execution-read-start\",\n summary: `Read persisted actor execution ${executionId}`,\n payload: { executionId },\n artifactFileName: \"actor-execution-read-request.json\",\n artifactContent: { executionId },\n });\n\n try {\n const ownership = await this.resolveOwnership(_sessionContext);\n const repository = this.repositoriesRegistry.getRepositoryOrThrow(WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE);\n const executionContext = await this.createInternalExecutionContext(\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n CoreResourceOperation.READ,\n _sessionContext,\n );\n const execution = await repository.read<Wildo_Application_ActorSystem_Execution>(executionContext, {\n _id: executionId,\n wildoApplicationId: ownership.wildoApplicationId,\n });\n\n if (!execution) {\n throw this.buildExecutionNotFoundError(FlowsActors_ElementKind.ACTOR,executionId);\n }\n\n if (_sessionContext) {\n await this.traceabilityService.registerAlias(_sessionContext, CompanionTraceAliasKind.ACTOR_EXECUTION,execution._id);\n }\n await this.traceOperationSuccess({\n sessionContext: _sessionContext,\n step: traceStep,\n type: \"actor-execution-read-success\",\n summary: `Read persisted actor execution ${execution._id}`,\n payload: {\n executionId: execution._id,\n status: execution.status,\n },\n artifactFileName: \"actor-execution-read-result.json\",\n artifactContent: execution,\n });\n return execution;\n } catch (error) {\n await this.traceOperationFailure({\n sessionContext: _sessionContext,\n step: traceStep,\n type: \"actor-execution-read-failure\",\n summary: `Failed to read persisted actor execution ${executionId}`,\n error,\n payload: { executionId },\n });\n throw error;\n }\n }\n\n public async getFlowExecution(executionId: string, _sessionContext?: CompanionExecutionSessionContext): Promise<Wildo_Application_FlowSystem_Execution> {\n const traceStep = this.createOperationTraceStep(_sessionContext, \"read-flow-execution\");\n await this.traceOperationStart({\n sessionContext: _sessionContext,\n step: traceStep,\n type: \"flow-execution-read-start\",\n summary: `Read persisted flow execution ${executionId}`,\n payload: { executionId },\n artifactFileName: \"flow-execution-read-request.json\",\n artifactContent: { executionId },\n });\n\n try {\n const ownership = await this.resolveOwnership(_sessionContext);\n const repository = this.repositoriesRegistry.getRepositoryOrThrow(WILDO_APPLICATION_FLOW_SYSTEM_EXECUTIONS_RESOURCE_TYPE);\n const executionContext = await this.createInternalExecutionContext(\n WILDO_APPLICATION_FLOW_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n CoreResourceOperation.READ,\n _sessionContext,\n );\n const execution = await repository.read<Wildo_Application_FlowSystem_Execution>(executionContext, {\n _id: executionId,\n wildoApplicationId: ownership.wildoApplicationId,\n });\n\n if (!execution) {\n throw this.buildExecutionNotFoundError(FlowsActors_ElementKind.FLOW,executionId);\n }\n\n if (_sessionContext) {\n await this.traceabilityService.registerAlias(_sessionContext, CompanionTraceAliasKind.FLOW_EXECUTION,execution._id);\n }\n await this.traceOperationSuccess({\n sessionContext: _sessionContext,\n step: traceStep,\n type: \"flow-execution-read-success\",\n summary: `Read persisted flow execution ${execution._id}`,\n payload: {\n executionId: execution._id,\n status: execution.status,\n },\n artifactFileName: \"flow-execution-read-result.json\",\n artifactContent: execution,\n });\n return execution;\n } catch (error) {\n await this.traceOperationFailure({\n sessionContext: _sessionContext,\n step: traceStep,\n type: \"flow-execution-read-failure\",\n summary: `Failed to read persisted flow execution ${executionId}`,\n error,\n payload: { executionId },\n });\n throw error;\n }\n }\n\n public async listActorExecutions(\n query: CompanionExecutionsListQuery,\n _sessionContext?: CompanionExecutionSessionContext,\n ): Promise<Wildo_Application_ActorSystem_Execution[]> {\n const traceStep = this.createOperationTraceStep(_sessionContext, \"list-actor-executions\");\n await this.traceOperationStart({\n sessionContext: _sessionContext,\n step: traceStep,\n type: \"actor-executions-list-start\",\n summary: \"List persisted actor executions\",\n payload: query,\n artifactFileName: \"actor-executions-list-request.json\",\n artifactContent: query,\n });\n\n try {\n const executions = await this.listExecutions<Wildo_Application_ActorSystem_Execution>(\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n query,\n _sessionContext,\n );\n await this.traceOperationSuccess({\n sessionContext: _sessionContext,\n step: traceStep,\n type: \"actor-executions-list-success\",\n summary: `Listed ${executions.length} persisted actor executions`,\n payload: {\n count: executions.length,\n status: query.status ?? null,\n systemRef: query.systemRef ?? null,\n limit: query.limit,\n },\n artifactFileName: \"actor-executions-list-result.json\",\n artifactContent: summarizeListedRowsForTrace(executions),\n });\n return executions;\n } catch (error) {\n await this.traceOperationFailure({\n sessionContext: _sessionContext,\n step: traceStep,\n type: \"actor-executions-list-failure\",\n summary: \"Failed to list persisted actor executions\",\n error,\n payload: query,\n });\n throw error;\n }\n }\n\n public async listFlowExecutions(\n query: CompanionExecutionsListQuery,\n _sessionContext?: CompanionExecutionSessionContext,\n ): Promise<Wildo_Application_FlowSystem_Execution[]> {\n const traceStep = this.createOperationTraceStep(_sessionContext, \"list-flow-executions\");\n await this.traceOperationStart({\n sessionContext: _sessionContext,\n step: traceStep,\n type: \"flow-executions-list-start\",\n summary: \"List persisted flow executions\",\n payload: query,\n artifactFileName: \"flow-executions-list-request.json\",\n artifactContent: query,\n });\n\n try {\n const executions = await this.listExecutions<Wildo_Application_FlowSystem_Execution>(\n WILDO_APPLICATION_FLOW_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n query,\n _sessionContext,\n );\n await this.traceOperationSuccess({\n sessionContext: _sessionContext,\n step: traceStep,\n type: \"flow-executions-list-success\",\n summary: `Listed ${executions.length} persisted flow executions`,\n payload: {\n count: executions.length,\n status: query.status ?? null,\n systemRef: query.systemRef ?? null,\n limit: query.limit,\n },\n artifactFileName: \"flow-executions-list-result.json\",\n artifactContent: summarizeListedRowsForTrace(executions),\n });\n return executions;\n } catch (error) {\n await this.traceOperationFailure({\n sessionContext: _sessionContext,\n step: traceStep,\n type: \"flow-executions-list-failure\",\n summary: \"Failed to list persisted flow executions\",\n error,\n payload: query,\n });\n throw error;\n }\n }\n\n public async createActorTask(\n payload: CompanionCreateActorTaskRequest,\n sessionContext?: CompanionExecutionSessionContext,\n ): Promise<Wildo_Application_Actor_Task> {\n this.noteExecutionWrite();\n try {\n const traceStep = this.createOperationTraceStep(sessionContext, \"create-actor-task\");\n await this.traceOperationStart({\n sessionContext,\n step: traceStep,\n type: \"actor-task-create-start\",\n summary: \"Create persisted actor task\",\n payload: {\n actorRef: payload.actors.actorRef,\n status: payload.status,\n executionId: payload.wildoApplicationActorSystemExecutionId ?? null,\n },\n artifactFileName: \"actor-task-create-request.json\",\n artifactContent: payload,\n });\n\n try {\n const task = await this.resourcePersistenceUnitOfWork.executeTransaction(\n {\n boundary: 'companion-executions.create-actor-task',\n participants: COMPANION_EXECUTION_PERSISTENCE_PARTICIPANTS,\n },\n async ({ transaction }) => {\n const ownership = await this.resolveOwnership(sessionContext);\n if (payload.wildoApplicationActorSystemExecutionId) {\n await this.readActorExecutionOrThrow(payload.wildoApplicationActorSystemExecutionId, ownership.wildoApplicationId, transaction, sessionContext);\n }\n const repository = this.repositoriesRegistry.getRepositoryOrThrow(WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE);\n const executionContext = await this.createInternalExecutionContext(\n WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE,\n CoreResourceOperation.CREATE,\n sessionContext,\n );\n const normalizedPayload = this.normalizeTaskCreatePayload(payload);\n const createData = {\n ...normalizedPayload,\n organizationId: ownership.organizationId,\n wildoApplicationId: ownership.wildoApplicationId,\n ...(payload.wildoApplicationActorSystemExecutionId ? { wildoApplicationActorSystemExecutionId: payload.wildoApplicationActorSystemExecutionId } : {}),\n };\n const createdTask = await repository.create<Wildo_Application_Actor_Task>(executionContext, createData, {\n ...this.buildRepositoryOptions(transaction),\n preserveServerInjectedFields: this.deriveServerInjectedPreserveFields(\n WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE,\n createData,\n CoreResourceOperation.CREATE,\n ),\n });\n\n await this.syncTaskIntoExecutionSnapshot(createdTask, transaction, sessionContext);\n this.publishControlPlaneMutation(\n transaction,\n WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE,\n ownership,\n String(createdTask._id),\n ResourceAction.CREATED,\n );\n return createdTask;\n },\n );\n\n if (sessionContext) {\n await this.traceabilityService.registerAlias(sessionContext, CompanionTraceAliasKind.ACTOR_TASK,task._id);\n }\n\n await this.traceOperationSuccess({\n sessionContext,\n step: traceStep,\n type: \"actor-task-create-success\",\n summary: `Created persisted actor task ${task._id}`,\n payload: {\n taskId: task._id,\n status: task.status,\n executionId: task.wildoApplicationActorSystemExecutionId ?? null,\n },\n artifactFileName: \"actor-task-create-result.json\",\n artifactContent: task,\n });\n return task;\n } catch (error) {\n await this.traceOperationFailure({\n sessionContext,\n step: traceStep,\n type: \"actor-task-create-failure\",\n summary: \"Failed to create persisted actor task\",\n error,\n payload: {\n actorRef: payload.actors.actorRef,\n status: payload.status,\n executionId: payload.wildoApplicationActorSystemExecutionId ?? null,\n },\n });\n throw error;\n }\n } finally {\n this.noteExecutionWrite();\n }\n }\n\n public async getActorTask(taskId: string, _sessionContext?: CompanionExecutionSessionContext): Promise<Wildo_Application_Actor_Task> {\n const traceStep = this.createOperationTraceStep(_sessionContext, \"read-actor-task\");\n await this.traceOperationStart({\n sessionContext: _sessionContext,\n step: traceStep,\n type: \"actor-task-read-start\",\n summary: `Read persisted actor task ${taskId}`,\n payload: { taskId },\n artifactFileName: \"actor-task-read-request.json\",\n artifactContent: { taskId },\n });\n\n try {\n const task = await this.readActorTaskOrThrow(taskId, undefined, _sessionContext);\n if (_sessionContext) {\n await this.traceabilityService.registerAlias(_sessionContext, CompanionTraceAliasKind.ACTOR_TASK,task._id);\n }\n await this.traceOperationSuccess({\n sessionContext: _sessionContext,\n step: traceStep,\n type: \"actor-task-read-success\",\n summary: `Read persisted actor task ${task._id}`,\n payload: {\n taskId: task._id,\n status: task.status,\n executionId: task.wildoApplicationActorSystemExecutionId ?? null,\n },\n artifactFileName: \"actor-task-read-result.json\",\n artifactContent: task,\n });\n return task;\n } catch (error) {\n await this.traceOperationFailure({\n sessionContext: _sessionContext,\n step: traceStep,\n type: \"actor-task-read-failure\",\n summary: `Failed to read persisted actor task ${taskId}`,\n error,\n payload: { taskId },\n });\n throw error;\n }\n }\n\n /**\n * The task rows of ONE build task's runs in one status, newest first, read from the database by `input.taskRef` (#3204).\n *\n * The selection's shared reads ({@link listActorTasks}) hold the 200 most recently updated rows of a status, so a task\n * whose last run is older than that reads as never having run. On reference run 42845651222, with 782 completed coding\n * runs, a follow-up whose only completed run had 204 newer ones behind it un-landed and was dispatched again, and every\n * task that ran early drifts out the same way. This read answers for one task whatever its age: a raw, bounded filter on\n * the nested ref, which both adapters compile (as {@link listActorExecutionsOwingCorrectionRecord} does for its own).\n * `omitStoredFields` leaves the transcripts out, as the shared listing does: a task's rows are re-read whenever a run's\n * memory is written.\n */\n public async listActorTasksOfBuildTask(\n status: FlowsActors_Status,\n buildTaskRef: string,\n sessionContext?: CompanionExecutionSessionContext,\n readOptions: { readonly omitStoredFields?: readonly string[] } = {},\n ): Promise<Wildo_Application_Actor_Task[]> {\n const ownership = await this.resolveOwnership(sessionContext);\n return this.repositoriesRegistry.findManyForInfrastructure<Wildo_Application_Actor_Task>(\n WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE,\n { wildoApplicationId: ownership.wildoApplicationId, status, 'input.taskRef': buildTaskRef },\n undefined,\n readOptions.omitStoredFields ? { omitStoredFields: readOptions.omitStoredFields } : undefined,\n { sort: [{ field: 'updatedAt', order: SortOrder.DESC }], limit: BUILD_TASK_RUN_ROWS_LIMIT },\n );\n }\n\n public async listActorTasks(\n query: CompanionActorTasksListQuery,\n _sessionContext?: CompanionExecutionSessionContext,\n /**\n * Stored fields the rows leave out (#3204, `RepositoryOptions.omitStoredFields`): an internal reader that never reads\n * a coding run's transcript passes {@link ACTOR_TASK_OUTPUT_FIELDS_HELD_ON_THE_TASK_ROW_ONLY}, as `output.<field>`.\n */\n readOptions: { readonly omitStoredFields?: readonly string[] } = {},\n ): Promise<Wildo_Application_Actor_Task[]> {\n const traceStep = this.createOperationTraceStep(_sessionContext, \"list-actor-tasks\");\n await this.traceOperationStart({\n sessionContext: _sessionContext,\n step: traceStep,\n type: \"actor-tasks-list-start\",\n summary: \"List persisted actor tasks\",\n payload: query,\n artifactFileName: \"actor-tasks-list-request.json\",\n artifactContent: query,\n });\n\n try {\n const ownership = await this.resolveOwnership(_sessionContext);\n const repository = this.repositoriesRegistry.getRepositoryOrThrow(WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE);\n const executionContext = await this.createInternalExecutionContext(\n WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE,\n CoreResourceOperation.LIST,\n _sessionContext,\n );\n /*\n * The newest rows, a page at a time, until `limit` of the caller's lane are held (#2484). This read every\n * task row the application ever had, and a task row carries a coding run's whole transcript (0.4–1.2 MB),\n * so each listing and each dispatch census loaded every transcript ever produced. The lane filter stays\n * in memory, for the reason `selectListedActorTasks` gives; pages arrive newest first, so once `limit`\n * rows of the lane are held, no later page can hold a newer one.\n */\n const filter = {\n wildoApplicationId: ownership.wildoApplicationId,\n ...(query.executionId ? { wildoApplicationActorSystemExecutionId: query.executionId } : {}),\n ...(query.status ? { status: query.status } : {}),\n };\n const tasks = await readNewestRowsByPage<Wildo_Application_Actor_Task>(\n async (listOptions) => (await repository.list<Wildo_Application_Actor_Task>(executionContext, filter, {\n paginated: true,\n listOptions,\n ...(readOptions.omitStoredFields !== undefined ? { omitStoredFields: readOptions.omitStoredFields } : {}),\n })).data,\n (rows) => selectListedActorTasks(rows, query).length >= query.limit,\n );\n\n const trimmedTasks = selectListedActorTasks(tasks, query);\n await this.traceOperationSuccess({\n sessionContext: _sessionContext,\n step: traceStep,\n type: \"actor-tasks-list-success\",\n summary: `Listed ${trimmedTasks.length} persisted actor tasks`,\n payload: {\n count: trimmedTasks.length,\n executionId: query.executionId ?? null,\n status: query.status ?? null,\n limit: query.limit,\n },\n artifactFileName: \"actor-tasks-list-result.json\",\n artifactContent: summarizeListedRowsForTrace(trimmedTasks),\n });\n return trimmedTasks;\n } catch (error) {\n await this.traceOperationFailure({\n sessionContext: _sessionContext,\n step: traceStep,\n type: \"actor-tasks-list-failure\",\n summary: \"Failed to list persisted actor tasks\",\n error,\n payload: query,\n });\n throw error;\n }\n }\n\n public async updateActorTask(\n taskId: string,\n payload: CompanionUpdateActorTaskRequest,\n sessionContext?: CompanionExecutionSessionContext,\n ): Promise<Wildo_Application_Actor_Task> {\n this.noteExecutionWrite();\n try {\n const traceStep = this.createOperationTraceStep(sessionContext, \"update-actor-task\");\n await this.traceOperationStart({\n sessionContext,\n step: traceStep,\n type: \"actor-task-update-start\",\n summary: `Update persisted actor task ${taskId}`,\n payload: {\n taskId,\n status: payload.status ?? null,\n executionId: payload.wildoApplicationActorSystemExecutionId ?? null,\n clearExecutionLink: payload.clearExecutionLink === true,\n },\n artifactFileName: \"actor-task-update-request.json\",\n artifactContent: {\n taskId,\n payload,\n },\n });\n\n try {\n const task = await this.resourcePersistenceUnitOfWork.executeTransaction(\n {\n boundary: 'companion-executions.update-actor-task',\n participants: COMPANION_EXECUTION_PERSISTENCE_PARTICIPANTS,\n },\n async ({ transaction }) => {\n const ownership = await this.resolveOwnership(sessionContext);\n /*\n * A write that names NO status still writes one — the one it read — because the row is written\n * whole. Read, then written unconditionally, that re-asserted a stale status: a memory note\n * landing just after a concurrent cancel put the task back to waiting and cleared its completion\n * instant (#1586 review F6). So such a write is conditional on the status it read, and a lost\n * race reads again and re-applies the payload to what is there now. A write that NAMES a status\n * is a move and stays unconditional: moves out of waiting are the execution's swap (#1586).\n */\n for (let attempt = 1; ; attempt += 1) {\n const existingTask = await this.readActorTaskOrThrow(taskId, transaction, sessionContext);\n if (\n payload.wildoApplicationActorSystemExecutionId &&\n payload.wildoApplicationActorSystemExecutionId !== existingTask.wildoApplicationActorSystemExecutionId\n ) {\n await this.readActorExecutionOrThrow(payload.wildoApplicationActorSystemExecutionId, ownership.wildoApplicationId, transaction, sessionContext);\n }\n const repository = this.repositoriesRegistry.getRepositoryOrThrow(WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE);\n const executionContext = await this.createInternalExecutionContext(\n WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE,\n CoreResourceOperation.UPDATE,\n sessionContext,\n );\n const updatedAt = payload.updatedAt ?? new Date().toISOString();\n const status = payload.status ?? existingTask.status;\n const shouldClearExecutionLink = payload.clearExecutionLink === true;\n const { clearExecutionLink: _clearExecutionLink, completedAt: payloadCompletedAt, ...payloadWithoutClearFlag } = payload;\n const shouldClearCompletedAt = !this.isTerminalStatus(status);\n const completedAt = shouldClearCompletedAt ? undefined : (payloadCompletedAt ?? existingTask.completedAt ?? updatedAt);\n const actorStates = payload.actorStates ?? existingTask.actorStates;\n\n const updateData = {\n ...payloadWithoutClearFlag,\n ...(payloadWithoutClearFlag.startedAt !== undefined ? { startedAt: persistedInstant(payloadWithoutClearFlag.startedAt) } : {}),\n actorStates,\n status,\n updatedAt: persistedInstant(updatedAt),\n // The existing row's instant is already a date; a request's is an ISO string.\n ...(completedAt ? { completedAt: completedAt instanceof Date ? completedAt : persistedInstant(completedAt) } : {}),\n };\n\n const statusGuard = payload.status === undefined ? { status: existingTask.status } : {};\n const written = await repository.update<Wildo_Application_Actor_Task>(executionContext, { _id: taskId, wildoApplicationId: ownership.wildoApplicationId, ...statusGuard }, updateData, {\n ...this.buildRepositoryOptions(transaction),\n // Derived allowlist (typically empty on UPDATE): the only fields the\n // update request DTO strips are the scope/audit FKs, and those are\n // never in this payload (`wildoApplicationId` is in the filter, not\n // the data). A re-linked `wildoApplicationActorSystemExecutionId` is\n // an ordinary relationship FK the DTO keeps, so it is not stripped.\n preserveServerInjectedFields: this.deriveServerInjectedPreserveFields(\n WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE,\n updateData,\n CoreResourceOperation.UPDATE,\n ),\n });\n if (written === null) {\n if (payload.status === undefined && attempt < TASK_STATUS_GUARD_ATTEMPTS) continue;\n // A row removed under the write answers the typed NOT_FOUND the read raises, as it always did (review N3)…\n await this.readActorTaskOrThrow(taskId, transaction, sessionContext);\n // …and one that is there but kept moving is a conflict, not a server fault.\n throw this.errorBuilder.buildError(ErrorType.CONFLICT, undefined, {\n customMessageReference: ErrorCustomMessageReference.CONFLICT,\n context: {\n // diagnostic (log-only)\n taskId,\n reason: payload.status === undefined\n ? `its status kept moving across ${TASK_STATUS_GUARD_ATTEMPTS} attempts`\n : 'the update matched no row under this application',\n },\n });\n }\n\n if (shouldClearExecutionLink || shouldClearCompletedAt) {\n await this.unsetActorTaskFields(\n taskId,\n ownership.wildoApplicationId,\n {\n ...(shouldClearExecutionLink ? { wildoApplicationActorSystemExecutionId: 1 } : {}),\n ...(shouldClearCompletedAt ? { completedAt: 1 } : {}),\n },\n transaction,\n );\n }\n\n const updatedTask = await this.readActorTaskOrThrow(taskId, transaction, sessionContext);\n\n if (\n existingTask.wildoApplicationActorSystemExecutionId &&\n existingTask.wildoApplicationActorSystemExecutionId !== updatedTask.wildoApplicationActorSystemExecutionId\n ) {\n await this.removeTaskFromExecutionSnapshot(existingTask, transaction, sessionContext);\n }\n\n await this.syncTaskIntoExecutionSnapshot(updatedTask, transaction, sessionContext);\n this.publishControlPlaneMutation(\n transaction,\n WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE,\n ownership,\n String(updatedTask._id),\n ResourceAction.UPDATED,\n );\n return updatedTask;\n }\n },\n );\n\n if (sessionContext) {\n await this.traceabilityService.registerAlias(sessionContext, CompanionTraceAliasKind.ACTOR_TASK,task._id);\n }\n\n await this.traceOperationSuccess({\n sessionContext,\n step: traceStep,\n type: \"actor-task-update-success\",\n summary: `Updated persisted actor task ${task._id}`,\n payload: {\n taskId: task._id,\n status: task.status,\n executionId: task.wildoApplicationActorSystemExecutionId ?? null,\n },\n artifactFileName: \"actor-task-update-result.json\",\n artifactContent: task,\n });\n return task;\n } catch (error) {\n await this.traceOperationFailure({\n sessionContext,\n step: traceStep,\n type: \"actor-task-update-failure\",\n summary: `Failed to update persisted actor task ${taskId}`,\n error,\n payload: {\n taskId,\n status: payload.status ?? null,\n executionId: payload.wildoApplicationActorSystemExecutionId ?? null,\n clearExecutionLink: payload.clearExecutionLink === true,\n },\n });\n throw error;\n }\n } finally {\n this.noteExecutionWrite();\n }\n }\n\n /**\n * Companion executions live in the shared apps-manager DB, but every local\n * companion instance is still attached to exactly one Wildo application row.\n * Resolving and memoizing that ownership keeps all repository calls scoped to\n * the truthful platform parent instead of falling back to tenant-app semantics.\n */\n /**\n * Announce a control-plane row the companion wrote REPOSITORY-DIRECT (issue #286).\n *\n * ## Why these writes were silent\n *\n * The engine emits `RESOURCE_UPDATED` from its resource CONTROLLERS, after the operation commits.\n * These rows never pass through one: the companion writes them straight to the repository inside\n * its own transaction, which is deliberate (they are control-plane records, and their CREATE and\n * UPDATE variants are `REPOSITORY_ONLY` precisely so no generated write API exists). The cost was\n * that nothing ever announced them: a board watching actor tasks or executions learned about a\n * new row only from a 30-second poll, and a SECOND browser learned nothing at all, because the\n * only invalidation was one the dispatching page emitted to itself.\n *\n * ## The ORGANIZATION room, and why not the application room\n *\n * These resources declare `isPrimaryScope: true` on their ORGANIZATIONS relationship, so a row\n * belongs to one tenant. Broadcasting to the application room — which the sibling introspection\n * notifier legitimately uses, because every resource IT serves is APPLICATION-anchored — would\n * carry one tenant's row ids to every user of the application. The room is keyed on the row's own\n * `organizationId`, which the ownership resolution has already established for the write itself.\n *\n * ## Notification-grade, and after COMMIT\n *\n * Registered as a post-commit effect: announcing a row inside the transaction would advertise a\n * write that can still roll back. The payload carries no `currentObject` — a scope room fans out\n * to every member, and these rows carry coding-agent input and output that a collection event has\n * no business broadcasting. Subscribers learn WHAT moved and refetch through their own\n * authorization, which is the same contract the introspection notifier's collection lane uses.\n *\n * Failure is swallowed by design: an announcement that could fail a committed write would make a\n * notification defect look like a persistence defect.\n */\n private publishControlPlaneMutation(\n /** `null` for a write that was not wrapped in a transaction — it is already committed. */\n transaction: unknown | null,\n resourceType: string,\n ownership: CompanionExecutionOwnership,\n resourceId: string,\n action: ResourceAction,\n ): void {\n if (!resourceId) return;\n const announce = async (): Promise<void> => {\n {\n try {\n const notification = buildControlPlaneMutationNotification(resourceType, ownership, resourceId, action);\n this.websocketService.emitToScopeRooms(\n notification.resourceType,\n notification.rooms,\n notification.event,\n buildScopeRoomNotificationPayload(notification.payload),\n );\n } catch (error) {\n this.logger.warn?.(\n `[CompanionExecutions] Could not announce ${resourceType} ${resourceId}: `\n + `${describeCaughtError(error)}`,\n );\n }\n }\n };\n if (transaction === null) {\n void announce();\n return;\n }\n registerTransactionPostCommitEffect(transaction as never, {\n key: `control-plane-notify:${resourceType}:${resourceId}:${action}`,\n execute: announce,\n });\n }\n\n private async resolveOwnership(sessionContext?: CompanionExecutionSessionContext): Promise<CompanionExecutionOwnership> {\n if (!this.ownershipPromise) {\n const ownershipPromise = this.loadOwnership(sessionContext).catch((error) => {\n if (this.ownershipPromise === ownershipPromise) {\n this.ownershipPromise = undefined;\n }\n\n throw error;\n });\n this.ownershipPromise = ownershipPromise;\n }\n\n return this.ownershipPromise;\n }\n\n private async loadOwnership(sessionContext?: CompanionExecutionSessionContext): Promise<CompanionExecutionOwnership> {\n const traceStep = sessionContext\n ? this.traceabilityService.createStep(sessionContext, {\n kind: \"execution-ownership\",\n label: \"resolve-companion-execution-ownership\",\n })\n : undefined;\n\n await this.traceOperationStart({\n sessionContext,\n step: traceStep,\n type: \"execution-ownership-resolution-start\",\n summary: \"Resolve companion execution ownership\",\n payload: {\n appSlug: this.companionContext.saasConfig.slug,\n },\n artifactFileName: \"execution-ownership-resolution-request.json\",\n artifactContent: {\n appSlug: this.companionContext.saasConfig.slug,\n },\n });\n\n try {\n const repository = this.repositoriesRegistry.getRepositoryOrThrow(CustomShared_ResourceType.WILDO_APPLICATION);\n const executionContext = await this.createInternalExecutionContext(\n CustomShared_ResourceType.WILDO_APPLICATION,\n CoreResourceOperation.READ,\n sessionContext,\n );\n const wildoApplication = await repository.read<Wildo_Application>(executionContext, {\n appSlug: this.companionContext.saasConfig.slug,\n });\n\n if (!wildoApplication) {\n throw this.errorBuilder.buildError(ErrorType.NOT_FOUND, undefined, {\n customMessageReference: ErrorCustomMessageReference.NOT_FOUND,\n context: {\n message: \"Companion app is not registered in the platform Wildo applications collection.\",\n appSlug: this.companionContext.saasConfig.slug,\n },\n });\n }\n\n this.logDebug(\"Resolved companion execution ownership\", {\n appSlug: this.companionContext.saasConfig.slug,\n organizationId: wildoApplication.organizationId,\n wildoApplicationId: wildoApplication._id,\n });\n\n const ownership = {\n organizationId: wildoApplication.organizationId,\n wildoApplicationId: wildoApplication._id,\n };\n\n await this.traceOperationSuccess({\n sessionContext,\n step: traceStep,\n type: \"execution-ownership-resolution-success\",\n summary: `Resolved companion execution ownership for ${this.companionContext.saasConfig.slug}`,\n payload: ownership,\n artifactFileName: \"execution-ownership-resolution-result.json\",\n artifactContent: {\n appSlug: this.companionContext.saasConfig.slug,\n ...ownership,\n },\n });\n\n return ownership;\n } catch (error) {\n await this.traceOperationFailure({\n sessionContext,\n step: traceStep,\n type: \"execution-ownership-resolution-failure\",\n summary: \"Failed to resolve companion execution ownership\",\n error,\n payload: {\n appSlug: this.companionContext.saasConfig.slug,\n },\n });\n throw error;\n }\n }\n\n /**\n * Builds an unattributed internal execution context for the companion's\n * control-plane reads/writes through the engine's REPOSITORY_ONLY-safe seam.\n * `createForInternalRepositoryOperation` resolves the operation path with a\n * repository-preferred (URL-fallback) resolver — the previous hand-rolled\n * `getOperationPathDefault → createForInternalOperation` pair used the\n * URL-only resolver and threw `RESOURCES_REGISTRY_OPERATION_PATH_NOT_FOUND`\n * for REPOSITORY_ONLY-only resources (migrated 2026-07-02, meta-workflows\n * Step 0 / P-12; the engine seam's JSDoc names this exact pattern).\n */\n /**\n * The `contextResourcesFieldIdentifier` map stays EMPTY on purpose. It\n * looks like the natural channel for the ownership FKs, but the engine's\n * context-map enrichment injects into EVERY schema path ending with the\n * field identifier — including `errorStates.errorItems[].initiatorIds.\n * organizationId` inside the embedded `WildoError_BackendSchema` — and\n * `setNestedValue` then fabricates a phantom error item that fails\n * Mongoose validation (observed live, 2026-07-03). The scope FK the strict\n * request-DTO parse strips (`organizationId`) is instead re-attached via\n * `RepositoryOptions.preserveServerInjectedFields`, derived per write by\n * {@link deriveServerInjectedPreserveFields}.\n */\n private async createInternalExecutionContext(\n resourceType: ResourceType,\n operationIdentifier: CoreResourceOperation,\n sessionContext?: CompanionExecutionSessionContext,\n ): Promise<ExecutionContext<any>> {\n const executionContext = await this.executionContextCreator.createForInternalRepositoryOperation({\n resourceType,\n operationIdentifier,\n contextResourcesFieldIdentifier: new Map(),\n initiatorIds: null,\n initiatorRoles: [],\n relationshipContexts: [],\n });\n if (sessionContext) {\n await this.traceInternalExecutionContext(sessionContext, executionContext, resourceType, operationIdentifier);\n }\n return executionContext;\n }\n\n /**\n * The row type is pinned through the repository handle's `TMainSchema`, NOT\n * through `list<T>` — and the difference is not cosmetic.\n *\n * `BackendResourceRepository.list<T>` returns\n * `ConditionalArrayReturnType<T, TMainSchema>`, i.e.\n * `T extends undefined ? z.infer<TMainSchema>[] : T[]`. That conditional can\n * only be evaluated when `T` is a CONCRETE type. Here `TExecution` is an\n * uninstantiated type parameter of this relay, so TypeScript defers the\n * conditional and falls back to its constraint — `unknown[]` — which is then\n * not assignable to `TExecution[]`. The sibling call sites in this file\n * (`list<Wildo_Application_Actor_Task>`) pass a concrete type, resolve the\n * false branch immediately, and are unaffected; this is the only generic\n * relay over a repository read in the companion.\n *\n * So the row shape is declared where the contract expects it: on the\n * repository handle. `list()` then takes its default `T = undefined`, the\n * conditional resolves eagerly to `z.infer<z.ZodType<TExecution>>[]` =\n * `TExecution[]`, and the value flows through with no cast.\n *\n * Rejected: `as unknown as TExecution[]` at the return. The correlation\n * between `resourceType` and `TExecution` is asserted by the caller either\n * way, but a value-level cast puts that assertion where nothing can see it,\n * and it would keep `left`/`right` typed `unknown` inside the comparator —\n * re-breaking the moment the sort key changes.\n */\n /**\n * Moved when a write to the execution or task rows starts AND when it ends (#3204): a shared execution listing\n * ({@link listExecutions}) is reused only under the generation its read started at, so a listing that overlapped a\n * write is never served after it. Every write door of this service calls it; it also drops the held listings.\n */\n // Both lazily initialised: a harness may build this service without running its field initialisers.\n private executionWriteGeneration?: number;\n private executionListings?: Map<string, { readonly generation: number; readonly heldUntilMs: number; readonly rows: Promise<readonly unknown[]> }>;\n\n private noteExecutionWrite(): void {\n this.executionWriteGeneration = (this.executionWriteGeneration ?? 0) + 1;\n this.executionListings?.clear();\n }\n\n /**\n * One execution listing per query, shared by every caller asking until a write moves the rows (#3204).\n *\n * During a build wave the companion lists the same executions from some twenty-five call sites (the selection's landing\n * pass, the in-flight census, the build records, the run report, the playbook lane…). On reference run 42845651222 that\n * was 150 listings and 318 MB read from MongoDB in 30 seconds, after coding transcripts had already left the rows, with\n * garbage collection at 15% and the event loop saturated. The rows change only through this service's write doors, which\n * move {@link executionWriteGeneration} as they start and as they end, so a listing is reused only while nothing was\n * written since its read began. A few seconds' ceiling bounds anything this service did not write. Each caller gets its\n * own array; the rows themselves are shared, read-only by contract.\n */\n private async listExecutions<TExecution extends { updatedAt: Date }>(\n resourceType: typeof WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE | typeof WILDO_APPLICATION_FLOW_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n query: CompanionExecutionsListQuery,\n sessionContext?: CompanionExecutionSessionContext,\n ): Promise<TExecution[]> {\n const key = `${resourceType}:${JSON.stringify(query)}`;\n const generation = this.executionWriteGeneration ?? 0;\n const listings = (this.executionListings ??= new Map());\n const held = listings.get(key);\n if (held !== undefined && held.generation === generation && Date.now() < held.heldUntilMs) return [...(await held.rows)] as TExecution[];\n const rows = this.readExecutionListing<TExecution>(resourceType, query, sessionContext);\n listings.set(key, { generation, heldUntilMs: Date.now() + EXECUTION_LISTING_HOLD_MS, rows });\n // A failed read is held by nobody.\n rows.catch(() => {\n if (this.executionListings?.get(key)?.rows === rows) this.executionListings.delete(key);\n });\n return [...(await rows)];\n }\n\n private async readExecutionListing<TExecution extends { updatedAt: Date }>(\n resourceType: typeof WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE | typeof WILDO_APPLICATION_FLOW_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n query: CompanionExecutionsListQuery,\n sessionContext?: CompanionExecutionSessionContext,\n ): Promise<TExecution[]> {\n const ownership = await this.resolveOwnership(sessionContext);\n const repository = this.repositoriesRegistry.getRepositoryOrThrow<undefined, undefined, z.ZodType<TExecution>>(resourceType);\n const executionContext = await this.createInternalExecutionContext(resourceType, CoreResourceOperation.LIST, sessionContext);\n const filter = {\n wildoApplicationId: ownership.wildoApplicationId,\n ...(query.systemRef ? { systemRef: query.systemRef } : {}),\n ...(query.status ? { status: query.status } : {}),\n // The window bounds (#3266): adapter-neutral comparisons on two date columns, which both repositories compile.\n ...(query.createdBefore ? { createdAt: { $lt: new Date(query.createdBefore) } } : {}),\n ...(query.finishedAfter ? { finishedAt: { $gt: new Date(query.finishedAfter) } } : {}),\n };\n\n // The newest `query.limit` rows, read newest-first FROM THE DATABASE, page by page (#2186): see `readNewestRowsByPage`.\n const listed = (await readNewestRowsByPage<TExecution>(\n async (listOptions) => (await repository.list(executionContext, filter, { paginated: true, listOptions })).data,\n (rows) => rows.length >= query.limit,\n ))\n .sort(newestUpdatedFirst)\n .slice(0, query.limit);\n const projected = listed.map(toExecutionWithTaskSnapshot);\n await this.compactStoredTaskSnapshots(resourceType, ownership.wildoApplicationId, listed, projected);\n return projected;\n }\n\n /**\n * Rewrite, once, the stored task snapshot of each listed row written before the snapshot stopped\n * carrying coding transcripts (2026-10-01, `execution-task-snapshot.models.ts`).\n *\n * Projecting the listing alone was not enough: a FINISHED execution is never re-synced, so its row kept\n * the transcript for good, every listing kept loading it from the database (34 MB per `GET /build/tasks`\n * on scratch-journey), and the workbench, which reads executions through the generic resource LIST/READ\n * rather than through here, kept receiving it. The rewrite is what makes the snapshot light everywhere.\n * It lives here rather than in a migration because the companion is delivered to every application,\n * and each one holds rows of its own.\n *\n * One guarded statement per row, matched on the `updatedAt` this listing read: a row that moved since\n * is skipped, so the rewrite can never put back an older snapshot over a newer one — the newer write\n * went through `updateActorExecutionTaskSnapshot` and is already projected. `updatedAt` is kept\n * (`preserveUpdatedAt`; without it both database arms stamp the rewrite — MongoDB through mongoose's\n * timestamps hook, PostgreSQL explicitly for parity — and the first live run of this, on PostgreSQL,\n * moved a 25 September run to the top of every newest-first listing): nothing a reader acts on\n * changed, and the task row still holds the transcript. Best-effort: a failure\n * leaves the row as it was, the listing already answers in snapshot form, and the next listing retries.\n */\n private async compactStoredTaskSnapshots(\n resourceType: typeof WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE | typeof WILDO_APPLICATION_FLOW_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n wildoApplicationId: string,\n stored: readonly { _id?: unknown; updatedAt: Date }[],\n projected: readonly unknown[],\n ): Promise<void> {\n for (let index = 0; index < stored.length; index += 1) {\n const row = stored[index]!;\n const snapshot = projected[index] as { standaloneTasks?: unknown };\n if (snapshot === row) continue;\n try {\n await this.repositoriesRegistry.atomicGuardedMutation(\n resourceType,\n { _id: row._id, wildoApplicationId, updatedAt: row.updatedAt },\n { set: { standaloneTasks: snapshot.standaloneTasks } },\n undefined,\n { preserveUpdatedAt: true },\n );\n } catch (error) {\n this.logger.warn?.(\n `[CompanionExecutions] Could not compact the task snapshot of ${resourceType} ${String(row._id)}: `\n + `${describeCaughtError(error)}`,\n );\n }\n }\n }\n\n private async persistExecutionTasks(\n ownership: CompanionExecutionOwnership,\n executionId: string,\n tasks: CompanionCreateActorExecutionRequest[\"standaloneTasks\"],\n standaloneTaskStates: CompanionCreateActorExecutionRequest[\"standaloneTaskStates\"],\n transaction?: TransactionContext,\n sessionContext?: CompanionExecutionSessionContext,\n ): Promise<PersistedExecutionTask[]> {\n this.noteExecutionWrite();\n try {\n const repository = this.repositoriesRegistry.getRepositoryOrThrow(WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE);\n const executionContext = await this.createInternalExecutionContext(\n WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE,\n CoreResourceOperation.CREATE,\n sessionContext,\n );\n\n const persistedTasks: PersistedExecutionTask[] = [];\n\n for (const task of tasks) {\n const taskState = standaloneTaskStates.find((item) => item.taskId === task._id);\n const createData = {\n ...this.normalizeTaskCreatePayload({\n ...task,\n status: taskState?.status ?? task.status,\n updatedAt: taskState?.updatedAt ?? task.updatedAt,\n wildoApplicationActorSystemExecutionId: executionId,\n }),\n organizationId: ownership.organizationId,\n wildoApplicationId: ownership.wildoApplicationId,\n wildoApplicationActorSystemExecutionId: executionId,\n };\n const persistedTask = await repository.create<Wildo_Application_Actor_Task>(executionContext, createData, {\n ...this.buildRepositoryOptions(transaction),\n preserveServerInjectedFields: this.deriveServerInjectedPreserveFields(\n WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE,\n createData,\n CoreResourceOperation.CREATE,\n ),\n });\n\n persistedTasks.push({\n sourceTaskId: task._id,\n task: persistedTask,\n });\n }\n\n return persistedTasks;\n } finally {\n this.noteExecutionWrite();\n }\n }\n\n private async updateActorExecutionTaskSnapshot(\n execution: Wildo_Application_ActorSystem_Execution,\n ownership: CompanionExecutionOwnership,\n tasks: ExecutionTaskSnapshotEntry[],\n transaction?: TransactionContext,\n standaloneTaskStatesOverride?: Wildo_Application_ActorSystem_Execution[\"standaloneTaskStates\"],\n sessionContext?: CompanionExecutionSessionContext,\n ): Promise<Wildo_Application_ActorSystem_Execution> {\n this.noteExecutionWrite();\n try {\n const repository = this.repositoriesRegistry.getRepositoryOrThrow(WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE);\n const executionContext = await this.createInternalExecutionContext(\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n CoreResourceOperation.UPDATE,\n sessionContext,\n );\n const updatedAt = new Date().toISOString();\n\n const updated = await repository.update<Wildo_Application_ActorSystem_Execution>(\n executionContext,\n { _id: execution._id, wildoApplicationId: ownership.wildoApplicationId },\n {\n // Every task write reaches the snapshot through here, so this is where a transcript is kept\n // off it: the task row holds `codingSessionFrames`, the snapshot holds the rest\n // (`execution-task-snapshot.models.ts`).\n standaloneTasks: tasks.map(toExecutionTaskSnapshot),\n standaloneTaskStates: standaloneTaskStatesOverride ?? this.buildStandaloneTaskStates(tasks, execution.standaloneTaskStates),\n updatedAt: persistedInstant(updatedAt),\n },\n this.buildRepositoryOptions(transaction),\n );\n /*\n * `update` answers `null` when the filter matched nothing — the execution was removed, or its\n * `wildoApplicationId` no longer matches, between the read that produced `execution` and this\n * write. This method PROMISES an execution, and returning `null` under that signature is how a\n * caller comes to read task state off nothing; it compiled while `strictNullChecks` was off\n * (#352).\n *\n * Refusing names the tenancy half deliberately, because the two causes are not the same finding:\n * a missing row is a concurrent delete, a non-matching `wildoApplicationId` is an ownership\n * violation, and the filter cannot tell them apart from here.\n */\n if (updated === null) {\n throw new Error(\n `Actor-system execution '${execution._id}' could not be updated: no row matches that id under application `\n + `'${ownership.wildoApplicationId}'. It was removed concurrently, or it belongs to another application.`,\n );\n }\n return updated;\n } finally {\n this.noteExecutionWrite();\n }\n }\n\n private async syncTaskIntoExecutionSnapshot(\n task: Wildo_Application_Actor_Task,\n transaction?: TransactionContext,\n sessionContext?: CompanionExecutionSessionContext,\n ): Promise<void> {\n this.noteExecutionWrite();\n try {\n if (!task.wildoApplicationActorSystemExecutionId) {\n return;\n }\n\n const repository = this.repositoriesRegistry.getRepositoryOrThrow(WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE);\n const executionContext = await this.createInternalExecutionContext(\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n CoreResourceOperation.READ,\n sessionContext,\n );\n const execution = await repository.read<Wildo_Application_ActorSystem_Execution>(\n executionContext,\n {\n _id: task.wildoApplicationActorSystemExecutionId,\n wildoApplicationId: task.wildoApplicationId,\n },\n this.buildRepositoryOptions(transaction),\n );\n\n if (!execution) {\n throw this.errorBuilder.buildError(ErrorType.NOT_FOUND, undefined, {\n customMessageReference: ErrorCustomMessageReference.NOT_FOUND,\n context: {\n message: \"Actor task references a missing persisted actor execution.\",\n taskId: task._id,\n wildoApplicationActorSystemExecutionId: task.wildoApplicationActorSystemExecutionId,\n appSlug: this.companionContext.saasConfig.slug,\n },\n });\n }\n\n await this.updateActorExecutionTaskSnapshot(\n execution,\n {\n organizationId: task.organizationId,\n wildoApplicationId: task.wildoApplicationId,\n },\n this.upsertTask(execution.standaloneTasks, toExecutionTaskSnapshot(task)),\n transaction,\n undefined,\n sessionContext,\n );\n } finally {\n this.noteExecutionWrite();\n }\n }\n\n private async removeTaskFromExecutionSnapshot(\n task: Pick<Wildo_Application_Actor_Task, \"_id\" | \"organizationId\" | \"wildoApplicationId\" | \"wildoApplicationActorSystemExecutionId\">,\n transaction?: TransactionContext,\n sessionContext?: CompanionExecutionSessionContext,\n ): Promise<void> {\n if (!task.wildoApplicationActorSystemExecutionId) {\n return;\n }\n\n const repository = this.repositoriesRegistry.getRepositoryOrThrow(WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE);\n const readExecutionContext = await this.createInternalExecutionContext(\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n CoreResourceOperation.READ,\n sessionContext,\n );\n const execution = await repository.read<Wildo_Application_ActorSystem_Execution>(\n readExecutionContext,\n {\n _id: task.wildoApplicationActorSystemExecutionId,\n wildoApplicationId: task.wildoApplicationId,\n },\n this.buildRepositoryOptions(transaction),\n );\n\n if (!execution) {\n return;\n }\n\n await this.updateActorExecutionTaskSnapshot(\n execution,\n {\n organizationId: task.organizationId,\n wildoApplicationId: task.wildoApplicationId,\n },\n execution.standaloneTasks.filter((item) => item._id !== task._id),\n transaction,\n undefined,\n sessionContext,\n );\n }\n\n private async readActorTaskOrThrow(\n taskId: string,\n transaction?: TransactionContext,\n sessionContext?: CompanionExecutionSessionContext,\n ): Promise<Wildo_Application_Actor_Task> {\n const ownership = await this.resolveOwnership(sessionContext);\n const repository = this.repositoriesRegistry.getRepositoryOrThrow(WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE);\n const executionContext = await this.createInternalExecutionContext(WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE, CoreResourceOperation.READ, sessionContext);\n const task = await repository.read<Wildo_Application_Actor_Task>(\n executionContext,\n { _id: taskId, wildoApplicationId: ownership.wildoApplicationId },\n this.buildRepositoryOptions(transaction),\n );\n\n if (!task) {\n throw this.buildTaskNotFoundError(taskId);\n }\n\n return task;\n }\n\n private async readActorExecutionOrThrow(\n executionId: string,\n wildoApplicationId: string,\n transaction?: TransactionContext,\n sessionContext?: CompanionExecutionSessionContext,\n ): Promise<Wildo_Application_ActorSystem_Execution> {\n const repository = this.repositoriesRegistry.getRepositoryOrThrow(WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE);\n const executionContext = await this.createInternalExecutionContext(\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n CoreResourceOperation.READ,\n sessionContext,\n );\n const execution = await repository.read<Wildo_Application_ActorSystem_Execution>(\n executionContext,\n { _id: executionId, wildoApplicationId },\n this.buildRepositoryOptions(transaction),\n );\n\n if (!execution) {\n throw this.buildExecutionNotFoundError(FlowsActors_ElementKind.ACTOR,executionId);\n }\n\n return execution;\n }\n\n private async listActorExecutionTasks(\n ownership: CompanionExecutionOwnership,\n executionId: string,\n transaction?: TransactionContext,\n ): Promise<Wildo_Application_Actor_Task[]> {\n const repository = this.repositoriesRegistry.getRepositoryOrThrow(WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE);\n const executionContext = await this.createInternalExecutionContext(WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE, CoreResourceOperation.LIST);\n return repository.list<Wildo_Application_Actor_Task>(\n executionContext,\n {\n wildoApplicationId: ownership.wildoApplicationId,\n wildoApplicationActorSystemExecutionId: executionId,\n },\n this.buildRepositoryOptions(transaction),\n );\n }\n\n private async traceInternalExecutionContext(\n sessionContext: CompanionExecutionSessionContext,\n executionContext: ExecutionContext<any>,\n resourceType: ResourceType,\n operationIdentifier: CoreResourceOperation,\n ): Promise<void> {\n const serializedExecutionContext = ResourceSerializationUtils.deserializeExecutionContextData(\n ResourceSerializationUtils.serializeExecutionContext({\n executionType: executionContext.executionType,\n initiatorIds: executionContext.initiatorIds,\n initiatorRoles: [...executionContext.initiatorRoles],\n /*\n * The two ENGINE declarations disagree by one `| undefined`, and the companion sits between\n * them (#352): `ExecutionContext.getContextResourceIds()` returns\n * `ReadonlyMap<…, string | string[] | undefined>` while `serializeExecutionContext` accepts\n * `ReadonlyMap<string, string | string[]>`. It compiled while `strictNullChecks` was off.\n *\n * Dropped rather than widened here, for two reasons. A context entry whose value is\n * `undefined` is not a resource id — it is a scope the context could not resolve — so\n * serializing it would record an absence as if it were a value. And widening belongs to the\n * engine's own contract, not to a consumer that happens to notice the gap; changing\n * `saas-models` from here would make the companion the author of a shared type.\n */\n getContextResourceIds: () => new Map(\n [...executionContext.getContextResourceIds()].filter(\n (entry): entry is [string, string | string[]] => entry[1] !== undefined,\n ),\n ),\n relationshipContexts: [...executionContext.relationshipContexts],\n }),\n );\n /*\n * The EC reshape removed `requestUUID` from the platform JWT claims; `correlationId` is the per-request\n * identifier now. Mapped here rather than renamed downstream on purpose: `requestUUID` is a field of the\n * traceability contract (`CompanionExecutionContextArtifactRef`), which dedupes artifacts on it, so renaming it\n * is a change to that model and its tests — a separate decision from unbreaking this build.\n */\n const requestUUID = executionContext.toExecutionContextPlatformJwtClaims().correlationId;\n const fileName = `${resourceType}-${operationIdentifier}-${requestUUID}-execution-context.json`;\n\n await this.traceabilityService.traceEvent({\n session: sessionContext,\n minimumLevel: CompanionTraceabilityLevel.DEBUG,\n type: \"internal-execution-context-created\",\n summary: `Created internal execution context for ${resourceType}.${operationIdentifier}`,\n payload: {\n resourceType,\n operationIdentifier,\n requestUUID,\n },\n });\n const artifactPersisted = await this.traceabilityService.writeArtifact({\n session: sessionContext,\n minimumLevel: CompanionTraceabilityLevel.DEBUG_VERBOSE,\n fileName,\n content: {\n resourceType,\n operationIdentifier,\n requestUUID,\n serializedExecutionContext,\n },\n });\n if (artifactPersisted) {\n await this.traceabilityService.recordExecutionContextArtifact(sessionContext, {\n requestUUID,\n resourceType,\n operationIdentifier,\n fileName,\n recordedAt: new Date().toISOString(),\n });\n }\n }\n\n private createOperationTraceStep(sessionContext: CompanionExecutionSessionContext | undefined, label: string) {\n return sessionContext\n ? this.traceabilityService.createStep(sessionContext, {\n kind: \"execution-persistence\",\n label,\n })\n : undefined;\n }\n\n private async traceOperationStart(input: {\n sessionContext?: CompanionExecutionSessionContext;\n step?: ReturnType<CompanionTraceabilityService[\"createStep\"]>;\n type: string;\n summary: string;\n payload?: unknown;\n artifactFileName?: string;\n artifactContent?: unknown;\n }): Promise<void> {\n if (!input.sessionContext) {\n return;\n }\n\n await this.traceabilityService.traceEvent({\n session: input.sessionContext,\n minimumLevel: CompanionTraceabilityLevel.DEBUG,\n type: input.type,\n summary: input.summary,\n ...(input.payload !== undefined ? { payload: input.payload } : {}),\n ...(input.step ? { step: input.step } : {}),\n });\n if (input.artifactFileName && input.artifactContent !== undefined) {\n await this.traceabilityService.writeArtifact({\n session: input.sessionContext,\n minimumLevel: CompanionTraceabilityLevel.DEBUG_VERBOSE,\n fileName: input.artifactFileName,\n content: input.artifactContent,\n ...(input.step ? { step: input.step } : {}),\n });\n }\n }\n\n private async traceOperationSuccess(input: {\n sessionContext?: CompanionExecutionSessionContext;\n step?: ReturnType<CompanionTraceabilityService[\"createStep\"]>;\n type: string;\n summary: string;\n payload?: unknown;\n artifactFileName?: string;\n artifactContent?: unknown;\n }): Promise<void> {\n if (!input.sessionContext) {\n return;\n }\n\n if (input.artifactFileName && input.artifactContent !== undefined) {\n await this.traceabilityService.writeArtifact({\n session: input.sessionContext,\n minimumLevel: CompanionTraceabilityLevel.DEBUG_VERBOSE,\n fileName: input.artifactFileName,\n content: input.artifactContent,\n ...(input.step ? { step: input.step } : {}),\n });\n }\n await this.traceabilityService.traceEvent({\n session: input.sessionContext,\n minimumLevel: CompanionTraceabilityLevel.DEBUG,\n type: input.type,\n summary: input.summary,\n ...(input.payload !== undefined ? { payload: input.payload } : {}),\n ...(input.step ? { step: input.step } : {}),\n });\n }\n\n private async traceOperationFailure(input: {\n sessionContext?: CompanionExecutionSessionContext;\n step?: ReturnType<CompanionTraceabilityService[\"createStep\"]>;\n type: string;\n summary: string;\n error: unknown;\n payload?: unknown;\n }): Promise<void> {\n if (!input.sessionContext) {\n return;\n }\n\n await this.traceabilityService.traceEvent({\n session: input.sessionContext,\n minimumLevel: CompanionTraceabilityLevel.DEBUG,\n type: input.type,\n summary: input.summary,\n payload: {\n ...(input.payload && typeof input.payload === \"object\" ? (input.payload as Record<string, unknown>) : { input: input.payload }),\n error: this.buildTraceErrorPayload(input.error),\n },\n ...(input.step ? { step: input.step } : {}),\n });\n }\n\n private buildTraceErrorPayload(error: unknown) {\n if (isWildoBackendError(error)) {\n return error;\n }\n\n if (error instanceof Error) {\n return {\n message: error.message,\n name: error.name,\n ...(error.stack ? { stack: error.stack } : {}),\n };\n }\n\n return {\n message: String(error),\n };\n }\n\n private async unsetActorTaskFields(\n taskId: string,\n wildoApplicationId: string,\n fieldsToUnset: Partial<Record<\"completedAt\" | \"wildoApplicationActorSystemExecutionId\", 1>>,\n transaction?: TransactionContext,\n ): Promise<void> {\n const fieldEntries = Object.entries(fieldsToUnset);\n if (fieldEntries.length === 0) {\n return;\n }\n\n /*\n * ADAPTER-NEUTRAL on purpose, and the previous body is the cautionary tale: it reached\n * `mongooseModel.findOneAndUpdate` + `getNativeSession` directly, which exists only on the\n * MongoDB repository — on a PostgreSQL-backed application (wonder-crm) the call threw\n * `repository.getNativeSession is not a function`, the interactive lane's park-persistence\n * write died on it, and the failure handler then recorded the whole parked run as\n * `agent_execution_failed`, destroying the suspension the restart-durability door needed\n * (measured 2026-09-04, first live park on PG). `atomicConditionalSet` is on the repository\n * CONTRACT — an adapter that cannot compile it fails to build — and its `clearFields` is\n * exactly the unset: `$unset` on MongoDB, `SET col = NULL` (+ read-path omission) on PG.\n */\n /*\n * Through the REGISTRY, not the raw repository. This reached\n * `getRepositoryOrThrow(...).atomicConditionalSet(...)` behind an `as unknown as` cast until\n * 2026-09-09, which skipped the one thing the registry wrapper adds: it runs the filter through\n * `applyRetentionHideToRawFilter` before handing it to the same primitive. A guarded-write\n * primitive does not apply the hide itself, so a call site that binds the repository first is\n * deciding a retention question it was never meant to answer — which is what\n * `check:retention-hide-reach` reports as `guarded-write-off-registry`.\n *\n * The registry is the engine's own `RepositoriesRegistryHandlerBackendService` (injected above),\n * so the wrapper was always available; the cast existed only because the earlier reasoning was\n * about the repository CONTRACT rather than about the door in front of it. Passing no execution\n * context preserves the previous `getRepositoryOrThrow` call exactly.\n */\n await this.repositoriesRegistry.atomicConditionalSet(\n WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE,\n { _id: taskId, wildoApplicationId },\n { clear: fieldEntries.map(([field]) => field) },\n undefined,\n this.buildRepositoryOptions(transaction),\n );\n }\n\n private buildRepositoryOptions(transaction?: TransactionContext): CompanionRepositoryOptions | undefined {\n return transaction ? { transaction } : undefined;\n }\n\n /**\n * Compute the repository-write re-attach allowlist for a server-authored\n * payload — the SAME schema-derived set the engine's application-tier trusted\n * writes use ({@link deriveTrustedSystemWritePreservedFieldsForResource}).\n *\n * WHY the companion needs it: every `repository.create/update` strict-parses\n * the payload against the resource's client-shaped request DTO, which omits\n * two field classes — `.isBackendOnly()` material and the context-auto-populated\n * scope/audit FKs (`CONTEXT_AUTO_POPULATED_FIELD_IDENTIFIERS`, stripped by NAME).\n * For these platform-persistence resources the only such field the companion\n * authors is `organizationId` (the ORGANIZATIONS primary-scope FK): on an\n * HTTP write it would be re-injected from the request context AFTER the parse,\n * but the companion's system-context writes have no request context, so without\n * this the strip silently drops it and the row fails Mongoose required-field\n * validation. `RepositoryOptions.preserveServerInjectedFields` re-attaches\n * exactly the derived keys after the parse.\n *\n * WHY it is DERIVED, not a hard-coded list: deriving from the registered\n * `mainSchema` is the single source of truth shared with the engine seam, so a\n * future schema change (a new backend-only field, an added scope FK) is covered\n * automatically. The other server-injected FKs (`wildoApplicationId`, the\n * `wildoApplicationActorSystemExecutionId` execution link) are ordinary\n * `.isForeignKey()` relationship fields that the request DTO does NOT strip —\n * they parse through normally — so the derivation correctly excludes them.\n *\n * TIER NOTE: the companion executions plane is local-platform-tier repository\n * CRUD (it never stands up the application `ServicesRegistryHandler`), so it\n * reuses the engine's DERIVATION helper directly at the repository tier rather\n * than routing through the application-services-tier\n * `SystemAccessBackendService.createAsSystem`/`updateAsSystem` (which resolve a\n * service/URL operation path these `REPOSITORY_ONLY` resources do not declare).\n */\n private deriveServerInjectedPreserveFields(\n resourceType: ResourceType,\n data: Record<string, unknown>,\n verb: CoreResourceOperation.CREATE | CoreResourceOperation.UPDATE | CoreResourceOperation.UPDATE_MANY,\n ): string[] {\n // Variant-aware (#2434): the payload's own variant, or every shape when it names none.\n return deriveTrustedSystemWritePreservedFieldsForResource(this.resourcesRegistry.getResourceConfiguration(resourceType) as never, data, verb);\n }\n\n private assertStandaloneTaskStateConsistency(payload: Pick<CompanionCreateActorExecutionRequest, \"standaloneTasks\" | \"standaloneTaskStates\">): void {\n const seenTaskIds = new Set<string>();\n for (const task of payload.standaloneTasks) {\n if (seenTaskIds.has(task._id)) {\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.VALIDATION,\n context: {\n message: \"Actor execution payload contains duplicate standalone task ids.\",\n taskId: task._id,\n },\n });\n }\n\n seenTaskIds.add(task._id);\n }\n\n for (const taskState of payload.standaloneTaskStates) {\n if (!seenTaskIds.has(taskState.taskId)) {\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.VALIDATION,\n context: {\n message: \"Actor execution task states must reference a declared standalone task.\",\n taskId: taskState.taskId,\n },\n });\n }\n }\n }\n\n\n private normalizeTaskCreatePayload(payload: CompanionCreateActorTaskRequest): Omit<\n CompanionCreateActorTaskRequest,\n \"wildoApplicationActorSystemExecutionId\" | \"createdAt\" | \"updatedAt\" | \"startedAt\" | \"completedAt\"\n > & {\n createdAt: Date;\n updatedAt: Date;\n startedAt?: Date;\n completedAt?: Date;\n actorStates: Wildo_Application_Actor_Task[\"actorStates\"];\n } {\n const {\n completedAt: _completedAt,\n startedAt,\n wildoApplicationActorSystemExecutionId: _wildoApplicationActorSystemExecutionId,\n ...payloadWithoutManagedFields\n } = payload;\n const now = new Date().toISOString();\n const createdAt = payload.createdAt ?? now;\n const updatedAt = payload.updatedAt ?? createdAt;\n const actorStates =\n payload.actorStates.length > 0\n ? payload.actorStates\n : [\n {\n actorRef: payload.actors.actorRef,\n status: payload.status,\n updatedAt,\n statusChanges: [{ status: payload.status, timestamp: updatedAt }],\n },\n ];\n const completedAt = this.isTerminalStatus(payload.status) ? (payload.completedAt ?? updatedAt) : undefined;\n\n // The row's instants are dates; `actorStates` is jsonb and keeps the ISO form (#2187).\n return {\n ...payloadWithoutManagedFields,\n createdAt: persistedInstant(createdAt),\n updatedAt: persistedInstant(updatedAt),\n ...(startedAt ? { startedAt: persistedInstant(startedAt) } : {}),\n actorStates,\n ...(completedAt ? { completedAt: persistedInstant(completedAt) } : {}),\n };\n }\n\n private buildPersistedStandaloneTaskStates(\n persistedTasks: PersistedExecutionTask[],\n sourceStates: CompanionCreateActorExecutionRequest[\"standaloneTaskStates\"],\n ): Wildo_Application_ActorSystem_Execution[\"standaloneTaskStates\"] {\n const statesBySourceTaskId = new Map<string, CompanionCreateActorExecutionRequest[\"standaloneTaskStates\"][number]>(\n sourceStates.map((item) => [item.taskId, item]),\n );\n\n return persistedTasks.map(({ sourceTaskId, task }) => {\n const sourceState = statesBySourceTaskId.get(sourceTaskId);\n const updatedAt = this.toStrictIsoDatetime(task.updatedAt);\n\n return {\n taskId: task._id,\n status: task.status,\n updatedAt,\n statusChanges: sourceState?.statusChanges?.length\n ? sourceState.statusChanges.map((change) => ({\n status: change.status,\n timestamp: this.toStrictIsoDatetime(change.timestamp),\n }))\n : [{ status: task.status, timestamp: updatedAt }],\n };\n });\n }\n\n /**\n * Normalize a persisted timestamp to the STRICT ISO-8601 form the execution\n * contract requires. Control-plane resources (actor tasks/executions) get\n * their `createdAt`/`updatedAt` from Mongoose auto-timestamps, which write a\n * `Date` into the STRING-typed field — Mongoose then casts it with\n * `Date.prototype.toString()`, producing a locale form (\"Wed Jul 08 2026\n * 06:16:36 GMT+0200 (Central European Summer Time)\"). The task schema's own\n * `updatedAt` (`z.string().refine(Date.parse)`) tolerates that, but the\n * execution's `standaloneTaskStates[].updatedAt` / `statusChanges[].timestamp`\n * are strict `z.iso.datetime()` (Z-suffixed) and REJECT it — so projecting a\n * raw `task.updatedAt` into a standalone-task-state write fails validation.\n * The companion owns the task→execution projection, so it normalizes here at\n * that loose→strict boundary. `Date.parse` accepts both the locale and ISO\n * forms; the `NaN` fallback (never hit for real persisted rows) keeps a bad\n * source from throwing.\n *\n * The \"deeper fix\" this note used to ask for — store the instants as instants — landed as #2187: the\n * persisted task and execution rows now hold dates (`timestamptz`), so a persisted value arrives here as\n * a `Date` and the locale form can only come from a snapshot written before it.\n */\n private toStrictIsoDatetime(value: string | Date): string {\n if (value instanceof Date) return Number.isNaN(value.getTime()) ? new Date().toISOString() : value.toISOString();\n const parsed = Date.parse(value);\n return Number.isNaN(parsed) ? new Date().toISOString() : new Date(parsed).toISOString();\n }\n\n private buildStandaloneTaskStates(\n tasks: ReadonlyArray<Pick<ExecutionTaskSnapshotEntry, \"_id\" | \"status\" | \"updatedAt\">>,\n existingStates: Wildo_Application_ActorSystem_Execution[\"standaloneTaskStates\"],\n ): Wildo_Application_ActorSystem_Execution[\"standaloneTaskStates\"] {\n const statesByTaskId = new Map<string, Wildo_Application_ActorSystem_Execution[\"standaloneTaskStates\"][number]>(\n existingStates.map((item) => [item.taskId, item]),\n );\n\n return tasks.map((task) => {\n const updatedAt = this.toStrictIsoDatetime(task.updatedAt);\n const existingState = statesByTaskId.get(String(task._id));\n const statusChanges = existingState?.statusChanges ?? [];\n const lastStatus = statusChanges[statusChanges.length - 1]?.status;\n const nextStatusChanges = lastStatus === task.status ? statusChanges : [...statusChanges, { status: task.status, timestamp: updatedAt }];\n\n return {\n taskId: String(task._id),\n status: task.status,\n updatedAt,\n statusChanges: nextStatusChanges.length > 0 ? nextStatusChanges : [{ status: task.status, timestamp: updatedAt }],\n };\n });\n }\n\n private upsertTask(tasks: ExecutionTaskSnapshotEntry[], task: ExecutionTaskSnapshotEntry): ExecutionTaskSnapshotEntry[] {\n const existingIndex = tasks.findIndex((item) => item._id === task._id);\n if (existingIndex === -1) {\n return [...tasks, task];\n }\n\n return tasks.map((item) => (item._id === task._id ? task : item));\n }\n\n private normalizeCreateEnvelope<TPayload extends ExecutionCreateEnvelope>(\n payload: TPayload,\n ): Pick<TPayload, \"statusChanges\"> & { createdAt: Date; updatedAt: Date; finishedAt?: Date } {\n const now = new Date().toISOString();\n const createdAt = payload.createdAt ?? now;\n const updatedAt = payload.updatedAt ?? createdAt;\n const statusChanges = payload.statusChanges.length > 0 ? payload.statusChanges : [{ status: payload.status, timestamp: createdAt }];\n const finishedAt = this.isTerminalStatus(payload.status) ? (payload.finishedAt ?? updatedAt) : undefined;\n\n // The row's instants are dates; `statusChanges` is jsonb and keeps the ISO form (#2187).\n return {\n statusChanges,\n createdAt: persistedInstant(createdAt),\n updatedAt: persistedInstant(updatedAt),\n ...(finishedAt ? { finishedAt: persistedInstant(finishedAt) } : {}),\n };\n }\n\n private isTerminalStatus(status: FlowsActors_Status): boolean {\n return [FlowsActors_Status.COMPLETED, FlowsActors_Status.FAILED, FlowsActors_Status.CANCELLED, FlowsActors_Status.ABORTED].includes(status);\n }\n\n /**\n * The `kind` derives from the canonical `FlowsActors_ElementKind` vocabulary\n * and is narrowed to the two element kinds that have persisted executions —\n * its string value is interpolated into the user-facing message below.\n */\n private buildExecutionNotFoundError(kind: FlowsActors_ElementKind.ACTOR | FlowsActors_ElementKind.FLOW, executionId: string) {\n return this.errorBuilder.buildError(ErrorType.NOT_FOUND, undefined, {\n customMessageReference: ErrorCustomMessageReference.NOT_FOUND,\n context: {\n message: `No persisted ${kind} execution exists for this companion app.`,\n executionId,\n appSlug: this.companionContext.saasConfig.slug,\n },\n });\n }\n\n private buildTaskNotFoundError(taskId: string) {\n return this.errorBuilder.buildError(ErrorType.NOT_FOUND, undefined, {\n customMessageReference: ErrorCustomMessageReference.NOT_FOUND,\n context: {\n message: \"No persisted actor task exists for this companion app.\",\n taskId,\n appSlug: this.companionContext.saasConfig.slug,\n },\n });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"companion-executions.companion.service.js","sourceRoot":"","sources":["../../../../src/executions/services/companion-executions.companion.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE/C,OAAO,EACL,0BAA0B,EAE1B,qCAAqC,EACrC,aAAa,EACb,yCAAyC,EACzC,2CAA2C,EAC3C,gCAAgC,EAChC,+BAA+B,EAC/B,kBAAkB,EAClB,gBAAgB,EAChB,iCAAiC,EACjC,mCAAmC,EACnC,iCAAiC,GAElC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEL,yBAAyB,EACzB,qBAAqB,EACrB,kBAAkB,EAClB,2BAA2B,EAC3B,SAAS,EACT,uBAAuB,EACvB,kBAAkB,EAClB,cAAc,EACd,oBAAoB,EACpB,0BAA0B,EAC1B,mBAAmB,EACnB,SAAS,EACT,kDAAkD,EAClD,mBAAmB,GAEpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,yBAAyB,GAK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C,MAAM,CAAC,CAAA;IACjC,WAAA,MAAM,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAA;IAY9C,WAAA,MAAM,CAAC,kBAAkB,CAAC,oCAAoC,CAAC,CAAA;IAE/D,WAAA,MAAM,CAAC,kBAAkB,CAAC,kCAAkC,CAAC,CAAA;IAE7D,WAAA,MAAM,CAAC,kBAAkB,CAAC,uBAAuB,CAAC,CAAA;IAElD,WAAA,MAAM,CAAC,kBAAkB,CAAC,qCAAqC,CAAC,CAAA;IAEhE,WAAA,MAAM,CAAC,uBAAuB,CAAC,gBAAgB,CAAC,CAAA;IAEhD,WAAA,MAAM,CAAC,uBAAuB,CAAC,mBAAmB,CAAC,CAAA;IAMnD,WAAA,MAAM,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAA;qCA7BgB,aAAa;QAE1C,0BAA0B;QAYT,2CAA2C;QAEpD,yCAAyC;QAE5C,+BAA+B;QAEzB,qCAAqC,UAIzC,4BAA4B;QAM/B,gBAAgB;GAnC1C,mCAAmC,CA+9E/C","sourcesContent":["import { inject, injectable } from \"inversify\";\nimport { z } from \"zod\";\nimport {\n ErrorBuilderBackendService,\n ExecutionContext,\n ExecutionContextCreatorBackendService,\n LoggerService,\n RepositoriesRegistryHandlerBackendService,\n ResourcePersistenceUnitOfWorkBackendService,\n RepositoryArrayAdditionPlacement,\n ResourcesRegistryBackendService,\n SAAS_SERVICE_TYPES,\n WebSocketService,\n buildScopeRoomNotificationPayload,\n registerTransactionPostCommitEffect,\n withActorSuspensionStageMarkersOf,\n type TransactionContext,\n} from \"@wildo-ai/saas-backend-lib\";\nimport {\n type ActorExecution_Suspension,\n DEFAULT_LIST_PAGE_CEILING,\n CoreResourceOperation,\n CoreWebSocketEvent,\n ErrorCustomMessageReference,\n ErrorType,\n FlowsActors_ElementKind,\n FlowsActors_Status,\n ResourceAction,\n ResourceScopeRoomKey,\n ResourceSerializationUtils,\n ReviewDeadlineStage,\n SortOrder,\n deriveTrustedSystemWritePreservedFieldsForResource,\n isWildoBackendError,\n type ResourceType,\n} from '@wildo-ai/saas-models';\nimport {\n CustomShared_ResourceType,\n type Wildo_Application,\n type Wildo_Application_Actor_Task,\n type Wildo_Application_ActorSystem_Execution,\n type Wildo_Application_FlowSystem_Execution,\n} from \"@wildo-ai/platform-core-shared\";\nimport type {\n CompanionActorTasksListQuery,\n CompanionCreateActorTaskRequest,\n CompanionCreateActorExecutionRequest,\n CompanionCreateFlowExecutionRequest,\n CompanionExecutionsListQuery,\n CompanionUpdateActorExecutionRequest,\n CompanionUpdateActorTaskRequest,\n} from \"../../companion-api/companion-api.schemas\";\nimport type { CompanionContext } from \"../../core/context/companion-context\";\nimport { COMPANION_SERVICE_TYPES } from \"../../core/inject/models/service-types\";\nimport { CompanionTraceabilityService } from \"../../core/traceability/companion-traceability.service\";\nimport { CompanionTraceabilityLevel, CompanionTraceAliasKind, type CompanionExecutionSessionContext } from \"../../core/traceability/companion-traceability.models\";\nimport { describeCaughtError } from '@wildo-ai/saas-backend-lib';\nimport { summarizeListedRowsForTrace, toExecutionTaskSnapshot, toExecutionWithTaskSnapshot } from \"../models/execution-task-snapshot.models\";\n/**\n * How many owing executions one repair sweep reads (#1922). A row past it is found by the next sweep: nothing clears a\n * marker but its record, and a review owes at most one per run at a time.\n */\nconst OWED_CORRECTION_RECORD_SCAN_LIMIT = 200;\n\n/** How many waiting executions one page of the question deadline sweep reads (#2807); the sweep pages by `_id`. */\nconst WAITING_ACTOR_EXECUTION_PAGE_LIMIT = 100;\n\n/**\n * How many times a route move re-reads the stored question when a deadline stage was marked between its read and its\n * write (#2807, the application persistence's #1863 review H1 guard). Only a stage marker can change the question\n * without moving its route version, and a question has four stages, so a few attempts always suffice.\n */\nconst MOVE_ATTEMPTS_AROUND_STAGE_MARKERS = 5;\n\n/** The suspension path one deadline stage's FIRED marker is stored at (`ActorExecution_SuspensionDeadlines.firedAt`). */\nfunction stageMarkerPath(stage: ReviewDeadlineStage): string {\n return `suspension.deadlines.firedAt.${stage}`;\n}\n\n/**\n * The filter that holds a stored question's deadline stage markers exactly as read (#2807): each fired stage at the\n * instant it fired, each unfired stage still absent. A write guarded on it matches nothing once a sweep has fired a stage\n * since the read. Empty for a question with no clocks, on which no stage can be marked.\n */\nfunction stageMarkersAsReadFilter(stored: ActorExecution_Suspension): Record<string, unknown> {\n if (!stored.deadlines) return {};\n const filter: Record<string, unknown> = {};\n for (const stage of Object.values(ReviewDeadlineStage)) {\n const firedAt = stored.deadlines.firedAt[stage];\n filter[stageMarkerPath(stage)] = firedAt !== undefined ? firedAt : { $exists: false };\n }\n return filter;\n}\n\n/** The filter naming the suspension `expected` names: its id, or its instant for one written before ids existed. */\nfunction suspensionIdentityFilter(expected: ActorExecution_Suspension): Record<string, unknown> {\n return expected.suspensionId !== undefined\n ? { 'suspension.suspensionId': expected.suspensionId }\n : { 'suspension.suspendedAt': expected.suspendedAt };\n}\n\n/** Does the stored question still name the one `expected` names, by the same identity rule as the filter? */\nfunction isSameSuspension(stored: ActorExecution_Suspension, expected: ActorExecution_Suspension): boolean {\n return expected.suspensionId !== undefined ? stored.suspensionId === expected.suspensionId : stored.suspendedAt === expected.suspendedAt;\n}\n\n/**\n * Which of an application's actor tasks a listing answers: the caller's LANE first, then the most\n * recently updated `limit` of it.\n *\n * The order of those two steps is the whole point (#1359). Trimming first makes the window the whole\n * application's — a caller asking for coding runs read the N most recent tasks of EVERY actor, so a\n * busy judge or labelling lane could push a coding row out and the caller would conclude it never\n * existed, which is how a loop guard comes to answer \"never ran\" about work that ran. The set is\n * already materialised here, so scoping is an in-memory filter rather than a nested-path query a\n * store might silently not honour.\n */\nexport function selectListedActorTasks<TTask extends { readonly updatedAt: Date; readonly actors?: { readonly actorRef?: string } }>(\n tasks: readonly TTask[],\n query: { readonly actorRefs?: readonly string[]; readonly limit: number },\n): TTask[] {\n const scoped = query.actorRefs\n ? tasks.filter((task) => query.actorRefs!.includes(task.actors?.actorRef ?? ''))\n : [...tasks];\n return scoped.sort(newestUpdatedFirst).slice(0, query.limit);\n}\n\n/**\n * Read a listing's rows newest-first FROM THE DATABASE, a page at a time, until `enough` says the rows held\n * answer the caller (#2186, #2484). The one page loop both the execution and the actor-task listings use.\n *\n * - A page holds at most the LIST operation's ceiling (`DEFAULT_LIST_PAGE_CEILING`, 100). Pages are addressed\n * by NUMBER and the repository computes the offset from the page size it actually applied, so a lower\n * ceiling cannot misalign them.\n * - It stops on an EMPTY page, never a short one: a short page says only that the ceiling was lower than asked.\n * - Offset pages over a moving column can shift: a row updated between two page reads moves to the head and\n * pushes its neighbours one place down, so one row is read twice and the moved row is not read at all.\n * Duplicates are dropped by `_id`, keeping the fresher copy; the moved row is the newest change and the\n * next listing returns it. A listing is a snapshot either way.\n * - The order ends on `_id` in both adapters, so ties on `updatedAt` do not skip or repeat rows.\n * - A page that adds no new row ends the read: it cannot be followed by one that does, unless the repository\n * ignored `page`, and then the loop would re-read the same rows forever.\n */\n/**\n * One page of a newest-first read. Typed to the repository's `_doList` contract (`listOptions.sort`), which the\n * public `list` overload's narrower type does not name — the same pattern as the audit-log and pipeline-run readers.\n */\ninterface NewestFirstPage { page: number; limit: number; sort: Record<string, 1 | -1> }\n\nasync function readNewestRowsByPage<TRow extends { updatedAt: Date }>(\n readPage: (listOptions: NewestFirstPage) => Promise<readonly TRow[]>,\n enough: (rows: readonly TRow[]) => boolean,\n): Promise<TRow[]> {\n const byId = new Map<string, TRow>();\n for (let page = 1; !enough([...byId.values()]); page += 1) {\n const data = await readPage({ page, limit: DEFAULT_LIST_PAGE_CEILING, sort: { updatedAt: -1 } });\n if (data.length === 0) break;\n const before = byId.size;\n for (const row of data) {\n const id = String((row as { _id?: unknown })._id);\n const seen = byId.get(id);\n if (seen === undefined || seen.updatedAt.getTime() < row.updatedAt.getTime()) byId.set(id, row);\n }\n if (byId.size === before) break;\n }\n return [...byId.values()];\n}\n\n/**\n * An instant as a persisted row stores it (#2187). The companion's wire contracts and the in-memory\n * runtime carry ISO strings, and so do the jsonb parts of a row (`statusChanges`, `standaloneTaskStates`,\n * the task snapshot); the row's own `createdAt` / `updatedAt` / `finishedAt` / `startedAt` /\n * `completedAt` columns are dates. Every write of one of those columns goes through here.\n */\nfunction persistedInstant(iso: string): Date {\n return new Date(iso);\n}\n\n/**\n * The finish instant a TERMINAL write records (#3235 c).\n *\n * A write that moves nothing keeps the instant the row ENDED. Clearing the checkpoint of a run that ended long ago is\n * such a write: it carries the status the row already has (`updateExecution` reads it for a checkpoint-only patch), so\n * it used to stamp the WRITE's instant as the run's end. Measured on app-creation-test-007: a relaunch at 13:14Z adopted\n * the checkpoint of a lane refused at 00:59Z, the adoption cleared the old row's checkpoint, and the old refusal was\n * re-dated to 13:14:34Z — so the feed and the monitor announced it as a new refusal one second after the lane resumed.\n * A write that ENDS the row (a status move into a terminal state) still records its own instant, or the one it names.\n */\nfunction settledFinishInstant(input: {\n readonly existing: { readonly status: string; readonly finishedAt?: Date | string | null };\n readonly payload: { readonly status: string; readonly finishedAt?: string };\n readonly updatedAt: string;\n}): Date {\n if (input.payload.finishedAt !== undefined) return persistedInstant(input.payload.finishedAt);\n const ended = input.existing.finishedAt;\n if (input.existing.status === input.payload.status && ended !== undefined && ended !== null) {\n return ended instanceof Date ? ended : persistedInstant(ended);\n }\n return persistedInstant(input.updatedAt);\n}\n\n/**\n * Newest `updatedAt` first, compared as INSTANTS (#2187). The stored rows carried local-offset text and\n * were ordered with `localeCompare`, which agrees with time only while every value has the same offset.\n */\nfunction newestUpdatedFirst(left: { readonly updatedAt: Date }, right: { readonly updatedAt: Date }): number {\n return right.updatedAt.getTime() - left.updatedAt.getTime();\n}\n\n/**\n * The room and payload for one repository-direct control-plane mutation (issue #286).\n *\n * Exported and pure so the two properties that MATTER can be pinned without standing up the whole\n * service: which room the event goes to, and what it carries.\n *\n * ## The ORGANIZATION room is a tenant-isolation decision, not a detail\n *\n * `wildoApplicationActorTasks` and both execution resources declare `isPrimaryScope: true` on their\n * ORGANIZATIONS relationship, so a row belongs to ONE tenant. The sibling introspection notifier\n * legitimately broadcasts to the APPLICATION room because every resource it serves is\n * APPLICATION-anchored; doing that here would carry one tenant's row ids to every user of the\n * application.\n *\n * ## Notification-grade, never row data\n *\n * `currentObject` is deliberately absent. A scope room fans out to every member of the tenant, and\n * these rows carry coding-agent input and output that a collection event has no business\n * broadcasting. Subscribers learn WHAT moved and refetch through their own authorization — the same\n * contract the introspection notifier's collection lane uses.\n */\nexport function buildControlPlaneMutationNotification(\n resourceType: string,\n ownership: CompanionExecutionOwnership,\n resourceId: string,\n action: ResourceAction,\n) {\n return {\n resourceType,\n rooms: [{ scopeKey: ResourceScopeRoomKey.ORGANIZATION, scopeId: ownership.organizationId }],\n event: CoreWebSocketEvent.RESOURCE_UPDATED,\n payload: {\n resourceType,\n resourceId,\n contextResourceIdentifiers: {\n organizationId: ownership.organizationId,\n applicationId: ownership.wildoApplicationId,\n },\n action,\n affectedIds: [resourceId],\n operationIdentifier: CoreResourceOperation.LIST,\n currentObject: undefined,\n },\n };\n}\n\ninterface CompanionExecutionOwnership {\n organizationId: string;\n wildoApplicationId: string;\n}\n\n/*\n * The stored rows are the PERSISTED platform types, imported rather than restated (#2187). This file used\n * to declare its own three, built from the in-memory schemas, so when the persisted instants became dates\n * the service still typed them as strings and compared them with `localeCompare` — a second description of\n * one row that had already drifted from the first.\n */\n\n/**\n * One entry of an execution's `standaloneTasks` snapshot: the IN-MEMORY task form, ISO-string instants,\n * stored as jsonb. Distinct from the persisted task row (`Wildo_Application_Actor_Task`, dated instants);\n * a row enters the snapshot only through `toExecutionTaskSnapshot`.\n */\ntype ExecutionTaskSnapshotEntry = Wildo_Application_ActorSystem_Execution[\"standaloneTasks\"][number];\n\nconst WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE: ResourceType = \"wildoApplicationActorSystemExecutions\";\n\nconst WILDO_APPLICATION_FLOW_SYSTEM_EXECUTIONS_RESOURCE_TYPE: ResourceType = \"wildoApplicationFlowSystemExecutions\";\n\nconst WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE: ResourceType = \"wildoApplicationActorTasks\";\n\n/**\n * The persistence participants of every companion execution boundary.\n *\n * Executions and their tasks are written together — creating an execution persists its\n * standalone tasks, and both task verbs read the owning execution back inside the same\n * transaction — so the two resources belong to ONE boundary. Declaring them is what lets the\n * unit of work resolve a single adapter and refuse the split-store case outright, instead of\n * discovering it at commit time on whichever adapter happened to open the transaction.\n */\nconst COMPANION_EXECUTION_PERSISTENCE_PARTICIPANTS: Readonly<Record<string, string>> = Object.freeze({\n actorExecution: WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n actorTask: WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE,\n});\n\ntype ExecutionCreateEnvelope = {\n status: FlowsActors_Status;\n statusChanges: Array<{ status: FlowsActors_Status; timestamp: string }>;\n createdAt?: string;\n updatedAt?: string;\n finishedAt?: string;\n};\n\n/** How many times a status-less task write re-reads a row whose status moved under it (#1586 review F6). */\nconst TASK_STATUS_GUARD_ATTEMPTS = 3;\n\ntype CompanionRepositoryOptions = {\n transaction?: TransactionContext;\n};\n\ntype PersistedExecutionTask = {\n sourceTaskId: string;\n task: Wildo_Application_Actor_Task;\n};\n\n/** The most runs of one build task in one status a per-task read returns (#3204): far above any task's real count. */\nconst BUILD_TASK_RUN_ROWS_LIMIT = 200;\n\n/** The longest one execution listing is shared, whatever else happens (#3204, {@link CompanionExecutionsCompanionService}). */\nconst EXECUTION_LISTING_HOLD_MS = 3_000;\n\n/**\n * The stored fields an actor-execution listing leaves out unless its caller asks for whole rows (#3204,\n * `RepositoryOptions.omitStoredFields`).\n *\n * `standaloneTasks.input.baseline.files` is a coding run's dirty-file map at admission: measured on the reference creation\n * (run 42886943490), 15.7 KB of a 36 KB coding row, over 986 rows, re-read by the build loop's 2,000-row listings several\n * times a minute — which kept the companion's thread blocked about 1.5 s in every 30. No reader of a LISTING uses it: the\n * change-set and recovery paths read the baseline from the task row (`getActorTask`) or hold it in memory, and the\n * listing readers take only `baseline.headSha` / `capturedAt`. The HTTP listing passes `[]` and keeps returning whole rows.\n */\nexport const ACTOR_EXECUTION_LISTING_OMITTED_FIELDS: readonly string[] = ['standaloneTasks.input.baseline.files'];\n\n@injectable()\nexport class CompanionExecutionsCompanionService {\n private readonly logDebug: (message: string, context?: Record<string, unknown>) => void;\n private ownershipPromise?: Promise<CompanionExecutionOwnership>;\n\n constructor(\n @inject(SAAS_SERVICE_TYPES.Logger) private readonly logger: LoggerService,\n @inject(SAAS_SERVICE_TYPES.ErrorBuilderService)\n private readonly errorBuilder: ErrorBuilderBackendService,\n /*\n * The ADAPTER-NEUTRAL transaction seam, not `MongoDBService`.\n *\n * These three boundaries used `mongoDBService.executeTransaction` until 2026-08-28, which\n * is one half of why the companion could not run on a PostgreSQL platform (issue #94):\n * even once the right store is connected, a Mongo-specific transaction cannot wrap a write\n * to a PostgreSQL-resolved repository. The unit of work resolves the adapter from the\n * DECLARED participants and refuses a boundary whose resources are split across two stores,\n * which is a configuration error rather than something to discover at commit time.\n */\n @inject(SAAS_SERVICE_TYPES.ResourcePersistenceUnitOfWorkService)\n private readonly resourcePersistenceUnitOfWork: ResourcePersistenceUnitOfWorkBackendService,\n @inject(SAAS_SERVICE_TYPES.RepositoriesRegistryHandlerService)\n private readonly repositoriesRegistry: RepositoriesRegistryHandlerBackendService,\n @inject(SAAS_SERVICE_TYPES.ResourceRegistryService)\n private readonly resourcesRegistry: ResourcesRegistryBackendService,\n @inject(SAAS_SERVICE_TYPES.ExecutionContextCreatorBackendService)\n private readonly executionContextCreator: ExecutionContextCreatorBackendService,\n @inject(COMPANION_SERVICE_TYPES.CompanionContext)\n private readonly companionContext: CompanionContext,\n @inject(COMPANION_SERVICE_TYPES.TraceabilityService)\n private readonly traceabilityService: CompanionTraceabilityService,\n /*\n * The companion MOUNTS the engine WebSocket server, and these control-plane writes were the\n * one lane that never used it (issue #286). See `publishControlPlaneMutation`.\n */\n @inject(SAAS_SERVICE_TYPES.WebSocketService)\n private readonly websocketService: WebSocketService,\n ) {\n this.logDebug = this.logger.debugByType(\"CompanionExecutionsCompanionService\");\n this.logger.setDebugTypeLogging(\"CompanionExecutionsCompanionService\", true);\n }\n\n public async createActorExecution(\n payload: CompanionCreateActorExecutionRequest,\n sessionContext?: CompanionExecutionSessionContext,\n ): Promise<Wildo_Application_ActorSystem_Execution> {\n this.noteExecutionWrite();\n try {\n const traceStep = this.createOperationTraceStep(sessionContext, \"create-actor-execution\");\n await this.traceOperationStart({\n sessionContext,\n step: traceStep,\n type: \"actor-execution-create-start\",\n summary: `Create persisted actor execution for ${payload.systemRef}`,\n payload: {\n systemRef: payload.systemRef,\n status: payload.status,\n standaloneTaskCount: payload.standaloneTasks.length,\n },\n artifactFileName: \"actor-execution-create-request.json\",\n artifactContent: payload,\n });\n\n try {\n this.assertStandaloneTaskStateConsistency(payload);\n const execution = await this.resourcePersistenceUnitOfWork.executeTransaction(\n {\n boundary: 'companion-executions.create-actor-execution',\n participants: COMPANION_EXECUTION_PERSISTENCE_PARTICIPANTS,\n },\n async ({ transaction }) => {\n const ownership = await this.resolveOwnership(sessionContext);\n const repository = this.repositoriesRegistry.getRepositoryOrThrow(WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE);\n const executionContext = await this.createInternalExecutionContext(\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n CoreResourceOperation.CREATE,\n sessionContext,\n );\n const normalizedPayload = this.normalizeCreateEnvelope(payload);\n // The execution's task snapshot never carries a transcript, whichever door writes it (see\n // `execution-task-snapshot.models.ts`).\n const createData = toExecutionWithTaskSnapshot({\n ...payload,\n ...normalizedPayload,\n organizationId: ownership.organizationId,\n wildoApplicationId: ownership.wildoApplicationId,\n });\n\n const createdExecution = await repository.create<Wildo_Application_ActorSystem_Execution>(executionContext, createData, {\n ...this.buildRepositoryOptions(transaction),\n preserveServerInjectedFields: this.deriveServerInjectedPreserveFields(\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n createData,\n CoreResourceOperation.CREATE,\n ),\n });\n\n this.publishControlPlaneMutation(\n transaction,\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n ownership,\n String(createdExecution._id),\n ResourceAction.CREATED,\n );\n // Announced ONCE, here, because both return paths below concern this same row — the\n // snapshot update that may follow is the same execution, not a second one.\n if (payload.standaloneTasks.length === 0) {\n return createdExecution;\n }\n\n const persistedTasks = await this.persistExecutionTasks(\n ownership,\n createdExecution._id,\n payload.standaloneTasks,\n payload.standaloneTaskStates,\n transaction,\n sessionContext,\n );\n\n const updatedExecution = await this.updateActorExecutionTaskSnapshot(\n createdExecution,\n ownership,\n persistedTasks.map(({ task }) => toExecutionTaskSnapshot(task)),\n transaction,\n this.buildPersistedStandaloneTaskStates(persistedTasks, payload.standaloneTaskStates),\n sessionContext,\n );\n return updatedExecution;\n },\n );\n\n if (sessionContext) {\n await this.traceabilityService.registerAlias(sessionContext, CompanionTraceAliasKind.ACTOR_EXECUTION,execution._id);\n }\n\n await this.traceOperationSuccess({\n sessionContext,\n step: traceStep,\n type: \"actor-execution-create-success\",\n summary: `Created persisted actor execution ${execution._id}`,\n payload: {\n executionId: execution._id,\n status: execution.status,\n standaloneTaskCount: execution.standaloneTasks.length,\n },\n artifactFileName: \"actor-execution-create-result.json\",\n artifactContent: execution,\n });\n return execution;\n } catch (error) {\n await this.traceOperationFailure({\n sessionContext,\n step: traceStep,\n type: \"actor-execution-create-failure\",\n summary: `Failed to create persisted actor execution for ${payload.systemRef}`,\n error,\n payload: {\n systemRef: payload.systemRef,\n status: payload.status,\n standaloneTaskCount: payload.standaloneTasks.length,\n },\n });\n throw error;\n }\n } finally {\n this.noteExecutionWrite();\n }\n }\n\n /**\n * SETTLE an execution — the write that did not exist until 2026-09-19 (#1343).\n *\n * `createActorExecution` could open one and nothing could close it: `syncTaskIntoExecutionSnapshot`\n * maintains `standaloneTasks`/`standaloneTaskStates` and never the execution's own `status`, so an\n * execution opened as PROCESSING stayed PROCESSING while its tasks finished underneath it. A\n * control-plane row that looks like it tracks a run and does not is the defect this lane already\n * has once; a second one is not worth having.\n *\n * `statusChanges` is APPENDED to rather than replaced, because it is a history and a caller that\n * had to send the whole list would have to read it first — and two settlers racing would then each\n * write a list missing the other's entry.\n */\n public async updateActorExecution(\n executionId: string,\n payload: CompanionUpdateActorExecutionRequest,\n sessionContext?: CompanionExecutionSessionContext,\n ): Promise<Wildo_Application_ActorSystem_Execution> {\n this.noteExecutionWrite();\n try {\n const traceStep = this.createOperationTraceStep(sessionContext, \"update-actor-execution\");\n await this.traceOperationStart({\n sessionContext,\n step: traceStep,\n type: \"actor-execution-update-start\",\n summary: `Update persisted actor execution ${executionId}`,\n payload: { executionId, status: payload.status },\n artifactFileName: \"actor-execution-update-request.json\",\n artifactContent: { executionId, payload },\n });\n\n try {\n const execution = await this.resourcePersistenceUnitOfWork.executeTransaction(\n {\n boundary: 'companion-executions.update-actor-execution',\n participants: COMPANION_EXECUTION_PERSISTENCE_PARTICIPANTS,\n },\n async ({ transaction }) => {\n const ownership = await this.resolveOwnership(sessionContext);\n const existing = await this.readActorExecutionOrThrow(executionId, ownership.wildoApplicationId, transaction, sessionContext);\n const repository = this.repositoriesRegistry.getRepositoryOrThrow(WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE);\n const executionContext = await this.createInternalExecutionContext(\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n CoreResourceOperation.UPDATE,\n sessionContext,\n );\n const updatedAt = new Date().toISOString();\n const isTerminal = this.isTerminalStatus(payload.status);\n const updated = await repository.update<Wildo_Application_ActorSystem_Execution>(\n executionContext,\n { _id: executionId, wildoApplicationId: ownership.wildoApplicationId },\n {\n status: payload.status,\n updatedAt: persistedInstant(updatedAt),\n /*\n * A HISTORY OF MOVES, so a write that moves nothing appends nothing (#1360): a\n * checkpoint-only update carries the status the row already has, and recording it as a\n * change would fill the history with one entry per checkpoint of a long run.\n */\n statusChanges: [\n ...existing.statusChanges,\n ...(payload.statusChanges ?? (payload.status === existing.status ? [] : [{ status: payload.status, timestamp: updatedAt }])),\n ],\n // `null` clears, absent leaves alone — see `CompanionUpdateActorExecutionRequestSchema`.\n ...(payload.suspension !== undefined ? { suspension: payload.suspension } : {}),\n ...(payload.checkpoint !== undefined ? { checkpoint: payload.checkpoint } : {}),\n // A record a put-back settle restores (#1922); its `null` is a clear, below.\n ...(payload.pendingCorrectionRecord ? { pendingCorrectionRecord: payload.pendingCorrectionRecord } : {}),\n // A non-terminal settle must not carry a finish instant, and the request schema already\n // refuses the combination — this is the same rule at the write, where it is enforceable.\n ...(isTerminal ? { finishedAt: settledFinishInstant({ existing, payload, updatedAt }) } : {}),\n },\n this.buildRepositoryOptions(transaction),\n );\n if (updated === null) {\n // Same reading as `updateActorExecutionTaskSnapshot`: the filter matched nothing, which is\n // either a concurrent delete or an ownership violation, and from here they are one shape.\n throw new Error(\n `Actor-system execution '${executionId}' could not be updated: no row matches that id under `\n + `application '${ownership.wildoApplicationId}'. It was removed concurrently, or it belongs to another application.`,\n );\n }\n /*\n * A NON-terminal row has no finish instant — whatever wrote one before. The ordinary update can\n * only set, so a run moved back to waiting after a withdraw was undone kept the withdraw's\n * `finishedAt`, and the run record and the workbench then read a waiting run as finished at\n * that instant (#1586 review N1). Cleared in the same transaction, only when there is one — and\n * announced like every other write: this is the one that tells a watcher the run waits again.\n */\n /*\n * The update can only SET, so a `null` that must clear is applied here, in the same transaction: a stale finish\n * instant (above), and a record a put-back settle no longer owes (#1922) — `null` there is the engine saying\n * the row owed nothing before the swap stamped it.\n */\n let written = updated;\n const cleared = [\n ...(!isTerminal && updated.finishedAt !== undefined ? ['finishedAt'] as const : []),\n ...(payload.pendingCorrectionRecord === null && updated.pendingCorrectionRecord != null ? ['pendingCorrectionRecord'] as const : []),\n ];\n if (cleared.length > 0) {\n await this.repositoriesRegistry.atomicConditionalSet(\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n { _id: executionId, wildoApplicationId: ownership.wildoApplicationId },\n { clear: [...cleared] },\n undefined,\n this.buildRepositoryOptions(transaction),\n );\n const remaining: Record<string, unknown> = { ...updated };\n for (const field of cleared) delete remaining[field];\n written = remaining as Wildo_Application_ActorSystem_Execution;\n }\n this.publishControlPlaneMutation(\n transaction,\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n ownership,\n String(written._id),\n ResourceAction.UPDATED,\n );\n return written;\n },\n );\n\n await this.traceOperationSuccess({\n sessionContext,\n step: traceStep,\n type: \"actor-execution-update-success\",\n summary: `Updated persisted actor execution ${execution._id}`,\n payload: { executionId: execution._id, status: execution.status },\n artifactFileName: \"actor-execution-update-result.json\",\n artifactContent: execution,\n });\n return execution;\n } catch (error) {\n await this.traceOperationFailure({\n sessionContext,\n step: traceStep,\n type: \"actor-execution-update-failure\",\n summary: `Failed to update persisted actor execution ${executionId}`,\n error,\n payload: { executionId, status: payload.status },\n });\n throw error;\n }\n } finally {\n this.noteExecutionWrite();\n }\n }\n\n /**\n * Move a WAITING actor execution out of waiting — the compare-and-swap behind the engine port's\n * `updateSuspendedExecution` (#1586). Answers the moved row, or `null` when the row is no longer\n * waiting on `expected`, in which case NOTHING was written.\n *\n * ONE guarded statement: the predicate (this application, `AWAITING_APPROVAL`, and the suspension\n * `expected` names) travels in the filter of `atomicGuardedMutation`, which compiles to a\n * `findOneAndUpdate` on MongoDB and an `UPDATE … WHERE` on PostgreSQL. `updateActorExecution` is not\n * reused: it reads the row and then writes it, which is exactly the window two decisions raced\n * through. For the same reason the history entry is APPENDED in the statement rather than rebuilt\n * from a read, and the two cleared fields use `clear`, the one spelling both adapters agree on.\n *\n * The suspension is matched by the field its reference was taken from — `suspensionId`, or\n * `suspendedAt` for a row written before ids existed — which is `actorExecutionSuspensionRef`'s own\n * rule, so a decision that names a suspension and the write that honours it cannot disagree.\n */\n public async updateSuspendedActorExecution(\n executionId: string,\n expected: ActorExecution_Suspension,\n payload: CompanionUpdateActorExecutionRequest,\n sessionContext?: CompanionExecutionSessionContext,\n ): Promise<Wildo_Application_ActorSystem_Execution | null> {\n this.noteExecutionWrite();\n try {\n const traceStep = this.createOperationTraceStep(sessionContext, \"update-suspended-actor-execution\");\n await this.traceOperationStart({\n sessionContext,\n step: traceStep,\n type: \"actor-execution-update-start\",\n summary: `Move waiting actor execution ${executionId} out of waiting`,\n payload: { executionId, status: payload.status },\n artifactFileName: \"actor-execution-swap-request.json\",\n artifactContent: { executionId, expected, payload },\n });\n\n try {\n const moved = await this.resourcePersistenceUnitOfWork.executeTransaction(\n {\n boundary: 'companion-executions.update-suspended-actor-execution',\n participants: COMPANION_EXECUTION_PERSISTENCE_PARTICIPANTS,\n },\n async ({ transaction }) => {\n const ownership = await this.resolveOwnership(sessionContext);\n const executionContext = await this.createInternalExecutionContext(\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n CoreResourceOperation.UPDATE,\n sessionContext,\n );\n const updatedAt = new Date().toISOString();\n const cleared = [\n ...(payload.suspension === null ? ['suspension'] : []),\n ...(payload.checkpoint === null ? ['checkpoint'] : []),\n ...(payload.pendingCorrectionRecord === null ? ['pendingCorrectionRecord'] : []),\n // A non-terminal move leaves no finish instant, as `updateActorExecution` guarantees (#1586 review N1).\n ...(this.isTerminalStatus(payload.status) ? [] : ['finishedAt']),\n ];\n const updated = await this.repositoriesRegistry.atomicGuardedMutation<Wildo_Application_ActorSystem_Execution>(\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n {\n _id: executionId,\n wildoApplicationId: ownership.wildoApplicationId,\n status: FlowsActors_Status.AWAITING_APPROVAL,\n ...(expected.suspensionId !== undefined\n ? { 'suspension.suspensionId': expected.suspensionId }\n : { 'suspension.suspendedAt': expected.suspendedAt }),\n // A route moved since the read makes this match nothing (#1594 I5). A suspension written\n // before routes existed carries no version and is matched by its identity alone.\n ...(expected.routeVersion !== undefined ? { 'suspension.routeVersion': expected.routeVersion } : {}),\n },\n {\n set: {\n status: payload.status,\n updatedAt: persistedInstant(updatedAt),\n ...(payload.suspension ? { suspension: payload.suspension } : {}),\n ...(payload.checkpoint ? { checkpoint: payload.checkpoint } : {}),\n // The record a settle of a review owes rides the move it settles (#1599 I3, #1922): one statement.\n ...(payload.pendingCorrectionRecord ? { pendingCorrectionRecord: payload.pendingCorrectionRecord } : {}),\n ...(this.isTerminalStatus(payload.status) ? { finishedAt: persistedInstant(payload.finishedAt ?? updatedAt) } : {}),\n },\n ...(cleared.length > 0 ? { clear: cleared } : {}),\n arrayAdditions: [{\n path: 'statusChanges',\n // How the wait ended rides on the change that ended it, in this statement (#1594 I4).\n values: [{ status: payload.status, timestamp: updatedAt, ...(payload.resolution ? { resolution: payload.resolution } : {}) }],\n placement: RepositoryArrayAdditionPlacement.TAIL,\n distinctOnly: false,\n }],\n },\n executionContext,\n this.buildRepositoryOptions(transaction),\n );\n if (updated !== null) {\n this.publishControlPlaneMutation(\n transaction,\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n ownership,\n String(updated._id),\n ResourceAction.UPDATED,\n );\n }\n return updated;\n },\n );\n\n await this.traceOperationSuccess({\n sessionContext,\n step: traceStep,\n type: \"actor-execution-update-success\",\n summary: moved\n ? `Moved waiting actor execution ${executionId} to ${payload.status}`\n : `Actor execution ${executionId} was no longer waiting on that question; nothing was written`,\n payload: { executionId, status: payload.status, moved: moved !== null },\n artifactFileName: \"actor-execution-swap-result.json\",\n artifactContent: moved ?? { moved: false },\n });\n return moved;\n } catch (error) {\n await this.traceOperationFailure({\n sessionContext,\n step: traceStep,\n type: \"actor-execution-update-failure\",\n summary: `Failed to move waiting actor execution ${executionId}`,\n error,\n payload: { executionId, status: payload.status },\n });\n throw error;\n }\n } finally {\n this.noteExecutionWrite();\n }\n }\n\n public async createFlowExecution(\n payload: CompanionCreateFlowExecutionRequest,\n sessionContext?: CompanionExecutionSessionContext,\n ): Promise<Wildo_Application_FlowSystem_Execution> {\n this.noteExecutionWrite();\n try {\n const traceStep = this.createOperationTraceStep(sessionContext, \"create-flow-execution\");\n await this.traceOperationStart({\n sessionContext,\n step: traceStep,\n type: \"flow-execution-create-start\",\n summary: `Create persisted flow execution for ${payload.systemRef}`,\n payload: {\n systemRef: payload.systemRef,\n status: payload.status,\n },\n artifactFileName: \"flow-execution-create-request.json\",\n artifactContent: payload,\n });\n\n try {\n const ownership = await this.resolveOwnership(sessionContext);\n const repository = this.repositoriesRegistry.getRepositoryOrThrow(WILDO_APPLICATION_FLOW_SYSTEM_EXECUTIONS_RESOURCE_TYPE);\n const executionContext = await this.createInternalExecutionContext(\n WILDO_APPLICATION_FLOW_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n CoreResourceOperation.CREATE,\n sessionContext,\n );\n const normalizedPayload = this.normalizeCreateEnvelope(payload);\n const createData = {\n ...payload,\n ...normalizedPayload,\n organizationId: ownership.organizationId,\n wildoApplicationId: ownership.wildoApplicationId,\n };\n\n const flowExecution = await repository.create<Wildo_Application_FlowSystem_Execution>(executionContext, createData, {\n preserveServerInjectedFields: this.deriveServerInjectedPreserveFields(\n WILDO_APPLICATION_FLOW_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n createData,\n CoreResourceOperation.CREATE,\n ),\n });\n // `null` transaction: this write is NOT wrapped in one, so it is already durable here.\n this.publishControlPlaneMutation(\n null,\n WILDO_APPLICATION_FLOW_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n ownership,\n String(flowExecution._id),\n ResourceAction.CREATED,\n );\n if (sessionContext) {\n await this.traceabilityService.registerAlias(sessionContext, CompanionTraceAliasKind.FLOW_EXECUTION,flowExecution._id);\n }\n await this.traceOperationSuccess({\n sessionContext,\n step: traceStep,\n type: \"flow-execution-create-success\",\n summary: `Created persisted flow execution ${flowExecution._id}`,\n payload: {\n executionId: flowExecution._id,\n status: flowExecution.status,\n },\n artifactFileName: \"flow-execution-create-result.json\",\n artifactContent: flowExecution,\n });\n return flowExecution;\n } catch (error) {\n await this.traceOperationFailure({\n sessionContext,\n step: traceStep,\n type: \"flow-execution-create-failure\",\n summary: `Failed to create persisted flow execution for ${payload.systemRef}`,\n error,\n payload: {\n systemRef: payload.systemRef,\n status: payload.status,\n },\n });\n throw error;\n }\n } finally {\n this.noteExecutionWrite();\n }\n }\n\n /**\n * Move a WAITING actor execution's question to another route — the compare-and-swap behind the engine port's\n * `moveSuspensionRoute` (#2636). Answers whether it moved; `false` means the row no longer waits on `expected` at the\n * route version that was read, and NOTHING was written.\n *\n * ONE guarded statement, like {@link updateSuspendedActorExecution}: the predicate (this application,\n * `AWAITING_APPROVAL`, the suspension `expected` names, its route version) travels in the filter, and the write\n * replaces the stored suspension — whose route and version are the move — and nothing else. The status and its\n * history are untouched: the question was moved, not settled.\n *\n * #2807: the deadline sweep marks a fired stage on the same stored question without moving the route version\n * ({@link markActorExecutionSuspensionDeadlineStage}), so a move built from an earlier read would put back a question\n * whose stage had not fired yet, and that stage would fire again. The move therefore re-reads the stored question,\n * keeps every stage marker it carries (`withActorSuspensionStageMarkersOf`: a stage that fired stays fired), and guards\n * on those markers exactly as read. A stage marked between that read and the write makes the write match nothing; the\n * move then reads again and retries, a bounded number of times, since only a marker can have landed while the version\n * still matches. The application persistence does the same on its serialized column (#1863 review H1).\n */\n public async moveActorExecutionSuspensionRoute(\n executionId: string,\n expected: ActorExecution_Suspension,\n next: ActorExecution_Suspension,\n sessionContext?: CompanionExecutionSessionContext,\n ): Promise<boolean> {\n this.noteExecutionWrite();\n try {\n return this.resourcePersistenceUnitOfWork.executeTransaction(\n {\n boundary: 'companion-executions.move-actor-execution-suspension-route',\n participants: COMPANION_EXECUTION_PERSISTENCE_PARTICIPANTS,\n },\n async ({ transaction }) => {\n const ownership = await this.resolveOwnership(sessionContext);\n const executionContext = await this.createInternalExecutionContext(\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n CoreResourceOperation.UPDATE,\n sessionContext,\n );\n for (let attempt = 0; attempt < MOVE_ATTEMPTS_AROUND_STAGE_MARKERS; attempt += 1) {\n const stored = await this.readStoredActorExecution(executionId, ownership.wildoApplicationId);\n const current = stored?.status === FlowsActors_Status.AWAITING_APPROVAL ? stored.suspension : undefined;\n // A stored question with no version was never routed, and the filter below could never match it (see the version guard).\n if (!current || !isSameSuspension(current, expected) || current.routeVersion === undefined || current.routeVersion !== (expected.routeVersion ?? 0)) return false;\n const moved = await this.repositoriesRegistry.atomicGuardedMutation<Wildo_Application_ActorSystem_Execution>(\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n {\n _id: executionId,\n wildoApplicationId: ownership.wildoApplicationId,\n status: FlowsActors_Status.AWAITING_APPROVAL,\n ...suspensionIdentityFilter(expected),\n // The version that was read (#1594 I5). A routed suspension is written at version 0, so an absent one reads 0:\n // a stored suspension with no version never matches, which refuses the move rather than guessing.\n 'suspension.routeVersion': expected.routeVersion ?? 0,\n // #2807: the stage markers exactly as just read, so a stage marked meanwhile is never overwritten.\n ...stageMarkersAsReadFilter(current),\n },\n { set: { suspension: withActorSuspensionStageMarkersOf(current, next), updatedAt: persistedInstant(new Date().toISOString()) } },\n executionContext,\n this.buildRepositoryOptions(transaction),\n );\n if (moved !== null) {\n this.publishControlPlaneMutation(\n transaction,\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n ownership,\n String(moved._id),\n ResourceAction.UPDATED,\n );\n return true;\n }\n }\n this.logger.warn('A route move kept losing to writes on the same question; it is refused', { executionId });\n return false;\n },\n );\n } finally {\n this.noteExecutionWrite();\n }\n }\n\n /**\n * Record that ONE deadline stage of a waiting actor execution's question FIRED — the compare-and-swap behind the engine\n * port's `markSuspensionDeadlineStage` (#1863 on this plane, #2807). Answers the question as written, or `null` when\n * another writer reached the row first (the stage fired, the question moved, was answered or ended), in which case\n * NOTHING was written.\n *\n * ONE guarded statement: the predicate (this application, `AWAITING_APPROVAL`, the suspension `expected` names, at its\n * route version, with clocks, and with THIS stage's marker still absent) travels in the filter, and the write sets that\n * one marker by its path and stamps `updatedAt`. It never touches the status or the status history, and never the rest\n * of the question: firing a reminder settles nothing. Two sweeps racing on one stage both read it unfired; the first\n * write sets the marker, and the second's filter then matches nothing, so the stage fires once.\n */\n public async markActorExecutionSuspensionDeadlineStage(\n executionId: string,\n expected: ActorExecution_Suspension,\n stage: ReviewDeadlineStage,\n firedAt: Date,\n sessionContext?: CompanionExecutionSessionContext,\n ): Promise<ActorExecution_Suspension | null> {\n this.noteExecutionWrite();\n try {\n return this.resourcePersistenceUnitOfWork.executeTransaction(\n {\n boundary: 'companion-executions.mark-actor-execution-suspension-deadline-stage',\n participants: COMPANION_EXECUTION_PERSISTENCE_PARTICIPANTS,\n },\n async ({ transaction }) => {\n const ownership = await this.resolveOwnership(sessionContext);\n const executionContext = await this.createInternalExecutionContext(\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n CoreResourceOperation.UPDATE,\n sessionContext,\n );\n const marked = await this.repositoriesRegistry.atomicGuardedMutation<Wildo_Application_ActorSystem_Execution>(\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n {\n _id: executionId,\n wildoApplicationId: ownership.wildoApplicationId,\n status: FlowsActors_Status.AWAITING_APPROVAL,\n ...suspensionIdentityFilter(expected),\n // The route the stage was due on: a question moved since (a claim restarts no clock, but it is a new read) is\n // re-read by the next sweep. A suspension written without a version is matched by its identity alone.\n ...(expected.routeVersion !== undefined ? { 'suspension.routeVersion': expected.routeVersion } : {}),\n // A question with clocks: a marker is never written onto one that has none.\n 'suspension.deadlines.decisionDeadlineAt': { $exists: true },\n // The exactly-once guard: this stage not yet fired.\n [stageMarkerPath(stage)]: { $exists: false },\n },\n { set: { [stageMarkerPath(stage)]: firedAt.toISOString(), updatedAt: persistedInstant(new Date().toISOString()) } },\n executionContext,\n this.buildRepositoryOptions(transaction),\n );\n if (marked === null || !marked.suspension) return null;\n this.publishControlPlaneMutation(\n transaction,\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n ownership,\n String(marked._id),\n ResourceAction.UPDATED,\n );\n return marked.suspension;\n },\n );\n } finally {\n this.noteExecutionWrite();\n }\n }\n\n /**\n * One page of this application's actor executions of `systemRef` that wait on a question (#2807): what the companion's\n * question deadline sweep walks. Bounded and ordered by `_id`, starting after `after`, so the sweep pages until a page\n * comes back empty and a row whose clocks keep failing cannot starve the rows behind it. The rows are read raw, as\n * stored: the sweep needs the owning organization and the question exactly as its guarded writes will compare it.\n */\n public async listWaitingActorExecutions(\n systemRef: string,\n after?: string,\n sessionContext?: CompanionExecutionSessionContext,\n ): Promise<Wildo_Application_ActorSystem_Execution[]> {\n const ownership = await this.resolveOwnership(sessionContext);\n const waiting = { wildoApplicationId: ownership.wildoApplicationId, systemRef, status: FlowsActors_Status.AWAITING_APPROVAL };\n return this.repositoriesRegistry.findManyForInfrastructure<Wildo_Application_ActorSystem_Execution>(\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n after === undefined ? waiting : { $and: [waiting, { _id: { $gt: after } }] },\n undefined,\n undefined,\n { sort: [{ field: '_id', order: SortOrder.ASC }], limit: WAITING_ACTOR_EXECUTION_PAGE_LIMIT },\n );\n }\n\n /** One stored actor execution of this application, read raw (as the guarded writes compare it), or `undefined`. */\n private async readStoredActorExecution(executionId: string, wildoApplicationId: string): Promise<Wildo_Application_ActorSystem_Execution | undefined> {\n const [stored] = await this.repositoriesRegistry.findManyForInfrastructure<Wildo_Application_ActorSystem_Execution>(\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n { _id: executionId, wildoApplicationId },\n undefined,\n undefined,\n { sort: [{ field: '_id', order: SortOrder.ASC }], limit: 1 },\n );\n return stored;\n }\n\n /**\n * Clear an execution's owed agent-work record only while it still names `recordRef` — the compare-and-swap behind the\n * engine port's `clearPendingCorrectionRecord` (#1599 review F3, #1922). One guarded statement: the predicate travels\n * in the filter. A marker a later settle replaced names another decision and is left alone; matching nothing is not\n * an error. Announces nothing: it changes no state a watcher shows.\n */\n public async clearActorExecutionPendingCorrectionRecord(\n executionId: string,\n recordRef: string,\n sessionContext?: CompanionExecutionSessionContext,\n ): Promise<void> {\n const ownership = await this.resolveOwnership(sessionContext);\n await this.repositoriesRegistry.atomicConditionalSet(\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n { _id: executionId, wildoApplicationId: ownership.wildoApplicationId, 'pendingCorrectionRecord.recordRef': recordRef },\n { clear: ['pendingCorrectionRecord'] },\n );\n }\n\n /**\n * One page of this application's actor executions that still owe an agent-work record (#1922): what the engine's\n * repair sweep walks. Bounded and ordered by `_id`, starting after `after` (#2189): the sweep pages until a page comes\n * back empty, so rows that keep failing cannot starve the rows behind them.\n */\n public async listActorExecutionsOwingCorrectionRecord(\n sessionContext?: CompanionExecutionSessionContext,\n after?: string,\n ): Promise<Wildo_Application_ActorSystem_Execution[]> {\n const ownership = await this.resolveOwnership(sessionContext);\n const owing = { wildoApplicationId: ownership.wildoApplicationId, 'pendingCorrectionRecord.recordRef': { $ne: null } };\n return this.repositoriesRegistry.findManyForInfrastructure<Wildo_Application_ActorSystem_Execution>(\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n after === undefined ? owing : { $and: [owing, { _id: { $gt: after } }] },\n undefined,\n undefined,\n { sort: [{ field: '_id', order: SortOrder.ASC }], limit: OWED_CORRECTION_RECORD_SCAN_LIMIT },\n );\n }\n\n public async getActorExecution(executionId: string, _sessionContext?: CompanionExecutionSessionContext): Promise<Wildo_Application_ActorSystem_Execution> {\n const traceStep = this.createOperationTraceStep(_sessionContext, \"read-actor-execution\");\n await this.traceOperationStart({\n sessionContext: _sessionContext,\n step: traceStep,\n type: \"actor-execution-read-start\",\n summary: `Read persisted actor execution ${executionId}`,\n payload: { executionId },\n artifactFileName: \"actor-execution-read-request.json\",\n artifactContent: { executionId },\n });\n\n try {\n const ownership = await this.resolveOwnership(_sessionContext);\n const repository = this.repositoriesRegistry.getRepositoryOrThrow(WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE);\n const executionContext = await this.createInternalExecutionContext(\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n CoreResourceOperation.READ,\n _sessionContext,\n );\n const execution = await repository.read<Wildo_Application_ActorSystem_Execution>(executionContext, {\n _id: executionId,\n wildoApplicationId: ownership.wildoApplicationId,\n });\n\n if (!execution) {\n throw this.buildExecutionNotFoundError(FlowsActors_ElementKind.ACTOR,executionId);\n }\n\n if (_sessionContext) {\n await this.traceabilityService.registerAlias(_sessionContext, CompanionTraceAliasKind.ACTOR_EXECUTION,execution._id);\n }\n await this.traceOperationSuccess({\n sessionContext: _sessionContext,\n step: traceStep,\n type: \"actor-execution-read-success\",\n summary: `Read persisted actor execution ${execution._id}`,\n payload: {\n executionId: execution._id,\n status: execution.status,\n },\n artifactFileName: \"actor-execution-read-result.json\",\n artifactContent: execution,\n });\n return execution;\n } catch (error) {\n await this.traceOperationFailure({\n sessionContext: _sessionContext,\n step: traceStep,\n type: \"actor-execution-read-failure\",\n summary: `Failed to read persisted actor execution ${executionId}`,\n error,\n payload: { executionId },\n });\n throw error;\n }\n }\n\n public async getFlowExecution(executionId: string, _sessionContext?: CompanionExecutionSessionContext): Promise<Wildo_Application_FlowSystem_Execution> {\n const traceStep = this.createOperationTraceStep(_sessionContext, \"read-flow-execution\");\n await this.traceOperationStart({\n sessionContext: _sessionContext,\n step: traceStep,\n type: \"flow-execution-read-start\",\n summary: `Read persisted flow execution ${executionId}`,\n payload: { executionId },\n artifactFileName: \"flow-execution-read-request.json\",\n artifactContent: { executionId },\n });\n\n try {\n const ownership = await this.resolveOwnership(_sessionContext);\n const repository = this.repositoriesRegistry.getRepositoryOrThrow(WILDO_APPLICATION_FLOW_SYSTEM_EXECUTIONS_RESOURCE_TYPE);\n const executionContext = await this.createInternalExecutionContext(\n WILDO_APPLICATION_FLOW_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n CoreResourceOperation.READ,\n _sessionContext,\n );\n const execution = await repository.read<Wildo_Application_FlowSystem_Execution>(executionContext, {\n _id: executionId,\n wildoApplicationId: ownership.wildoApplicationId,\n });\n\n if (!execution) {\n throw this.buildExecutionNotFoundError(FlowsActors_ElementKind.FLOW,executionId);\n }\n\n if (_sessionContext) {\n await this.traceabilityService.registerAlias(_sessionContext, CompanionTraceAliasKind.FLOW_EXECUTION,execution._id);\n }\n await this.traceOperationSuccess({\n sessionContext: _sessionContext,\n step: traceStep,\n type: \"flow-execution-read-success\",\n summary: `Read persisted flow execution ${execution._id}`,\n payload: {\n executionId: execution._id,\n status: execution.status,\n },\n artifactFileName: \"flow-execution-read-result.json\",\n artifactContent: execution,\n });\n return execution;\n } catch (error) {\n await this.traceOperationFailure({\n sessionContext: _sessionContext,\n step: traceStep,\n type: \"flow-execution-read-failure\",\n summary: `Failed to read persisted flow execution ${executionId}`,\n error,\n payload: { executionId },\n });\n throw error;\n }\n }\n\n public async listActorExecutions(\n query: CompanionExecutionsListQuery,\n _sessionContext?: CompanionExecutionSessionContext,\n /**\n * Stored fields the rows leave out. Defaults to {@link ACTOR_EXECUTION_LISTING_OMITTED_FIELDS}; pass `[]` for whole rows.\n */\n readOptions: { readonly omitStoredFields?: readonly string[] } = {},\n ): Promise<Wildo_Application_ActorSystem_Execution[]> {\n const traceStep = this.createOperationTraceStep(_sessionContext, \"list-actor-executions\");\n await this.traceOperationStart({\n sessionContext: _sessionContext,\n step: traceStep,\n type: \"actor-executions-list-start\",\n summary: \"List persisted actor executions\",\n payload: query,\n artifactFileName: \"actor-executions-list-request.json\",\n artifactContent: query,\n });\n\n try {\n const executions = await this.listExecutions<Wildo_Application_ActorSystem_Execution>(\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n query,\n _sessionContext,\n readOptions.omitStoredFields ?? ACTOR_EXECUTION_LISTING_OMITTED_FIELDS,\n );\n await this.traceOperationSuccess({\n sessionContext: _sessionContext,\n step: traceStep,\n type: \"actor-executions-list-success\",\n summary: `Listed ${executions.length} persisted actor executions`,\n payload: {\n count: executions.length,\n status: query.status ?? null,\n systemRef: query.systemRef ?? null,\n limit: query.limit,\n },\n artifactFileName: \"actor-executions-list-result.json\",\n artifactContent: summarizeListedRowsForTrace(executions),\n });\n return executions;\n } catch (error) {\n await this.traceOperationFailure({\n sessionContext: _sessionContext,\n step: traceStep,\n type: \"actor-executions-list-failure\",\n summary: \"Failed to list persisted actor executions\",\n error,\n payload: query,\n });\n throw error;\n }\n }\n\n public async listFlowExecutions(\n query: CompanionExecutionsListQuery,\n _sessionContext?: CompanionExecutionSessionContext,\n ): Promise<Wildo_Application_FlowSystem_Execution[]> {\n const traceStep = this.createOperationTraceStep(_sessionContext, \"list-flow-executions\");\n await this.traceOperationStart({\n sessionContext: _sessionContext,\n step: traceStep,\n type: \"flow-executions-list-start\",\n summary: \"List persisted flow executions\",\n payload: query,\n artifactFileName: \"flow-executions-list-request.json\",\n artifactContent: query,\n });\n\n try {\n const executions = await this.listExecutions<Wildo_Application_FlowSystem_Execution>(\n WILDO_APPLICATION_FLOW_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n query,\n _sessionContext,\n );\n await this.traceOperationSuccess({\n sessionContext: _sessionContext,\n step: traceStep,\n type: \"flow-executions-list-success\",\n summary: `Listed ${executions.length} persisted flow executions`,\n payload: {\n count: executions.length,\n status: query.status ?? null,\n systemRef: query.systemRef ?? null,\n limit: query.limit,\n },\n artifactFileName: \"flow-executions-list-result.json\",\n artifactContent: summarizeListedRowsForTrace(executions),\n });\n return executions;\n } catch (error) {\n await this.traceOperationFailure({\n sessionContext: _sessionContext,\n step: traceStep,\n type: \"flow-executions-list-failure\",\n summary: \"Failed to list persisted flow executions\",\n error,\n payload: query,\n });\n throw error;\n }\n }\n\n public async createActorTask(\n payload: CompanionCreateActorTaskRequest,\n sessionContext?: CompanionExecutionSessionContext,\n ): Promise<Wildo_Application_Actor_Task> {\n this.noteExecutionWrite();\n try {\n const traceStep = this.createOperationTraceStep(sessionContext, \"create-actor-task\");\n await this.traceOperationStart({\n sessionContext,\n step: traceStep,\n type: \"actor-task-create-start\",\n summary: \"Create persisted actor task\",\n payload: {\n actorRef: payload.actors.actorRef,\n status: payload.status,\n executionId: payload.wildoApplicationActorSystemExecutionId ?? null,\n },\n artifactFileName: \"actor-task-create-request.json\",\n artifactContent: payload,\n });\n\n try {\n const task = await this.resourcePersistenceUnitOfWork.executeTransaction(\n {\n boundary: 'companion-executions.create-actor-task',\n participants: COMPANION_EXECUTION_PERSISTENCE_PARTICIPANTS,\n },\n async ({ transaction }) => {\n const ownership = await this.resolveOwnership(sessionContext);\n if (payload.wildoApplicationActorSystemExecutionId) {\n await this.readActorExecutionOrThrow(payload.wildoApplicationActorSystemExecutionId, ownership.wildoApplicationId, transaction, sessionContext);\n }\n const repository = this.repositoriesRegistry.getRepositoryOrThrow(WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE);\n const executionContext = await this.createInternalExecutionContext(\n WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE,\n CoreResourceOperation.CREATE,\n sessionContext,\n );\n const normalizedPayload = this.normalizeTaskCreatePayload(payload);\n const createData = {\n ...normalizedPayload,\n organizationId: ownership.organizationId,\n wildoApplicationId: ownership.wildoApplicationId,\n ...(payload.wildoApplicationActorSystemExecutionId ? { wildoApplicationActorSystemExecutionId: payload.wildoApplicationActorSystemExecutionId } : {}),\n };\n const createdTask = await repository.create<Wildo_Application_Actor_Task>(executionContext, createData, {\n ...this.buildRepositoryOptions(transaction),\n preserveServerInjectedFields: this.deriveServerInjectedPreserveFields(\n WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE,\n createData,\n CoreResourceOperation.CREATE,\n ),\n });\n\n await this.syncTaskIntoExecutionSnapshot(createdTask, transaction, sessionContext);\n this.publishControlPlaneMutation(\n transaction,\n WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE,\n ownership,\n String(createdTask._id),\n ResourceAction.CREATED,\n );\n return createdTask;\n },\n );\n\n if (sessionContext) {\n await this.traceabilityService.registerAlias(sessionContext, CompanionTraceAliasKind.ACTOR_TASK,task._id);\n }\n\n await this.traceOperationSuccess({\n sessionContext,\n step: traceStep,\n type: \"actor-task-create-success\",\n summary: `Created persisted actor task ${task._id}`,\n payload: {\n taskId: task._id,\n status: task.status,\n executionId: task.wildoApplicationActorSystemExecutionId ?? null,\n },\n artifactFileName: \"actor-task-create-result.json\",\n artifactContent: task,\n });\n return task;\n } catch (error) {\n await this.traceOperationFailure({\n sessionContext,\n step: traceStep,\n type: \"actor-task-create-failure\",\n summary: \"Failed to create persisted actor task\",\n error,\n payload: {\n actorRef: payload.actors.actorRef,\n status: payload.status,\n executionId: payload.wildoApplicationActorSystemExecutionId ?? null,\n },\n });\n throw error;\n }\n } finally {\n this.noteExecutionWrite();\n }\n }\n\n public async getActorTask(taskId: string, _sessionContext?: CompanionExecutionSessionContext): Promise<Wildo_Application_Actor_Task> {\n const traceStep = this.createOperationTraceStep(_sessionContext, \"read-actor-task\");\n await this.traceOperationStart({\n sessionContext: _sessionContext,\n step: traceStep,\n type: \"actor-task-read-start\",\n summary: `Read persisted actor task ${taskId}`,\n payload: { taskId },\n artifactFileName: \"actor-task-read-request.json\",\n artifactContent: { taskId },\n });\n\n try {\n const task = await this.readActorTaskOrThrow(taskId, undefined, _sessionContext);\n if (_sessionContext) {\n await this.traceabilityService.registerAlias(_sessionContext, CompanionTraceAliasKind.ACTOR_TASK,task._id);\n }\n await this.traceOperationSuccess({\n sessionContext: _sessionContext,\n step: traceStep,\n type: \"actor-task-read-success\",\n summary: `Read persisted actor task ${task._id}`,\n payload: {\n taskId: task._id,\n status: task.status,\n executionId: task.wildoApplicationActorSystemExecutionId ?? null,\n },\n artifactFileName: \"actor-task-read-result.json\",\n artifactContent: task,\n });\n return task;\n } catch (error) {\n await this.traceOperationFailure({\n sessionContext: _sessionContext,\n step: traceStep,\n type: \"actor-task-read-failure\",\n summary: `Failed to read persisted actor task ${taskId}`,\n error,\n payload: { taskId },\n });\n throw error;\n }\n }\n\n /**\n * The task rows of ONE build task's runs in one status, newest first, read from the database by `input.taskRef` (#3204).\n *\n * The selection's shared reads ({@link listActorTasks}) hold the 200 most recently updated rows of a status, so a task\n * whose last run is older than that reads as never having run. On reference run 42845651222, with 782 completed coding\n * runs, a follow-up whose only completed run had 204 newer ones behind it un-landed and was dispatched again, and every\n * task that ran early drifts out the same way. This read answers for one task whatever its age: a raw, bounded filter on\n * the nested ref, which both adapters compile (as {@link listActorExecutionsOwingCorrectionRecord} does for its own).\n * `omitStoredFields` leaves the transcripts out, as the shared listing does: a task's rows are re-read whenever a run's\n * memory is written.\n */\n public async listActorTasksOfBuildTask(\n status: FlowsActors_Status,\n buildTaskRef: string,\n sessionContext?: CompanionExecutionSessionContext,\n readOptions: { readonly omitStoredFields?: readonly string[] } = {},\n ): Promise<Wildo_Application_Actor_Task[]> {\n const ownership = await this.resolveOwnership(sessionContext);\n return this.repositoriesRegistry.findManyForInfrastructure<Wildo_Application_Actor_Task>(\n WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE,\n { wildoApplicationId: ownership.wildoApplicationId, status, 'input.taskRef': buildTaskRef },\n undefined,\n readOptions.omitStoredFields ? { omitStoredFields: readOptions.omitStoredFields } : undefined,\n { sort: [{ field: 'updatedAt', order: SortOrder.DESC }], limit: BUILD_TASK_RUN_ROWS_LIMIT },\n );\n }\n\n public async listActorTasks(\n query: CompanionActorTasksListQuery,\n _sessionContext?: CompanionExecutionSessionContext,\n /**\n * Stored fields the rows leave out (#3204, `RepositoryOptions.omitStoredFields`): an internal reader that never reads\n * a coding run's transcript passes {@link ACTOR_TASK_OUTPUT_FIELDS_HELD_ON_THE_TASK_ROW_ONLY}, as `output.<field>`.\n */\n readOptions: { readonly omitStoredFields?: readonly string[] } = {},\n ): Promise<Wildo_Application_Actor_Task[]> {\n const traceStep = this.createOperationTraceStep(_sessionContext, \"list-actor-tasks\");\n await this.traceOperationStart({\n sessionContext: _sessionContext,\n step: traceStep,\n type: \"actor-tasks-list-start\",\n summary: \"List persisted actor tasks\",\n payload: query,\n artifactFileName: \"actor-tasks-list-request.json\",\n artifactContent: query,\n });\n\n try {\n const ownership = await this.resolveOwnership(_sessionContext);\n const repository = this.repositoriesRegistry.getRepositoryOrThrow(WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE);\n const executionContext = await this.createInternalExecutionContext(\n WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE,\n CoreResourceOperation.LIST,\n _sessionContext,\n );\n /*\n * The newest rows, a page at a time, until `limit` of the caller's lane are held (#2484). This read every\n * task row the application ever had, and a task row carries a coding run's whole transcript (0.4–1.2 MB),\n * so each listing and each dispatch census loaded every transcript ever produced. The lane filter stays\n * in memory, for the reason `selectListedActorTasks` gives; pages arrive newest first, so once `limit`\n * rows of the lane are held, no later page can hold a newer one.\n */\n const filter = {\n wildoApplicationId: ownership.wildoApplicationId,\n ...(query.executionId ? { wildoApplicationActorSystemExecutionId: query.executionId } : {}),\n ...(query.status ? { status: query.status } : {}),\n };\n const tasks = await readNewestRowsByPage<Wildo_Application_Actor_Task>(\n async (listOptions) => (await repository.list<Wildo_Application_Actor_Task>(executionContext, filter, {\n paginated: true,\n listOptions,\n ...(readOptions.omitStoredFields !== undefined ? { omitStoredFields: readOptions.omitStoredFields } : {}),\n })).data,\n (rows) => selectListedActorTasks(rows, query).length >= query.limit,\n );\n\n const trimmedTasks = selectListedActorTasks(tasks, query);\n await this.traceOperationSuccess({\n sessionContext: _sessionContext,\n step: traceStep,\n type: \"actor-tasks-list-success\",\n summary: `Listed ${trimmedTasks.length} persisted actor tasks`,\n payload: {\n count: trimmedTasks.length,\n executionId: query.executionId ?? null,\n status: query.status ?? null,\n limit: query.limit,\n },\n artifactFileName: \"actor-tasks-list-result.json\",\n artifactContent: summarizeListedRowsForTrace(trimmedTasks),\n });\n return trimmedTasks;\n } catch (error) {\n await this.traceOperationFailure({\n sessionContext: _sessionContext,\n step: traceStep,\n type: \"actor-tasks-list-failure\",\n summary: \"Failed to list persisted actor tasks\",\n error,\n payload: query,\n });\n throw error;\n }\n }\n\n public async updateActorTask(\n taskId: string,\n payload: CompanionUpdateActorTaskRequest,\n sessionContext?: CompanionExecutionSessionContext,\n ): Promise<Wildo_Application_Actor_Task> {\n this.noteExecutionWrite();\n try {\n const traceStep = this.createOperationTraceStep(sessionContext, \"update-actor-task\");\n await this.traceOperationStart({\n sessionContext,\n step: traceStep,\n type: \"actor-task-update-start\",\n summary: `Update persisted actor task ${taskId}`,\n payload: {\n taskId,\n status: payload.status ?? null,\n executionId: payload.wildoApplicationActorSystemExecutionId ?? null,\n clearExecutionLink: payload.clearExecutionLink === true,\n },\n artifactFileName: \"actor-task-update-request.json\",\n artifactContent: {\n taskId,\n payload,\n },\n });\n\n try {\n const task = await this.resourcePersistenceUnitOfWork.executeTransaction(\n {\n boundary: 'companion-executions.update-actor-task',\n participants: COMPANION_EXECUTION_PERSISTENCE_PARTICIPANTS,\n },\n async ({ transaction }) => {\n const ownership = await this.resolveOwnership(sessionContext);\n /*\n * A write that names NO status still writes one — the one it read — because the row is written\n * whole. Read, then written unconditionally, that re-asserted a stale status: a memory note\n * landing just after a concurrent cancel put the task back to waiting and cleared its completion\n * instant (#1586 review F6). So such a write is conditional on the status it read, and a lost\n * race reads again and re-applies the payload to what is there now. A write that NAMES a status\n * is a move and stays unconditional: moves out of waiting are the execution's swap (#1586).\n */\n for (let attempt = 1; ; attempt += 1) {\n const existingTask = await this.readActorTaskOrThrow(taskId, transaction, sessionContext);\n if (\n payload.wildoApplicationActorSystemExecutionId &&\n payload.wildoApplicationActorSystemExecutionId !== existingTask.wildoApplicationActorSystemExecutionId\n ) {\n await this.readActorExecutionOrThrow(payload.wildoApplicationActorSystemExecutionId, ownership.wildoApplicationId, transaction, sessionContext);\n }\n const repository = this.repositoriesRegistry.getRepositoryOrThrow(WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE);\n const executionContext = await this.createInternalExecutionContext(\n WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE,\n CoreResourceOperation.UPDATE,\n sessionContext,\n );\n const updatedAt = payload.updatedAt ?? new Date().toISOString();\n const status = payload.status ?? existingTask.status;\n const shouldClearExecutionLink = payload.clearExecutionLink === true;\n const { clearExecutionLink: _clearExecutionLink, completedAt: payloadCompletedAt, ...payloadWithoutClearFlag } = payload;\n const shouldClearCompletedAt = !this.isTerminalStatus(status);\n const completedAt = shouldClearCompletedAt ? undefined : (payloadCompletedAt ?? existingTask.completedAt ?? updatedAt);\n const actorStates = payload.actorStates ?? existingTask.actorStates;\n\n const updateData = {\n ...payloadWithoutClearFlag,\n ...(payloadWithoutClearFlag.startedAt !== undefined ? { startedAt: persistedInstant(payloadWithoutClearFlag.startedAt) } : {}),\n actorStates,\n status,\n updatedAt: persistedInstant(updatedAt),\n // The existing row's instant is already a date; a request's is an ISO string.\n ...(completedAt ? { completedAt: completedAt instanceof Date ? completedAt : persistedInstant(completedAt) } : {}),\n };\n\n const statusGuard = payload.status === undefined ? { status: existingTask.status } : {};\n const written = await repository.update<Wildo_Application_Actor_Task>(executionContext, { _id: taskId, wildoApplicationId: ownership.wildoApplicationId, ...statusGuard }, updateData, {\n ...this.buildRepositoryOptions(transaction),\n // Derived allowlist (typically empty on UPDATE): the only fields the\n // update request DTO strips are the scope/audit FKs, and those are\n // never in this payload (`wildoApplicationId` is in the filter, not\n // the data). A re-linked `wildoApplicationActorSystemExecutionId` is\n // an ordinary relationship FK the DTO keeps, so it is not stripped.\n preserveServerInjectedFields: this.deriveServerInjectedPreserveFields(\n WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE,\n updateData,\n CoreResourceOperation.UPDATE,\n ),\n });\n if (written === null) {\n if (payload.status === undefined && attempt < TASK_STATUS_GUARD_ATTEMPTS) continue;\n // A row removed under the write answers the typed NOT_FOUND the read raises, as it always did (review N3)…\n await this.readActorTaskOrThrow(taskId, transaction, sessionContext);\n // …and one that is there but kept moving is a conflict, not a server fault.\n throw this.errorBuilder.buildError(ErrorType.CONFLICT, undefined, {\n customMessageReference: ErrorCustomMessageReference.CONFLICT,\n context: {\n // diagnostic (log-only)\n taskId,\n reason: payload.status === undefined\n ? `its status kept moving across ${TASK_STATUS_GUARD_ATTEMPTS} attempts`\n : 'the update matched no row under this application',\n },\n });\n }\n\n if (shouldClearExecutionLink || shouldClearCompletedAt) {\n await this.unsetActorTaskFields(\n taskId,\n ownership.wildoApplicationId,\n {\n ...(shouldClearExecutionLink ? { wildoApplicationActorSystemExecutionId: 1 } : {}),\n ...(shouldClearCompletedAt ? { completedAt: 1 } : {}),\n },\n transaction,\n );\n }\n\n const updatedTask = await this.readActorTaskOrThrow(taskId, transaction, sessionContext);\n\n if (\n existingTask.wildoApplicationActorSystemExecutionId &&\n existingTask.wildoApplicationActorSystemExecutionId !== updatedTask.wildoApplicationActorSystemExecutionId\n ) {\n await this.removeTaskFromExecutionSnapshot(existingTask, transaction, sessionContext);\n }\n\n await this.syncTaskIntoExecutionSnapshot(updatedTask, transaction, sessionContext);\n this.publishControlPlaneMutation(\n transaction,\n WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE,\n ownership,\n String(updatedTask._id),\n ResourceAction.UPDATED,\n );\n return updatedTask;\n }\n },\n );\n\n if (sessionContext) {\n await this.traceabilityService.registerAlias(sessionContext, CompanionTraceAliasKind.ACTOR_TASK,task._id);\n }\n\n await this.traceOperationSuccess({\n sessionContext,\n step: traceStep,\n type: \"actor-task-update-success\",\n summary: `Updated persisted actor task ${task._id}`,\n payload: {\n taskId: task._id,\n status: task.status,\n executionId: task.wildoApplicationActorSystemExecutionId ?? null,\n },\n artifactFileName: \"actor-task-update-result.json\",\n artifactContent: task,\n });\n return task;\n } catch (error) {\n await this.traceOperationFailure({\n sessionContext,\n step: traceStep,\n type: \"actor-task-update-failure\",\n summary: `Failed to update persisted actor task ${taskId}`,\n error,\n payload: {\n taskId,\n status: payload.status ?? null,\n executionId: payload.wildoApplicationActorSystemExecutionId ?? null,\n clearExecutionLink: payload.clearExecutionLink === true,\n },\n });\n throw error;\n }\n } finally {\n this.noteExecutionWrite();\n }\n }\n\n /**\n * Companion executions live in the shared apps-manager DB, but every local\n * companion instance is still attached to exactly one Wildo application row.\n * Resolving and memoizing that ownership keeps all repository calls scoped to\n * the truthful platform parent instead of falling back to tenant-app semantics.\n */\n /**\n * Announce a control-plane row the companion wrote REPOSITORY-DIRECT (issue #286).\n *\n * ## Why these writes were silent\n *\n * The engine emits `RESOURCE_UPDATED` from its resource CONTROLLERS, after the operation commits.\n * These rows never pass through one: the companion writes them straight to the repository inside\n * its own transaction, which is deliberate (they are control-plane records, and their CREATE and\n * UPDATE variants are `REPOSITORY_ONLY` precisely so no generated write API exists). The cost was\n * that nothing ever announced them: a board watching actor tasks or executions learned about a\n * new row only from a 30-second poll, and a SECOND browser learned nothing at all, because the\n * only invalidation was one the dispatching page emitted to itself.\n *\n * ## The ORGANIZATION room, and why not the application room\n *\n * These resources declare `isPrimaryScope: true` on their ORGANIZATIONS relationship, so a row\n * belongs to one tenant. Broadcasting to the application room — which the sibling introspection\n * notifier legitimately uses, because every resource IT serves is APPLICATION-anchored — would\n * carry one tenant's row ids to every user of the application. The room is keyed on the row's own\n * `organizationId`, which the ownership resolution has already established for the write itself.\n *\n * ## Notification-grade, and after COMMIT\n *\n * Registered as a post-commit effect: announcing a row inside the transaction would advertise a\n * write that can still roll back. The payload carries no `currentObject` — a scope room fans out\n * to every member, and these rows carry coding-agent input and output that a collection event has\n * no business broadcasting. Subscribers learn WHAT moved and refetch through their own\n * authorization, which is the same contract the introspection notifier's collection lane uses.\n *\n * Failure is swallowed by design: an announcement that could fail a committed write would make a\n * notification defect look like a persistence defect.\n */\n private publishControlPlaneMutation(\n /** `null` for a write that was not wrapped in a transaction — it is already committed. */\n transaction: unknown | null,\n resourceType: string,\n ownership: CompanionExecutionOwnership,\n resourceId: string,\n action: ResourceAction,\n ): void {\n if (!resourceId) return;\n const announce = async (): Promise<void> => {\n {\n try {\n const notification = buildControlPlaneMutationNotification(resourceType, ownership, resourceId, action);\n this.websocketService.emitToScopeRooms(\n notification.resourceType,\n notification.rooms,\n notification.event,\n buildScopeRoomNotificationPayload(notification.payload),\n );\n } catch (error) {\n this.logger.warn?.(\n `[CompanionExecutions] Could not announce ${resourceType} ${resourceId}: `\n + `${describeCaughtError(error)}`,\n );\n }\n }\n };\n if (transaction === null) {\n void announce();\n return;\n }\n registerTransactionPostCommitEffect(transaction as never, {\n key: `control-plane-notify:${resourceType}:${resourceId}:${action}`,\n execute: announce,\n });\n }\n\n private async resolveOwnership(sessionContext?: CompanionExecutionSessionContext): Promise<CompanionExecutionOwnership> {\n if (!this.ownershipPromise) {\n const ownershipPromise = this.loadOwnership(sessionContext).catch((error) => {\n if (this.ownershipPromise === ownershipPromise) {\n this.ownershipPromise = undefined;\n }\n\n throw error;\n });\n this.ownershipPromise = ownershipPromise;\n }\n\n return this.ownershipPromise;\n }\n\n private async loadOwnership(sessionContext?: CompanionExecutionSessionContext): Promise<CompanionExecutionOwnership> {\n const traceStep = sessionContext\n ? this.traceabilityService.createStep(sessionContext, {\n kind: \"execution-ownership\",\n label: \"resolve-companion-execution-ownership\",\n })\n : undefined;\n\n await this.traceOperationStart({\n sessionContext,\n step: traceStep,\n type: \"execution-ownership-resolution-start\",\n summary: \"Resolve companion execution ownership\",\n payload: {\n appSlug: this.companionContext.saasConfig.slug,\n },\n artifactFileName: \"execution-ownership-resolution-request.json\",\n artifactContent: {\n appSlug: this.companionContext.saasConfig.slug,\n },\n });\n\n try {\n const repository = this.repositoriesRegistry.getRepositoryOrThrow(CustomShared_ResourceType.WILDO_APPLICATION);\n const executionContext = await this.createInternalExecutionContext(\n CustomShared_ResourceType.WILDO_APPLICATION,\n CoreResourceOperation.READ,\n sessionContext,\n );\n const wildoApplication = await repository.read<Wildo_Application>(executionContext, {\n appSlug: this.companionContext.saasConfig.slug,\n });\n\n if (!wildoApplication) {\n throw this.errorBuilder.buildError(ErrorType.NOT_FOUND, undefined, {\n customMessageReference: ErrorCustomMessageReference.NOT_FOUND,\n context: {\n message: \"Companion app is not registered in the platform Wildo applications collection.\",\n appSlug: this.companionContext.saasConfig.slug,\n },\n });\n }\n\n this.logDebug(\"Resolved companion execution ownership\", {\n appSlug: this.companionContext.saasConfig.slug,\n organizationId: wildoApplication.organizationId,\n wildoApplicationId: wildoApplication._id,\n });\n\n const ownership = {\n organizationId: wildoApplication.organizationId,\n wildoApplicationId: wildoApplication._id,\n };\n\n await this.traceOperationSuccess({\n sessionContext,\n step: traceStep,\n type: \"execution-ownership-resolution-success\",\n summary: `Resolved companion execution ownership for ${this.companionContext.saasConfig.slug}`,\n payload: ownership,\n artifactFileName: \"execution-ownership-resolution-result.json\",\n artifactContent: {\n appSlug: this.companionContext.saasConfig.slug,\n ...ownership,\n },\n });\n\n return ownership;\n } catch (error) {\n await this.traceOperationFailure({\n sessionContext,\n step: traceStep,\n type: \"execution-ownership-resolution-failure\",\n summary: \"Failed to resolve companion execution ownership\",\n error,\n payload: {\n appSlug: this.companionContext.saasConfig.slug,\n },\n });\n throw error;\n }\n }\n\n /**\n * Builds an unattributed internal execution context for the companion's\n * control-plane reads/writes through the engine's REPOSITORY_ONLY-safe seam.\n * `createForInternalRepositoryOperation` resolves the operation path with a\n * repository-preferred (URL-fallback) resolver — the previous hand-rolled\n * `getOperationPathDefault → createForInternalOperation` pair used the\n * URL-only resolver and threw `RESOURCES_REGISTRY_OPERATION_PATH_NOT_FOUND`\n * for REPOSITORY_ONLY-only resources (migrated 2026-07-02, meta-workflows\n * Step 0 / P-12; the engine seam's JSDoc names this exact pattern).\n */\n /**\n * The `contextResourcesFieldIdentifier` map stays EMPTY on purpose. It\n * looks like the natural channel for the ownership FKs, but the engine's\n * context-map enrichment injects into EVERY schema path ending with the\n * field identifier — including `errorStates.errorItems[].initiatorIds.\n * organizationId` inside the embedded `WildoError_BackendSchema` — and\n * `setNestedValue` then fabricates a phantom error item that fails\n * Mongoose validation (observed live, 2026-07-03). The scope FK the strict\n * request-DTO parse strips (`organizationId`) is instead re-attached via\n * `RepositoryOptions.preserveServerInjectedFields`, derived per write by\n * {@link deriveServerInjectedPreserveFields}.\n */\n private async createInternalExecutionContext(\n resourceType: ResourceType,\n operationIdentifier: CoreResourceOperation,\n sessionContext?: CompanionExecutionSessionContext,\n ): Promise<ExecutionContext<any>> {\n const executionContext = await this.executionContextCreator.createForInternalRepositoryOperation({\n resourceType,\n operationIdentifier,\n contextResourcesFieldIdentifier: new Map(),\n initiatorIds: null,\n initiatorRoles: [],\n relationshipContexts: [],\n });\n if (sessionContext) {\n await this.traceInternalExecutionContext(sessionContext, executionContext, resourceType, operationIdentifier);\n }\n return executionContext;\n }\n\n /**\n * The row type is pinned through the repository handle's `TMainSchema`, NOT\n * through `list<T>` — and the difference is not cosmetic.\n *\n * `BackendResourceRepository.list<T>` returns\n * `ConditionalArrayReturnType<T, TMainSchema>`, i.e.\n * `T extends undefined ? z.infer<TMainSchema>[] : T[]`. That conditional can\n * only be evaluated when `T` is a CONCRETE type. Here `TExecution` is an\n * uninstantiated type parameter of this relay, so TypeScript defers the\n * conditional and falls back to its constraint — `unknown[]` — which is then\n * not assignable to `TExecution[]`. The sibling call sites in this file\n * (`list<Wildo_Application_Actor_Task>`) pass a concrete type, resolve the\n * false branch immediately, and are unaffected; this is the only generic\n * relay over a repository read in the companion.\n *\n * So the row shape is declared where the contract expects it: on the\n * repository handle. `list()` then takes its default `T = undefined`, the\n * conditional resolves eagerly to `z.infer<z.ZodType<TExecution>>[]` =\n * `TExecution[]`, and the value flows through with no cast.\n *\n * Rejected: `as unknown as TExecution[]` at the return. The correlation\n * between `resourceType` and `TExecution` is asserted by the caller either\n * way, but a value-level cast puts that assertion where nothing can see it,\n * and it would keep `left`/`right` typed `unknown` inside the comparator —\n * re-breaking the moment the sort key changes.\n */\n /**\n * Moved when a write to the execution or task rows starts AND when it ends (#3204): a shared execution listing\n * ({@link listExecutions}) is reused only under the generation its read started at, so a listing that overlapped a\n * write is never served after it. Every write door of this service calls it; it also drops the held listings.\n */\n // Both lazily initialised: a harness may build this service without running its field initialisers.\n private executionWriteGeneration?: number;\n private executionListings?: Map<string, { readonly generation: number; readonly heldUntilMs: number; readonly rows: Promise<readonly unknown[]> }>;\n\n private noteExecutionWrite(): void {\n this.executionWriteGeneration = (this.executionWriteGeneration ?? 0) + 1;\n this.executionListings?.clear();\n }\n\n /**\n * One execution listing per query, shared by every caller asking until a write moves the rows (#3204).\n *\n * During a build wave the companion lists the same executions from some twenty-five call sites (the selection's landing\n * pass, the in-flight census, the build records, the run report, the playbook lane…). On reference run 42845651222 that\n * was 150 listings and 318 MB read from MongoDB in 30 seconds, after coding transcripts had already left the rows, with\n * garbage collection at 15% and the event loop saturated. The rows change only through this service's write doors, which\n * move {@link executionWriteGeneration} as they start and as they end, so a listing is reused only while nothing was\n * written since its read began. A few seconds' ceiling bounds anything this service did not write. Each caller gets its\n * own array; the rows themselves are shared, read-only by contract.\n */\n private async listExecutions<TExecution extends { updatedAt: Date }>(\n resourceType: typeof WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE | typeof WILDO_APPLICATION_FLOW_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n query: CompanionExecutionsListQuery,\n sessionContext?: CompanionExecutionSessionContext,\n omitStoredFields: readonly string[] = [],\n ): Promise<TExecution[]> {\n // A listing that left fields out is not the one a whole-row caller asked for, so the omission is part of the key.\n const key = `${resourceType}:${JSON.stringify(query)}:${JSON.stringify(omitStoredFields)}`;\n const generation = this.executionWriteGeneration ?? 0;\n const listings = (this.executionListings ??= new Map());\n const held = listings.get(key);\n if (held !== undefined && held.generation === generation && Date.now() < held.heldUntilMs) return [...(await held.rows)] as TExecution[];\n const rows = this.readExecutionListing<TExecution>(resourceType, query, sessionContext, omitStoredFields);\n listings.set(key, { generation, heldUntilMs: Date.now() + EXECUTION_LISTING_HOLD_MS, rows });\n // A failed read is held by nobody.\n rows.catch(() => {\n if (this.executionListings?.get(key)?.rows === rows) this.executionListings.delete(key);\n });\n return [...(await rows)];\n }\n\n private async readExecutionListing<TExecution extends { updatedAt: Date }>(\n resourceType: typeof WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE | typeof WILDO_APPLICATION_FLOW_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n query: CompanionExecutionsListQuery,\n sessionContext?: CompanionExecutionSessionContext,\n omitStoredFields: readonly string[] = [],\n ): Promise<TExecution[]> {\n const ownership = await this.resolveOwnership(sessionContext);\n const repository = this.repositoriesRegistry.getRepositoryOrThrow<undefined, undefined, z.ZodType<TExecution>>(resourceType);\n const executionContext = await this.createInternalExecutionContext(resourceType, CoreResourceOperation.LIST, sessionContext);\n const filter = {\n wildoApplicationId: ownership.wildoApplicationId,\n ...(query.systemRef ? { systemRef: query.systemRef } : {}),\n ...(query.status ? { status: query.status } : {}),\n // The window bounds (#3266): adapter-neutral comparisons on two date columns, which both repositories compile.\n ...(query.createdBefore ? { createdAt: { $lt: new Date(query.createdBefore) } } : {}),\n ...(query.finishedAfter ? { finishedAt: { $gt: new Date(query.finishedAfter) } } : {}),\n };\n\n // The newest `query.limit` rows, read newest-first FROM THE DATABASE, page by page (#2186): see `readNewestRowsByPage`.\n const listed = (await readNewestRowsByPage<TExecution>(\n async (listOptions) => (await repository.list(executionContext, filter, {\n paginated: true,\n listOptions,\n ...(omitStoredFields.length > 0 ? { omitStoredFields } : {}),\n })).data,\n (rows) => rows.length >= query.limit,\n ))\n .sort(newestUpdatedFirst)\n .slice(0, query.limit);\n const projected = listed.map(toExecutionWithTaskSnapshot);\n /*\n * The compaction writes each projected `standaloneTasks` back WHOLE, so it runs only on rows read whole: written back\n * from a row that left a field out, it would delete that field from the stored row. A whole-row listing (the HTTP one)\n * still compacts.\n */\n if (omitStoredFields.length === 0) await this.compactStoredTaskSnapshots(resourceType, ownership.wildoApplicationId, listed, projected);\n return projected;\n }\n\n /**\n * Rewrite, once, the stored task snapshot of each listed row written before the snapshot stopped\n * carrying coding transcripts (2026-10-01, `execution-task-snapshot.models.ts`).\n *\n * Projecting the listing alone was not enough: a FINISHED execution is never re-synced, so its row kept\n * the transcript for good, every listing kept loading it from the database (34 MB per `GET /build/tasks`\n * on scratch-journey), and the workbench, which reads executions through the generic resource LIST/READ\n * rather than through here, kept receiving it. The rewrite is what makes the snapshot light everywhere.\n * It lives here rather than in a migration because the companion is delivered to every application,\n * and each one holds rows of its own.\n *\n * One guarded statement per row, matched on the `updatedAt` this listing read: a row that moved since\n * is skipped, so the rewrite can never put back an older snapshot over a newer one — the newer write\n * went through `updateActorExecutionTaskSnapshot` and is already projected. `updatedAt` is kept\n * (`preserveUpdatedAt`; without it both database arms stamp the rewrite — MongoDB through mongoose's\n * timestamps hook, PostgreSQL explicitly for parity — and the first live run of this, on PostgreSQL,\n * moved a 25 September run to the top of every newest-first listing): nothing a reader acts on\n * changed, and the task row still holds the transcript. Best-effort: a failure\n * leaves the row as it was, the listing already answers in snapshot form, and the next listing retries.\n */\n private async compactStoredTaskSnapshots(\n resourceType: typeof WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE | typeof WILDO_APPLICATION_FLOW_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n wildoApplicationId: string,\n stored: readonly { _id?: unknown; updatedAt: Date }[],\n projected: readonly unknown[],\n ): Promise<void> {\n for (let index = 0; index < stored.length; index += 1) {\n const row = stored[index]!;\n const snapshot = projected[index] as { standaloneTasks?: unknown };\n if (snapshot === row) continue;\n try {\n await this.repositoriesRegistry.atomicGuardedMutation(\n resourceType,\n { _id: row._id, wildoApplicationId, updatedAt: row.updatedAt },\n { set: { standaloneTasks: snapshot.standaloneTasks } },\n undefined,\n { preserveUpdatedAt: true },\n );\n } catch (error) {\n this.logger.warn?.(\n `[CompanionExecutions] Could not compact the task snapshot of ${resourceType} ${String(row._id)}: `\n + `${describeCaughtError(error)}`,\n );\n }\n }\n }\n\n private async persistExecutionTasks(\n ownership: CompanionExecutionOwnership,\n executionId: string,\n tasks: CompanionCreateActorExecutionRequest[\"standaloneTasks\"],\n standaloneTaskStates: CompanionCreateActorExecutionRequest[\"standaloneTaskStates\"],\n transaction?: TransactionContext,\n sessionContext?: CompanionExecutionSessionContext,\n ): Promise<PersistedExecutionTask[]> {\n this.noteExecutionWrite();\n try {\n const repository = this.repositoriesRegistry.getRepositoryOrThrow(WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE);\n const executionContext = await this.createInternalExecutionContext(\n WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE,\n CoreResourceOperation.CREATE,\n sessionContext,\n );\n\n const persistedTasks: PersistedExecutionTask[] = [];\n\n for (const task of tasks) {\n const taskState = standaloneTaskStates.find((item) => item.taskId === task._id);\n const createData = {\n ...this.normalizeTaskCreatePayload({\n ...task,\n status: taskState?.status ?? task.status,\n updatedAt: taskState?.updatedAt ?? task.updatedAt,\n wildoApplicationActorSystemExecutionId: executionId,\n }),\n organizationId: ownership.organizationId,\n wildoApplicationId: ownership.wildoApplicationId,\n wildoApplicationActorSystemExecutionId: executionId,\n };\n const persistedTask = await repository.create<Wildo_Application_Actor_Task>(executionContext, createData, {\n ...this.buildRepositoryOptions(transaction),\n preserveServerInjectedFields: this.deriveServerInjectedPreserveFields(\n WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE,\n createData,\n CoreResourceOperation.CREATE,\n ),\n });\n\n persistedTasks.push({\n sourceTaskId: task._id,\n task: persistedTask,\n });\n }\n\n return persistedTasks;\n } finally {\n this.noteExecutionWrite();\n }\n }\n\n private async updateActorExecutionTaskSnapshot(\n execution: Wildo_Application_ActorSystem_Execution,\n ownership: CompanionExecutionOwnership,\n tasks: ExecutionTaskSnapshotEntry[],\n transaction?: TransactionContext,\n standaloneTaskStatesOverride?: Wildo_Application_ActorSystem_Execution[\"standaloneTaskStates\"],\n sessionContext?: CompanionExecutionSessionContext,\n ): Promise<Wildo_Application_ActorSystem_Execution> {\n this.noteExecutionWrite();\n try {\n const repository = this.repositoriesRegistry.getRepositoryOrThrow(WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE);\n const executionContext = await this.createInternalExecutionContext(\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n CoreResourceOperation.UPDATE,\n sessionContext,\n );\n const updatedAt = new Date().toISOString();\n\n const updated = await repository.update<Wildo_Application_ActorSystem_Execution>(\n executionContext,\n { _id: execution._id, wildoApplicationId: ownership.wildoApplicationId },\n {\n // Every task write reaches the snapshot through here, so this is where a transcript is kept\n // off it: the task row holds `codingSessionFrames`, the snapshot holds the rest\n // (`execution-task-snapshot.models.ts`).\n standaloneTasks: tasks.map(toExecutionTaskSnapshot),\n standaloneTaskStates: standaloneTaskStatesOverride ?? this.buildStandaloneTaskStates(tasks, execution.standaloneTaskStates),\n updatedAt: persistedInstant(updatedAt),\n },\n this.buildRepositoryOptions(transaction),\n );\n /*\n * `update` answers `null` when the filter matched nothing — the execution was removed, or its\n * `wildoApplicationId` no longer matches, between the read that produced `execution` and this\n * write. This method PROMISES an execution, and returning `null` under that signature is how a\n * caller comes to read task state off nothing; it compiled while `strictNullChecks` was off\n * (#352).\n *\n * Refusing names the tenancy half deliberately, because the two causes are not the same finding:\n * a missing row is a concurrent delete, a non-matching `wildoApplicationId` is an ownership\n * violation, and the filter cannot tell them apart from here.\n */\n if (updated === null) {\n throw new Error(\n `Actor-system execution '${execution._id}' could not be updated: no row matches that id under application `\n + `'${ownership.wildoApplicationId}'. It was removed concurrently, or it belongs to another application.`,\n );\n }\n return updated;\n } finally {\n this.noteExecutionWrite();\n }\n }\n\n private async syncTaskIntoExecutionSnapshot(\n task: Wildo_Application_Actor_Task,\n transaction?: TransactionContext,\n sessionContext?: CompanionExecutionSessionContext,\n ): Promise<void> {\n this.noteExecutionWrite();\n try {\n if (!task.wildoApplicationActorSystemExecutionId) {\n return;\n }\n\n const repository = this.repositoriesRegistry.getRepositoryOrThrow(WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE);\n const executionContext = await this.createInternalExecutionContext(\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n CoreResourceOperation.READ,\n sessionContext,\n );\n const execution = await repository.read<Wildo_Application_ActorSystem_Execution>(\n executionContext,\n {\n _id: task.wildoApplicationActorSystemExecutionId,\n wildoApplicationId: task.wildoApplicationId,\n },\n this.buildRepositoryOptions(transaction),\n );\n\n if (!execution) {\n throw this.errorBuilder.buildError(ErrorType.NOT_FOUND, undefined, {\n customMessageReference: ErrorCustomMessageReference.NOT_FOUND,\n context: {\n message: \"Actor task references a missing persisted actor execution.\",\n taskId: task._id,\n wildoApplicationActorSystemExecutionId: task.wildoApplicationActorSystemExecutionId,\n appSlug: this.companionContext.saasConfig.slug,\n },\n });\n }\n\n await this.updateActorExecutionTaskSnapshot(\n execution,\n {\n organizationId: task.organizationId,\n wildoApplicationId: task.wildoApplicationId,\n },\n this.upsertTask(execution.standaloneTasks, toExecutionTaskSnapshot(task)),\n transaction,\n undefined,\n sessionContext,\n );\n } finally {\n this.noteExecutionWrite();\n }\n }\n\n private async removeTaskFromExecutionSnapshot(\n task: Pick<Wildo_Application_Actor_Task, \"_id\" | \"organizationId\" | \"wildoApplicationId\" | \"wildoApplicationActorSystemExecutionId\">,\n transaction?: TransactionContext,\n sessionContext?: CompanionExecutionSessionContext,\n ): Promise<void> {\n if (!task.wildoApplicationActorSystemExecutionId) {\n return;\n }\n\n const repository = this.repositoriesRegistry.getRepositoryOrThrow(WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE);\n const readExecutionContext = await this.createInternalExecutionContext(\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n CoreResourceOperation.READ,\n sessionContext,\n );\n const execution = await repository.read<Wildo_Application_ActorSystem_Execution>(\n readExecutionContext,\n {\n _id: task.wildoApplicationActorSystemExecutionId,\n wildoApplicationId: task.wildoApplicationId,\n },\n this.buildRepositoryOptions(transaction),\n );\n\n if (!execution) {\n return;\n }\n\n await this.updateActorExecutionTaskSnapshot(\n execution,\n {\n organizationId: task.organizationId,\n wildoApplicationId: task.wildoApplicationId,\n },\n execution.standaloneTasks.filter((item) => item._id !== task._id),\n transaction,\n undefined,\n sessionContext,\n );\n }\n\n private async readActorTaskOrThrow(\n taskId: string,\n transaction?: TransactionContext,\n sessionContext?: CompanionExecutionSessionContext,\n ): Promise<Wildo_Application_Actor_Task> {\n const ownership = await this.resolveOwnership(sessionContext);\n const repository = this.repositoriesRegistry.getRepositoryOrThrow(WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE);\n const executionContext = await this.createInternalExecutionContext(WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE, CoreResourceOperation.READ, sessionContext);\n const task = await repository.read<Wildo_Application_Actor_Task>(\n executionContext,\n { _id: taskId, wildoApplicationId: ownership.wildoApplicationId },\n this.buildRepositoryOptions(transaction),\n );\n\n if (!task) {\n throw this.buildTaskNotFoundError(taskId);\n }\n\n return task;\n }\n\n private async readActorExecutionOrThrow(\n executionId: string,\n wildoApplicationId: string,\n transaction?: TransactionContext,\n sessionContext?: CompanionExecutionSessionContext,\n ): Promise<Wildo_Application_ActorSystem_Execution> {\n const repository = this.repositoriesRegistry.getRepositoryOrThrow(WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE);\n const executionContext = await this.createInternalExecutionContext(\n WILDO_APPLICATION_ACTOR_SYSTEM_EXECUTIONS_RESOURCE_TYPE,\n CoreResourceOperation.READ,\n sessionContext,\n );\n const execution = await repository.read<Wildo_Application_ActorSystem_Execution>(\n executionContext,\n { _id: executionId, wildoApplicationId },\n this.buildRepositoryOptions(transaction),\n );\n\n if (!execution) {\n throw this.buildExecutionNotFoundError(FlowsActors_ElementKind.ACTOR,executionId);\n }\n\n return execution;\n }\n\n private async listActorExecutionTasks(\n ownership: CompanionExecutionOwnership,\n executionId: string,\n transaction?: TransactionContext,\n ): Promise<Wildo_Application_Actor_Task[]> {\n const repository = this.repositoriesRegistry.getRepositoryOrThrow(WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE);\n const executionContext = await this.createInternalExecutionContext(WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE, CoreResourceOperation.LIST);\n return repository.list<Wildo_Application_Actor_Task>(\n executionContext,\n {\n wildoApplicationId: ownership.wildoApplicationId,\n wildoApplicationActorSystemExecutionId: executionId,\n },\n this.buildRepositoryOptions(transaction),\n );\n }\n\n private async traceInternalExecutionContext(\n sessionContext: CompanionExecutionSessionContext,\n executionContext: ExecutionContext<any>,\n resourceType: ResourceType,\n operationIdentifier: CoreResourceOperation,\n ): Promise<void> {\n const serializedExecutionContext = ResourceSerializationUtils.deserializeExecutionContextData(\n ResourceSerializationUtils.serializeExecutionContext({\n executionType: executionContext.executionType,\n initiatorIds: executionContext.initiatorIds,\n initiatorRoles: [...executionContext.initiatorRoles],\n /*\n * The two ENGINE declarations disagree by one `| undefined`, and the companion sits between\n * them (#352): `ExecutionContext.getContextResourceIds()` returns\n * `ReadonlyMap<…, string | string[] | undefined>` while `serializeExecutionContext` accepts\n * `ReadonlyMap<string, string | string[]>`. It compiled while `strictNullChecks` was off.\n *\n * Dropped rather than widened here, for two reasons. A context entry whose value is\n * `undefined` is not a resource id — it is a scope the context could not resolve — so\n * serializing it would record an absence as if it were a value. And widening belongs to the\n * engine's own contract, not to a consumer that happens to notice the gap; changing\n * `saas-models` from here would make the companion the author of a shared type.\n */\n getContextResourceIds: () => new Map(\n [...executionContext.getContextResourceIds()].filter(\n (entry): entry is [string, string | string[]] => entry[1] !== undefined,\n ),\n ),\n relationshipContexts: [...executionContext.relationshipContexts],\n }),\n );\n /*\n * The EC reshape removed `requestUUID` from the platform JWT claims; `correlationId` is the per-request\n * identifier now. Mapped here rather than renamed downstream on purpose: `requestUUID` is a field of the\n * traceability contract (`CompanionExecutionContextArtifactRef`), which dedupes artifacts on it, so renaming it\n * is a change to that model and its tests — a separate decision from unbreaking this build.\n */\n const requestUUID = executionContext.toExecutionContextPlatformJwtClaims().correlationId;\n const fileName = `${resourceType}-${operationIdentifier}-${requestUUID}-execution-context.json`;\n\n await this.traceabilityService.traceEvent({\n session: sessionContext,\n minimumLevel: CompanionTraceabilityLevel.DEBUG,\n type: \"internal-execution-context-created\",\n summary: `Created internal execution context for ${resourceType}.${operationIdentifier}`,\n payload: {\n resourceType,\n operationIdentifier,\n requestUUID,\n },\n });\n const artifactPersisted = await this.traceabilityService.writeArtifact({\n session: sessionContext,\n minimumLevel: CompanionTraceabilityLevel.DEBUG_VERBOSE,\n fileName,\n content: {\n resourceType,\n operationIdentifier,\n requestUUID,\n serializedExecutionContext,\n },\n });\n if (artifactPersisted) {\n await this.traceabilityService.recordExecutionContextArtifact(sessionContext, {\n requestUUID,\n resourceType,\n operationIdentifier,\n fileName,\n recordedAt: new Date().toISOString(),\n });\n }\n }\n\n private createOperationTraceStep(sessionContext: CompanionExecutionSessionContext | undefined, label: string) {\n return sessionContext\n ? this.traceabilityService.createStep(sessionContext, {\n kind: \"execution-persistence\",\n label,\n })\n : undefined;\n }\n\n private async traceOperationStart(input: {\n sessionContext?: CompanionExecutionSessionContext;\n step?: ReturnType<CompanionTraceabilityService[\"createStep\"]>;\n type: string;\n summary: string;\n payload?: unknown;\n artifactFileName?: string;\n artifactContent?: unknown;\n }): Promise<void> {\n if (!input.sessionContext) {\n return;\n }\n\n await this.traceabilityService.traceEvent({\n session: input.sessionContext,\n minimumLevel: CompanionTraceabilityLevel.DEBUG,\n type: input.type,\n summary: input.summary,\n ...(input.payload !== undefined ? { payload: input.payload } : {}),\n ...(input.step ? { step: input.step } : {}),\n });\n if (input.artifactFileName && input.artifactContent !== undefined) {\n await this.traceabilityService.writeArtifact({\n session: input.sessionContext,\n minimumLevel: CompanionTraceabilityLevel.DEBUG_VERBOSE,\n fileName: input.artifactFileName,\n content: input.artifactContent,\n ...(input.step ? { step: input.step } : {}),\n });\n }\n }\n\n private async traceOperationSuccess(input: {\n sessionContext?: CompanionExecutionSessionContext;\n step?: ReturnType<CompanionTraceabilityService[\"createStep\"]>;\n type: string;\n summary: string;\n payload?: unknown;\n artifactFileName?: string;\n artifactContent?: unknown;\n }): Promise<void> {\n if (!input.sessionContext) {\n return;\n }\n\n if (input.artifactFileName && input.artifactContent !== undefined) {\n await this.traceabilityService.writeArtifact({\n session: input.sessionContext,\n minimumLevel: CompanionTraceabilityLevel.DEBUG_VERBOSE,\n fileName: input.artifactFileName,\n content: input.artifactContent,\n ...(input.step ? { step: input.step } : {}),\n });\n }\n await this.traceabilityService.traceEvent({\n session: input.sessionContext,\n minimumLevel: CompanionTraceabilityLevel.DEBUG,\n type: input.type,\n summary: input.summary,\n ...(input.payload !== undefined ? { payload: input.payload } : {}),\n ...(input.step ? { step: input.step } : {}),\n });\n }\n\n private async traceOperationFailure(input: {\n sessionContext?: CompanionExecutionSessionContext;\n step?: ReturnType<CompanionTraceabilityService[\"createStep\"]>;\n type: string;\n summary: string;\n error: unknown;\n payload?: unknown;\n }): Promise<void> {\n if (!input.sessionContext) {\n return;\n }\n\n await this.traceabilityService.traceEvent({\n session: input.sessionContext,\n minimumLevel: CompanionTraceabilityLevel.DEBUG,\n type: input.type,\n summary: input.summary,\n payload: {\n ...(input.payload && typeof input.payload === \"object\" ? (input.payload as Record<string, unknown>) : { input: input.payload }),\n error: this.buildTraceErrorPayload(input.error),\n },\n ...(input.step ? { step: input.step } : {}),\n });\n }\n\n private buildTraceErrorPayload(error: unknown) {\n if (isWildoBackendError(error)) {\n return error;\n }\n\n if (error instanceof Error) {\n return {\n message: error.message,\n name: error.name,\n ...(error.stack ? { stack: error.stack } : {}),\n };\n }\n\n return {\n message: String(error),\n };\n }\n\n private async unsetActorTaskFields(\n taskId: string,\n wildoApplicationId: string,\n fieldsToUnset: Partial<Record<\"completedAt\" | \"wildoApplicationActorSystemExecutionId\", 1>>,\n transaction?: TransactionContext,\n ): Promise<void> {\n const fieldEntries = Object.entries(fieldsToUnset);\n if (fieldEntries.length === 0) {\n return;\n }\n\n /*\n * ADAPTER-NEUTRAL on purpose, and the previous body is the cautionary tale: it reached\n * `mongooseModel.findOneAndUpdate` + `getNativeSession` directly, which exists only on the\n * MongoDB repository — on a PostgreSQL-backed application (wonder-crm) the call threw\n * `repository.getNativeSession is not a function`, the interactive lane's park-persistence\n * write died on it, and the failure handler then recorded the whole parked run as\n * `agent_execution_failed`, destroying the suspension the restart-durability door needed\n * (measured 2026-09-04, first live park on PG). `atomicConditionalSet` is on the repository\n * CONTRACT — an adapter that cannot compile it fails to build — and its `clearFields` is\n * exactly the unset: `$unset` on MongoDB, `SET col = NULL` (+ read-path omission) on PG.\n */\n /*\n * Through the REGISTRY, not the raw repository. This reached\n * `getRepositoryOrThrow(...).atomicConditionalSet(...)` behind an `as unknown as` cast until\n * 2026-09-09, which skipped the one thing the registry wrapper adds: it runs the filter through\n * `applyRetentionHideToRawFilter` before handing it to the same primitive. A guarded-write\n * primitive does not apply the hide itself, so a call site that binds the repository first is\n * deciding a retention question it was never meant to answer — which is what\n * `check:retention-hide-reach` reports as `guarded-write-off-registry`.\n *\n * The registry is the engine's own `RepositoriesRegistryHandlerBackendService` (injected above),\n * so the wrapper was always available; the cast existed only because the earlier reasoning was\n * about the repository CONTRACT rather than about the door in front of it. Passing no execution\n * context preserves the previous `getRepositoryOrThrow` call exactly.\n */\n await this.repositoriesRegistry.atomicConditionalSet(\n WILDO_APPLICATION_ACTOR_TASKS_RESOURCE_TYPE,\n { _id: taskId, wildoApplicationId },\n { clear: fieldEntries.map(([field]) => field) },\n undefined,\n this.buildRepositoryOptions(transaction),\n );\n }\n\n private buildRepositoryOptions(transaction?: TransactionContext): CompanionRepositoryOptions | undefined {\n return transaction ? { transaction } : undefined;\n }\n\n /**\n * Compute the repository-write re-attach allowlist for a server-authored\n * payload — the SAME schema-derived set the engine's application-tier trusted\n * writes use ({@link deriveTrustedSystemWritePreservedFieldsForResource}).\n *\n * WHY the companion needs it: every `repository.create/update` strict-parses\n * the payload against the resource's client-shaped request DTO, which omits\n * two field classes — `.isBackendOnly()` material and the context-auto-populated\n * scope/audit FKs (`CONTEXT_AUTO_POPULATED_FIELD_IDENTIFIERS`, stripped by NAME).\n * For these platform-persistence resources the only such field the companion\n * authors is `organizationId` (the ORGANIZATIONS primary-scope FK): on an\n * HTTP write it would be re-injected from the request context AFTER the parse,\n * but the companion's system-context writes have no request context, so without\n * this the strip silently drops it and the row fails Mongoose required-field\n * validation. `RepositoryOptions.preserveServerInjectedFields` re-attaches\n * exactly the derived keys after the parse.\n *\n * WHY it is DERIVED, not a hard-coded list: deriving from the registered\n * `mainSchema` is the single source of truth shared with the engine seam, so a\n * future schema change (a new backend-only field, an added scope FK) is covered\n * automatically. The other server-injected FKs (`wildoApplicationId`, the\n * `wildoApplicationActorSystemExecutionId` execution link) are ordinary\n * `.isForeignKey()` relationship fields that the request DTO does NOT strip —\n * they parse through normally — so the derivation correctly excludes them.\n *\n * TIER NOTE: the companion executions plane is local-platform-tier repository\n * CRUD (it never stands up the application `ServicesRegistryHandler`), so it\n * reuses the engine's DERIVATION helper directly at the repository tier rather\n * than routing through the application-services-tier\n * `SystemAccessBackendService.createAsSystem`/`updateAsSystem` (which resolve a\n * service/URL operation path these `REPOSITORY_ONLY` resources do not declare).\n */\n private deriveServerInjectedPreserveFields(\n resourceType: ResourceType,\n data: Record<string, unknown>,\n verb: CoreResourceOperation.CREATE | CoreResourceOperation.UPDATE | CoreResourceOperation.UPDATE_MANY,\n ): string[] {\n // Variant-aware (#2434): the payload's own variant, or every shape when it names none.\n return deriveTrustedSystemWritePreservedFieldsForResource(this.resourcesRegistry.getResourceConfiguration(resourceType) as never, data, verb);\n }\n\n private assertStandaloneTaskStateConsistency(payload: Pick<CompanionCreateActorExecutionRequest, \"standaloneTasks\" | \"standaloneTaskStates\">): void {\n const seenTaskIds = new Set<string>();\n for (const task of payload.standaloneTasks) {\n if (seenTaskIds.has(task._id)) {\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.VALIDATION,\n context: {\n message: \"Actor execution payload contains duplicate standalone task ids.\",\n taskId: task._id,\n },\n });\n }\n\n seenTaskIds.add(task._id);\n }\n\n for (const taskState of payload.standaloneTaskStates) {\n if (!seenTaskIds.has(taskState.taskId)) {\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.VALIDATION,\n context: {\n message: \"Actor execution task states must reference a declared standalone task.\",\n taskId: taskState.taskId,\n },\n });\n }\n }\n }\n\n\n private normalizeTaskCreatePayload(payload: CompanionCreateActorTaskRequest): Omit<\n CompanionCreateActorTaskRequest,\n \"wildoApplicationActorSystemExecutionId\" | \"createdAt\" | \"updatedAt\" | \"startedAt\" | \"completedAt\"\n > & {\n createdAt: Date;\n updatedAt: Date;\n startedAt?: Date;\n completedAt?: Date;\n actorStates: Wildo_Application_Actor_Task[\"actorStates\"];\n } {\n const {\n completedAt: _completedAt,\n startedAt,\n wildoApplicationActorSystemExecutionId: _wildoApplicationActorSystemExecutionId,\n ...payloadWithoutManagedFields\n } = payload;\n const now = new Date().toISOString();\n const createdAt = payload.createdAt ?? now;\n const updatedAt = payload.updatedAt ?? createdAt;\n const actorStates =\n payload.actorStates.length > 0\n ? payload.actorStates\n : [\n {\n actorRef: payload.actors.actorRef,\n status: payload.status,\n updatedAt,\n statusChanges: [{ status: payload.status, timestamp: updatedAt }],\n },\n ];\n const completedAt = this.isTerminalStatus(payload.status) ? (payload.completedAt ?? updatedAt) : undefined;\n\n // The row's instants are dates; `actorStates` is jsonb and keeps the ISO form (#2187).\n return {\n ...payloadWithoutManagedFields,\n createdAt: persistedInstant(createdAt),\n updatedAt: persistedInstant(updatedAt),\n ...(startedAt ? { startedAt: persistedInstant(startedAt) } : {}),\n actorStates,\n ...(completedAt ? { completedAt: persistedInstant(completedAt) } : {}),\n };\n }\n\n private buildPersistedStandaloneTaskStates(\n persistedTasks: PersistedExecutionTask[],\n sourceStates: CompanionCreateActorExecutionRequest[\"standaloneTaskStates\"],\n ): Wildo_Application_ActorSystem_Execution[\"standaloneTaskStates\"] {\n const statesBySourceTaskId = new Map<string, CompanionCreateActorExecutionRequest[\"standaloneTaskStates\"][number]>(\n sourceStates.map((item) => [item.taskId, item]),\n );\n\n return persistedTasks.map(({ sourceTaskId, task }) => {\n const sourceState = statesBySourceTaskId.get(sourceTaskId);\n const updatedAt = this.toStrictIsoDatetime(task.updatedAt);\n\n return {\n taskId: task._id,\n status: task.status,\n updatedAt,\n statusChanges: sourceState?.statusChanges?.length\n ? sourceState.statusChanges.map((change) => ({\n status: change.status,\n timestamp: this.toStrictIsoDatetime(change.timestamp),\n }))\n : [{ status: task.status, timestamp: updatedAt }],\n };\n });\n }\n\n /**\n * Normalize a persisted timestamp to the STRICT ISO-8601 form the execution\n * contract requires. Control-plane resources (actor tasks/executions) get\n * their `createdAt`/`updatedAt` from Mongoose auto-timestamps, which write a\n * `Date` into the STRING-typed field — Mongoose then casts it with\n * `Date.prototype.toString()`, producing a locale form (\"Wed Jul 08 2026\n * 06:16:36 GMT+0200 (Central European Summer Time)\"). The task schema's own\n * `updatedAt` (`z.string().refine(Date.parse)`) tolerates that, but the\n * execution's `standaloneTaskStates[].updatedAt` / `statusChanges[].timestamp`\n * are strict `z.iso.datetime()` (Z-suffixed) and REJECT it — so projecting a\n * raw `task.updatedAt` into a standalone-task-state write fails validation.\n * The companion owns the task→execution projection, so it normalizes here at\n * that loose→strict boundary. `Date.parse` accepts both the locale and ISO\n * forms; the `NaN` fallback (never hit for real persisted rows) keeps a bad\n * source from throwing.\n *\n * The \"deeper fix\" this note used to ask for — store the instants as instants — landed as #2187: the\n * persisted task and execution rows now hold dates (`timestamptz`), so a persisted value arrives here as\n * a `Date` and the locale form can only come from a snapshot written before it.\n */\n private toStrictIsoDatetime(value: string | Date): string {\n if (value instanceof Date) return Number.isNaN(value.getTime()) ? new Date().toISOString() : value.toISOString();\n const parsed = Date.parse(value);\n return Number.isNaN(parsed) ? new Date().toISOString() : new Date(parsed).toISOString();\n }\n\n private buildStandaloneTaskStates(\n tasks: ReadonlyArray<Pick<ExecutionTaskSnapshotEntry, \"_id\" | \"status\" | \"updatedAt\">>,\n existingStates: Wildo_Application_ActorSystem_Execution[\"standaloneTaskStates\"],\n ): Wildo_Application_ActorSystem_Execution[\"standaloneTaskStates\"] {\n const statesByTaskId = new Map<string, Wildo_Application_ActorSystem_Execution[\"standaloneTaskStates\"][number]>(\n existingStates.map((item) => [item.taskId, item]),\n );\n\n return tasks.map((task) => {\n const updatedAt = this.toStrictIsoDatetime(task.updatedAt);\n const existingState = statesByTaskId.get(String(task._id));\n const statusChanges = existingState?.statusChanges ?? [];\n const lastStatus = statusChanges[statusChanges.length - 1]?.status;\n const nextStatusChanges = lastStatus === task.status ? statusChanges : [...statusChanges, { status: task.status, timestamp: updatedAt }];\n\n return {\n taskId: String(task._id),\n status: task.status,\n updatedAt,\n statusChanges: nextStatusChanges.length > 0 ? nextStatusChanges : [{ status: task.status, timestamp: updatedAt }],\n };\n });\n }\n\n private upsertTask(tasks: ExecutionTaskSnapshotEntry[], task: ExecutionTaskSnapshotEntry): ExecutionTaskSnapshotEntry[] {\n const existingIndex = tasks.findIndex((item) => item._id === task._id);\n if (existingIndex === -1) {\n return [...tasks, task];\n }\n\n return tasks.map((item) => (item._id === task._id ? task : item));\n }\n\n private normalizeCreateEnvelope<TPayload extends ExecutionCreateEnvelope>(\n payload: TPayload,\n ): Pick<TPayload, \"statusChanges\"> & { createdAt: Date; updatedAt: Date; finishedAt?: Date } {\n const now = new Date().toISOString();\n const createdAt = payload.createdAt ?? now;\n const updatedAt = payload.updatedAt ?? createdAt;\n const statusChanges = payload.statusChanges.length > 0 ? payload.statusChanges : [{ status: payload.status, timestamp: createdAt }];\n const finishedAt = this.isTerminalStatus(payload.status) ? (payload.finishedAt ?? updatedAt) : undefined;\n\n // The row's instants are dates; `statusChanges` is jsonb and keeps the ISO form (#2187).\n return {\n statusChanges,\n createdAt: persistedInstant(createdAt),\n updatedAt: persistedInstant(updatedAt),\n ...(finishedAt ? { finishedAt: persistedInstant(finishedAt) } : {}),\n };\n }\n\n private isTerminalStatus(status: FlowsActors_Status): boolean {\n return [FlowsActors_Status.COMPLETED, FlowsActors_Status.FAILED, FlowsActors_Status.CANCELLED, FlowsActors_Status.ABORTED].includes(status);\n }\n\n /**\n * The `kind` derives from the canonical `FlowsActors_ElementKind` vocabulary\n * and is narrowed to the two element kinds that have persisted executions —\n * its string value is interpolated into the user-facing message below.\n */\n private buildExecutionNotFoundError(kind: FlowsActors_ElementKind.ACTOR | FlowsActors_ElementKind.FLOW, executionId: string) {\n return this.errorBuilder.buildError(ErrorType.NOT_FOUND, undefined, {\n customMessageReference: ErrorCustomMessageReference.NOT_FOUND,\n context: {\n message: `No persisted ${kind} execution exists for this companion app.`,\n executionId,\n appSlug: this.companionContext.saasConfig.slug,\n },\n });\n }\n\n private buildTaskNotFoundError(taskId: string) {\n return this.errorBuilder.buildError(ErrorType.NOT_FOUND, undefined, {\n customMessageReference: ErrorCustomMessageReference.NOT_FOUND,\n context: {\n message: \"No persisted actor task exists for this companion app.\",\n taskId,\n appSlug: this.companionContext.saasConfig.slug,\n },\n });\n }\n}\n"]}
|