@wildo-ai/saas-backend-lib 1.1.12 → 1.1.13
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/base-classes/models/manual-controllers.backend.definition.d.ts.map +1 -1
- package/dist/esm/base-classes/models/manual-controllers.backend.definition.js +2 -0
- package/dist/esm/base-classes/models/manual-controllers.backend.definition.js.map +1 -1
- package/dist/esm/base-classes/services/repositories/stored-field-omission.backend.d.ts +4 -0
- package/dist/esm/base-classes/services/repositories/stored-field-omission.backend.d.ts.map +1 -1
- package/dist/esm/base-classes/services/repositories/stored-field-omission.backend.js +20 -5
- package/dist/esm/base-classes/services/repositories/stored-field-omission.backend.js.map +1 -1
- package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-registry.backend.service.d.ts +3 -0
- package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-registry.backend.service.d.ts.map +1 -1
- package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-registry.backend.service.js +10 -1
- package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-registry.backend.service.js.map +1 -1
- package/dist/esm/base-classes/services/services/resource-operation-custom-implementation.factory.backend.d.ts +22 -0
- package/dist/esm/base-classes/services/services/resource-operation-custom-implementation.factory.backend.d.ts.map +1 -1
- package/dist/esm/base-classes/services/services/resource-operation-custom-implementation.factory.backend.js +25 -1
- package/dist/esm/base-classes/services/services/resource-operation-custom-implementation.factory.backend.js.map +1 -1
- package/dist/esm/base-classes/services/services/resource-operation-transaction-persistence.backend.utils.d.ts +38 -3
- package/dist/esm/base-classes/services/services/resource-operation-transaction-persistence.backend.utils.d.ts.map +1 -1
- package/dist/esm/base-classes/services/services/resource-operation-transaction-persistence.backend.utils.js +68 -5
- package/dist/esm/base-classes/services/services/resource-operation-transaction-persistence.backend.utils.js.map +1 -1
- package/dist/esm/base-classes/services/services/resource-status-transition.custom-impl.backend.service.d.ts +2 -2
- package/dist/esm/base-classes/services/services/resource-status-transition.custom-impl.backend.service.d.ts.map +1 -1
- package/dist/esm/base-classes/services/services/resource-status-transition.custom-impl.backend.service.js +6 -3
- package/dist/esm/base-classes/services/services/resource-status-transition.custom-impl.backend.service.js.map +1 -1
- package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.d.ts +83 -0
- package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.d.ts.map +1 -1
- package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.js +217 -14
- package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.js.map +1 -1
- package/dist/esm/compliance/approval-seals/approval-seal-currency.backend.d.ts +32 -0
- package/dist/esm/compliance/approval-seals/approval-seal-currency.backend.d.ts.map +1 -0
- package/dist/esm/compliance/approval-seals/approval-seal-currency.backend.js +36 -0
- package/dist/esm/compliance/approval-seals/approval-seal-currency.backend.js.map +1 -0
- package/dist/esm/compliance/approval-seals/approval-seal-on-record.backend.d.ts +38 -0
- package/dist/esm/compliance/approval-seals/approval-seal-on-record.backend.d.ts.map +1 -0
- package/dist/esm/compliance/approval-seals/approval-seal-on-record.backend.js +83 -0
- package/dist/esm/compliance/approval-seals/approval-seal-on-record.backend.js.map +1 -0
- package/dist/esm/compliance/approval-seals/approval-seal-presentation-read.backend.d.ts +36 -0
- package/dist/esm/compliance/approval-seals/approval-seal-presentation-read.backend.d.ts.map +1 -0
- package/dist/esm/compliance/approval-seals/approval-seal-presentation-read.backend.js +51 -0
- package/dist/esm/compliance/approval-seals/approval-seal-presentation-read.backend.js.map +1 -0
- package/dist/esm/compliance/approval-seals/approval-seal-relay-store.backend.d.ts +46 -0
- package/dist/esm/compliance/approval-seals/approval-seal-relay-store.backend.d.ts.map +1 -1
- package/dist/esm/compliance/approval-seals/approval-seal-relay-store.backend.js +68 -0
- package/dist/esm/compliance/approval-seals/approval-seal-relay-store.backend.js.map +1 -1
- package/dist/esm/compliance/approval-seals/approval-seal-store.backend.d.ts +27 -0
- package/dist/esm/compliance/approval-seals/approval-seal-store.backend.d.ts.map +1 -1
- package/dist/esm/compliance/approval-seals/approval-seal-store.backend.js +42 -3
- package/dist/esm/compliance/approval-seals/approval-seal-store.backend.js.map +1 -1
- package/dist/esm/compliance/approval-seals/approval-seals-admin.backend.contracts.d.ts +26 -1
- package/dist/esm/compliance/approval-seals/approval-seals-admin.backend.contracts.d.ts.map +1 -1
- package/dist/esm/compliance/approval-seals/approval-seals-admin.backend.contracts.js +10 -0
- package/dist/esm/compliance/approval-seals/approval-seals-admin.backend.contracts.js.map +1 -1
- package/dist/esm/compliance/approval-seals/approval-seals-admin.backend.controller.d.ts +10 -1
- package/dist/esm/compliance/approval-seals/approval-seals-admin.backend.controller.d.ts.map +1 -1
- package/dist/esm/compliance/approval-seals/approval-seals-admin.backend.controller.js +60 -28
- package/dist/esm/compliance/approval-seals/approval-seals-admin.backend.controller.js.map +1 -1
- package/dist/esm/compliance/approval-seals/approval-seals-on-record.backend.controller.d.ts +90 -0
- package/dist/esm/compliance/approval-seals/approval-seals-on-record.backend.controller.d.ts.map +1 -0
- package/dist/esm/compliance/approval-seals/approval-seals-on-record.backend.controller.js +373 -0
- package/dist/esm/compliance/approval-seals/approval-seals-on-record.backend.controller.js.map +1 -0
- package/dist/esm/compliance/approval-seals/decision-presentation.backend.d.ts +29 -2
- package/dist/esm/compliance/approval-seals/decision-presentation.backend.d.ts.map +1 -1
- package/dist/esm/compliance/approval-seals/decision-presentation.backend.js +40 -3
- package/dist/esm/compliance/approval-seals/decision-presentation.backend.js.map +1 -1
- package/dist/esm/compliance/electronic-signatures/pdf-signature-structure.backend.d.ts.map +1 -1
- package/dist/esm/compliance/electronic-signatures/pdf-signature-structure.backend.js +34 -6
- package/dist/esm/compliance/electronic-signatures/pdf-signature-structure.backend.js.map +1 -1
- package/dist/esm/compliance/electronic-signatures/signature-request-evidence-files.backend.d.ts +30 -6
- package/dist/esm/compliance/electronic-signatures/signature-request-evidence-files.backend.d.ts.map +1 -1
- package/dist/esm/compliance/electronic-signatures/signature-request-evidence-files.backend.js +67 -22
- package/dist/esm/compliance/electronic-signatures/signature-request-evidence-files.backend.js.map +1 -1
- package/dist/esm/compliance/electronic-signatures/signature-request-poll.batch.backend.service.d.ts.map +1 -1
- package/dist/esm/compliance/electronic-signatures/signature-request-poll.batch.backend.service.js +18 -1
- package/dist/esm/compliance/electronic-signatures/signature-request-poll.batch.backend.service.js.map +1 -1
- package/dist/esm/compliance/electronic-signatures/signature-requests.backend.service.d.ts +66 -1
- package/dist/esm/compliance/electronic-signatures/signature-requests.backend.service.d.ts.map +1 -1
- package/dist/esm/compliance/electronic-signatures/signature-requests.backend.service.js +161 -14
- package/dist/esm/compliance/electronic-signatures/signature-requests.backend.service.js.map +1 -1
- package/dist/esm/compliance/electronic-signatures/signed-document-validation.backend.d.ts +47 -0
- package/dist/esm/compliance/electronic-signatures/signed-document-validation.backend.d.ts.map +1 -1
- package/dist/esm/compliance/electronic-signatures/signed-document-validation.backend.js.map +1 -1
- package/dist/esm/external-providers/services/content-safety.backend.service.d.ts +27 -2
- package/dist/esm/external-providers/services/content-safety.backend.service.d.ts.map +1 -1
- package/dist/esm/external-providers/services/content-safety.backend.service.js +46 -1
- package/dist/esm/external-providers/services/content-safety.backend.service.js.map +1 -1
- package/dist/esm/external-providers/services/embeddings.backend.service.d.ts.map +1 -1
- package/dist/esm/external-providers/services/embeddings.backend.service.js +2 -0
- package/dist/esm/external-providers/services/embeddings.backend.service.js.map +1 -1
- package/dist/esm/external-providers/services/external-providers-registry.backend.service.d.ts +11 -0
- package/dist/esm/external-providers/services/external-providers-registry.backend.service.d.ts.map +1 -1
- package/dist/esm/external-providers/services/external-providers-registry.backend.service.js +23 -0
- package/dist/esm/external-providers/services/external-providers-registry.backend.service.js.map +1 -1
- package/dist/esm/external-providers/services/provider-service-account-token.backend.d.ts +19 -1
- package/dist/esm/external-providers/services/provider-service-account-token.backend.d.ts.map +1 -1
- package/dist/esm/external-providers/services/provider-service-account-token.backend.js +41 -1
- package/dist/esm/external-providers/services/provider-service-account-token.backend.js.map +1 -1
- package/dist/esm/files/utils/file-parent-read-context.backend.d.ts +27 -2
- package/dist/esm/files/utils/file-parent-read-context.backend.d.ts.map +1 -1
- package/dist/esm/files/utils/file-parent-read-context.backend.js +23 -4
- package/dist/esm/files/utils/file-parent-read-context.backend.js.map +1 -1
- package/dist/esm/flows-actors/content-guardrails/classifier-availability.backend.utils.d.ts +26 -0
- package/dist/esm/flows-actors/content-guardrails/classifier-availability.backend.utils.d.ts.map +1 -1
- package/dist/esm/flows-actors/content-guardrails/classifier-availability.backend.utils.js +100 -8
- package/dist/esm/flows-actors/content-guardrails/classifier-availability.backend.utils.js.map +1 -1
- package/dist/esm/flows-actors/content-guardrails/record-owner-policy.backend.d.ts +3 -1
- package/dist/esm/flows-actors/content-guardrails/record-owner-policy.backend.d.ts.map +1 -1
- package/dist/esm/flows-actors/content-guardrails/record-owner-policy.backend.js +8 -2
- package/dist/esm/flows-actors/content-guardrails/record-owner-policy.backend.js.map +1 -1
- package/dist/esm/flows-actors/models/function-tools.backend.definitions.d.ts +43 -0
- package/dist/esm/flows-actors/models/function-tools.backend.definitions.d.ts.map +1 -1
- package/dist/esm/flows-actors/models/function-tools.backend.definitions.js +37 -0
- package/dist/esm/flows-actors/models/function-tools.backend.definitions.js.map +1 -1
- package/dist/esm/flows-actors/services/agent-work-decisions.backend.service.d.ts +7 -0
- package/dist/esm/flows-actors/services/agent-work-decisions.backend.service.d.ts.map +1 -1
- package/dist/esm/flows-actors/services/agent-work-decisions.backend.service.js +8 -3
- package/dist/esm/flows-actors/services/agent-work-decisions.backend.service.js.map +1 -1
- package/dist/esm/flows-actors/services/agents.backend.service.d.ts +31 -6
- package/dist/esm/flows-actors/services/agents.backend.service.d.ts.map +1 -1
- package/dist/esm/flows-actors/services/agents.backend.service.js +78 -30
- package/dist/esm/flows-actors/services/agents.backend.service.js.map +1 -1
- package/dist/esm/flows-actors/services/autonomous-agent-turn.backend.service.d.ts.map +1 -1
- package/dist/esm/flows-actors/services/autonomous-agent-turn.backend.service.js +4 -0
- package/dist/esm/flows-actors/services/autonomous-agent-turn.backend.service.js.map +1 -1
- package/dist/esm/flows-actors/services/conversational-execution.backend.service.d.ts +28 -2
- package/dist/esm/flows-actors/services/conversational-execution.backend.service.d.ts.map +1 -1
- package/dist/esm/flows-actors/services/conversational-execution.backend.service.js +132 -22
- package/dist/esm/flows-actors/services/conversational-execution.backend.service.js.map +1 -1
- package/dist/esm/flows-actors/services/flow-actor-executions.custom-impl.backend.service.d.ts.map +1 -1
- package/dist/esm/flows-actors/services/flow-actor-executions.custom-impl.backend.service.js +12 -8
- package/dist/esm/flows-actors/services/flow-actor-executions.custom-impl.backend.service.js.map +1 -1
- package/dist/esm/flows-actors/services/flows-actors-registry.service.d.ts +5 -0
- package/dist/esm/flows-actors/services/flows-actors-registry.service.d.ts.map +1 -1
- package/dist/esm/flows-actors/services/flows-actors-registry.service.js +18 -2
- package/dist/esm/flows-actors/services/flows-actors-registry.service.js.map +1 -1
- package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.d.ts +33 -0
- package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.d.ts.map +1 -1
- package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.js +58 -0
- package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.js.map +1 -1
- package/dist/esm/inbound/services/inbound-delivery-dispatch.backend.service.d.ts +12 -1
- package/dist/esm/inbound/services/inbound-delivery-dispatch.backend.service.d.ts.map +1 -1
- package/dist/esm/inbound/services/inbound-delivery-dispatch.backend.service.js +23 -4
- package/dist/esm/inbound/services/inbound-delivery-dispatch.backend.service.js.map +1 -1
- package/dist/esm/inbound/services/inbound-delivery-receiver.backend.service.d.ts +12 -1
- package/dist/esm/inbound/services/inbound-delivery-receiver.backend.service.d.ts.map +1 -1
- package/dist/esm/inbound/services/inbound-delivery-receiver.backend.service.js +55 -17
- package/dist/esm/inbound/services/inbound-delivery-receiver.backend.service.js.map +1 -1
- package/dist/esm/inbound/services/inbound-delivery-store.backend.service.d.ts +22 -1
- package/dist/esm/inbound/services/inbound-delivery-store.backend.service.d.ts.map +1 -1
- package/dist/esm/inbound/services/inbound-delivery-store.backend.service.js +52 -9
- package/dist/esm/inbound/services/inbound-delivery-store.backend.service.js.map +1 -1
- package/dist/esm/inbound/services/inbound-delivery-stored-body.backend.service.d.ts +79 -0
- package/dist/esm/inbound/services/inbound-delivery-stored-body.backend.service.d.ts.map +1 -0
- package/dist/esm/inbound/services/inbound-delivery-stored-body.backend.service.js +211 -0
- package/dist/esm/inbound/services/inbound-delivery-stored-body.backend.service.js.map +1 -0
- package/dist/esm/inbound/services/inbound-delivery-subject-erasure-severance.backend.d.ts +2 -2
- package/dist/esm/inbound/services/inbound-delivery-subject-erasure-severance.backend.d.ts.map +1 -1
- package/dist/esm/inbound/services/inbound-delivery-subject-erasure-severance.backend.js +9 -1
- package/dist/esm/inbound/services/inbound-delivery-subject-erasure-severance.backend.js.map +1 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/inject/models/container.d.ts.map +1 -1
- package/dist/esm/inject/models/container.js +6 -0
- package/dist/esm/inject/models/container.js.map +1 -1
- package/dist/esm/inject/models/service-types.d.ts +5 -0
- package/dist/esm/inject/models/service-types.d.ts.map +1 -1
- package/dist/esm/inject/models/service-types.js +3 -0
- package/dist/esm/inject/models/service-types.js.map +1 -1
- package/dist/esm/monitoring/observability/models/observability.backend.schemas.d.ts +5 -0
- package/dist/esm/monitoring/observability/models/observability.backend.schemas.d.ts.map +1 -1
- package/dist/esm/monitoring/observability/models/observability.backend.schemas.js.map +1 -1
- package/dist/esm/monitoring/observability/services/metrics.service.d.ts +34 -1
- package/dist/esm/monitoring/observability/services/metrics.service.d.ts.map +1 -1
- package/dist/esm/monitoring/observability/services/metrics.service.js +49 -0
- package/dist/esm/monitoring/observability/services/metrics.service.js.map +1 -1
- package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.d.ts +6 -1
- package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.d.ts.map +1 -1
- package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.js +15 -4
- package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.js.map +1 -1
- package/dist/esm/notifications/webhooks/outbound/services/m2m-webhook-delivery-log.custom-impl.backend.service.d.ts.map +1 -1
- package/dist/esm/notifications/webhooks/outbound/services/m2m-webhook-delivery-log.custom-impl.backend.service.js +3 -1
- package/dist/esm/notifications/webhooks/outbound/services/m2m-webhook-delivery-log.custom-impl.backend.service.js.map +1 -1
- package/dist/esm/runtime/services/http-server.backend.service.d.ts +3 -1
- package/dist/esm/runtime/services/http-server.backend.service.d.ts.map +1 -1
- package/dist/esm/runtime/services/http-server.backend.service.js +11 -3
- package/dist/esm/runtime/services/http-server.backend.service.js.map +1 -1
- package/dist/esm/runtime/services/utils/inbound-endpoint-raw-body.backend.utils.d.ts +22 -0
- package/dist/esm/runtime/services/utils/inbound-endpoint-raw-body.backend.utils.d.ts.map +1 -1
- package/dist/esm/runtime/services/utils/inbound-endpoint-raw-body.backend.utils.js +54 -0
- package/dist/esm/runtime/services/utils/inbound-endpoint-raw-body.backend.utils.js.map +1 -1
- package/dist/esm/security/authentications/services/auth-methods/auth-password-reset.backend.service.d.ts +51 -0
- package/dist/esm/security/authentications/services/auth-methods/auth-password-reset.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/auth-methods/auth-password-reset.backend.service.js +87 -15
- package/dist/esm/security/authentications/services/auth-methods/auth-password-reset.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/custom-impls/siem-delivery-dlq.custom-impl.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/custom-impls/siem-delivery-dlq.custom-impl.backend.service.js +5 -2
- package/dist/esm/security/authentications/services/custom-impls/siem-delivery-dlq.custom-impl.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.js +65 -24
- package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.js.map +1 -1
- package/dist/esm/security/authorizations/super-admin-floor.backend.utils.d.ts +64 -1
- package/dist/esm/security/authorizations/super-admin-floor.backend.utils.d.ts.map +1 -1
- package/dist/esm/security/authorizations/super-admin-floor.backend.utils.js +84 -2
- package/dist/esm/security/authorizations/super-admin-floor.backend.utils.js.map +1 -1
- package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.d.ts +14 -0
- package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.d.ts.map +1 -1
- package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.js +13 -5
- package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.js.map +1 -1
- package/dist/esm/users/services/anonymous-consent.custom-impl.backend.service.d.ts.map +1 -1
- package/dist/esm/users/services/anonymous-consent.custom-impl.backend.service.js +6 -2
- package/dist/esm/users/services/anonymous-consent.custom-impl.backend.service.js.map +1 -1
- package/dist/esm/users/services/user-force-password-reset.custom-impl.backend.service.d.ts +7 -0
- package/dist/esm/users/services/user-force-password-reset.custom-impl.backend.service.d.ts.map +1 -1
- package/dist/esm/users/services/user-force-password-reset.custom-impl.backend.service.js +65 -20
- package/dist/esm/users/services/user-force-password-reset.custom-impl.backend.service.js.map +1 -1
- package/dist/esm/users/services/user-role-administration.custom-impl.backend.service.d.ts.map +1 -1
- package/dist/esm/users/services/user-role-administration.custom-impl.backend.service.js +11 -4
- package/dist/esm/users/services/user-role-administration.custom-impl.backend.service.js.map +1 -1
- package/dist/esm/users/services/user-self-custom-implementations.backend.d.ts.map +1 -1
- package/dist/esm/users/services/user-self-custom-implementations.backend.js +4 -2
- package/dist/esm/users/services/user-self-custom-implementations.backend.js.map +1 -1
- package/dist/esm/users/services/user-super-admin-floor.custom-impl.backend.service.d.ts.map +1 -1
- package/dist/esm/users/services/user-super-admin-floor.custom-impl.backend.service.js +16 -0
- package/dist/esm/users/services/user-super-admin-floor.custom-impl.backend.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +10 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversational-execution.backend.service.js","sourceRoot":"","sources":["../../../../src/flows-actors/services/conversational-execution.backend.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAEzD,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AACpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,qEAAqE,CAAC;AAC3G,OAAO,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAC;AAC7F,OAAO,EAAE,2BAA2B,EAAE,MAAM,8EAA8E,CAAC;AAC3H,OAAO,EAAE,yBAAyB,EAAE,MAAM,6FAA6F,CAAC;AACxI,OAAO,EAAE,+BAA+B,EAAE,MAAM,0EAA0E,CAAC;AAC3H,OAAO,EAAE,qCAAqC,EAAE,MAAM,6FAA6F,CAAC;AAEpJ,OAAO,EAAE,mCAAmC,EAA2B,MAAM,gEAAgE,CAAC;AAC9I,OAAO,EACL,0BAA0B,EAC1B,qBAAqB,GAEtB,MAAM,sFAAsF,CAAC;AAC9F,OAAO,EAAE,iCAAiC,EAAE,MAAM,kFAAkF,CAAC;AACrI,OAAO,EAAE,0BAA0B,EAAE,MAAM,iFAAiF,CAAC;AAE7H,OAAO,EACL,sBAAsB,EACtB,4BAA4B,EAC5B,iBAAiB,EACjB,6BAA6B,GAC9B,MAAM,4EAA4E,CAAC;AACpF,OAAO,EAAE,wBAAwB,EAAE,MAAM,oF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AAmB,CAAC,MAA0C;IACrE,OAAO,0BAA0B,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,CAAC,QAAQ,CAAE,EAAE,CAAC,CAAC,CAAC;AACjH,CAAC","sourcesContent":["import 'reflect-metadata';\nimport { injectable, inject, optional } from 'inversify';\nimport type { Container } from 'inversify';\nimport { randomUUID } from 'crypto';\n\nimport { SAAS_SERVICE_TYPES } from '~wildo-backend-lib/inject/models/service-types';\nimport { callerReadsModelCost } from '~wildo-backend-lib/flows-actors/services/model-cost.backend.service';\nimport { LoggerService } from '~wildo-backend-lib/monitoring/logger/services/logger.service';\nimport { projectCaughtErrorLogFields } from '~wildo-backend-lib/errors/utils/error-log-level-classification.backend.utils';\nimport { ConversationalErasureStep } from '~wildo-backend-lib/flows-actors/services/conversational-execution-erasure-severance.backend';\nimport { ResourcesRegistryBackendService } from '~wildo-backend-lib/resources/services/resources-registry.backend.service';\nimport { ServicesRegistryHandlerBackendService } from '~wildo-backend-lib/base-classes/services/services/services-registry-handler.backend.service';\nimport type { RowTeardownSettlementEvent } from '~wildo-backend-lib/base-classes/services/services/row-teardown-settlement.backend.schemas';\nimport { registerTransactionPostCommitEffect, type TransactionContext } from '~wildo-backend-lib/databases/models/transaction.shared.schemas';\nimport {\n capturablePostCommitEffect,\n decisionEndingCapture,\n type CapturedDecisionNoticeOutcomePayload,\n} from '~wildo-backend-lib/base-classes/services/services/post-commit-effect-capture.backend';\nimport { CapturedHumanDecisionAnnouncement } from '~wildo-backend-lib/base-classes/models/post-commit-effect-outbox.backend.schemas';\nimport { SystemAccessBackendService } from '~wildo-backend-lib/base-classes/services/services/system-access.backend.service';\nimport type { RedisService } from '~wildo-backend-lib/databases/services/redis.service';\nimport {\n TURN_LEASE_TTL_SECONDS,\n TurnLeaseAbandonmentEvidence,\n TurnLivenessLease,\n abandonmentEvidenceIsAVerdict,\n} from '~wildo-backend-lib/flows-actors/services/turn-liveness-lease.backend.utils';\nimport { ResumedTurnStopBroadcast } from '~wildo-backend-lib/flows-actors/services/resumed-turn-stop-broadcast.backend.utils';\nimport { DecisionRequesterAuthorityStanding, ExecutionContextCreatorBackendService } from '~wildo-backend-lib/runtime/services/execution-context-creator.backend.service';\nimport type { DecisionWaitingWorkRef } from '~wildo-backend-lib/runtime/services/execution-context-creator.backend.service';\nimport { actingSessionOfConnection, createBareExecutionContextFromVerifiedAuth, type ActingSession, type ExecutionContext, type SocketAuthResult } from '~wildo-backend-lib/runtime/models/execution-context.backend.schemas';\nimport type { WebSocketService } from '~wildo-backend-lib/requests/service/websocket.service';\nimport type { FunctionTool, FunctionToolExecutionContext } from '~wildo-backend-lib/flows-actors/models/function-tools.backend.definitions';\nimport { chatAgentRefOfActorSystem, modelToolNameForFunctionRef, rehearsedToolArguments, sdkInputSchemaOfFunctionTool, personalDataArgumentsResourceOf, resolveFunctionToolApprovalGate } from '~wildo-backend-lib/flows-actors/models/function-tools.backend.definitions';\nimport type { AuditLogsBackendService } from '~wildo-backend-lib/compliance/audit-trails/services/audit-logs.backend.service';\nimport { WITHHELD_CREDENTIAL_ARGUMENT, editedCredentialPaths, heldCallInput, isWithheldOrAbsentAt } from '~wildo-backend-lib/flows-actors/utils/agent-work-correction.backend.utils';\nimport { applyModifiedToolApprovalInput, argumentsNotRunAsWritten, argumentsRunOtherwiseThanWritten, declaredArgumentPredicateOf, pendingToolCallIdOf, pendingToolCallInputOf, pendingToolApprovalCallsOf, pendingToolCallSchemaInputOf, schemaKeepsRewriting, ToolApprovalModificationOutcomeKind, withKeptStringsInModelForm, withoutArgumentAt, withSettledToolCallsHeld } from '~wildo-backend-lib/flows-actors/utils/tool-approval-modification.backend.utils';\nimport {\n applicationDisplayName,\n ASK_PERSON_DECLINED_REASON,\n HUMAN_DECISION_NOTE_MAX_LENGTH,\n HumanDecisionAnswerError,\n HumanDecision_ResponseIntent,\n askPersonDecisionRequest,\n humanDecisionAgentValues,\n resolveHumanDecisionAnswer,\n type HumanDecision_Answer,\n type HumanDecision_Request,\n type HumanInputForm,\n jsonParsingSchemaOf,\n} from '@wildo-ai/saas-models';\nimport {\n effectiveAgentContentGuardrails,\n isStricterPersonalDataTreatment,\n resolveRepresentingOrganizationIdsInOrganization,\n type FlowsActors_AgentContentGuardrails,\n} from '@wildo-ai/saas-models';\nimport { outputModerationCategories, type FlowsActors_OutputModerationPolicy } from '@wildo-ai/saas-models';\nimport { flowsActorsAccessControlStartRoles } from '@wildo-ai/saas-models';\nimport { DecisionStepUpProofKind, humanDecisionAnswerChannelAdmitted, humanDecisionDeciderMayDecideMeaning, humanDecisionStepUpRequirementOf, type HumanDecision_AnswerChannels, type HumanDecision_StepUpRequirement } from '@wildo-ai/saas-models';\nimport { checkDecisionStepUp, consumeDecisionStepUpProof, deciderStepUpEvidenceOf } from '~wildo-backend-lib/flows-actors/utils/decision-step-up.backend.utils';\nimport type { ConsumableTokenBackendService } from '~wildo-backend-lib/security/consumable-tokens/services/consumable-token.backend.service';\nimport type { ContentSafety_HarmCategory, ContentSafety_HarmSeverity } from '@wildo-ai/external-connectors-models';\nimport { isLLMCatalogModel } from '@wildo-ai/external-connectors-models';\nimport { readAgentPolicies, runWithAgentPolicyFrame, turnPolicyOrganizationIds, type AgentPolicyLookup } from '~wildo-backend-lib/flows-actors/content-guardrails/agent-policy.backend';\nimport {\n TurnPersonalDataView,\n UNGUARDED_PAUSED_POSTURE,\n looserPausedPosture,\n pausedPostureOfGuardrails,\n} from '~wildo-backend-lib/flows-actors/content-guardrails/turn-personal-data.backend.utils';\nimport { PersonalDataGuard, PersonalDataPlaceholderTable, renamePlaceholders } from '~wildo-backend-lib/flows-actors/content-guardrails/personal-data-guard.backend.utils';\nimport { composeHumanInputForm } from '~wildo-backend-lib/flows-actors/services/human-input-form-composer.backend';\nimport { serializeZodSchema } from '@wildo-ai/zod-decorators';\n\n/**\n * What the lookup behind a paused approval's tool name found (#587). Named so the announcement and the\n * modification check branch on the same members — the two must agree on which tool a name means.\n */\nenum GatedFunctionToolResolutionKind {\n /** The chat agent declares a function tool shown to the model under this name. */\n FOUND = 'found',\n /** The system has no chat agent any more, so no tool can be resolved at all. */\n AGENT_MISSING = 'agent-missing',\n /** The agent exists but no longer declares a tool under this name. */\n TOOL_MISSING = 'tool-missing',\n}\n\ntype GatedFunctionToolResolution =\n | { kind: GatedFunctionToolResolutionKind.FOUND; agentRef: string; functionTool: NonNullable<ReturnType<FlowsActorsRegistryService['getFunctionTool']>> }\n | { kind: GatedFunctionToolResolutionKind.AGENT_MISSING }\n | { kind: GatedFunctionToolResolutionKind.TOOL_MISSING };\nimport type { RateLimitBackendService } from '~wildo-backend-lib/errors/services/rate-limit.backend.service';\nimport { ServiceConsentRequirementVerdict, type AuthorizationsBackendService } from '~wildo-backend-lib/security/authorizations/services/authorizations.backend.service';\nimport { relationshipStandingOf, runAsRelationshipProvenanceOf } from '~wildo-backend-lib/security/authorizations/relationship-record-separation.backend';\nimport { FlowsActorsRegistryService } from './flows-actors-registry.service';\nimport { AgentCallAdmission, AgentsBackendService, AgentModelCallFailedError, AgentStreamingUnsupportedError, agentSuspensionRefusalOf, type AgentApprovalSuspension, type FunctionToolStreamEvent } from './agents.backend.service';\nimport { isDeepEqualData } from 'ai';\nimport { AgentOutputWithheldError } from '~wildo-backend-lib/flows-actors/content-guardrails/output-moderation.backend.utils';\nimport { ConversationalTurnTrace, isReplayedTurn, resourceTypeReadByToolName } from './conversational-turn-trace.backend.utils';\nimport {\n AgentSuspensionRefusalReason,\n CoreResourceType,\n CoreWebSocketEvent,\n resolveRelationshipWorkAttribution,\n FlowActorSystem_Kind,\n FlowsActors_ConversationRole,\n FlowsActors_MessageContentType,\n FLOWS_ACTORS_DEFAULT_AGENT_INSTANCE,\n isFlowActorPausedApprovalLapsed,\n parseFlowActorPausedApproval,\n type FlowActorExecution_PausedApproval,\n serializeFlowActorPausedApproval,\n FLOWS_ACTORS_NO_MACHINE_CREDENTIAL,\n FlowsActors_Status,\n type ActorSystem,\n type AgentTraceContext,\n type ExecutionContext_InitiatorIds,\n type ChatConversation,\n type FlowActorExecution,\n type FlowActorExecution_Message,\n type Inbound_Arrival,\n type FlowsActors_Agent_Invocation,\n type WS_FlowsActorsApprovalAnnouncementData,\n type WS_FlowsActorsTurnUsage,\n admitsDecisionSuspension,\n FlowsActors_ExecutionErrorCode,\n FlowsActors_ApprovalModificationRefusalReason,\n resourceInheritanceVariantSchemas,\n type WS_FlowsActorsApprovalModificationRefusal,\n type WS_FlowsActorsErrorPayload,\n CoreResourceOperation,\n ErrorCustomMessageReference,\n ErrorType,\n isWildoBackendError,\n type ResourceConfiguration_Operation,\n FlowsActors_InitiationKind,\n ExecutionContext_ExecutionType,\n type ResourceOperationRiskLevel,\n ResourcePrimaryScope,\n SortOrder,\n type Roles,\n HumanDecision_Act,\n HumanDecision_Outcome,\n HumanDecision_Plane,\n type FlowsActors_PersonalDataModelTreatment,\n HumanDecision_RefusalReason,\n HumanDecision_SentCardContent,\n HumanDecision_RequesterKind,\n HumanDecision_RouteKind,\n HumanDecision_VerdictKind,\n HumanDecision_ToolApprovalOption,\n HumanDecision_ActOutcomeKind,\n type HumanDecision_ActOutcome,\n type HumanDecision_ActRequest,\n type HumanDecision_AnsweredThrough,\n type HumanDecision_PendingCard,\n type HumanDecision_ReassignCandidate,\n type HumanDecision_ReassignCandidatesResponse,\n type OrganizationMember,\n OrganizationMemberStatus,\n authorizeHumanDecisionActor,\n humanDecisionOutcomeOf,\n type HumanDecision_Requester,\n type HumanDecision_Route,\n type HumanDecision_RoleFacts,\n type AutonomousPrincipalSource,\n type AutonomousTurnTrigger,\n type WorkUnitRef,\n ExecutionRefKind,\n AgentWorkDecisionRecordSource,\n AgentWorkDecisionSurface,\n type ModelCallAttributionInput,\n // #1628 — decision deadlines.\n BrandAssetComposition,\n BrandAssetPurpose,\n EmailTemplateType,\n HumanDecision_RouteChangeTrigger,\n NotificationLevel,\n ReviewClockBasis,\n ReviewDeadlineKind,\n ReviewDeadlineStage,\n ReviewEscalationActionKind,\n SystemEmailTemplateRef,\n armReviewDeadlines,\n dueReviewDeadlineStages,\n isReviewWarningStage,\n resolveReviewDeadlinePolicy,\n resumeReviewServiceTargets,\n reviewDeadlineKindOfStage,\n type ArmedReviewDeadlines,\n type ReviewCalendar,\n type ReviewDeadlinePolicy,\n type User,\n ActorExecutionInterruptionCause,\n type ActorExecutionAbandonmentCause,\n modelSpendDoorOfInitiationKind,\n flowsActorsStatusChange,\n storedTurnFailureCodeOf,\n flowsActorsExecutionErrorCodeOf,\n type FlowsActors_StatusTransition,\n isLLMAgentConfiguration,\n} from '@wildo-ai/saas-models';\nimport { boundReplayedTranscript, conversationReplayBudget, ReplayBoundOutcome, type ConversationReplayBudget } from '~wildo-backend-lib/flows-actors/utils/transcript-bound.backend.utils';\nimport { carryDroppedTurns, DroppedTurnsReplayKind, parseDroppedTurnsSummary, serializeDroppedTurnsSummary } from '~wildo-backend-lib/flows-actors/services/conversation-dropped-turns-summary.backend';\nimport { runWithAgentActorFrame } from '~wildo-backend-lib/runtime/models/agent-actor-frame.als.backend';\nimport { runWithWorkAttributionFrame } from '~wildo-backend-lib/runtime/models/work-attribution.als.backend';\nimport { runOutsideModelSpendFrame, runWithModelSpendFrame } from '~wildo-backend-lib/runtime/models/model-spend-frame.als.backend';\nimport type { HumanDecisionActingActor, HumanDecisionHost, HumanDecisionLapsedActor } from '~wildo-backend-lib/flows-actors/models/human-decision-host.backend.port';\nimport { humanDecisionDeciderEventFields, humanDecisionDeciderRecordOfActor, humanDecisionRequesterEventFields } from '~wildo-backend-lib/flows-actors/utils/human-decision-decider.backend.utils';\nimport { humanDecisionReplyAnswerOf, type HumanDecisionReplyAnswer } from '~wildo-backend-lib/flows-actors/utils/human-decision-reply-answer.backend.utils';\nimport { sealDecisionInTransaction, type DecisionSealFacts } from '~wildo-backend-lib/compliance/approval-seals/approval-seal-store.backend';\nimport {\n DecisionPresentationCheckKind,\n acknowledgeDecisionPresentation,\n decisionPresentationKeyOfRuntime,\n decisionStatementOf,\n resolveDecisionDeliverables,\n withDecisionPresentation,\n type DecisionDeliverableFiles,\n type ResolvedDecisionDeliverables,\n} from '~wildo-backend-lib/compliance/approval-seals/decision-presentation.backend';\nimport type { FilesBackendService } from '~wildo-backend-lib/files/services/files.backend.service';\nimport type { ResourcePersistenceUnitOfWorkBackendService } from '~wildo-backend-lib/databases/services/resource-persistence-unit-of-work.backend.service';\nimport type { ServiceOptions } from '~wildo-backend-lib/base-classes/models/repositories.backend.schemas';\nimport type { ApplicationIdentityBackendService } from '~wildo-backend-lib/applications/services/application-identity.backend.service';\nimport type { ApprovalSealRelayBackendService } from '~wildo-backend-lib/compliance/approval-seals/approval-seal-relay.backend.service';\nimport { ApprovalSealMeaning, ApprovalSource, isApprovalSealOutcome } from '@wildo-ai/saas-models';\nimport type { HumanDecision_DeciderRecord } from '@wildo-ai/saas-models';\nimport {\n agentWorkOwnerOfExecution,\n owedRecordIsRepairableFromRow,\n type AgentWorkDecisionsBackendService,\n type ExecutionResolutionRow,\n} from '~wildo-backend-lib/flows-actors/services/agent-work-decisions.backend.service';\nimport {\n NO_HUMAN_DECISION_ROLE_FACTS,\n PENDING_DECISION_CLEARED,\n humanDecisionRequesterOfAuth,\n humanDecisionRequesterOfRow,\n humanDecisionRouteOfRow,\n announceHumanDecisionRouted,\n announceCapturedHumanDecision,\n announceHumanDecisionWithdrawn,\n admitHumanDecisionAnswerers,\n chatOfferableAnswerPredicate,\n collectHumanDecisionAnswerers,\n holdHumanDecisionActorToGrantingOrganization,\n HumanDecisionGrantorHoldKind,\n END_PENDING_DECISION_ROUTE_ATTEMPTS,\n isReviewerRoute,\n resolveHumanDecisionListingOrganizationIds,\n resolveHumanDecisionRoleFacts,\n humanDecisionSubjectOfToolCall,\n humanDecisionForeignKeyArgumentsEdited,\n answersAsOrganizationOwnStaff,\n HUMAN_DECISION_NAMES_NO_RECORD,\n HumanDecisionSubjectKind,\n type HumanDecisionSubject,\n toolApprovalDecisionRequest,\n toolApprovalVerdictOf,\n type HumanDecisionRoleFactsPorts,\n createHumanDecisionRoleFactsPorts,\n answeredThroughRefusalFields,\n lapsedActorRefusalReason,\n DECISION_REQUEST_REPAIR_GRACE_MS,\n DecisionRequestWriteOutcome,\n humanDecisionRequestedAuditEventId,\n readBackThrownDecisionRequestWrite,\n waitBeforeDecisionRequestRead,\n type UnrecordedDecisionRequestRepairResult,\n} from './pending-human-decision.backend.utils';\nimport {\n HumanDecisionNoticeStayLiveness,\n type HumanDecisionNoticeAnswererCheck,\n type HumanDecisionNoticeLiveStay,\n type HumanDecisionNoticeLiveStayPage,\n type HumanDecisionNoticeSource,\n type HumanDecisionNoticeStayDescription,\n type HumanDecisionNoticeStayState,\n} from '~wildo-backend-lib/flows-actors/models/human-decision-notice-source.backend.port';\nimport type { RepositoriesRegistryHandlerBackendService } from '~wildo-backend-lib/base-classes/services/repositories/repositories-registry-handler.backend.service';\nimport { RepositoryArrayAdditionPlacement } from '~wildo-backend-lib/base-classes/services/repositories/repository-guarded-mutation.backend.types';\nimport {\n DEADLINE_STAGE_FIRED_COLUMN,\n DecisionDeadlineNoticeAudience,\n armedDeadlineColumns,\n deadlineOutcomesOfRow,\n deadlineStageScheduleOfRow,\n inAppNoticeOfDeadlineStage,\n inAppDestinationOfDeadlineNotice,\n nextDueAtOfRow,\n noticedDeadlineOfStage,\n serviceTargetColumns,\n serviceTargetsOfRow,\n type DecisionDeadlineNoticeRecipient,\n} from './pending-decision-deadlines.backend.utils';\nimport type { FunctionTool_HumanApprovalGate } from '~wildo-backend-lib/flows-actors/models/function-tools.backend.definitions';\nimport type { AppConfigurationService } from '~wildo-backend-lib/config/services/app-configuration.backend.service';\nimport type { EmailBackendService } from '~wildo-backend-lib/notifications/email/services/email.backend.service';\nimport { getConfiguredPrimaryLanguage } from '~wildo-backend-lib/config/services/app-configuration.backend.utils';\nimport { AuthControllerUtils } from '~wildo-backend-lib/security/authentications/services/utils/auth-controller.utils';\nimport type { RecipientLanguageBackendService } from '~wildo-backend-lib/notifications/services/recipient-language.backend.service';\nimport { noteHumanDecisionNoticeOutcome, type HumanDecisionNoticeStayStoreBackendService } from '~wildo-backend-lib/flows-actors/services/human-decision-notice-stay-store.backend.service';\nimport type { ChatConversationStoreBackendService } from '~wildo-backend-lib/flows-actors/services/chat-conversation-store.backend.service';\nimport { confineAuthorityToChatConversationOrganization } from '~wildo-backend-lib/flows-actors/services/chat-conversation-confinement.backend.utils';\nimport type { RagRetrievalBackendService } from '~wildo-backend-lib/rag/services/rag-retrieval.backend.service';\n\n/**\n * Transport-agnostic sink for the server→client events a conversational\n * execution emits. The WebSocket layer supplies an implementation bound to the\n * initiating user's room; this service never imports `WebSocketService`, which\n * (a) keeps the runtime independent of the transport (Decision A's honest seam —\n * a future SSE/other transport could supply a different emitter) and (b) avoids\n * a circular DI dependency between the two services.\n *\n * The `event` is one of the `CoreWebSocketEvent.FLOWS_ACTORS_*` server→client\n * events; `payload` matches the corresponding `WS_FlowsActors*PayloadSchema`.\n */\nexport type FlowsActorsExecutionEmitter = (event: CoreWebSocketEvent, payload: unknown) => void;\n\n/**\n * How many candidates one indexed selection may return when listing a person's pending decisions. A\n * person with more waiting than this has a queue no list view serves; the soonest are shown and the\n * log says the cap was reached.\n */\nconst PENDING_DECISION_LIST_LIMIT = 200;\n\n/**\n * How many ACTIVE members of a decision's organization are considered when listing who it may be moved to.\n * Each is vetted with a fresh read of their roles, so the bound keeps one request's cost proportionate.\n */\nconst REASSIGN_CANDIDATE_SCAN_LIMIT = 100;\n\n/**\n * The three owner-scope variants an execution can live on — the population the lapsed-approval\n * sweep walks. Declared as data so a fourth variant is a visible omission rather than a scope the\n * sweep silently never reaches (the credential-expiry sweep's lesson, #413).\n */\n/**\n * The key namespace of conversational turn leases (#1780): `flows-actors:execution:lease:<executionId>`\n * and its two siblings. Distinct from the A2A task namespace on purpose — an A2A turn holds both, one per\n * row it keeps truthful (the task, and the conversation it runs), and neither may answer for the other.\n */\nexport const CONVERSATIONAL_TURN_LEASE_NAMESPACE = 'flows-actors:execution';\n\n/**\n * The key namespace of a WORK's liveness lease (#2829): `flows-actors:work:lease:<executionId>:<workRef>` and its two\n * siblings. Held by the continuation an answered decision releases, for its whole run, beside the execution's own lease.\n * The execution's lease cannot answer for a work: one thread runs many turns, non-chat turns may overlap on it, and the\n * one id is held by whichever of them is running, so it stays alive when the continuation of one work dies under another\n * turn. Distinct namespace for the same reason as the A2A one: neither lease may answer for the other.\n */\nexport const CONVERSATIONAL_WORK_LEASE_NAMESPACE = 'flows-actors:work';\n\n/** The id one work's lease is held under: a work is named by its first decision, which is unique to its thread. */\nexport function conversationalWorkLeaseId(executionId: string, workRef: string): string {\n return `${executionId}:${workRef}`;\n}\n\n/**\n * How long a stop of a decision's continuation that found no resumed turn is remembered, so a resume of that decision\n * released before it and registering after it is still stopped (#2550, #2821). The gap it covers is one row write and one record write; a minute is far beyond it,\n * and short enough that the memory stays a handful of entries.\n */\nconst UNMATCHED_RESUMED_TURN_STOP_MEMORY_MS = 60_000;\n\n/**\n * How long a PROCESSING row must have been still before the interrupted-turn sweep even asks its lease —\n * four lease lifetimes, the A2A sweep's window. Generous on purpose: waiting one more run to fail a dead\n * turn costs nothing, while mistaking a live one for dead kills real work.\n */\nexport const INTERRUPTED_TURN_GRACE_MS = TURN_LEASE_TTL_SECONDS * 1000 * 4;\n\n/**\n * The decision a running turn is CARRYING OUT, read off its row (#2800): the turn is that decision's continuation.\n *\n * The answer's release swaps the row to PROCESSING and stamps `lastResolvedDecisionRef` + `decidedAt` in the same write,\n * and every end of a turn stamps `finishedAt` (a completion, a failure, a cancel, and an ending of the decision itself,\n * which writes `finishedAt` equal to `decidedAt`). So a row whose last resolved decision has had no end written since\n * (`finishedAt` absent or EARLIER than `decidedAt`) is still running that decision's continuation. A thread reuses its\n * row, so `lastResolvedDecisionRef` stays after the continuation ends: a later fresh turn on the thread sees a\n * `finishedAt` at or after `decidedAt` and continues nothing.\n *\n * Read from the row as LISTED, before the settle writes its own `finishedAt`. The two instants may be written by\n * different processes, so the comparison trusts their clocks to agree to within one model call; a skew larger than the\n * continuation's whole run could name a decision whose continuation had in fact ended.\n */\nexport function continuingDecisionOfInterruptedTurn(\n row: Pick<FlowActorExecution, 'status' | 'lastResolvedDecisionRef' | 'decidedAt' | 'finishedAt'>,\n): string | undefined {\n if (row.status !== FlowsActors_Status.PROCESSING || !lastResolvedDecisionContinuationIsOpen(row)) return undefined;\n return row.lastResolvedDecisionRef ?? undefined;\n}\n\n/**\n * Whether the work the row's LAST RESOLVED decision released has had no end written since (#2800, #2821): `decidedAt` is\n * set and `finishedAt` is absent or earlier than it. The one reading of the two instants, so the interrupted-turn sweep\n * ({@link continuingDecisionOfInterruptedTurn}) and a door addressing work by its decision ({@link decisionWorkOfRow})\n * cannot disagree about when a continuation ended. Same clock caveat as the former.\n */\nfunction lastResolvedDecisionContinuationIsOpen(row: Pick<FlowActorExecution, 'lastResolvedDecisionRef' | 'decidedAt' | 'finishedAt'>): boolean {\n if (!row.lastResolvedDecisionRef || !row.decidedAt) return false;\n const decidedAtMs = new Date(row.decidedAt).getTime();\n if (Number.isNaN(decidedAtMs)) return false;\n if (row.finishedAt) {\n const finishedAtMs = new Date(row.finishedAt).getTime();\n if (Number.isNaN(finishedAtMs) || finishedAtMs >= decidedAtMs) return false;\n }\n return true;\n}\n\n/**\n * How many entries of `workEvents` a conversation row keeps (#2821): the newest. Each work appends at most two per decision\n * it raises (its continuation starting, then ending), so fifty covers every live work of any thread by a wide margin. A\n * work whose entries were all dropped is read from the row's own fields again ({@link decisionWorkOfRow}).\n */\nexport const CONVERSATION_WORK_EVENTS_RETAINED = 50;\n\n/** The newest `workEvents` entry of one work, or `undefined` when the row holds none for it. */\nfunction latestWorkEventOf(\n row: Pick<FlowActorExecution, 'workEvents'>,\n workRef: string,\n): NonNullable<FlowActorExecution['workEvents']>[number] | undefined {\n const events = row.workEvents ?? [];\n for (let index = events.length - 1; index >= 0; index -= 1) {\n if (events[index]?.workRef === workRef) return events[index];\n }\n return undefined;\n}\n\n/** Whether a write's answer is a conversation row (a repository answers the row it wrote, a store double may not). */\nfunction isFlowActorExecutionRow(value: unknown): value is FlowActorExecution {\n return typeof value === 'object' && value !== null && typeof (value as { executionId?: unknown }).executionId === 'string';\n}\n\n/**\n * Where a piece of WORK stands NOW, read off the conversation row (#2821). A work is what one fresh turn started and\n * every continuation of its answered decisions carried on, and it is named by its FIRST decision. For a door that holds\n * work by that decision rather than by the thread: one thread runs many turns, and non-chat turns may even overlap\n * (`conversationalAdvanceGuard`), so the thread's status is whichever turn wrote last, and a door reading it about an\n * earlier turn reads someone else's work (an A2A task that paused, was approved and finished, read as the PROCESSING of\n * a later task's turn in the same thread).\n */\nexport enum ConversationalDecisionWorkStanding {\n /**\n * The work waits for a human decision: the one it opened with, or one a continuation of it raised after an earlier\n * decision of it was answered. `waitingDecisionRef` names the decision that waits. Only a decision the pause RECORDED as\n * this work's (`pendingDecisionWorkRef`) is ever reported here, never one another turn of the thread raised.\n */\n WAITING = 'waiting',\n /** A decision of the work was answered and the turn continuing it has not ended (its newest `workEvents` entry). */\n CONTINUING = 'continuing',\n /**\n * The work has ended. `endedStatus` is how: the work's own newest `workEvents` entry. Absent only on the FALLBACK path\n * of {@link decisionWorkOfRow} (no entry for the work) when the row's own fields no longer say: the work ended, how is\n * not known.\n */\n ENDED = 'ended',\n}\n\n/** {@link ConversationalDecisionWorkStanding}, with what each standing carries. */\nexport type ConversationalDecisionWork =\n | { readonly standing: ConversationalDecisionWorkStanding.WAITING; readonly waitingDecisionRef: string }\n | { readonly standing: ConversationalDecisionWorkStanding.CONTINUING }\n | {\n readonly standing: ConversationalDecisionWorkStanding.ENDED;\n readonly endedStatus?: FlowsActors_Status;\n /** #2827: why the work ended FAILED, when it did and the ending recorded why. */\n readonly endedFailureCode?: FlowsActors_ExecutionErrorCode;\n };\n\n/** The decision outcomes that END a decision without an answer (`endPendingDecision`). */\ntype DecisionEndingOutcome = HumanDecision_Outcome.LAPSED | HumanDecision_Outcome.WITHDRAWN | HumanDecision_Outcome.REQUESTER_AUTHORITY_LAPSED;\n\n/**\n * #2827: what ending a decision without an answer writes, by its outcome: a withdrawal ends the work CANCELLED, a lapse\n * and a lapsed requester authority end it FAILED, with the code its client is told. Total over the ending outcomes, so the\n * code cannot be forgotten for one; {@link STATUS_WRITTEN_BY_DECISION_ENDING} reads its statuses here. One cause overrides\n * the outcome: an ERASURE's ending CANCELS the work whatever its outcome ({@link DECISION_ENDED_BY_ERASURE}, #2865).\n */\nconst DECISION_ENDING_TRANSITION: Readonly<Record<DecisionEndingOutcome, ConversationalTurnTerminalEnding>> = Object.freeze({\n [HumanDecision_Outcome.LAPSED]: { status: FlowsActors_Status.FAILED, failureCode: FlowsActors_ExecutionErrorCode.DECISION_LAPSED },\n [HumanDecision_Outcome.WITHDRAWN]: { status: FlowsActors_Status.CANCELLED },\n [HumanDecision_Outcome.REQUESTER_AUTHORITY_LAPSED]: { status: FlowsActors_Status.FAILED, failureCode: FlowsActors_ExecutionErrorCode.DECISION_REQUESTER_AUTHORITY_LAPSED },\n});\n\n/**\n * #2865: what ending a decision because a person's ERASURE leaves nobody it could continue for writes, whatever its\n * outcome (`REQUESTER_AUTHORITY_LAPSED` for one they raised, `WITHDRAWN` for one assigned to them with no role to go back\n * to). The work is CANCELLED: nothing in it went wrong, and nobody is left to ask again, so it is not a failure and owes no\n * failure code (#2827). The OUTCOME still says why on the decision's record; the CAUSE decides how the work ends. The\n * actor plane ends the same case ABORTED, its own non-failure ending (`endSuspendedExecutionForErasure`).\n *\n * A separate constant rather than a row of {@link DECISION_ENDING_TRANSITION}, because that table is keyed by the outcome,\n * and the same outcome ends work FAILED when an ANSWER meets a lapsed authority (the person was told to ask again). Keying\n * the work's ending on the outcome alone is what turned an erasure's ending FAILED when #2827 replaced the per-call status\n * with the table.\n */\nconst DECISION_ENDED_BY_ERASURE: ConversationalTurnTerminalEnding = Object.freeze({ status: FlowsActors_Status.CANCELLED });\n\n/**\n * The status a decision's OWN ending writes onto the row, by its outcome (`endPendingDecision`), as\n * {@link DECISION_ENDING_TRANSITION} states it. An ANSWER (accepted, modified, rejected) ends nothing: it releases a\n * continuation, whose own end is the work's. Total over the vocabulary, so an outcome added tomorrow must be classified here.\n *\n * Not what an ERASURE's ending wrote ({@link DECISION_ENDED_BY_ERASURE}): a reader with the row's history reads the\n * ending's own entry first (`decisionEndingEntryOf`), and this table answers only for a row whose entry is missing.\n */\nconst STATUS_WRITTEN_BY_DECISION_ENDING: Readonly<Record<HumanDecision_Outcome, FlowsActors_Status | undefined>> = Object.freeze({\n [HumanDecision_Outcome.ACCEPTED]: undefined,\n [HumanDecision_Outcome.ACCEPTED_WITH_MODIFICATIONS]: undefined,\n [HumanDecision_Outcome.REJECTED]: undefined,\n [HumanDecision_Outcome.LAPSED]: DECISION_ENDING_TRANSITION[HumanDecision_Outcome.LAPSED].status,\n [HumanDecision_Outcome.WITHDRAWN]: DECISION_ENDING_TRANSITION[HumanDecision_Outcome.WITHDRAWN].status,\n [HumanDecision_Outcome.REQUESTER_AUTHORITY_LAPSED]: DECISION_ENDING_TRANSITION[HumanDecision_Outcome.REQUESTER_AUTHORITY_LAPSED].status,\n});\n\n/** The statuses a conversational turn ENDS in; a row in any other status is running or waiting. */\nconst CONVERSATIONAL_TURN_ENDINGS: ReadonlySet<FlowsActors_Status> = new Set([\n FlowsActors_Status.COMPLETED, FlowsActors_Status.FAILED, FlowsActors_Status.CANCELLED, FlowsActors_Status.ABORTED,\n]);\n\n/**\n * The `statusChanges` entry a decision's own ending appended (#2865): `endPendingDecision` writes it at the instant it\n * writes as `decidedAt`, with the status the ending set. The newest such entry, or `undefined` for a row written before\n * the ending recorded one, or whose history lost it.\n */\nfunction decisionEndingEntryOf(\n row: Pick<FlowActorExecution, 'decidedAt' | 'statusChanges'>,\n): { readonly status: FlowsActors_Status; readonly failureCode?: string | null } | undefined {\n const decidedAtMs = row.decidedAt ? new Date(row.decidedAt).getTime() : Number.NaN;\n if (Number.isNaN(decidedAtMs)) return undefined;\n for (const entry of [...(row.statusChanges ?? [])].reverse()) {\n if (!entry?.timestamp || new Date(entry.timestamp).getTime() !== decidedAtMs) continue;\n if (entry.status && CONVERSATIONAL_TURN_ENDINGS.has(entry.status as FlowsActors_Status)) {\n return entry as { readonly status: FlowsActors_Status; readonly failureCode?: string | null };\n }\n }\n return undefined;\n}\n\n/**\n * Where the work named by `workRef` (its FIRST decision) stands, read off its conversation row (#2821). Pure; the row is\n * read by the caller under the conversation's isolation axes.\n *\n * Decided from what the row records about THIS work, never from the thread's own status or instants, which belong to\n * whichever turn wrote last once non-chat turns overlap:\n *\n * - WAITING: the row waits on a decision whose pause recorded it as this work's (`pendingDecisionWorkRef`: the decision\n * itself for a fresh turn, the work's first decision for a continuation that paused again). A decision an overlapping\n * turn raised is never this work's.\n * - Otherwise this work's newest `workEvents` entry: `PROCESSING` (an answer released a decision of it and that\n * continuation has not ended) → CONTINUING; an ending status → ENDED with that status. Each entry is appended by its own\n * work's release or ending through a write that does not depend on the row's status, so another turn completing,\n * pausing, or having its own decision answered in the meantime changes nothing here.\n * - FALLBACK, only when the row holds no entry for this work (a row written before the log existed, entries dropped by\n * the bound, or a process with no repository to append through): the row's own fields, as before #2821's per-work log.\n * This work holds the last resolved decision (`lastResolvedDecisionWorkRef`) and no end was written since it was\n * decided → CONTINUING; the decision's own ending → ENDED as its own `statusChanges` entry at `decidedAt` says\n * (`decisionEndingEntryOf`, #2865), or as its outcome says ({@link STATUS_WRITTEN_BY_DECISION_ENDING}) when that entry is\n * missing; the row's ending when no turn has started on the thread since → ENDED with it; else ENDED, how unknown.\n * These read the thread's instants and are exact only while no turn overlaps this work's — the reason the log exists.\n *\n * A continuation whose PROCESS dies leaves its work's newest entry PROCESSING, and so does an ending append lost to a\n * store error (logged at `recordWorkEvent`). Neither reads CONTINUING for long (#2829): the continuation holds its WORK's\n * liveness lease ({@link CONVERSATIONAL_WORK_LEASE_NAMESPACE}) from before its PROCESSING entry until after its ending\n * entry, and the interrupted-turn sweep records FAILED for a work whose lease is gone, on a thread it finds by\n * `workContinuationOpenedAt` whatever the thread's status (`sweepAbandonedWorkContinuations`). Between the death and that\n * sweep (its grace window, then one run, or two when the lease never could be written) the work still reads CONTINUING.\n * A lost ending is recorded FAILED, not as the ending that was lost: the sweep knows only that nothing runs the work.\n */\nexport function decisionWorkOfRow(\n row: Pick<FlowActorExecution, 'status' | 'pendingDecisionRef' | 'pendingDecisionWorkRef' | 'lastResolvedDecisionRef' | 'lastResolvedDecisionWorkRef'\n | 'decidedAt' | 'finishedAt' | 'decisionOutcome' | 'messages' | 'workEvents' | 'statusChanges'>,\n workRef: string,\n): ConversationalDecisionWork {\n // A row written before the work columns existed names no work: its decision is taken to open its own.\n if (row.status === FlowsActors_Status.AWAITING_APPROVAL && row.pendingDecisionRef && (row.pendingDecisionWorkRef ?? row.pendingDecisionRef) === workRef) {\n return { standing: ConversationalDecisionWorkStanding.WAITING, waitingDecisionRef: row.pendingDecisionRef };\n }\n const latest = latestWorkEventOf(row, workRef);\n if (latest) {\n if (latest.status === FlowsActors_Status.PROCESSING) return { standing: ConversationalDecisionWorkStanding.CONTINUING };\n if (CONVERSATIONAL_TURN_ENDINGS.has(latest.status)) {\n return {\n standing: ConversationalDecisionWorkStanding.ENDED,\n endedStatus: latest.status,\n ...(latest.status === FlowsActors_Status.FAILED && latest.failureCode ? { endedFailureCode: latest.failureCode } : {}),\n };\n }\n }\n // FALLBACK: no entry for this work (see above).\n if ((row.lastResolvedDecisionWorkRef ?? row.lastResolvedDecisionRef) !== workRef) return { standing: ConversationalDecisionWorkStanding.ENDED };\n if (lastResolvedDecisionContinuationIsOpen(row)\n && (row.status === FlowsActors_Status.PROCESSING || row.status === FlowsActors_Status.AWAITING_APPROVAL)) {\n return { standing: ConversationalDecisionWorkStanding.CONTINUING };\n }\n const endingStatus = row.decisionOutcome ? STATUS_WRITTEN_BY_DECISION_ENDING[row.decisionOutcome] : undefined;\n if (endingStatus) {\n // #2865: the ending's own history entry says how it ended the work, which the outcome alone cannot for an erasure's\n // ending (CANCELLED, where an answer meeting the same lapsed authority ends it FAILED). The outcome answers only for\n // a row whose entry is missing.\n const entry = decisionEndingEntryOf(row);\n if (entry) {\n const failureCode = entry.status === FlowsActors_Status.FAILED ? flowsActorsExecutionErrorCodeOf(entry.failureCode) : undefined;\n return { standing: ConversationalDecisionWorkStanding.ENDED, endedStatus: entry.status, ...(failureCode ? { endedFailureCode: failureCode } : {}) };\n }\n // #2827: the decision's own ending decides the code too.\n const transition = DECISION_ENDING_TRANSITION[row.decisionOutcome as DecisionEndingOutcome];\n return {\n standing: ConversationalDecisionWorkStanding.ENDED,\n endedStatus: endingStatus,\n ...(transition?.status === FlowsActors_Status.FAILED ? { endedFailureCode: transition.failureCode } : {}),\n };\n }\n const decidedAtMs = row.decidedAt ? new Date(row.decidedAt).getTime() : Number.NaN;\n const turnStartedSince = Number.isNaN(decidedAtMs) || (row.messages ?? []).some((message) => message.role === FlowsActors_ConversationRole.USER\n && !(new Date(message.createdAt).getTime() < decidedAtMs));\n if (CONVERSATIONAL_TURN_ENDINGS.has(row.status) && !turnStartedSince) {\n const failureCode = storedTurnFailureCodeOf(row);\n return { standing: ConversationalDecisionWorkStanding.ENDED, endedStatus: row.status, ...(failureCode ? { endedFailureCode: failureCode } : {}) };\n }\n return { standing: ConversationalDecisionWorkStanding.ENDED };\n}\n\n/** What one interrupted-turn sweep did. `failed` counts repairs only; every other count is a row left alone, and why. */\nexport interface InterruptedTurnSweepResult {\n /** True when the run did nothing because the lease could not be trusted here. */\n readonly abstained: boolean;\n readonly scanned: number;\n readonly failed: number;\n readonly stillAlive: number;\n /** Rows that ended between the listing and the repair — NOT repairs. */\n readonly raced: number;\n /** Rows whose missing lease is not yet explained; this run recorded the absence for the next. */\n readonly awaitingCorroboration: number;\n /** Rows about which this run learned nothing. */\n readonly undetermined: number;\n /** Owner scopes whose running turns could not be listed. */\n readonly unreadScopes: number;\n /** The second pass of the same run: works whose continuation's process is gone, on any thread (#2829). */\n readonly works: AbandonedWorkSweepResult;\n}\n\n/**\n * What the abandoned-work pass of one interrupted-turn sweep did (#2829). `failed` counts repairs only. The other work\n * counts say why a work was left alone; `scanned` and `settled` count THREADS.\n */\nexport interface AbandonedWorkSweepResult {\n /** Threads listed because a continuation was released on them and not yet seen to end. */\n readonly scanned: number;\n /** Works recorded FAILED: their continuation's lease is gone, and nothing else ended them. */\n readonly failed: number;\n /** Works whose continuation still holds its lease. */\n readonly stillAlive: number;\n /** Works whose continuation paused again: the thread waits on that work's decision, so nothing runs it, by design. */\n readonly waiting: number;\n /** Works that ended, or started a new continuation, between the listing and the repair — NOT repairs. */\n readonly raced: number;\n /** Works whose missing lease is not yet explained; this run recorded the absence for the next. */\n readonly awaitingCorroboration: number;\n /** Works about which this run learned nothing (the lease enquiry, the re-read or the append failed). */\n readonly undetermined: number;\n /** Threads whose `workContinuationOpenedAt` was removed: every work on them was seen ended or waiting. */\n readonly settled: number;\n /** Owner scopes whose threads could not be listed. */\n readonly unreadScopes: number;\n}\n\nconst NO_ABANDONED_WORK_SWEEP: AbandonedWorkSweepResult = Object.freeze({\n scanned: 0, failed: 0, stillAlive: 0, waiting: 0, raced: 0, awaitingCorroboration: 0, undetermined: 0, settled: 0, unreadScopes: 0,\n});\n\n/**\n * The works of a thread whose newest `workEvents` entry is `PROCESSING`, each with that entry: the works a continuation\n * was released for and that nothing recorded ending since (#2829). Ordered by that entry, oldest first.\n */\nexport function worksWithOpenContinuation(row: Pick<FlowActorExecution, 'workEvents'>): ReadonlyArray<NonNullable<FlowActorExecution['workEvents']>[number]> {\n const newest = new Map<string, NonNullable<FlowActorExecution['workEvents']>[number]>();\n for (const event of row.workEvents ?? []) {\n newest.delete(event.workRef);\n newest.set(event.workRef, event);\n }\n return [...newest.values()].filter((event) => event.status === FlowsActors_Status.PROCESSING);\n}\n\nexport const FLOW_ACTOR_EXECUTION_OWNER_VARIANTS: readonly CoreResourceType[] = Object.freeze([\n CoreResourceType.USER_FLOW_ACTOR_EXECUTIONS,\n CoreResourceType.ORGANIZATION_FLOW_ACTOR_EXECUTIONS,\n CoreResourceType.APPLICATION_FLOW_ACTOR_EXECUTIONS,\n]);\n\n/**\n * What one lapsed-approval sweep did (#484). Counted apart because each wants a different reaction\n * from whoever reads the batch output:\n *\n * - `lapsed` — a pause nobody answered in its window, now FAILED. The repair.\n * - `stillOpen` — paused and inside its window (or paused under the pre-#465 contract, with no\n * expiry at all). Correctly left alone.\n * - `raced` — lapsed when read, but the row had moved on by the time the compare-and-swap ran: a\n * decision landed, or a re-pause replaced the blob. NOT a repair, and counting it as one is how a\n * sweep claims work it did not do.\n * - `unreadable` — `AWAITING_APPROVAL` with a missing or unparseable blob. Not failed here: without\n * a readable expiry nothing says the window closed, and the resume path already refuses such a row\n * loudly. Reported so a run that is mostly this is visibly degraded rather than quiet.\n */\nexport interface LapsedApprovalPauseSweepResult {\n scanned: number;\n lapsed: number;\n stillOpen: number;\n raced: number;\n unreadable: number;\n}\n\n/** What {@link ConversationalExecutionBackendService.endDecisionsRaisedThroughEndedRelationship} did. */\nexport interface EndedRelationshipDecisionsResult {\n /** Paused turns read and judged. */\n scanned: number;\n /** Decisions ended, raised through the relationship that ended. */\n ended: number;\n /** Turns that moved on between the listing and the ending write. */\n raced: number;\n /** Turns whose pause state could not be read; left as they stand. */\n unreadable: number;\n}\n\n/**\n * When a decision was put before the person who took it (#1599 I8): the instant it was CLAIMED, when someone claimed\n * it, else the instant it was requested — both read off the row before the settling write clears them. Never the\n * moment the record is written.\n */\nexport function decisionPresentedAtOfRow(row: Pick<FlowActorExecution, 'pendingDecisionClaimedAt' | 'pendingDecisionRequestedAt'> | undefined, fallback: Date): Date {\n const instant = row?.pendingDecisionClaimedAt ?? row?.pendingDecisionRequestedAt;\n return instant ? new Date(instant) : fallback;\n}\n\n/**\n * The columns a settling compare-and-swap writes so that its decision record survives a crash (#1599 I3): the\n * decision the record is owed for, and when it was presented. Spread INTO the settling write — never written apart\n * from it, which is the one mutation that would lose a record to a crash between the two writes.\n */\nexport function correctionMarkerOf(\n decisionRef: string,\n row: Pick<FlowActorExecution, 'pendingDecisionClaimedAt' | 'pendingDecisionRequestedAt' | 'pendingDecisionOrganizationId'> | undefined,\n decidedAt: Date,\n admittedByRole?: string,\n): { pendingCorrectionRecordRef: string; pendingCorrectionPresentedAt: Date; pendingCorrectionOrganizationId: string | null; pendingCorrectionAdmittedByRole: string | null } {\n return {\n pendingCorrectionRecordRef: decisionRef,\n pendingCorrectionPresentedAt: decisionPresentedAtOfRow(row, decidedAt),\n // Review F4: the same write clears the route columns, so the marker keeps what a repaired record needs of them.\n pendingCorrectionOrganizationId: row?.pendingDecisionOrganizationId ?? null,\n pendingCorrectionAdmittedByRole: admittedByRole ?? null,\n };\n}\n\n/**\n * What one decision-deadline sweep did (#1628). `raced` counts a stage another writer settled first — the\n * stage had already fired, the decision ended or was paused, or a reassignment's route moved meanwhile.\n * `repaired` counts a row selected with nothing actually due, whose next-due instant was recomputed.\n */\nexport interface DecisionDeadlineSweepResult {\n scanned: number;\n fired: number;\n raced: number;\n unreadable: number;\n repaired: number;\n}\n\n/**\n * Owner scope of a conversation — EXACTLY ONE owner. Selects the persisted\n * polymorphic variant resource and its owner FK:\n * - `{ userId }` → `userFlowActorExecutions` (WS chat + user-delegated A2A)\n * - `{ organizationId }` → `organizationFlowActorExecutions` (org-machine A2A)\n * - `{ applicationId }` → `applicationFlowActorExecutions` (app-machine A2A)\n *\n * A conversation is owned by exactly one scope; the runtime never mixes owners on\n * one row. Resolved to `{ resourceType, ownerFields, scopeContext }` by\n * `resolveOwnerVariant`.\n */\nexport type ConversationalOwnerScope =\n | { userId: string }\n | { organizationId: string }\n | { applicationId: string };\n\n/**\n * One approve-with-modifications decision, prepared and ready to resume (#566).\n *\n * Produced by ONE walk of the SDK's message array, which is why the argument names ride here rather\n * than being recomputed at the emit site: a second walk could disagree with the version that was signed.\n * The resolved decision records the NAMES only (#1594); input digests were retired from the trail, since\n * an unkeyed digest of low-entropy arguments is reversible by enumeration and the ledger cannot be scrubbed.\n */\ninterface PreparedToolCallModification {\n /** The agent whose declaration gated the tool — for the trail, so a row reads back to a config. */\n agentRef: string;\n /** The tool name AS THE SDK ARRAY DECLARES IT, which is what the re-signature was computed over. */\n toolName: string;\n /** The rewritten, re-signed resume payload. */\n sdkModelMessages: Record<string, unknown>[];\n /** Argument NAMES the approver changed, sorted. Names only — never values. */\n modifiedArgumentKeys: string[];\n}\n\n/** `message` is for the log; `refusal` is what the approver is shown, as labels (#1186). */\ninterface ToolCallRefusal {\n kind: ToolApprovalModificationOutcomeKind.REFUSED;\n message: string;\n refusal: WS_FlowsActorsApprovalModificationRefusal;\n /** #3295: for the doors that get only the outcome (the inbox), which have no error payload to read `refusal` from. */\n humanDecisionRefusalReason?: HumanDecision_RefusalReason;\n}\n\n/**\n * The outcome of preparing a modification, discriminated by\n * {@link ToolApprovalModificationOutcomeKind} — see that enum for why the discriminant is a named\n * string rather than an `ok` boolean (this package compiles with `strict: false`, under which a\n * boolean-literal discriminant narrows nothing).\n *\n * `UNCHANGED` is the honest encoding of an edit that changed nothing: the turn resumes untouched and\n * no audit row is written, because a person who typed the same arguments back did not author them.\n */\ntype ToolCallModificationPreparation =\n | { kind: ToolApprovalModificationOutcomeKind.MODIFIED; modification: PreparedToolCallModification }\n | { kind: ToolApprovalModificationOutcomeKind.UNCHANGED }\n | ToolCallRefusal;\n\n/**\n * What a deletion found between itself and an execution row's decision (#2582). The DELETE's door reads it and refuses\n * every outcome but the first two: the row is the only thing a missing record could be repaired from, and the only\n * thing a decision still waiting could be ended on, so it may not go while either is true.\n */\nexport enum DeletedExecutionDecisionSettlement {\n /** The row held no decision and owed no record: nothing stands between it and the delete. */\n NOTHING_OWED = 'nothing_owed',\n /** Its decision was ended WITHDRAWN, recorded and announced, and the agent-work record it owed is written. */\n SETTLED = 'settled',\n /**\n * A record the row owes could not be written: the settlement of the decision just ended, or of one that ended\n * earlier. The row keeps the marker the repair sweep writes it from, so it must stay until the record exists.\n */\n RECORD_NOT_WRITTEN = 'record_not_written',\n /**\n * The run paused on a NEW decision each time the last was ended, past {@link DELETED_EXECUTION_WITHDRAWAL_ATTEMPTS}.\n * The latest is still waiting, so the delete is refused; a retry ends it.\n */\n STILL_WAITING = 'still_waiting',\n}\n\n/**\n * How many times a deletion re-reads a row whose decision it could not end because the row moved under it (#2582\n * review F5): answered and paused again on a new decision, or ended by another writer. Each extra pass needs another\n * decision to be raised in the window; a run that keeps doing so is refused rather than chased.\n */\nexport const DELETED_EXECUTION_WITHDRAWAL_ATTEMPTS = 3;\n\n/** Whether an execution row is paused on a decision a person could still answer. */\nfunction holdsPendingDecision(row: Pick<FlowActorExecution, 'status' | 'pausedApproval' | 'pendingDecisionRef'>): boolean {\n return row.status === FlowsActors_Status.AWAITING_APPROVAL && !!row.pausedApproval && !!row.pendingDecisionRef;\n}\n\n/**\n * What the resumed turn is told, beside the denier's own reason, when a denial's declared effect failed (#3015): the\n * refusal stands, and the record it was about is unchanged, so the model can say so rather than imply it moved.\n */\nconst DENIAL_EFFECT_FAILED_REASON = 'The refusal could not be applied to the record this action was about: that record is unchanged.';\n\n/** An owner scope resolved to its persisted variant + owner FK + `*AsSystem` scope map. */\nexport interface ResolvedOwnerVariant {\n resourceType: CoreResourceType;\n ownerFields: Record<string, string>;\n scopeContext: { userId?: string; organizationId?: string; applicationId?: string };\n}\n\n/** Parameters to start one conversational execution of an actor system. */\nexport interface StartConversationalExecutionParams {\n /**\n * The A2A agent this turn arrived through — absent for the WebSocket surface, which has no agent,\n * and for the default (unnamed) A2A agent. Normalised to the sentinel on the way to storage and\n * part of the continuation filter thereafter, so a held `contextId` cannot load this transcript\n * into a different agent's context (review finding G5-8).\n */\n resourceServerInstanceRef?: string;\n /** Ref of the flow/actor system to converse with. */\n systemRef: string;\n /** Client-supplied execution id; a new one is minted when absent. */\n executionId?: string;\n /** Free-form start input from the client; the user's turn is read from it. */\n initialInput?: Record<string, unknown>;\n /** Authenticated initiator identity (from the socket / A2A auth). */\n initiator: ExecutionContext_InitiatorIds;\n /**\n * Full verified auth of the caller (user OR machine principal). Used to build\n * the tool `ExecutionContext` when running the agent's tools, so tools read/write\n * as the caller with the caller's own visibility (never trusting LLM-supplied\n * identity).\n */\n auth: SocketAuthResult;\n /** Owner scope of the persisted execution (selects the variant + owner FK). */\n scopeContext: ConversationalOwnerScope;\n /**\n * The context the client opened this conversation in, canonicalised by\n * `canonicalizeFlowsActorsContextRef` — persisted on a NEW thread as `contextRef` so history can\n * be listed per context. Ignored on a continuation: the thread keeps the context it was opened in.\n */\n contextRef?: string;\n /** Sink for the server→client stream of this execution. */\n emitter: FlowsActorsExecutionEmitter;\n /**\n * Which door opened this turn (#1594). Required, so every door states it: a decision raised later in\n * the turn is routed and re-authorized by it, and it cannot be recovered from the row afterwards.\n */\n initiationKind: FlowsActors_InitiationKind;\n /**\n * The stored inbound delivery the user's message arrived through (#2665): set by the chat door from the delivery it\n * runs for, never by a request. Recorded on the user message, so the transcript says which messages came from chat\n * (the reply posted there answers those, never an in-app one) and an audit reader can join a message to its delivery.\n */\n arrivedThrough?: Inbound_Arrival;\n /**\n * Cooperative cancellation for this turn's model call. Supplied by the A2A transport\n * when the turn is addressable as a task (so `tasks/cancel` can reach it); absent for\n * WebSocket chat, where the client cancels by disconnecting.\n */\n abortSignal?: AbortSignal;\n /**\n * INSERT a new thread and never continue one (#1611 I5). The autonomous entry point sets it: its\n * `executionId` is derived from the occurrence, so an id that already exists is the same occurrence\n * arriving twice, never a conversation to append to. With it set the thread is not read at all; a row\n * that already exists makes the insert fail and the turn is reported `PERSIST_FAILED`, which the entry\n * point answers as \"already started\" after re-reading the id.\n */\n createOnly?: boolean;\n /** AUTONOMOUS turns only (#1611): what the entry point resolved, written on the new row and never updated. */\n autonomous?: ConversationalAutonomousTurnFacts;\n /**\n * The CASE this conversation works on (#1598): a row of a resource declared `workUnit: true`. Every model call\n * of the turn, and of its resumes, is attributed to it. Written on the NEW row only (the column is never\n * updated), so the thread keeps the case it was opened on and a resume, which is a different request, reopens\n * it from the row.\n *\n * The caller's boundary has ALREADY checked it (`WorkUnitCaseBackendService.admitClientCaseRef`): the\n * resource is a work unit and the caller can READ the row. This service never trusts an unchecked case.\n * An autonomous turn passes its case through `autonomous.caseRef` instead.\n */\n caseRef?: WorkUnitRef;\n /**\n * The id to store the person's message under, as the client minted it (#2525 review N1): a page that draws the message\n * before the record holds it recognises it there by identity. Ignored when the thread already holds that id — the\n * server then mints its own, so a client can never overwrite or alias a stored message.\n */\n userMessageId?: string;\n}\n\n/** What the autonomous entry point records on the row of a turn it opens (#1611). */\nexport interface ConversationalAutonomousTurnFacts {\n readonly autonomousAgentRef: string;\n readonly trigger: AutonomousTurnTrigger;\n readonly principalSource: AutonomousPrincipalSource;\n readonly caseRef?: WorkUnitRef;\n /** `SKIP_IF_ACTIVE` agents only: the concurrency slot this turn holds while active. */\n readonly activeSlotKey?: string;\n}\n\n/**\n * Drives a **conversational execution** of a flows-actors system: resolve the\n * system, find its chat actor's agent, stream the agent's token-by-token answer\n * (executing its grounding tools mid-turn), and persist the execution + full\n * message log to the owner's `*FlowActorExecutions` variant — streaming server→client\n * events over the supplied emitter throughout.\n *\n * PERSISTENCE + MULTI-TURN (server-authoritative): one execution row per\n * discussion accumulates every turn's messages. Each turn READS the existing row\n * (owner-scoped via `scopeContext` — the USER_SELF filter resolves from the scope\n * context-map, never LLM- or client-supplied identity), builds the LLM context\n * from that DURABLE transcript, and writes its user + assistant turns onto the row\n * AS IT STANDS at each write (#2743: a turn overlapping it on the same thread may have\n * written meanwhile, and a write that replaced the transcript erased that turn's\n * messages; see {@link ConversationalTurnTranscript}). Reload history is served from the same rows by the controller's\n * `/flows-actors/history` endpoint under the caller's own EC. No client-supplied\n * history is trusted, and nothing is stored browser-side.\n *\n * SCOPE: the actor conversational path streams a real round-trip against\n * `AgentsBackendService.invokeAgentStreaming` (buffered fallback for non-streaming\n * transports) with tool execution. The richer actor plan/task orchestration\n * (`actorState` graph state) is not produced yet — see the schema note.\n *\n * KIND-AGNOSTIC (Invariant): the record persisted is kind-discriminated. v1\n * implements the ACTOR conversational path only; a FLOW system fails closed with\n * a typed \"not implemented\" rather than pretending to run.\n */\n/**\n * Keep only conversation messages that can actually be PERSISTED — i.e. those carrying content.\n *\n * WHY: `FlowActorExecution_Message.content` is declared `z.string()`, which maps to a REQUIRED\n * mongoose string, and mongoose treats `''` as ABSENT — so a message with empty content fails the\n * write with `messages.<n>.content: Path 'content' is required`. That matters far beyond the one\n * message: the execution row is persisted by writing the WHOLE messages array together with the\n * terminal status, so ONE contentless message used to fail the entire update — discarding the user's\n * own turn and leaving the row wedged at PROCESSING. An assistant turn legitimately produces no text\n * (a reasoning-only step, or a tool loop whose continuation yielded nothing), so this is a real state\n * that must not cost the rest of the history.\n *\n * Dropping such a message is honest rather than lossy: an empty message carries no information, and\n * its absence — next to a COMPLETED status — is itself the signal. Callers should log the empty-reply\n * case so it stays visible.\n */\nexport function toPersistableConversationMessages(\n messages: readonly FlowActorExecution_Message[],\n): FlowActorExecution_Message[] {\n return messages.filter((message) => typeof message?.content === 'string' && message.content.length > 0);\n}\n\n/**\n * What one turn writes into its thread's transcript, as a FUNCTION of the transcript as it stands when the write lands\n * (#2743).\n *\n * One thread admits overlapping turns: two in-app or A2A messages sent before the first reply ended, or a message sent\n * while a resumed turn runs. Each turn starts from the transcript it read, and every write that advanced or ended a turn\n * used to REPLACE the row's `messages` with that turn's own snapshot. So whichever turn wrote last erased the other's\n * messages: T1 wrote `[…, u1, a1]`, T2 then wrote `[…, u2, a2]`, both replies had streamed, and a reload showed one.\n *\n * So a turn never carries a transcript. It carries what it does to one, and\n * {@link ConversationalExecutionBackendService} applies it to the row as it is at the moment the write lands, under a\n * compare-and-swap on the row's `_version` (`writeTurnTranscript`). A sibling turn's messages written meanwhile are in\n * `current`, so they stay.\n *\n * A function rather than a list of messages to append: a turn does not only append. Its trace UPDATES the tool row a\n * pause stored (`ConversationalTurnTrace.appendTo` merges a call by `toolCallId`, keeping one row per call across the\n * pause), and no array append on either store can express that. Rejected: an atomic `$push` (the guarded mutation's\n * array addition) for every write but the resumed one, which would leave two mechanisms for one invariant and the\n * resumed turn still replacing.\n */\nexport type ConversationalTurnTranscript = (current: readonly FlowActorExecution_Message[]) => FlowActorExecution_Message[];\n\n/** #2827: the end the interrupted-turn sweep records, for a turn and for the work it ran: its process went away. */\nconst TURN_INTERRUPTED_END = { status: FlowsActors_Status.FAILED, failureCode: FlowsActors_ExecutionErrorCode.TURN_INTERRUPTED } as const satisfies FlowsActors_StatusTransition;\n\n/**\n * #2827: the code a turn that ended without the pause it reached for records, tells its client, and leaves on the work it\n * ran. One constant because three sites state it (`endTurnWithoutPause`'s write, its client message, and the resumed\n * work's ending, which reads `PauseAttemptOutcome.ENDED_WITHOUT_PAUSE` and must agree with what was written). The words\n * differ per exit (the failure message); the code does not, since no exit has a remedy the client could branch on.\n */\nexport const TURN_ENDED_WITHOUT_PAUSE_CODE = FlowsActors_ExecutionErrorCode.AGENT_FAILED;\n\n/**\n * How a turn ENDS without completing (#2827): CANCELLED, or FAILED with the code its client is told. A FAILED end without\n * a code is not expressible, so every terminal failure of a turn is stored with the code a reload, a chat reply and an\n * A2A task read back.\n */\ntype ConversationalTurnTerminalEnding =\n | { readonly status: FlowsActors_Status.CANCELLED }\n | { readonly status: FlowsActors_Status.FAILED; readonly failureCode: FlowsActors_ExecutionErrorCode };\n\n/** The transcript as it stands: for a turn whose earlier work the row already holds (a resumed turn after its answer). */\nexport const TRANSCRIPT_AS_IT_STANDS: ConversationalTurnTranscript = (current) => [...current];\n\n/**\n * #2292: a turn's own write fields with its placeholders renamed to the names the conversation stores them under (see\n * `TurnPersonalDataView.stateToStore`). Only `pausedApproval` carries them: the paused call as the model wrote it, and its\n * arguments when the reader is shown placeholders.\n */\nfunction renamedPlaceholdersInTurnFields(fields: Record<string, unknown>, renames: ReadonlyMap<string, string>): Record<string, unknown> {\n if (renames.size === 0 || typeof fields.pausedApproval !== 'string') return fields;\n return { ...fields, pausedApproval: renamePlaceholders(fields.pausedApproval, renames) };\n}\n\n/**\n * #2292: the transcript to write, with this turn's placeholders renamed in the messages THIS turn added (those the row\n * did not hold). A message another turn wrote keeps its names: they are that turn's, and the row binds them.\n */\nfunction renamedPlaceholdersInTurnMessages(\n current: readonly FlowActorExecution_Message[],\n next: FlowActorExecution_Message[],\n renames: ReadonlyMap<string, string>,\n): FlowActorExecution_Message[] {\n if (renames.size === 0) return next;\n const held = new Set(current.map((message) => message.id));\n return next.map((message) => (held.has(message.id) || typeof message.content !== 'string'\n ? message\n : { ...message, content: renamePlaceholders(message.content, renames) }));\n}\n\n/**\n * The transcript with the turn's own `message` on it: left where an earlier write of the same turn put it (the user's\n * message, written when the turn advanced the row), and appended when the row does not hold it.\n */\nexport function transcriptWithTurnMessage(\n transcript: readonly FlowActorExecution_Message[],\n message: FlowActorExecution_Message,\n): FlowActorExecution_Message[] {\n return transcript.some((held) => held.id === message.id) ? [...transcript] : [...transcript, message];\n}\n\n/**\n * How many consecutive compare-and-swap misses a transcript write tolerates before it gives up (#2743). A miss means\n * ANOTHER write landed on the same row between this write's read and its write, so each one is progress for some turn.\n * Bounded only so that a row rewritten without pause can never hold a turn's end forever; reaching it throws, and every\n * caller already handles a write that throws.\n */\nconst TURN_TRANSCRIPT_WRITE_ATTEMPTS = 10;\n\n/**\n * The machine credential that owns a turn, normalised for storage and filtering.\n *\n * A user-delegated turn has none — the human is the principal and the `userId` owner FK already\n * discriminates — so it stores the sentinel rather than a null, keeping the filter a plain\n * equality on both persistence adapters.\n */\n/**\n * The agent instance a turn arrived through, normalised for storage and filtering.\n *\n * The WebSocket surface has no agent and the default A2A agent is an identity of its own; both\n * store the sentinel. One resolver rather than the expression repeated at each of the five\n * owner-scoped sites — see `.claude/rules/invariant-call-site-enumeration.md`.\n */\nfunction agentInstanceOf(resourceServerInstanceRef: string | undefined): string {\n return resourceServerInstanceRef ?? FLOWS_ACTORS_DEFAULT_AGENT_INSTANCE;\n}\n\n/**\n * The machine credential a turn's owner-scoped rows are keyed by, or the sentinel when the caller is not a machine.\n * Typed on {@link SocketAuthResult} itself, whose `initiatorIds` is NULLABLE: a hand-written structural parameter\n * omitted the `null` and so accepted no real auth result under `strictNullChecks` (#3583).\n */\nfunction machineCredentialIdOf(auth: Pick<SocketAuthResult, 'initiatorIds'> | undefined): string {\n return auth?.initiatorIds?.machineCredential?.credentialId ?? FLOWS_ACTORS_NO_MACHINE_CREDENTIAL;\n}\n\n/**\n * The server's sentence for a message refused because the thread waits for a decision (#2721). Door-neutral (#2721\n * review F-5): the decision settles by an answer, a lapse or, on the A2A door only, `tasks/cancel`, so naming one way\n * on would promise a door the reader may not have. A client words the refusal from its own labels; this sentence\n * reaches an A2A client as the JSON-RPC error's message and the log.\n */\nexport function decisionPendingMessage(decisionRef: string | undefined): string {\n return `This conversation is waiting for a decision${decisionRef ? ` (${decisionRef})` : ''}, and takes no new message until it is settled.`;\n}\n\n/** What {@link ConversationalExecutionBackendService.previewChatTurn} found (#2665 S6, plan V1). */\nexport enum ChatTurnPreviewKind {\n /** The turn may start, with the authority given (confined to the chat's organization). */\n ADMITTED = 'admitted',\n /** The conversation already holds this message. */\n ALREADY_RECEIVED = 'already_received',\n /**\n * The conversation waits for a human decision and takes no new message until it settles. When the decision is a\n * question the person's next message can answer (`replyAnswer`, #2751), the chat door answers it with the message.\n */\n WAITING_FOR_DECISION = 'waiting_for_decision',\n /** A turn is running in the conversation: the message waits for it to end. */\n BUSY = 'busy',\n /** The message cannot start a turn: consent, or a system that cannot converse. */\n REFUSED = 'refused',\n}\n\nexport type ChatTurnPreview =\n | { readonly kind: ChatTurnPreviewKind.ADMITTED; readonly auth: SocketAuthResult }\n | { readonly kind: ChatTurnPreviewKind.ALREADY_RECEIVED }\n | {\n readonly kind: ChatTurnPreviewKind.WAITING_FOR_DECISION;\n readonly decisionRef: string;\n /**\n * #2751: how the person's message answers the waiting decision, when it is an agent's question whose whole answer is\n * one piece of prose (`humanDecisionReplyAnswerOf`). Absent for every other decision, which the message cannot answer.\n */\n readonly replyAnswer?: HumanDecisionReplyAnswer;\n }\n | { readonly kind: ChatTurnPreviewKind.BUSY }\n | { readonly kind: ChatTurnPreviewKind.REFUSED; readonly errorCode: FlowsActors_ExecutionErrorCode };\n\n/**\n * The preview could not tell whether the application's consent requirement admits the turn (#2665 S6 review M1): not the\n * person's refusal, so the delivery fails this attempt and is tried again, named in its attempt record.\n */\nexport class ChatTurnConsentNotEvaluatedError extends Error {\n override readonly name = 'ChatTurnConsentNotEvaluatedError';\n\n constructor(executionId: string) {\n super(`The application's consent requirement could not be evaluated for the chat conversation ${executionId}; the message is tried again`);\n }\n}\n\n/** The server's sentence for a message refused because a chat turn admits no second turn beside it (#2665). */\nexport const CONVERSATION_BUSY_MESSAGE = 'A turn is already running in this conversation; send the message again once it ends.';\n\n/** The refusal of a turn by the system's launch gate (`SYSTEM_ROLE_NOT_HELD`, #2544 follow-up). */\nconst SYSTEM_ROLE_NOT_HELD_MESSAGE = 'This assistant is open only to certain roles, and you hold none of them here. An administrator can give you one.';\n\n/**\n * Whether a turn arriving from `arrivingKind` must wait for the turn running on `row` (#2665 A6). A conversation that a\n * chat turn is running in, or that a chat turn arrives at while any turn runs, admits ONE turn at a time: the chat\n * reply is posted where the person wrote, and two turns beside it would interleave two replies in one thread and\n * interleave two transcripts. Two in-app or A2A turns may still overlap, as before; each writes its messages onto the row\n * as it stands, so neither erases the other's (#2743, `writeTurnTranscript`).\n *\n * Decided per turn from the door, not from a column: every turn records its own door on the row, and a waiting row\n * (AWAITING_APPROVAL) is refused separately and keeps the door of the turn that paused, so the rule holds across a\n * resume. {@link conversationalAdvanceGuard} is the same rule as the advance write's filter, so a turn started between\n * the read and the write is refused too.\n */\nexport function conversationRefusesArrivingTurn(\n row: Pick<FlowActorExecution, 'status' | 'initiationKind'>,\n arrivingKind: FlowsActors_InitiationKind | null | undefined,\n): boolean {\n if (row.status !== FlowsActors_Status.PROCESSING) return false;\n return arrivingKind === FlowsActors_InitiationKind.CHAT_MESSAGE || row.initiationKind === FlowsActors_InitiationKind.CHAT_MESSAGE;\n}\n\n/**\n * The condition the single advance write puts on the row's status (#2721, #2665 A6): never out of AWAITING_APPROVAL, and\n * never onto a row a turn runs in when {@link conversationRefusesArrivingTurn} would refuse it. A chat turn excludes\n * every running row; any other turn excludes only a row a CHAT turn runs in. A running row that predates recording the\n * door (no `initiationKind`) stays advanceable: `$ne` matches a missing value on both stores (PostgreSQL compiles it as\n * `IS DISTINCT FROM`, for parity with MongoDB), pinned on both by the native lane.\n */\nexport function conversationalAdvanceGuard(arrivingKind: FlowsActors_InitiationKind | null | undefined): Record<string, unknown> {\n const notWaitingNorRunning = { status: { $nin: [FlowsActors_Status.AWAITING_APPROVAL, FlowsActors_Status.PROCESSING] } };\n if (arrivingKind === FlowsActors_InitiationKind.CHAT_MESSAGE) return notWaitingNorRunning;\n return {\n $or: [\n notWaitingNorRunning,\n { status: FlowsActors_Status.PROCESSING, initiationKind: { $ne: FlowsActors_InitiationKind.CHAT_MESSAGE } },\n ],\n };\n}\n\n/**\n * What a turn-ending write found (#2721 review N-1). A turn reports its own end only when its end was RECORDED; when\n * another turn's decision holds the thread its end is not written, and the client is told the decision waits.\n */\nenum TurnEndRecordKind {\n /** The end was written, or the write failed with nothing waiting on the row: the turn reports its own end. */\n RECORDED = 'recorded',\n /** The row waits for a decision another turn on the thread raised meanwhile: nothing was written. */\n DECISION_WAITING = 'decision_waiting',\n}\n\ntype TurnEndRecord =\n | { readonly kind: TurnEndRecordKind.RECORDED }\n | { readonly kind: TurnEndRecordKind.DECISION_WAITING; readonly decisionRef: string };\n\nconst TURN_END_RECORDED: TurnEndRecord = { kind: TurnEndRecordKind.RECORDED };\n\n/*\n * #2820: the read-back vocabulary (`DecisionRequestWriteOutcome`), its delays, the repair's grace and the request row's id\n * (`humanDecisionRequestedAuditEventId`) moved to `pending-human-decision.backend.utils`, shared with the actor,\n * operation-approval and representative-admission planes, which have the same commit-then-throw write, together with the\n * repair's result shape (`UnrecordedDecisionRequestRepairResult`).\n */\n\n/** An actor system a conversation can run on, or why the ref names none (the error the turn ends with). */\ntype ConversationalActorSystemResolution =\n | { readonly actorSystem: ActorSystem; readonly refusal?: undefined }\n | { readonly actorSystem?: undefined; readonly refusal: { readonly errorCode: FlowsActors_ExecutionErrorCode; readonly errorMessage: string } };\n\n/** A read of a decision's row that failed: nothing may be decided from it (`HumanDecisionNoticeStayLiveness.UNREADABLE`). */\nconst UNREADABLE_DECISION_ROW = Symbol('unreadable-decision-row');\n\n/** What {@link ConversationalExecutionBackendService} resumes a paused turn with. */\n/**\n * How a resumed turn ended, filled by its own end sites (#2821) for {@link ConversationalExecutionBackendService} to\n * append to the work's `workEvents` once the resume is over. `status` is the turn's own ending, set BEFORE the row write\n * that records it, since an overlapping turn may refuse that write while the work has ended all the same. Left unset when\n * the work did not end here: the resume paused again (or may have), or an inline resume of the same work recorded it.\n */\ninterface ResumedTurnEnding {\n status?: FlowsActors_Status;\n /** The error a FAILED ending reported to its owner, and recorded on the row (#2827). Every FAILED end site sets it. */\n errorCode?: FlowsActors_ExecutionErrorCode;\n /** #3313: the accepted call's `execute` was reached, whatever it answered: a tool that failed once it ran was not left unrun. */\n acceptedCallReached?: boolean;\n}\n\n/**\n * #2827: the work-log entry a resumed turn's ending records. A FAILED end site always sets its code; one that did not\n * would be a defect, recorded as the generic failure it reported rather than as no reason at all.\n */\nfunction resumedWorkTransitionOf(ending: ResumedTurnEnding & { status: FlowsActors_Status }): FlowsActors_StatusTransition {\n return ending.status === FlowsActors_Status.FAILED\n ? { status: FlowsActors_Status.FAILED, failureCode: ending.errorCode ?? FlowsActors_ExecutionErrorCode.AGENT_FAILED }\n : { status: ending.status };\n}\n\n/**\n * What one append to a thread's per-work log did (`recordWorkEvent`, #2829). The interrupted-turn sweep tells the three\n * apart: an entry that matched no row was refused by its guard (the row moved on), which is a race, while one that could\n * not be written taught it nothing.\n */\nenum WorkEventRecording {\n /** The entry is on the row. */\n LANDED = 'landed',\n /** The filter matched no row: the row is gone, or a guard in the filter (the sweep's `workContinuationOpenedAt`) moved. */\n NO_ROW = 'no-row',\n /** Not written: no repository is bound here, or the write threw (logged where it happened). */\n NOT_RECORDED = 'not-recorded',\n}\n\n/**\n * Why the abandoned-work pass left a work alone or failed it (#2829). Each value names the {@link AbandonedWorkSweepResult}\n * count it adds to, so the tally cannot count a work under a reason it did not have.\n */\nenum OpenWorkContinuationSweepOutcome {\n FAILED = 'failed',\n STILL_ALIVE = 'stillAlive',\n WAITING = 'waiting',\n RACED = 'raced',\n AWAITING_CORROBORATION = 'awaitingCorroboration',\n UNDETERMINED = 'undetermined',\n}\n\n/**\n * The outcomes after which a thread may still hold a continuation that runs, or whose death is not yet established, so its\n * `workContinuationOpenedAt` stays. A work that failed, ended, restarted or waits on its decision needs no further look:\n * a restart wrote a newer instant, and an answer to the decision will.\n */\nconst OPEN_WORK_CONTINUATION_OUTCOMES_KEEPING_THE_MARKER: ReadonlySet<OpenWorkContinuationSweepOutcome> = new Set([\n OpenWorkContinuationSweepOutcome.STILL_ALIVE,\n OpenWorkContinuationSweepOutcome.AWAITING_CORROBORATION,\n OpenWorkContinuationSweepOutcome.UNDETERMINED,\n]);\n\n\n/**\n * What the agent is told when a person refuses a call it asked to run. A question's decline had words of its own and this\n * had none, so the model received a bare denial, read it beside instructions that mention approval, and asked the person\n * who had just refused to approve the call.\n */\nconst CALL_REFUSED_BY_A_PERSON_REASON =\n 'The person reviewed this call and refused it, so it did not run. Do not ask them to approve it again. Say it was not done, and ask what they would like instead.';\n/**\n * What one attempt to pause a turn on a human decision DID (#2821), as `persistApprovalSuspension` itself knows it, so a\n * resume that paused again writes its work's log from the attempt's own outcome and never infers it from a later read of\n * the row (which an answer to the new decision, an automated approver's, can have moved on in between). A closed\n * vocabulary with one named source, per the repository's semantic-literal rule.\n */\nenum PauseAttemptOutcome {\n /** The pause landed: the work waits on the decision it raised. Nothing of the work ended. */\n RAISED = 'raised',\n /**\n * The pause write threw and could not be read back, so whether the decision was raised is unknown. The work's log\n * records nothing: if the decision waits, the work reads WAITING and its answer or its ending continues the log; if it\n * does not, the row stays PROCESSING and the interrupted-turn sweep fails the turn, which ends the work in its log.\n * Recording an ending here would be a guess that is wrong exactly when the decision waits, and an approver can answer.\n */\n UNCONFIRMED = 'unconfirmed',\n /** No pause: the turn ended through its own exits (the person's stop → CANCELLED, otherwise FAILED). */\n ENDED_WITHOUT_PAUSE = 'ended_without_pause',\n /** Nobody could answer, so the call was denied and the turn resumed inline; that resume records its own ending. */\n RESUMED_INLINE = 'resumed_inline',\n}\n\ninterface ResumeAfterApprovalParams {\n systemRef: string;\n executionId: string;\n owner: ResolvedOwnerVariant;\n paused: FlowActorExecution_PausedApproval;\n approved: boolean;\n reason?: string;\n auth?: SocketAuthResult;\n resourceServerInstanceRef?: string;\n emitter?: FlowsActorsExecutionEmitter;\n /**\n * What the turn being resumed wrote into the thread that the row does NOT hold yet; the resumed turn's own work follows\n * it, and both are written onto the row as it stands (#2743). {@link TRANSCRIPT_AS_IT_STANDS} for a decision that was\n * answered (the pause recorded everything before it); the paused turn's own transcript for an automatic denial, which\n * resumes inline with no pause written.\n *\n * REQUIRED, and no longer a transcript: every write below used to REPLACE the row's `messages` with what it was given,\n * so an omitted transcript was written as `[]` and erased the conversation the moment a resumed model call threw\n * (#2521), and a message sent while the resumed turn ran was erased by its end (#2743).\n */\n transcript: ConversationalTurnTranscript;\n /**\n * The SDK array REWRITTEN so the pending tool call carries the approver's own arguments, with\n * the approval signature re-bound to them (#566).\n *\n * Absent on every ordinary decision, which is why the fallback is the untouched\n * `paused.sdkModelMessages` rather than a merge: the contract above — \"we do not reconstruct the\n * conversation\" — still holds. A modification replaces exactly two values inside the array the\n * SDK itself produced, and nothing else about it is authored here.\n */\n modifiedSdkModelMessages?: Record<string, unknown>[];\n /**\n * #2292: the paused turn's personal-data view, when the caller holds it (an automatic denial, or an answer whose\n * modification it tokenized). Otherwise the resume opens one from `storedPersonalDataState`.\n */\n personalData?: TurnPersonalDataView;\n /** #2292: the row's `personalDataModelState`, as read with the decision. */\n storedPersonalDataState?: string | null;\n /** The decision this resume answers; stamped on every tool call it makes so each row names it (#1594). */\n decisionRef?: string;\n /**\n * #2904: the approval seal the answer's release wrote, handed to every tool call of the resume beside `decisionRef`\n * (`FunctionToolExecutionContext.decisionSealId`), so a consumer that records the decision stores its seal. Absent\n * when nothing was sealed (an automatic denial, a host without the seal services).\n */\n decisionSealId?: string;\n /**\n * The WORK this resume continues, named by its first decision (#2821): the answered decision's\n * `pendingDecisionWorkRef`, or the turn's own work for an inline resume. A pause it makes belongs to that work, and an\n * answered resume is registered under it, so a stop of the work reaches every continuation in its chain.\n */\n workRef?: string;\n /** The original requester, carried into a second pause so it is theirs, never the answerer's (D11, I10). */\n requester?: HumanDecision_Requester;\n /** The door that opened the turn, carried unchanged into a second pause. */\n initiationKind?: FlowsActors_InitiationKind | null;\n /** AUTONOMOUS turns: what started the turn, from its row (#1611). */\n autonomousTrigger?: AutonomousTurnTrigger | null;\n /** Automatic denials this turn has already had — see `persistApprovalSuspension`. */\n automaticDenials?: number;\n /**\n * The abort of the turn this resume CONTINUES, when it is resumed inline (an automatic denial): the caller's cancel\n * (A2A `tasks/cancel`, an SSE hang-up) reaches the resumed model call through it (#2721 gate-4 F4). The owner's Stop\n * does not need it: every resume registers with the running-turn registry, which it reaches. Absent on a resume an\n * answer released, which no caller is waiting on: the request that opened that work reaches it by the decision it\n * continues instead, on whichever replica runs it ({@link ConversationalExecutionBackendService.stopResumedTurns}, #2550,\n * #2821).\n */\n abortSignal?: AbortSignal;\n /**\n * When the answer that released this resume DECIDED it (its `decidedAt`, epoch ms), #2550. A stop of its decision that\n * reached this process after that instant and before the resume registered (while the release was written and the\n * decision recorded) found no turn to stop; it is honoured at registration instead. Absent on an inline resume, which\n * hears its own turn's abort — and its absence is what registers such a resume as part of that turn rather than as a\n * decision resume (`runResumeAfterApproval`).\n */\n releasedAt?: number;\n /**\n * #3313: how the decision this resume carries out was accepted, on a release that accepted one. A denial runs nothing and\n * an inline resume is an automatic denial, so neither carries it; a turn ending before an accepted call ran owes a record.\n */\n acceptedAs?: HumanDecision_Outcome;\n /** #3313: the organization the accepted decision was routed in, as its RESOLVED row names it. The release clears it from the row. */\n acceptedDecisionOrganizationId?: string;\n /**\n * The case the thread was opened on (#1598), from its row. Absent: read from the row here, so a resume is\n * attributed to its case whatever door released it — the resume is a different request, with no frame.\n */\n caseRef?: WorkUnitRef | null;\n}\n\n@injectable()\nexport class ConversationalExecutionBackendService implements HumanDecisionNoticeSource {\n constructor(\n @inject(SAAS_SERVICE_TYPES.Logger) private readonly logger: LoggerService,\n @inject(SAAS_SERVICE_TYPES.FlowsActorsRegistryService) private readonly flowsActorsRegistry: FlowsActorsRegistryService,\n @inject(SAAS_SERVICE_TYPES.AgentsBackendService) private readonly agentsBackend: AgentsBackendService,\n @inject(SAAS_SERVICE_TYPES.ResourceRegistryService) private readonly resourcesRegistry: ResourcesRegistryBackendService,\n @inject(SAAS_SERVICE_TYPES.ServicesRegistryHandlerService) private readonly servicesRegistryHandler: ServicesRegistryHandlerBackendService,\n @inject(SAAS_SERVICE_TYPES.ExecutionContextCreatorBackendService) private readonly executionContextCreator: ExecutionContextCreatorBackendService,\n @inject(SAAS_SERVICE_TYPES.SystemAccessService) private readonly systemAccess: SystemAccessBackendService,\n @inject(SAAS_SERVICE_TYPES.RateLimitBackendService) private readonly rateLimitService: RateLimitBackendService,\n // Appended LAST deliberately: a constructor parameter inserted mid-list silently re-binds every\n // positional construction site (the DI container resolves by decorator, hand-built test doubles\n // do not).\n @inject(SAAS_SERVICE_TYPES.AuthorizationsService) private readonly authorizer: AuthorizationsBackendService,\n /**\n * The trail an approve-with-modifications decision leaves. `@optional` and feature-detected at\n * every use, for the reason the MCP emitter already records: an absent or failing audit sink\n * must never fail the act it was going to observe, and this service is constructed positionally\n * by hand in several test doubles.\n */\n @inject(SAAS_SERVICE_TYPES.AuditLogsService) @optional() private readonly auditLogs?: AuditLogsBackendService,\n /**\n * Where a newly routed decision is announced to the people it was routed to (#1594 D6). `@optional()`:\n * a process with no socket server (a worker, a minion) routes decisions just the same, and those people\n * find them in their inbox. Appended last, like every optional injection here.\n */\n @inject(SAAS_SERVICE_TYPES.WebSocketService) @optional() private readonly webSocket?: WebSocketService,\n /**\n * Where a running turn's liveness lease is written (#1780). `@optional()`: a process with no Redis\n * bound runs turns exactly the same and leases none, and the interrupted-turn sweep abstains there\n * because the lease cannot be written. Appended last, like every optional injection here.\n */\n @inject(SAAS_SERVICE_TYPES.RedisService) @optional() redisService?: RedisService,\n /**\n * #1628: the application's `reviewCalendar` (CALENDAR-basis deadlines) and its identity, for a deadline\n * email. `@optional()` and appended last: absent, every clock counts elapsed time — which startup has\n * already guaranteed is what every gate asks for — and no email carries a link.\n */\n @inject(SAAS_SERVICE_TYPES.AppConfigService) @optional() private readonly appConfig?: AppConfigurationService,\n /** #1628: deadline reminders by email. `@optional()`: absent, reminders go in-app only. */\n @inject(SAAS_SERVICE_TYPES.EmailService) @optional() private readonly emailService?: EmailBackendService,\n // Writes a person's own emails in their language (#1799 review M3).\n @inject(SAAS_SERVICE_TYPES.RecipientLanguageService) @optional() private readonly recipientLanguage?: RecipientLanguageBackendService,\n /**\n * The HOSTS of decision planes beside this one (#1612, #2539): a granting organization's per-representative\n * approvals (a representing organization's assignment) and an application's actor-system questions (its own actor\n * plane). Their cards join this inbox and their acts this act route, so a person has one list and one door whatever\n * plane a decision is on. `@optional()`: absent, only the conversational plane is served.\n *\n * A list since #2539. The note that stood here said a SECOND host \"would turn this into a registry; one does not\n * justify one\" — the actor plane is that second host, so it is now a list bound in one place (the container), and\n * each host answers for its own decisions (`holdsDecision`) by id alone.\n */\n @inject(SAAS_SERVICE_TYPES.HumanDecisionHosts) @optional() private readonly humanDecisionHosts?: readonly HumanDecisionHost[],\n /**\n * #1599: where a settled decision on an agent's proposal is recorded. `@optional()` and appended last: absent, a\n * decision still settles and its marker stays on the row for a process that has the recorder to repair.\n */\n @inject(SAAS_SERVICE_TYPES.AgentWorkDecisionsService) @optional() private readonly agentWorkDecisions?: AgentWorkDecisionsBackendService,\n /**\n * #2664: what the walk over a decision's holders reads, by keyset (`collectHumanDecisionAnswerers`). `@optional()` and\n * appended last: absent, a ROLE decision's notices reach nobody (with a warning) and the decision is in the inbox.\n */\n @inject(SAAS_SERVICE_TYPES.RepositoriesRegistryHandlerService) @optional() private readonly repositoriesRegistry?: RepositoriesRegistryHandlerBackendService,\n /**\n * #2664 S5b gate L3: where a resolved decision's outcome reaches its chat cards, so their withdraw says it was\n * answered or lapsed. `@optional()` and appended last: absent, a withdrawn card says it can no longer be acted on.\n */\n @inject(SAAS_SERVICE_TYPES.HumanDecisionNoticeStayStore) @optional() private readonly decisionNoticeStays?: Pick<HumanDecisionNoticeStayStoreBackendService, 'recordDecisionOutcome'>,\n /**\n * #2665 S6 B7: the chat-conversation ledger. A conversation with a row there lives in a chat: its turns run confined\n * to that row's organization, and its resume owes the chat a reply. `@optional()` and appended last: bound in every\n * application container; a hand-built service without it has no chat conversation to confine.\n */\n @inject(SAAS_SERVICE_TYPES.ChatConversationStore) @optional() private readonly chatConversations?: Pick<ChatConversationStoreBackendService, 'readByExecutionId' | 'oweReply'>,\n /**\n * #2300: what the engine's retrieval tool searches with, on the caller's authority. `@optional()` and appended last:\n * bound in every application container; a hand-built service without it offers no retrieval, and the tool says so.\n */\n @inject(SAAS_SERVICE_TYPES.RagRetrievalService) @optional() private readonly ragRetrieval?: Pick<RagRetrievalBackendService, 'retrieve'>,\n /**\n * #2903: the transaction an answered decision's release and its approval seal commit in. `@optional()` and appended\n * last: bound in every application container; a hand-built service without it releases and seals nothing.\n */\n @inject(SAAS_SERVICE_TYPES.ResourcePersistenceUnitOfWorkService) @optional() private readonly unitOfWork?: Pick<ResourcePersistenceUnitOfWorkBackendService, 'executeTransaction'>,\n /** #2903: the application RECORD a seal belongs to (never the platform's id for the process). `@optional()`, appended last. */\n @inject(SAAS_SERVICE_TYPES.ApplicationIdentityService) @optional() private readonly applicationIdentity?: Pick<ApplicationIdentityBackendService, 'getCanonicalApplicationId'>,\n /** #2903: signs a seal right after its decision commits; the relay batch signs what this did not. `@optional()`, last. */\n @inject(SAAS_SERVICE_TYPES.ApprovalSealRelayService) @optional() private readonly approvalSealRelay?: Pick<ApprovalSealRelayBackendService, 'sealSoon'>,\n /**\n * #2904: where a tool approval's file deliverable is read and hashed (`ensureContentHash`) before its card and its seal\n * bind it. `@optional()`, appended last: bound in every application container; a hand-built service without it shows\n * and seals every declared deliverable as NOT bound.\n */\n @inject(SAAS_SERVICE_TYPES.FilesBackendService) @optional() private readonly files?: Pick<FilesBackendService, 'getFile' | 'ensureContentHash'>,\n /**\n * #2923: where a decision's step-up proof is read and consumed, for a gated tool that declares\n * `humanApproval.requiresStepUpAuthentication`. `@optional()`, appended last: bound in every application container; a\n * hand-built service without it refuses every answer to such a decision (fail closed), and requires nothing else.\n */\n @inject(SAAS_SERVICE_TYPES.ConsumableTokenService) @optional() private readonly consumableTokens?: Pick<ConsumableTokenBackendService, 'validateToken' | 'consumeToken'>,\n ) {\n this.turnLease = redisService\n ? new TurnLivenessLease({ keyNamespace: CONVERSATIONAL_TURN_LEASE_NAMESPACE, logTag: '[ConversationalExecution]', subjectNoun: 'Execution', logger, redisService })\n : undefined;\n this.workLease = redisService\n ? new TurnLivenessLease({ keyNamespace: CONVERSATIONAL_WORK_LEASE_NAMESPACE, logTag: '[ConversationalExecution]', subjectNoun: 'Work', logger, redisService })\n : undefined;\n this.resumedTurnStops = redisService\n ? new ResumedTurnStopBroadcast({ redisService, logger, onStop: (executionId, workRef) => { this.stopResumedTurnsHere(executionId, workRef); } })\n : undefined;\n // Subscribed from the start (Redis is connected before a backend constructs this), so a replica is stoppable before\n // its first turn. Not the guarantee — the answer awaits its own arm before it releases (`answerPendingDecision`).\n void this.resumedTurnStops?.arm();\n }\n\n /**\n * The fleet channel a stop of a RESUMED turn travels on (#2550), or `undefined` when no Redis is bound: a process\n * with no Redis is the only replica there is, and {@link stopResumedTurns} stops its own turns directly.\n */\n private readonly resumedTurnStops: ResumedTurnStopBroadcast | undefined;\n\n /**\n * The liveness lease of every conversational turn this process is running (#1780), or `undefined` when\n * no Redis is bound. A turn holds it for exactly as long as its row says PROCESSING, so a row that says\n * PROCESSING with no lease behind it was left by a process that is gone.\n */\n private readonly turnLease: TurnLivenessLease | undefined;\n\n /**\n * Hold the turn's lease, and return what lets it go. Taken BEFORE the row is written PROCESSING and let\n * go only AFTER the row leaves it, so a live process never shows a sweep a PROCESSING row without a lease.\n * Never throws: a lease that cannot be written leaves the turn running and merely unobservable.\n */\n private async holdTurnLease(executionId: string): Promise<() => Promise<void>> {\n const lease = this.turnLease;\n if (!lease) return async () => {};\n await lease.hold(executionId);\n return () => lease.release(executionId);\n }\n\n /**\n * The liveness lease of every WORK whose continuation this process is running (#2829), or `undefined` when no Redis is\n * bound. Held for exactly as long as the work's newest `workEvents` entry may say PROCESSING because of this process,\n * so a work whose entry says PROCESSING with no lease behind it was left by a process that is gone, whichever turn holds\n * the thread meanwhile.\n */\n private readonly workLease: TurnLivenessLease | undefined;\n\n /**\n * Hold a work's lease, and return what lets it go. Taken BEFORE the work's PROCESSING entry is appended and let go only\n * AFTER its ending entry (`recordResumedWorkEnding`) was attempted, mirroring {@link holdTurnLease}: a live continuation\n * never shows the sweep a PROCESSING entry without a lease. Never throws.\n */\n private async holdWorkLease(executionId: string, workRef: string): Promise<() => Promise<void>> {\n const lease = this.workLease;\n if (!lease) return async () => {};\n const id = conversationalWorkLeaseId(executionId, workRef);\n await lease.hold(id);\n return () => lease.release(id);\n }\n\n /**\n * Tell the people a decision is now routed to that it exists — the id and nothing else (#1594 D6). Who they are is\n * `humanDecisionHoldersOf`, the one answer the withdrawal uses too (#2569).\n */\n private announceDecisionRouted(route: HumanDecision_Route, decisionRef: string, except?: string, requester?: HumanDecision_Requester): void {\n announceHumanDecisionRouted({\n channel: this.webSocket, logger: this.logger, route, decisionRef, ...(except ? { except } : {}), ...(requester ? { requester } : {}),\n });\n }\n\n /**\n * Tell the people a decision has LEFT that it is no longer theirs (#2569) — see `announceHumanDecisionWithdrawn`.\n * Called by every site that takes a decision away from its holders: a move (`movePendingDecision`, the deadline\n * sweep's reassignment) with the version the route moved to, and an ending (`endPendingDecision`,\n * `answerPendingDecision`) with none.\n */\n private announceDecisionWithdrawn(params: {\n route: HumanDecision_Route;\n requester: HumanDecision_Requester | undefined;\n decisionRef: string;\n routeVersion?: number;\n except?: string;\n }): void {\n announceHumanDecisionWithdrawn({\n channel: this.webSocket, logger: this.logger, route: params.route, decisionRef: params.decisionRef,\n ...(params.requester ? { requester: params.requester } : {}),\n ...(params.routeVersion === undefined ? {} : { routeVersion: params.routeVersion }),\n ...(params.except ? { except: params.except } : {}),\n });\n }\n\n /**\n * A conversational turn's work attribution (#1598 §4, I3): the tenant from the OWNER fields of the persisted\n * execution (never from the caller or the model), the thread's case, and the execution itself. The recorder\n * then derives the tenant from the case row when there is one, overruling this one if they ever disagree.\n *\n * And the representing organization the turn is done through (#2618): from the role entries of the principal the turn\n * runs as (`auth`, the requester's on a resume), when they work in that tenant only through one representing\n * organization's relationships. Accounting only.\n */\n private workAttributionOf(owner: ResolvedOwnerVariant, executionId: string, caseRef: WorkUnitRef | undefined, auth: SocketAuthResult | undefined): ModelCallAttributionInput {\n const viaOrganization = resolveRelationshipWorkAttribution(auth?.initiatorRoles, owner.ownerFields.organizationId);\n return {\n ...(owner.ownerFields.organizationId ? { organizationId: owner.ownerFields.organizationId } : {}),\n ...(caseRef ? { caseRef: { resourceType: caseRef.resourceType, resourceId: caseRef.resourceId } } : {}),\n executionRef: { kind: ExecutionRefKind.CONVERSATIONAL_EXECUTION, id: executionId },\n ...(viaOrganization ? { viaOrganization } : {}),\n };\n }\n\n /** The case a persisted thread was opened on, read owner-scoped; `undefined` when none or unreadable. */\n private async readTurnCaseRef(\n owner: ResolvedOwnerVariant,\n executionId: string,\n auth: SocketAuthResult | undefined,\n resourceServerInstanceRef: string | undefined,\n ): Promise<WorkUnitRef | undefined> {\n try {\n const row = await this.systemAccess.readAsSystem<FlowActorExecution>(\n owner.resourceType,\n { executionId, ...owner.ownerFields, machineCredentialId: machineCredentialIdOf(auth), resourceServerInstanceRef: agentInstanceOf(resourceServerInstanceRef) },\n { scopeContext: owner.scopeContext, suppressSystemAudit: true },\n );\n return row?.caseRef ?? undefined;\n } catch (error) {\n this.logger.warn('[ConversationalExecution] The thread\\'s case could not be read for a resume; its calls are attributed to the execution only', {\n executionId, ...projectCaughtErrorLogFields(error),\n });\n return undefined;\n }\n }\n\n /**\n * Resolve the owner scope to its persisted polymorphic variant: the concrete\n * `CoreResourceType`, the single owner FK to write on create, and the `*AsSystem`\n * scope-context map (which seeds the contextual filter so reads/writes are scoped\n * to that owner). Fails closed if no owner is present. Priority userId → org → app\n * (a conversation has exactly one owner; priority only disambiguates a\n * mis-populated caller).\n */\n private resolveOwnerVariant(scope: ConversationalOwnerScope): ResolvedOwnerVariant {\n const s = scope as { userId?: string; organizationId?: string; applicationId?: string };\n if (s.userId) {\n return { resourceType: CoreResourceType.USER_FLOW_ACTOR_EXECUTIONS, ownerFields: { userId: s.userId }, scopeContext: { userId: s.userId } };\n }\n if (s.organizationId) {\n return { resourceType: CoreResourceType.ORGANIZATION_FLOW_ACTOR_EXECUTIONS, ownerFields: { organizationId: s.organizationId }, scopeContext: { organizationId: s.organizationId } };\n }\n if (s.applicationId) {\n return { resourceType: CoreResourceType.APPLICATION_FLOW_ACTOR_EXECUTIONS, ownerFields: { applicationId: s.applicationId }, scopeContext: { applicationId: s.applicationId } };\n }\n throw new Error('[ConversationalExecution] scopeContext carries no owner (userId | organizationId | applicationId).');\n }\n\n /**\n * Start (and, for v1, fully run) one conversational execution. Never throws to\n * the caller — every failure path is reported through the emitter as a\n * `FLOWS_ACTORS_ERROR`, so the WebSocket handler stays a thin dispatcher.\n *\n * The turn is the work of the principal it runs as (#2722): its execution row and every other record its system\n * writes create are stamped with the relationship that principal stands in the organization through, as the records\n * it creates itself are (`runAsRelationshipProvenanceOf`, the rule `doOperation` applies). A turn opens no operation,\n * so without this its row would be the organization's own even when a representing organization's admitted agent\n * (#2615) or a representative ran it.\n */\n public async startConversationalExecution(params: StartConversationalExecutionParams): Promise<void> {\n return runAsRelationshipProvenanceOf(\n params.auth,\n // The organization the turn works in: its owner's, else (a person's own thread) the one its principal acts in.\n // Never throws: a missing owner is reported by the turn itself (NO_OWNER).\n (params.scopeContext && 'organizationId' in params.scopeContext ? params.scopeContext.organizationId : undefined) ?? params.auth?.initiatorIds?.organizationId ?? undefined,\n () => this.runConversationalExecution(params),\n );\n }\n\n private async runConversationalExecution(params: StartConversationalExecutionParams): Promise<void> {\n const { systemRef, initialInput, initiator, scopeContext, emitter } = params;\n const executionId = params.executionId ?? randomUUID();\n const startedAt = Date.now();\n\n // Resolve the owner scope → its persisted variant (userFlowActorExecutions /\n // organizationFlowActorExecutions / applicationFlowActorExecutions) + owner FK.\n // Never throws to the caller — a missing owner is reported through the emitter.\n let owner: ResolvedOwnerVariant;\n try {\n owner = this.resolveOwnerVariant(scopeContext);\n } catch {\n this.emitError(emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.NO_OWNER, 'The conversation has no resolvable owner scope.');\n return;\n }\n\n // ── #2665 B7: a conversation that lives in a chat runs confined to that chat's organization ─────\n // Decided here, whichever door started this turn (the chat door, the application, a user-delegated A2A client), so a\n // member of several organizations cannot have the agent bring another organization's records into a transcript\n // posted into this one's chat. Only a person's conversation can live in a chat, and a create-only start continues no\n // conversation. A ledger that cannot be read refuses the turn, recoverably: never run it unconfined.\n let auth = params.auth;\n if (!params.createOnly && owner.resourceType === CoreResourceType.USER_FLOW_ACTOR_EXECUTIONS) {\n let chatConversation: ChatConversation | null;\n try {\n chatConversation = await this.chatConversationOf(executionId);\n } catch (error) {\n this.logger.error('[ConversationalExecution] A conversation\\'s chat record could not be read; the turn does not run unconfined', { systemRef, executionId, ...projectCaughtErrorLogFields(error) });\n this.emitError(emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.PERSIST_FAILED, 'The conversation could not be opened. Send the message again.', true);\n return;\n }\n auth = this.confineToChatConversation(auth, chatConversation);\n }\n\n // ── The application's declared consent requirement ──────────────────────\n if (!(await this.admitsUnderServiceConsentRequirement({ auth, owner, systemRef, executionId, emitter }))) return;\n\n // ── Resolve the system (ACTOR-only in v1; FLOW fails closed) ──────────────\n const actorSystem = this.resolveConversationalActorSystem(systemRef, executionId, emitter);\n if (!actorSystem) return;\n\n // ── The system's launch gate (`config.accessControl[].roles`), whichever door this turn came through ──\n // Asked of the authority the turn will hold (confined to a chat's organization above), in the organization it works\n // in. Every turn is a start: a person whose role was taken away cannot send the next message.\n const turnOrganizationId = (scopeContext && 'organizationId' in scopeContext ? scopeContext.organizationId : undefined) ?? auth?.initiatorIds?.organizationId ?? undefined;\n if (!(await this.admitsSystemStart({ auth, owner, actorSystem, organizationId: turnOrganizationId, refusedSurface: `flows-actors:turn:${params.initiationKind}` }))) {\n this.emitError(emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.SYSTEM_ROLE_NOT_HELD, SYSTEM_ROLE_NOT_HELD_MESSAGE);\n return;\n }\n\n // ── Find the chat actor's agent ──────────────────────────────────────────\n const agentRef = this.resolveChatAgentRef(actorSystem);\n if (!agentRef) {\n this.emitError(emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.NO_CHAT_ACTOR, `System '${systemRef}' has no AGENTIC actor bound to an agent to converse with.`);\n return;\n }\n\n // ── Extract the user's turn ──────────────────────────────────────────────\n const userText = this.extractUserText(initialInput);\n if (!userText) {\n this.emitError(emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.EMPTY_INPUT, 'No user message was provided to start the conversation.');\n return;\n }\n\n // ── #2750: what the conversation may send its model ───────────────────────\n // A message too large to send even with every earlier turn left out is refused here, before anything is written,\n // rather than cut: the replay below never splits a message. The earlier turns are bounded where they are built.\n const replayBudget = this.conversationReplayBudgetOf(agentRef);\n const replayCurrentTurn = { role: FlowsActors_ConversationRole.USER as string, content: userText };\n const currentTurnFit = boundReplayedTranscript([], replayCurrentTurn, replayBudget.budgetTokens);\n if (currentTurnFit.outcome === ReplayBoundOutcome.CURRENT_TURN_EXCEEDS_BUDGET) {\n this.logger.info('[ConversationalExecution] The message is larger than the agent\\'s model can be sent; the turn is refused, nothing is cut', {\n systemRef, executionId, agentRef, currentTurnTokens: currentTurnFit.currentTurnTokens, ...replayBudget,\n });\n this.emitError(emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.MESSAGE_EXCEEDS_CONTEXT_WINDOW, 'The message is too long for the assistant to read. Shorten it and send it again.');\n return;\n }\n\n // ── Load the persisted thread (server-authoritative history) ─────────────\n // One execution row per discussion accumulates every turn's message log. On a\n // CONTINUED thread the client reuses the `executionId`, so the row already\n // exists; reading it here yields BOTH the durable transcript to append to AND\n // the multi-turn context for the LLM — no client-supplied history is trusted.\n //\n // The read is owner-scoped through `scopeContext`: `readAsSystem` seeds the\n // USER_SELF filter from the scope context-map (`userId`), NOT from the absent\n // system-context initiator identity (an internal EC rejects identity fields on\n // `initiatorIds`). So a user only ever reads their own thread.\n const now = new Date();\n let priorMessages: FlowActorExecution_Message[] = [];\n let rowExists = false;\n /** A continued thread's case, as its row recorded it when it was opened (#1598). */\n let persistedCaseRef: WorkUnitRef | undefined;\n /** The decision a continued thread is waiting for, when it is (#2721). */\n let waitingDecisionRef: string | undefined;\n /** Whether a turn already running in the thread admits no second one beside it (#2665 A6). */\n let busy = false;\n /** #2292: the thread's stored placeholder table and model-side texts, as read. */\n let storedPersonalDataState: string | null | undefined;\n /** #2750: the thread's stored summary of the turns its replay leaves out, as read. */\n let storedDroppedTurnsSummary: string | null | undefined;\n // A create-only turn never reads a thread to continue (see `createOnly`): the insert decides.\n if (!params.createOnly) try {\n // Scope the lookup by the owner FK, NOT `executionId` alone: `executionId` is\n // CALLER-SUPPLIED (the A2A `contextId`), and the APPLICATION variant's `*AsSystem`\n // scope-context map does NOT carry `applicationId` (system-access forwards it to\n // `initiatorIds`, which the contextual filter never reads). Without the owner FK\n // in the filter, an app-machine that supplies ANOTHER app's `executionId` would\n // read/continue that app's conversation. The FK makes every variant fail-closed\n // (redundant-but-harmless for USER/ORG, load-bearing for APP).\n const existing = await this.systemAccess.readAsSystem<FlowActorExecution>(\n owner.resourceType,\n // The CREDENTIAL axis rides alongside the owner FK (finding H-5). The scope FK does not\n // identify the principal on the machine variants — `applicationId` is a deployment\n // singleton and `organizationId` is shared by every machine client of one tenant — so\n // without it a separately-credentialed client could continue another's conversation and\n // read its whole message log.\n { executionId, ...owner.ownerFields, machineCredentialId: machineCredentialIdOf(auth), resourceServerInstanceRef: agentInstanceOf(params.resourceServerInstanceRef) },\n { scopeContext: owner.scopeContext },\n );\n if (existing) {\n rowExists = true;\n priorMessages = existing.messages ?? [];\n storedPersonalDataState = existing.personalDataModelState;\n storedDroppedTurnsSummary = existing.droppedTurnsSummary;\n persistedCaseRef = existing.caseRef ?? undefined;\n if (existing.status === FlowsActors_Status.AWAITING_APPROVAL) waitingDecisionRef = existing.pendingDecisionRef ?? '';\n busy = conversationRefusesArrivingTurn(existing, params.initiationKind);\n }\n } catch (error) {\n // Non-fatal: treat as a fresh thread. A create below surfaces any hard\n // persistence failure loudly; a transient read blip must not drop the turn.\n this.logger.error('[ConversationalExecution] Failed to read existing execution', { systemRef, executionId, error });\n }\n\n /*\n * #2721: a thread waiting for a human decision takes no new message. Advancing it would move the row out of\n * AWAITING_APPROVAL by a write that does not end the decision: every inbox would lose it, any later answer would\n * fail, and the trail would hold a request with no resolution. Refused, naming the decision, rather than ending it\n * implicitly: the decision may be routed to someone else, whose say a new message cannot take away. The ways on are\n * the decision's own: an answer, its lapse, or on the A2A door `tasks/cancel`, which ends it WITHDRAWN with its\n * record. The in-app door offers the requester no withdrawal, which is why the sentence names none (#2721 review\n * F-5). An A2A client sees the task as `input-required` meanwhile; the input it waits for is that person's answer.\n * Recoverable: once the decision settles, the same message is admitted.\n */\n if (waitingDecisionRef !== undefined) {\n this.emitDecisionPending(emitter, systemRef, executionId, waitingDecisionRef);\n return;\n }\n // #2665 A6: a chat conversation runs one turn at a time. Refused before anything is written, recoverably.\n if (busy) {\n this.emitError(emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.CONVERSATION_BUSY, CONVERSATION_BUSY_MESSAGE, true);\n return;\n }\n // #2665 A10: a chat message is identified by the vendor's own message id, so a thread holding it already took it. It\n // is answered as such, never re-identified into a second copy (an in-app id is re-minted below; a chat one is not).\n // The chat door asks first (`previewChatTurn`) and its deliveries run one at a time per sender and conversation, so\n // this is the guard behind that check.\n if (params.initiationKind === FlowsActors_InitiationKind.CHAT_MESSAGE && params.userMessageId\n && priorMessages.some((message) => message.id === params.userMessageId)) {\n this.emitError(emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.MESSAGE_ALREADY_RECEIVED, 'This message is already in the conversation.');\n return;\n }\n\n const userMessage: FlowActorExecution_Message = {\n id: params.userMessageId && !priorMessages.some((message) => message.id === params.userMessageId) ? params.userMessageId : randomUUID(),\n role: FlowsActors_ConversationRole.USER,\n contentType: FlowsActors_MessageContentType.TEXT,\n content: userText,\n createdAt: now,\n ...(params.arrivedThrough ? { arrivedThrough: params.arrivedThrough } : {}),\n };\n /*\n * What this turn writes into the thread, applied to the row as it stands at each write (#2743): the person's message,\n * then whatever each end adds after it. `priorMessages` is what the turn READ, for the model's context only; a\n * sibling turn may have written to the row since, and no write of this turn may take that away.\n */\n const turnTranscript: ConversationalTurnTranscript = (current) => transcriptWithTurnMessage(current, userMessage);\n\n /*\n * The turn's work attribution (#1598 §4): the tenant from the OWNER fields, the case the thread was opened on,\n * and this execution. A continued thread keeps the case its row recorded; a case named on a later turn of the\n * same thread is not adopted (the column is never updated, so the thread IS its case).\n */\n const openingCaseRef = params.autonomous?.caseRef ?? params.caseRef;\n const turnCaseRef = rowExists ? persistedCaseRef : openingCaseRef;\n const workAttribution = this.workAttributionOf(owner, executionId, turnCaseRef, auth);\n\n // The lease covers the whole PROCESSING window: taken before the row is opened or advanced to\n // PROCESSING, let go after every exit below — completed, failed, cancelled, suspended, or a write that\n // never landed. A process that dies inside it leaves a PROCESSING row whose lease lapses (#1780).\n //\n // Except a create-only start (#1611), which takes it only once ITS insert landed: two processes starting\n // the same occurrence share one execution id, and the loser — whose insert fails — must neither hold nor,\n // unwinding, DROP the winner's lease. The gap before the first write is safe: a turn whose lease was never\n // established is one the interrupted-turn sweep abstains on.\n let releaseTurnLease: () => Promise<void> = params.createOnly ? async () => {} : await this.holdTurnLease(executionId);\n // The turn's ONE abort (#2524): the caller's signal (A2A `tasks/cancel`, an SSE hang-up) and the owner's Stop\n // both end it, through the same arms.\n const turnAbort = this.registerRunningTurn(executionId, owner, params.abortSignal, undefined);\n try {\n // ── Open (new) or advance (continued) the row to PROCESSING ──────────────\n // A new thread INSERTs; a continued thread UPDATEs by `executionId` (the row's\n // `isUnique({ scope: 'global' })` id) so a reused id never collides on insert —\n // the prior bug was an unconditional create that E11000'd on continuation.\n try {\n if (!rowExists) {\n await this.systemAccess.createAsSystem(owner.resourceType, {\n executionId,\n ...owner.ownerFields,\n systemRef,\n kind: FlowActorSystem_Kind.ACTOR,\n status: FlowsActors_Status.PROCESSING,\n statusChanges: [{ status: FlowsActors_Status.PROCESSING, timestamp: now }],\n messages: [userMessage],\n machineCredentialId: machineCredentialIdOf(auth),\n resourceServerInstanceRef: agentInstanceOf(params.resourceServerInstanceRef),\n contextRef: params.contextRef ?? '',\n initiationKind: params.initiationKind,\n // The case the thread is opened on, whichever door opened it (#1598): a resume reopens it from here.\n ...(openingCaseRef ? { caseRef: openingCaseRef } : {}),\n ...(params.autonomous ? {\n autonomousAgentRef: params.autonomous.autonomousAgentRef,\n autonomousTrigger: params.autonomous.trigger,\n autonomousPrincipalSource: params.autonomous.principalSource,\n ...(params.autonomous.activeSlotKey ? { autonomousActiveSlotKey: params.autonomous.activeSlotKey } : {}),\n } : {}),\n }, { scopeContext: owner.scopeContext });\n } else {\n const advanced = await this.writeTurnTranscript(owner, {\n executionId, ...owner.ownerFields, machineCredentialId: machineCredentialIdOf(auth), resourceServerInstanceRef: agentInstanceOf(params.resourceServerInstanceRef),\n // #2721: never out of AWAITING_APPROVAL by this write. A pause landing between the read above and here\n // would otherwise be overwritten with its decision left on the row, unended. #2665 A6: nor onto a row a\n // turn runs in when that turn, or this one, came from chat.\n ...conversationalAdvanceGuard(params.initiationKind),\n }, turnTranscript, {\n status: FlowsActors_Status.PROCESSING,\n // Each turn records its own door: the turn that raises a decision is the one routed by it.\n initiationKind: params.initiationKind,\n });\n // The row existed on read, so a write matching nothing means it began waiting for a decision meanwhile, went\n // away, or a real scope inconsistency. Either way this turn must not run on a row it did not advance. Only a\n // row read back as waiting is reported as a waiting decision (#2721 review F-4): telling a client to answer a\n // decision that does not exist would send it to an inbox with nothing in it.\n if (!advanced) {\n const waitingFor = await this.waitingDecisionOf(owner, {\n executionId, ...owner.ownerFields, machineCredentialId: machineCredentialIdOf(auth), resourceServerInstanceRef: agentInstanceOf(params.resourceServerInstanceRef),\n });\n if (waitingFor !== undefined) {\n this.logger.info('[ConversationalExecution] The thread began waiting for a decision before this turn advanced it; the turn does not run', { systemRef, executionId });\n this.emitDecisionPending(emitter, systemRef, executionId, waitingFor);\n } else if (await this.threadRefusesArrivingTurn(owner, {\n executionId, ...owner.ownerFields, machineCredentialId: machineCredentialIdOf(auth), resourceServerInstanceRef: agentInstanceOf(params.resourceServerInstanceRef),\n }, params.initiationKind)) {\n this.logger.info('[ConversationalExecution] A turn began in the thread before this one advanced it, and the thread runs one at a time; the turn does not run', { systemRef, executionId });\n this.emitError(emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.CONVERSATION_BUSY, CONVERSATION_BUSY_MESSAGE, true);\n } else {\n this.logger.error('[ConversationalExecution] Continued-thread PROCESSING update matched no row; the turn does not run', { systemRef, executionId, owner: owner.scopeContext });\n this.emitError(emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.PERSIST_FAILED, 'The conversation could not be continued.');\n }\n return;\n }\n }\n } catch (error) {\n // An insert that collided with another turn's insert of the same thread (#2665 D5): the thread now runs that\n // turn, and a thread that admits one turn at a time refuses this one recoverably rather than as a fault. Never for\n // a create-only start: it continues no thread, so an id that exists is a failed open, read nowhere (#1611 I5).\n if (!rowExists && !params.createOnly && await this.threadRefusesArrivingTurn(owner, {\n executionId, ...owner.ownerFields, machineCredentialId: machineCredentialIdOf(auth), resourceServerInstanceRef: agentInstanceOf(params.resourceServerInstanceRef),\n }, params.initiationKind)) {\n this.logger.info('[ConversationalExecution] Another turn opened the thread first, and the thread runs one at a time; the turn does not run', { systemRef, executionId });\n this.emitError(emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.CONVERSATION_BUSY, CONVERSATION_BUSY_MESSAGE, true);\n return;\n }\n this.logger.error('[ConversationalExecution] Failed to persist execution', { systemRef, executionId, error });\n this.emitError(emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.PERSIST_FAILED, 'Failed to open the execution record.');\n return;\n }\n if (params.createOnly) releaseTurnLease = await this.holdTurnLease(executionId);\n\n emitter(CoreWebSocketEvent.FLOWS_ACTORS_STARTED, { systemRef, executionId });\n\n // ── Invoke the agent, streaming token deltas back over the channel ───────\n // One id ties every streamed delta to a single assistant message on the\n // client (the payload's `messageId`); the terminal event carries the full\n // assembled markdown (`isFinal: true`).\n const assistantMessageId = randomUUID();\n // What the turn does on its way to the reply — tool calls, shown reasoning, sources — live and on every exit (#2524).\n const trace = this.openTurnTrace(systemRef, executionId, agentRef, emitter, auth?.initiatorIds?.organizationId);\n // Generics are Zod *schema* types (fields are `z.infer<...>`); the runtime\n // invocation is untyped input, matching `invokeAgent`'s own `<any,any,any>`.\n // Multi-turn context from the DURABLE transcript (server-authoritative): the\n // thread's prior user/assistant turns from the DB, then the new user message.\n // The tool trace, reasoning, PROGRESS and SYSTEM entries are what a turn DID, not what was said, so they are\n // dropped (`isReplayedTurn`) — a reasoning message is an assistant message too (#2524).\n // #2292: the agent's personal-data treatment for this turn. Earlier replies are sent as the MODEL saw them, so a value\n // it was never shown in clear is never sent in clear now; a person on their own turn reads the values back.\n // #2292 R8: under the agent policy of every organization the turn acts for, read once for the turn and carried\n // to the agent service in a frame, so the view and the guards read the same answer.\n const turnPolicies = await this.turnAgentPolicies(auth);\n const personalData = TurnPersonalDataView.open(\n this.turnGuardrailsOf(agentRef, turnPolicies),\n params.initiationKind,\n storedPersonalDataState,\n );\n const invocation: FlowsActors_Agent_Invocation<any, any, any> = {\n agentRef,\n initiator,\n invocationContext: [],\n // Set below, once the replay is decided (#2750): deciding it may make a call that the turn's trace context names.\n input: { messages: [] },\n output: {},\n executionContext: {},\n artifactBindings: [],\n };\n\n // Tool-execution context: lets the agent's grounding tools read the user's\n // own data (scoped by the caller's verified auth), never LLM-supplied identity.\n const toolContext: FunctionToolExecutionContext = this.buildToolExecutionContext(auth, executionId, systemRef, undefined, {\n initiationKind: params.initiationKind,\n autonomousTrigger: params.autonomous?.trigger,\n });\n if (personalData.table) toolContext.personalDataPlaceholders = personalData.table;\n\n // Traceability: correlate every agent call of this conversation (`sessionRef` =\n // executionId) and carry the EXTERNAL PRINCIPAL as filterable dimensions, so\n // run-time observability can attribute LLM spend + behaviour to the caller — a\n // user, or an org/app machine agent (A2A). The engine emits a per-call trace to\n // the configured sink only when traceability is enabled (NONE ⇒ skipped).\n const traceContext: AgentTraceContext = {\n sessionRef: executionId,\n label: `flows-actors:${systemRef}`,\n attributes: {\n systemRef,\n executionType: auth.executionType,\n ...owner.ownerFields,\n ...(auth.initiatorIds?.machineCredential ? { machineCredential: auth.initiatorIds.machineCredential } : {}),\n },\n // #1598: the turn's model calls are attributed EXPLICITLY; the frame opened around the call carries\n // the same attribution to the calls its tools make.\n attribution: workAttribution,\n };\n\n // #2750: bounded to what the agent's model holds: the newest whole turns that fit `replayBudget` beside the current\n // one, which was checked to fit before anything was written. The oldest turns go first, and what they said is\n // carried ahead of the rest as a summary, written by the agent's own model when the window has to move\n // (`carryDroppedTurns`). A stored summary a treated turn may not send as it is (#2292 R8) is written again.\n const storedSummary = parseDroppedTurnsSummary(storedDroppedTurnsSummary);\n const replay = await carryDroppedTurns({\n agents: this.agentsBackend,\n logger: this.logger,\n agentRef,\n prior: priorMessages.filter(isReplayedTurn).map((m) => ({ id: m.id, role: m.role, content: personalData.modelTextOf(m) })),\n current: replayCurrentTurn,\n budgetTokens: replayBudget.budgetTokens,\n stored: storedSummary && personalData.mayResendModelTextWrittenAt(storedSummary.producedAt) ? storedSummary : undefined,\n traceContext,\n abortSignal: turnAbort.signal,\n inTurnFrames: (call) => this.inTurnSpendFrame(params.initiationKind, auth, () => runWithWorkAttributionFrame(workAttribution, () => this.inTurnPolicyFrame(turnPolicies, call))),\n });\n invocation.input = { messages: [...replay.messages] };\n if (replay.kind !== DroppedTurnsReplayKind.WHOLE) {\n this.logger.info('[ConversationalExecution] The conversation is longer than the agent\\'s model holds; its oldest turns are not sent in full this turn', {\n systemRef, executionId, agentRef, replay: replay.kind, droppedMessageCount: replay.droppedMessageCount,\n unsummarizedDroppedMessageCount: replay.unsummarizedDroppedMessageCount, summaryCalls: replay.summaryCalls,\n keptMessageCount: replay.messages.length, keptTokens: replay.keptTokens, ...replayBudget,\n });\n }\n if (replay.summaryToStore) {\n // Stored as soon as it is written, so a turn that then fails or pauses does not pay for it again. Best-effort: a\n // summary that is not stored is written again by the next turn that needs it.\n try {\n await this.systemAccess.updateAsSystem<FlowActorExecution>(owner.resourceType, {\n executionId, ...owner.ownerFields, machineCredentialId: machineCredentialIdOf(auth), resourceServerInstanceRef: agentInstanceOf(params.resourceServerInstanceRef),\n }, { droppedTurnsSummary: serializeDroppedTurnsSummary(replay.summaryToStore) }, { scopeContext: owner.scopeContext });\n } catch (error) {\n this.logger.warn('[ConversationalExecution] The summary of the turns a conversation leaves out could not be stored; the next turn that needs it writes it again', {\n systemRef, executionId, ...projectCaughtErrorLogFields(error),\n });\n }\n }\n\n let assistantText: string;\n /** The agent's result, kept for the usage a COMPLETED event may carry (#2524). */\n let turnResult: unknown;\n /** Set when the turn stopped at a human-in-the-loop boundary instead of finishing. */\n let approvalSuspension: AgentApprovalSuspension | undefined;\n try {\n try {\n let streamedText = '';\n const result = await this.inTurnSpendFrame(params.initiationKind, auth, () => runWithWorkAttributionFrame(workAttribution, () => this.inTurnPolicyFrame(turnPolicies, () => this.agentsBackend.invokeAgentStreaming(invocation, {\n abortSignal: turnAbort.signal,\n onDelta: (delta) => {\n streamedText += delta;\n // #2292: released to the reader with placeholders put back; a placeholder split across deltas waits whole.\n const released = personalData.streamDelta(delta);\n if (released.length === 0) return;\n emitter(CoreWebSocketEvent.FLOWS_ACTORS_MESSAGE, {\n systemRef,\n executionId,\n messageId: assistantMessageId,\n // MARKDOWN throughout: LLM chat output is markdown, and the client's\n // streaming renderer (Streamdown) handles partial markdown, so the\n // reply renders formatted as it streams — not plain text then a swap.\n messageType: FlowsActors_MessageContentType.MARKDOWN,\n content: released,\n isFinal: false,\n timestamp: new Date(),\n });\n },\n // Every phase of every tool call, the reasoning the agent shows, the sources it cites (#2524). FACTS only:\n // the browser words them from its label tree, and a tool is named by its name verbatim (#1283).\n // #2292: what the model wrote (a call's arguments, its reasoning) names values by placeholders; the reader sees\n // them back when entitled to (the turn's personal-data view decides).\n onToolEvent: (event) => trace.recordToolEvent(personalData.toolEventForReader(this.toolEventWithCredentialsWithheld(systemRef, event))),\n onReasoningDelta: (delta) => trace.recordReasoningDelta(personalData.reasoningDelta(delta)),\n onSource: trace.recordSource,\n }, toolContext, traceContext))));\n trace.recordReasoningDelta(personalData.flushReasoning());\n assistantText = this.extractAssistantText(result.output) || streamedText;\n turnResult = result;\n approvalSuspension = (result as { approvalSuspension?: AgentApprovalSuspension }).approvalSuspension;\n } catch (streamError) {\n if (streamError instanceof AgentStreamingUnsupportedError) {\n // Graceful degradation (e.g. a CLI-transport agent): deliver the full\n // reply in one buffered turn — not streamed, but honest and complete.\n //\n // ⚠️ CANCELLATION LIMIT (review finding F-6) — a deliberate SCOPE CHOICE, and it\n // matters that it is recorded as one rather than as a technical impossibility.\n //\n // It WOULD be wireable: AI-SDK's `generateText` accepts an `abortSignal`, and Node's\n // `spawn` accepts one too, so both the buffered provider call and the CLI child\n // process could honour cancellation. What stops it today is that no seam exists and\n // adding one widens `invokeAgent` — an `@wildo_source`-ANCHORED public contract that\n // ships into app-facing skills — for a capability nothing yet exercises.\n //\n // An earlier version of this comment claimed a signal \"cannot reach\" these\n // transports. That was false, and stating a choice as an impossibility is exactly\n // what stops a future maintainer revisiting it. Revisit it when a buffered-transport\n // agent actually needs interruption.\n //\n // What IS honoured: a cancellation that arrived before this fallback begins. That\n // bounds the exposure to one already-started buffered turn instead of letting a\n // cancelled conversation start a whole new one.\n if (turnAbort.signal.aborted) {\n this.logger.info('[ConversationalExecution] Turn was cancelled before the buffered fallback began; recording CANCELLED', { systemRef, executionId });\n // FINALIZE, do not just return (review finding G4-2). Returning bare left the row wedged\n // at PROCESSING while the task plane had already written CANCELLED — the same two-plane\n // disagreement G3-1 was raised to fix, surviving on the one transport G3-1's fix does not\n // reach. It also contradicted this file's own completion path, which exists so a reload\n // never shows \"a row wedged at PROCESSING\".\n const ended = await this.finalizeTerminal(systemRef, executionId, owner, (current) => trace.appendTo(turnTranscript(current)), { status: FlowsActors_Status.CANCELLED }, machineCredentialIdOf(auth), agentInstanceOf(params.resourceServerInstanceRef));\n this.reportTurnEnd(emitter, systemRef, executionId, ended, () => this.emitTurnCancelled(emitter, systemRef, executionId, startedAt));\n return;\n }\n this.logger.info('[ConversationalExecution] Streaming unsupported; falling back to buffered invocation', { systemRef, executionId, reason: streamError.reason });\n const result = await this.inTurnSpendFrame(params.initiationKind, auth, () => runWithWorkAttributionFrame(workAttribution, () => this.agentsBackend.invokeAgent(invocation, traceContext)));\n assistantText = this.extractAssistantText(result.output);\n turnResult = result;\n } else {\n throw streamError;\n }\n }\n } catch (error) {\n // A CANCELLED turn is not a failed one: `tasks/cancel` and an SSE disconnect both abort the\n // model call deliberately, so without this branch an ordinary user action is recorded as\n // `FAILED`, emits `AGENT_FAILED` to the client, and logs at ERROR twice per cancellation —\n // contradicting the task plane (which writes `CANCELLED` for the same event) and training\n // operators to ignore the error channel.\n //\n // ⚠️ THIS IS THE SECONDARY ARM, not the primary one. An earlier revision claimed \"the abort\n // surfaces here as a thrown provider/SDK error\" and relied on that; it is NOT reliably true\n // (AI-SDK v7 ends an aborted stream cleanly with an `abort` part), and the claim quietly\n // became false when the metering fix removed the one read that threw. See the post-invocation\n // check after this block — that is what actually catches a cancelled streaming turn. This arm\n // survives for the transports and providers that DO throw on abort (a future buffered call\n // wired to a signal, an SDK layer that rejects), so cancellation is classified correctly\n // whether it arrives as a throw or as a clean return. Do not delete it; do not rely on it alone.\n //\n // Detected from OUR OWN signal rather than the error's shape: abort errors are named\n // inconsistently across providers and SDK layers, whereas `abortSignal.aborted` is the fact\n // we control and is true only because something deliberately cancelled this turn.\n if (turnAbort.signal.aborted) {\n this.logger.info('[ConversationalExecution] Turn cancelled by the caller; recording CANCELLED', { systemRef, executionId, agentRef });\n const ended = await this.finalizeTerminal(systemRef, executionId, owner, (current) => trace.appendTo(turnTranscript(current)), { status: FlowsActors_Status.CANCELLED }, machineCredentialIdOf(auth), agentInstanceOf(params.resourceServerInstanceRef));\n this.reportTurnEnd(emitter, systemRef, executionId, ended, () => this.emitTurnCancelled(emitter, systemRef, executionId, startedAt));\n return;\n }\n if (error instanceof AgentOutputWithheldError) {\n // #2292 Phase 3: the agent's output moderation withheld what its model wrote. Not a fault: the turn ends FAILED\n // under the withholding's own code, so the person is told the reply was withheld rather than that it broke.\n // Nothing after the withheld chunk was sent, and a failed turn stores no reply.\n this.logger.warn('[ConversationalExecution] The agent\\'s output was withheld by its output moderation; recording the turn FAILED', {\n systemRef, executionId, agentRef, code: error.code, outputKind: error.withholding.outputKind,\n });\n const withheldEnd = await this.finalizeTerminal(systemRef, executionId, owner, (current) => trace.appendTo(turnTranscript(current)), { status: FlowsActors_Status.FAILED, failureCode: error.code }, machineCredentialIdOf(auth), agentInstanceOf(params.resourceServerInstanceRef));\n this.reportTurnEnd(emitter, systemRef, executionId, withheldEnd, () => this.emitError(emitter, systemRef, executionId, error.code, error.message));\n return;\n }\n if (agentSuspensionRefusalOf(error)?.reason === AgentSuspensionRefusalReason.SUSPENDED) {\n // #2843: an administrator suspended the agent; its model was not called (the refusal is already recorded by the\n // agent service). Not a fault: the turn ends FAILED under its own code, so the person is told the assistant is\n // suspended rather than that it broke, and is not invited to send the message again.\n this.logger.warn('[ConversationalExecution] The agent is suspended; recording the turn FAILED', { systemRef, executionId, agentRef });\n const suspendedEnd = await this.finalizeTerminal(systemRef, executionId, owner, (current) => trace.appendTo(turnTranscript(current)), { status: FlowsActors_Status.FAILED, failureCode: FlowsActors_ExecutionErrorCode.AGENT_SUSPENDED }, machineCredentialIdOf(auth), agentInstanceOf(params.resourceServerInstanceRef));\n this.reportTurnEnd(emitter, systemRef, executionId, suspendedEnd, () => this.emitError(emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.AGENT_SUSPENDED, 'This assistant has been suspended by an administrator.'));\n return;\n }\n if (error instanceof AgentModelCallFailedError) {\n // Named apart from a generic failure (#2191). A refusal (an HTTP status) points the operator at\n // the provider ACCOUNT — exhausted, revoked, misconfigured — not at the prompt or the code. A\n // failure without one is the SDK's own (an invalid prompt, a forged approval signature) and is\n // worded as such, so it never sends anyone to a billing page.\n this.logger.error(error.statusCode !== undefined\n ? '[ConversationalExecution] The model provider refused the call; recording the turn FAILED'\n : '[ConversationalExecution] The model call failed on the stream; recording the turn FAILED', {\n systemRef, executionId, agentRef, statusCode: error.statusCode, reason: error.message,\n });\n } else {\n this.logger.error('[ConversationalExecution] Agent invocation failed', { systemRef, executionId, agentRef, error });\n }\n // Mark the persisted row FAILED (keeping the user turn) so a reload shows the\n // question with a failed status rather than a row wedged at PROCESSING.\n const ended = await this.finalizeTerminal(systemRef, executionId, owner, (current) => trace.appendTo(turnTranscript(current)), { status: FlowsActors_Status.FAILED, failureCode: FlowsActors_ExecutionErrorCode.AGENT_FAILED }, machineCredentialIdOf(auth), agentInstanceOf(params.resourceServerInstanceRef));\n this.reportTurnEnd(emitter, systemRef, executionId, ended, () => this.emitError(emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.AGENT_FAILED, 'The assistant failed to produce a response.'));\n return;\n }\n\n // #2292: the stream releases what it still held back, and every stored and final copy of the reply is the READER's\n // text (placeholders put back for a reader entitled to the values); the model-side text is kept for the next turn.\n const heldBack = personalData.flushStream();\n if (heldBack.length > 0) {\n emitter(CoreWebSocketEvent.FLOWS_ACTORS_MESSAGE, {\n systemRef, executionId, messageId: assistantMessageId, messageType: FlowsActors_MessageContentType.MARKDOWN,\n content: heldBack, isFinal: false, timestamp: new Date(),\n });\n }\n const readerAssistantText = personalData.recordReply(assistantMessageId, assistantText);\n\n // ── A CANCELLED turn is not a COMPLETED one ──────────────────────────────\n //\n // ⚠️ THIS CHECK CANNOT MOVE BACK INTO THE `catch` ABOVE — that is precisely where it used to\n // live, and where it silently died (review findings F-B, then G3-1).\n //\n // F-B detected cancellation in the catch on the premise stated in its own comment: \"the abort\n // surfaces here as a thrown provider/SDK error\". A LATER fix IN THE SAME BATCH (F-A, the\n // unmetered-cancellation hole) removed the only thing that threw — `streamTextToDeltas`'s\n // unguarded `await result.usage`. AI-SDK v7 signals an abort as a stream PART (`type:'abort'`),\n // so `fullStream` ends cleanly, `invokeAgentStreaming` only re-throws what it catches, and\n // nothing below the controller throws at all. F-B's branch therefore became DEAD CODE on the\n // only abortable transport, and every cancelled streaming turn fell through to the COMPLETED\n // write below — reproducing the two-plane disagreement F-B existed to fix, inverted (task plane\n // CANCELLED, conversation plane COMPLETED, on the same user action).\n //\n // The lesson generalises: a handler that detects a condition by CATCHING is coupled to whoever\n // throws, and that coupling is invisible to the type system. Detect from the signal we own.\n if (turnAbort.signal.aborted) {\n this.logger.info('[ConversationalExecution] Turn cancelled by the caller; recording CANCELLED', { systemRef, executionId, agentRef });\n // Retain whatever already streamed: the user SAW that text, so discarding it would leave a\n // reloaded transcript emptier than the live one was. `toPersistableConversationMessages`\n // (inside `finalizeTerminal`) drops a contentless message, so an immediately-cancelled turn\n // persists nothing extra rather than an empty assistant bubble.\n // The trace of what the turn did before it was stopped is kept the same way (#2524).\n const cancelledAt = new Date();\n const cancelledTranscript: ConversationalTurnTranscript = (current) => (assistantText.length > 0\n ? [...trace.appendTo(turnTranscript(current), cancelledAt), {\n id: assistantMessageId,\n role: FlowsActors_ConversationRole.ASSISTANT,\n contentType: FlowsActors_MessageContentType.MARKDOWN,\n content: readerAssistantText,\n createdAt: cancelledAt,\n }]\n : trace.appendTo(turnTranscript(current), cancelledAt));\n const ended = await this.finalizeTerminal(systemRef, executionId, owner, cancelledTranscript, { status: FlowsActors_Status.CANCELLED }, machineCredentialIdOf(auth), agentInstanceOf(params.resourceServerInstanceRef), { personalData });\n this.reportTurnEnd(emitter, systemRef, executionId, ended, () => this.emitTurnCancelled(emitter, systemRef, executionId, startedAt));\n return;\n }\n\n // ── A SUSPENDED turn is not a COMPLETED one either ───────────────────────\n //\n // Falling through to the completion write below would record a terminal status for work the\n // model has not done — the same class of lie as recording COMPLETED for a cancelled turn.\n //\n // Ordered AFTER the stop above, as the resumed turn orders them: a turn stopped in the instant\n // it paused ends CANCELLED, and its decision is never raised. The person asked the turn to stop,\n // and the gated call then never runs; persisting the suspension first used to ignore the stop\n // and hand them a decision for a turn they had stopped. Nothing is lost by skipping it — the\n // decision is routed to nobody until the suspension is persisted (#2524).\n if (approvalSuspension) {\n await this.persistApprovalSuspension({\n systemRef, executionId, owner, auth,\n resourceServerInstanceRef: params.resourceServerInstanceRef,\n // The work the turn did before it paused is part of its transcript too (#2524), and so is what it SAID.\n transcript: (current) => this.pausedTurnMessages(trace.appendTo(turnTranscript(current)), {\n id: assistantMessageId, text: readerAssistantText, data: trace.replyData(),\n }),\n personalData,\n suspension: approvalSuspension,\n emitter,\n initiationKind: params.initiationKind,\n autonomousTrigger: params.autonomous?.trigger,\n workAttribution,\n turnAbortSignal: turnAbort.signal,\n withholdCallInput: trace.withholdInput,\n turnStartedAt: startedAt,\n });\n return;\n }\n\n // ── Persist the assistant turn + complete ────────────────────────────────\n const finishedAt = new Date();\n // The sources the reply cited travel ON the reply, stored and live (#2524).\n const replyData = trace.replyData();\n const assistantMessage: FlowActorExecution_Message = {\n id: assistantMessageId,\n role: FlowsActors_ConversationRole.ASSISTANT,\n contentType: FlowsActors_MessageContentType.MARKDOWN,\n content: readerAssistantText,\n ...(replyData ? { data: replyData } : {}),\n createdAt: finishedAt,\n };\n if (assistantText.length === 0) {\n this.logger.warn('[ConversationalExecution] Assistant produced no text; persisting the turn without an assistant message', { systemRef, executionId, agentRef });\n }\n // Written onto the row as it stands (#2743): a sibling turn's messages written since this turn read it stay.\n const completedTranscript: ConversationalTurnTranscript = (current) => [...trace.appendTo(turnTranscript(current), finishedAt), assistantMessage];\n /** Whether this turn's COMPLETED was recorded, or another turn's decision now holds the row. */\n let ended: TurnEndRecord = TURN_END_RECORDED;\n try {\n const completedRowFilter = { executionId, ...owner.ownerFields, machineCredentialId: params.auth ? machineCredentialIdOf(params.auth) : FLOWS_ACTORS_NO_MACHINE_CREDENTIAL, resourceServerInstanceRef: agentInstanceOf(params.resourceServerInstanceRef) };\n const completed = await this.writeTurnTranscript(owner, {\n ...completedRowFilter,\n // #2721 review F-1: never over a row waiting for a decision. One thread admits overlapping turns, so another\n // turn may have paused it meanwhile, and overwriting would leave that decision on the row, unended.\n status: { $nin: [FlowsActors_Status.AWAITING_APPROVAL] },\n }, completedTranscript, {\n status: FlowsActors_Status.COMPLETED,\n finishedAt,\n statusChanges: [\n { status: FlowsActors_Status.PROCESSING, timestamp: now },\n { status: FlowsActors_Status.COMPLETED, timestamp: finishedAt },\n ],\n }, personalData);\n if (!completed) {\n const waitingFor = await this.waitingDecisionOf(owner, completedRowFilter);\n if (waitingFor !== undefined) {\n // The reply was streamed and is not kept: the row holds another turn's decision now, which is what the\n // client is told instead of COMPLETED (`reportTurnEnd`), so a tab holding THAT decision's card keeps it.\n this.logger.warn('[ConversationalExecution] An overlapping turn paused the thread for a decision; this turn\\'s reply is not persisted', { systemRef, executionId });\n ended = { kind: TurnEndRecordKind.DECISION_WAITING, decisionRef: waitingFor };\n } else {\n this.logger.error('[ConversationalExecution] Completion update matched no row', { systemRef, executionId, owner: owner.scopeContext });\n }\n }\n } catch (error) {\n // The answer was produced and streamed; a persistence failure here is logged\n // but the user still receives the reply (best-effort durable history).\n this.logger.error('[ConversationalExecution] Failed to persist assistant turn', { systemRef, executionId, error });\n }\n\n // Terminal, authoritative message: full assembled markdown. The client\n // replaces the accumulated `text` deltas for this `messageId` with it.\n trace.finishReasoning();\n emitter(CoreWebSocketEvent.FLOWS_ACTORS_MESSAGE, {\n systemRef,\n executionId,\n messageId: assistantMessageId,\n messageType: FlowsActors_MessageContentType.MARKDOWN,\n content: readerAssistantText,\n ...(replyData ? { data: replyData } : {}),\n isFinal: true,\n timestamp: new Date(),\n });\n const usage = this.turnUsageShownTo(auth, turnResult);\n this.reportTurnEnd(emitter, systemRef, executionId, ended, () => emitter(CoreWebSocketEvent.FLOWS_ACTORS_COMPLETED, {\n systemRef,\n executionId,\n status: FlowsActors_Status.COMPLETED,\n duration: Date.now() - startedAt,\n ...(usage ? { usage } : {}),\n }));\n } finally {\n this.unregisterRunningTurn(executionId, turnAbort);\n await releaseTurnLease();\n }\n }\n\n // ── Stopping a running turn (#2524) ────────────────────────────────────────\n\n /**\n * The turns THIS process is running, by execution id — a thread reuses its id, so one id can hold two overlapping\n * turns — each with the conversation's owner, the only person who may stop it, and the WORK it resumes, if any, named\n * by that work's first decision (#2550, #2821): only a turn an ANSWER released can be stopped by its work\n * ({@link stopResumedTurns}), since a fresh turn — and an inline automatic-denial resume, which continues it under its\n * abort — is stopped by whatever opened it. Keyed by the work, not by the thread, because a thread outlives the work and\n * non-chat turns may overlap: a stop meant for one work's continuation must not reach another's in the same thread,\n * and must reach every continuation in its own chain (its decision answered, the continuation paused again, that\n * decision answered).\n */\n private readonly runningTurns = new Map<string, Set<{ readonly controller: AbortController; readonly ownerUserId?: string; readonly resumedWorkRef?: string }>>();\n\n /**\n * Stops that found NO resumed turn of their work on this process: execution id → work (its first decision) → when they\n * arrived (#2550, #2821). The gap they cover: an answer swaps the row to PROCESSING, then records the decision, and only\n * then does its resume register here — a stop arriving in between would otherwise reach nothing. A resume of THAT work\n * released BEFORE such a stop arrived is stopped at registration ({@link registerRunningTurn}); one released after it\n * is newer work and runs, and a resume of another work is never matched. Honoured for\n * {@link UNMATCHED_RESUMED_TURN_STOP_MEMORY_MS}, far longer than that gap: the age is checked where the entry is read,\n * and older entries are pruned on every insert. Not recorded when a resumed turn of the work runs here, stopped or not\n * (a replica hearing its own broadcast after stopping its own turn).\n */\n private readonly unmatchedResumedTurnStops = new Map<string, Map<string, number>>();\n\n /**\n * Open a running turn's abort, chained to the caller's own signal when it has one, so either ends the turn the same\n * way. Unregistered by the caller when the turn ends, whatever the exit.\n */\n private registerRunningTurn(\n executionId: string,\n owner: ResolvedOwnerVariant,\n external: AbortSignal | undefined,\n /** The work an ANSWER released this turn to continue, by its first decision (#2550, #2821); absent for every other turn. */\n resumedWorkRef: string | undefined,\n /** A resume's `releasedAt`: a stop of its work that found no turn after that instant was meant for this one (#2550). */\n releasedAt?: number,\n ): AbortController {\n const controller = new AbortController();\n if (external?.aborted) controller.abort();\n else external?.addEventListener('abort', () => controller.abort(), { once: true });\n const unmatchedStopAt = resumedWorkRef !== undefined && releasedAt !== undefined\n ? this.unmatchedResumedTurnStops.get(executionId)?.get(resumedWorkRef)\n : undefined;\n // Both instants are this process's wall clock: `releasedAt` is the answer's `decidedAt`, taken on the replica that\n // runs the resume, and the stop's arrival is recorded by that same replica when it hears the stop. `>=`, so a stop\n // in the same millisecond as the decision stops it: the cancel is the act both planes must agree on.\n if (unmatchedStopAt !== undefined && Date.now() - unmatchedStopAt <= UNMATCHED_RESUMED_TURN_STOP_MEMORY_MS && unmatchedStopAt >= releasedAt!) {\n this.logger.info('[ConversationalExecution] A stop requested after this resume was released reached it before it ran; it ends stopped', { executionId });\n controller.abort();\n }\n const ownerUserId = (owner.ownerFields as { userId?: string }).userId;\n const turns = this.runningTurns.get(executionId) ?? new Set();\n turns.add({ controller, ...(resumedWorkRef !== undefined ? { resumedWorkRef } : {}), ...(ownerUserId ? { ownerUserId } : {}) });\n this.runningTurns.set(executionId, turns);\n // On EVERY turn too (#2550), so a subscription that dropped is rebuilt by the next turn. Not the guarantee: an answer\n // awaits its own arm before it releases a resume. Idempotent, never awaited here, never rejects.\n void this.resumedTurnStops?.arm();\n return controller;\n }\n\n private unregisterRunningTurn(executionId: string, controller: AbortController): void {\n const turns = this.runningTurns.get(executionId);\n if (!turns) return;\n for (const turn of turns) if (turn.controller === controller) turns.delete(turn);\n if (turns.size === 0) this.runningTurns.delete(executionId);\n }\n\n /**\n * The conversation's OWNER stops their own running turn (`FLOWS_ACTORS_CANCEL`, #2524). The turn ends CANCELLED\n * through the runtime's own arms — keeping what it had produced — and `FLOWS_ACTORS_COMPLETED` reports it.\n *\n * Answers whether a turn was stopped. FALSE for a turn this process is not running (it ended, or another process\n * runs it: a cancel reaches the process that holds the socket, which is the one that started the turn unless the\n * person moved tabs to another instance) and for a caller who does not own the conversation. Both are refused\n * silently: a cancel racing a turn's end is ordinary, and naming whose turn exists would answer a question the\n * caller may not ask.\n *\n * assurance-control: WILDO.ACCESS.LEAST_PRIVILEGE — only the conversation's owner can stop its turn.\n * assurance-control: WILDO.AI.HUMAN_OVERSIGHT — a person can stop a running agent turn; it ends through the runtime's own arms.\n */\n cancelTurn(params: { readonly executionId: string; readonly userId: string }): boolean {\n const turns = this.runningTurns.get(params.executionId);\n if (!turns) return false;\n let stopped = false;\n for (const turn of turns) {\n if (turn.ownerUserId !== params.userId || turn.controller.signal.aborted) continue;\n turn.controller.abort();\n stopped = true;\n }\n if (stopped) this.logger.info('[ConversationalExecution] The owner stopped a running turn', { executionId: params.executionId });\n return stopped;\n }\n\n /**\n * Stop the turn that CONTINUES a human decision of this execution, wherever it runs (#2550). For a transport whose\n * request opened the work and may stop it, but holds no handle on what an answer released: the continuation runs on\n * the replica that received the ANSWER, with no abort of the opener's chained to it. Today that is the A2A\n * `tasks/cancel`. The core knows only that some door asked, by the execution and the decision it addressed: it never\n * learns that A2A exists, the same direction as {@link readDecisionWork} and {@link withdrawPendingDecision}.\n *\n * Only a RESUMED turn of `decisionRef` is stopped (#2821). A fresh turn is stopped by whatever opened it (the owner's\n * socket, an SSE hang-up, an A2A task's own signal), and neither a fresh turn of ANOTHER request in the same thread nor\n * the continuation of ANOTHER decision there is this caller's to stop: a thread outlives the work it held, and keying\n * the stop by the thread let one task's cancel stop a later task's resumed turn.\n *\n * The execution is read first through the same four isolation axes as {@link withdrawPendingDecision} (owner FK,\n * machine credential, agent instance), so a caller reaches only its own conversation: a mismatch, or a store that\n * fails, stops nothing. Then this replica's resumed turns are stopped directly and the stop is broadcast, so the\n * replica that runs the resume, whichever it is, stops it ({@link ResumedTurnStopBroadcast}). A stopped turn ends\n * CANCELLED through the resume's own arms, keeping its trace and what it had said, exactly as the owner's Stop does.\n * A replica that holds no resumed turn of the work remembers the stop briefly, so a resume of it whose answer was\n * decided before the stop, and which registers after it, is stopped too ({@link unmatchedResumedTurnStops}). The replica\n * running that resume hears the broadcast because its answer awaited the subscription before deciding\n * ({@link answerPendingDecision}); only a replica that cannot subscribe at all (Redis down) cannot be reached.\n *\n * Call it AFTER ending the decision the work may still wait on ({@link withdrawPendingDecision}), never before. An\n * answer that beats the withdrawal decided before its release, which landed before the withdrawal missed, so its\n * resume's release instant precedes this stop and is caught running or at registration. A stop sent first can be\n * followed by an answer decided after it, whose resume no remembered stop matches.\n *\n * @returns whether a turn was stopped here or the stop was published — never proof that a turn stopped: the replica\n * running it may be gone, or the turn finished. The conversation's record is the truth, as for {@link cancelTurn}.\n */\n public async stopResumedTurns(params: {\n readonly executionId: string;\n /**\n * The work whose continuations are stopped, named by its FIRST decision — the one the caller's work paused on\n * (#2821). Every continuation in its chain is registered under it.\n */\n readonly workRef: string;\n readonly scopeContext: ConversationalOwnerScope;\n /** Whoever asked — the conversation's own principal on every door that reaches this; its credential is an axis. */\n readonly stoppedBy?: SocketAuthResult;\n /** The agent instance the conversation runs on; with the principal's credential, the full isolation key. */\n readonly resourceServerInstanceRef?: string;\n }): Promise<boolean> {\n let owner: ResolvedOwnerVariant;\n try {\n owner = this.resolveOwnerVariant(params.scopeContext);\n } catch {\n return false;\n }\n const row = await this.systemAccess.readAsSystem<FlowActorExecution>(owner.resourceType, {\n executionId: params.executionId,\n ...owner.ownerFields,\n machineCredentialId: machineCredentialIdOf(params.stoppedBy),\n resourceServerInstanceRef: agentInstanceOf(params.resourceServerInstanceRef),\n }, { suppressSystemAudit: true }).catch((error: unknown) => {\n // A store that failed is not a conversation that is absent; nothing is stopped and this line says why.\n this.logger.warn('[ConversationalExecution] The execution of stopped work could not be read; a turn resumed on it runs to its end', {\n executionId: params.executionId, ...projectCaughtErrorLogFields(error),\n });\n return null;\n });\n if (!row) return false;\n const stoppedHere = this.stopResumedTurnsHere(row.executionId, params.workRef);\n const published = (await this.resumedTurnStops?.publish(row.executionId, params.workRef)) ?? false;\n return stoppedHere || published;\n }\n\n /**\n * Stop the turns THIS process runs that resume `workRef`'s work in this execution. Answers whether one was stopped;\n * never throws.\n */\n private stopResumedTurnsHere(executionId: string, workRef: string): boolean {\n let stopped = false;\n /** Whether a resumed turn of the work runs here at all, stopped by this call or already stopped. */\n let found = false;\n for (const turn of this.runningTurns.get(executionId) ?? []) {\n if (turn.resumedWorkRef !== workRef) continue;\n found = true;\n if (turn.controller.signal.aborted) continue;\n turn.controller.abort();\n stopped = true;\n }\n if (stopped) this.logger.info('[ConversationalExecution] Stopped a turn resumed after a decision, at the request of the work it continues', { executionId, workRef });\n // Remembered only when NO resumed turn of the work runs here: the replica that stopped its own turn and then hears\n // its own broadcast found that turn already stopped, which is not a stop waiting for a resume to register.\n if (!found) this.rememberUnmatchedResumedTurnStop(executionId, workRef);\n return stopped;\n }\n\n private rememberUnmatchedResumedTurnStop(executionId: string, workRef: string): void {\n const now = Date.now();\n for (const [id, stops] of this.unmatchedResumedTurnStops) {\n for (const [ref, at] of stops) if (now - at > UNMATCHED_RESUMED_TURN_STOP_MEMORY_MS) stops.delete(ref);\n if (stops.size === 0) this.unmatchedResumedTurnStops.delete(id);\n }\n const stops = this.unmatchedResumedTurnStops.get(executionId) ?? new Map<string, number>();\n stops.set(workRef, now);\n this.unmatchedResumedTurnStops.set(executionId, stops);\n }\n\n /**\n * Every end of a turn before its pause write, which ends the turn exactly once (#2721 re-reviews). Five call sites: its\n * routing failed; nobody can approve the call and the agent already had its one automatic denial (or there is nobody to\n * resume as); the person pressed Stop while the route was decided; the person pressed Stop while the question was\n * composed; the pause write threw without landing. CANCELLED when the person stopped the turn meanwhile, since that is\n * what they asked for, otherwise FAILED with `failureMessage`. The end is written only onto a row still PROCESSING (#2721 gate-4 F2): when another turn's\n * decision holds the thread that decision is reported, and when another turn already ENDED the row its end stands and\n * this turn's is reported without being written, as the pause write's own miss is (`finalizeTerminal`, `reportTurnEnd`).\n */\n private async endTurnWithoutPause(\n params: {\n readonly systemRef: string;\n readonly executionId: string;\n readonly owner: ResolvedOwnerVariant;\n readonly transcript: ConversationalTurnTranscript;\n readonly auth: SocketAuthResult | undefined;\n readonly resourceServerInstanceRef?: string;\n readonly emitter: FlowsActorsExecutionEmitter;\n readonly turnAbortSignal?: AbortSignal;\n readonly turnStartedAt: number;\n },\n failureMessage: string,\n options: {\n /**\n * #2749: the decision this turn's own pause write tried to raise, when that write threw. Its end write then finding\n * the row waiting for THIS decision means the pause committed after all: nothing is reported, and the caller goes\n * on to record and announce it. Any other waiting decision is reported as before.\n */\n readonly ownDecisionRef?: string;\n } = {},\n ): Promise<TurnEndRecord> {\n const stopped = params.turnAbortSignal?.aborted === true;\n const ended = await this.finalizeTerminal(params.systemRef, params.executionId, params.owner, params.transcript,\n // #2827: the code the client is told below, recorded with the end.\n stopped ? { status: FlowsActors_Status.CANCELLED } : { status: FlowsActors_Status.FAILED, failureCode: TURN_ENDED_WITHOUT_PAUSE_CODE },\n machineCredentialIdOf(params.auth), agentInstanceOf(params.resourceServerInstanceRef), { onlyWhileProcessing: true });\n if (options.ownDecisionRef !== undefined && ended.kind === TurnEndRecordKind.DECISION_WAITING && ended.decisionRef === options.ownDecisionRef) return ended;\n this.reportTurnEnd(params.emitter, params.systemRef, params.executionId, ended, () => (stopped\n ? this.emitTurnCancelled(params.emitter, params.systemRef, params.executionId, params.turnStartedAt)\n : this.emitError(params.emitter, params.systemRef, params.executionId, TURN_ENDED_WITHOUT_PAUSE_CODE, failureMessage)));\n return ended;\n }\n\n /**\n * Record a TERMINAL outcome for the turn, keeping the messages accumulated so far (the user's turn among them, so a\n * reloaded transcript still shows the question). Best-effort: a persistence failure is logged, never thrown.\n *\n * The turn's messages are written onto the row as it stands, never in place of it (#2743): `transcript` is what the\n * turn adds, and a sibling turn's messages written since this one read the thread stay (`writeTurnTranscript`).\n *\n * The status is a parameter because a cancelled turn is NOT a failed one. A caller who invokes\n * `tasks/cancel`, or an SSE client that disconnects, ABORTS the model call deliberately — writing\n * `FAILED` there would contradict the task plane (the A2A controller records `CANCELLED` for the\n * very same event) and would leave the two planes disagreeing about one user action.\n *\n * Answers what it found (#2721 review F-1, N-1): RECORDED, or DECISION_WAITING when the write was refused because the\n * row waits for a decision another turn on the thread raised meanwhile. The decision, not this turn, is the thread's\n * state then, and its card must not be cleared. Every caller reports the answer through {@link reportTurnEnd}.\n */\n private async finalizeTerminal(\n systemRef: string,\n executionId: string,\n owner: ResolvedOwnerVariant,\n transcript: ConversationalTurnTranscript,\n /**\n * How the turn ended: CANCELLED, or FAILED with the code its client is told (#2827). The pairing is the type, so a\n * failure cannot be recorded without saying why: the code rides the `failed` entry of `statusChanges`.\n */\n ending: ConversationalTurnTerminalEnding,\n // Carried explicitly: this write is owner-scoped, and the owner FK alone does not identify the\n // principal on the machine variants — a terminal write that omits the axis matches nothing.\n machineCredentialId: string = FLOWS_ACTORS_NO_MACHINE_CREDENTIAL,\n resourceServerInstanceRef: string = FLOWS_ACTORS_DEFAULT_AGENT_INSTANCE,\n /**\n * Write only onto a row still PROCESSING (#2721 gate-4 F2): for every end before the pause write (`endTurnWithoutPause`\n * and its five callers), decided while the turn could not know who else had written, so a row another turn already\n * ended keeps its end.\n */\n options: {\n readonly onlyWhileProcessing?: boolean;\n /** #2292: the turn's personal-data view, when the end keeps a reply it streamed. */\n readonly personalData?: TurnPersonalDataView;\n } = {},\n ): Promise<TurnEndRecord> {\n const rowFilter = { executionId, ...owner.ownerFields, machineCredentialId, resourceServerInstanceRef };\n const { status } = ending;\n const finishedAt = new Date();\n try {\n const ended = await this.writeTurnTranscript(owner, {\n ...rowFilter,\n // #2721 review F-1: never over a row waiting for a decision, as the completion write.\n status: options.onlyWhileProcessing ? FlowsActors_Status.PROCESSING : { $nin: [FlowsActors_Status.AWAITING_APPROVAL] },\n }, transcript, (row) => ({\n status,\n finishedAt,\n // The row's history gains the end it records, as the interrupted-turn sweep's FAILED does. Without it a refused or\n // cancelled turn read `statusChanges: [processing]` beside `status: failed`, and a continued thread kept the previous\n // turn's `completed` as its last entry (#2035 item 100, from #2191).\n // #2827: a FAILED entry carries why, so a reload, a chat reply and an A2A task can say it.\n statusChanges: [...(row.statusChanges ?? []), flowsActorsStatusChange(ending, finishedAt)],\n }), options.personalData);\n if (!ended) {\n const waitingFor = await this.waitingDecisionOf(owner, rowFilter);\n if (waitingFor !== undefined) {\n this.logger.warn('[ConversationalExecution] An overlapping turn paused the thread for a decision; this turn ends unrecorded', { systemRef, executionId, status });\n return { kind: TurnEndRecordKind.DECISION_WAITING, decisionRef: waitingFor };\n }\n }\n } catch (error) {\n this.logger.error('[ConversationalExecution] Failed to finalize execution', { systemRef, executionId, status, error });\n }\n return TURN_END_RECORDED;\n }\n\n /**\n * Tell the turn's client how it ended (#2721 review N-1): its own end when that was recorded, and otherwise the\n * decision that now holds the thread, as a RECOVERABLE `DECISION_PENDING`. Never silence. A turn's emitter is not\n * always the owner's browser room: an A2A call has a private one per request, and reads a turn that says nothing\n * as one that succeeded with no reply, so silence turned a failed turn into a successful empty one. A tab holding\n * the decision's card keeps it (the code is recoverable), a tab that does not refreshes its history and finds it,\n * and an A2A client is answered -32015.\n */\n private reportTurnEnd(\n emitter: FlowsActorsExecutionEmitter | undefined,\n systemRef: string,\n executionId: string,\n ended: TurnEndRecord,\n reportOwnEnd: () => void,\n ): void {\n if (ended.kind === TurnEndRecordKind.RECORDED) {\n reportOwnEnd();\n return;\n }\n if (emitter) this.emitDecisionPending(emitter, systemRef, executionId, ended.decisionRef);\n }\n\n /**\n * The decision a conversation waits for, read as the turn's own continuation read finds the thread (#2721 review\n * F-3): `undefined` when there is no such thread, it does not wait, or it could not be read. For a door that must\n * answer BEFORE it runs a turn (A2A's non-blocking send, which creates a task first). The turn still refuses on its\n * own, so a decision raised after this answer is refused there.\n */\n public async waitingDecisionOfThread(params: {\n readonly scopeContext: ConversationalOwnerScope;\n readonly auth: SocketAuthResult;\n readonly executionId: string;\n readonly resourceServerInstanceRef?: string;\n }): Promise<string | undefined> {\n let owner: ResolvedOwnerVariant;\n try {\n owner = this.resolveOwnerVariant(params.scopeContext);\n } catch {\n return undefined;\n }\n return this.waitingDecisionOf(owner, {\n executionId: params.executionId, ...owner.ownerFields,\n machineCredentialId: machineCredentialIdOf(params.auth), resourceServerInstanceRef: agentInstanceOf(params.resourceServerInstanceRef),\n });\n }\n\n /**\n * Whether a thread admits no turn from `arrivingKind` beside the one running in it (#2665 A6), read as the turn's\n * own continuation read finds the thread: `false` when there is no such thread, nothing runs, or it could not be\n * read. For a door that must answer BEFORE it runs a turn (A2A's non-blocking send, which creates a task first); the\n * turn still refuses on its own, so a turn begun after this answer is refused there.\n */\n public async threadAdmitsNoSecondTurn(params: {\n readonly scopeContext: ConversationalOwnerScope;\n readonly auth: SocketAuthResult;\n readonly executionId: string;\n readonly resourceServerInstanceRef?: string;\n readonly initiationKind: FlowsActors_InitiationKind;\n }): Promise<boolean> {\n let owner: ResolvedOwnerVariant;\n try {\n owner = this.resolveOwnerVariant(params.scopeContext);\n } catch {\n return false;\n }\n return this.threadRefusesArrivingTurn(owner, {\n executionId: params.executionId, ...owner.ownerFields,\n machineCredentialId: machineCredentialIdOf(params.auth), resourceServerInstanceRef: agentInstanceOf(params.resourceServerInstanceRef),\n }, params.initiationKind);\n }\n\n /** {@link conversationRefusesArrivingTurn} on the thread read back now; `false` when it is absent or unreadable. */\n private async threadRefusesArrivingTurn(owner: ResolvedOwnerVariant, rowFilter: Record<string, unknown>, arrivingKind: FlowsActors_InitiationKind | undefined): Promise<boolean> {\n try {\n const row = await this.systemAccess.readAsSystem<FlowActorExecution>(owner.resourceType, rowFilter, { scopeContext: owner.scopeContext });\n return row ? conversationRefusesArrivingTurn(row, arrivingKind) : false;\n } catch (error) {\n this.logger.warn('[ConversationalExecution] A thread could not be read back to tell whether a turn runs in it', {\n executionId: rowFilter.executionId, ...projectCaughtErrorLogFields(error),\n });\n return false;\n }\n }\n\n /**\n * Whether a pause write that THREW raised `decisionRef` (#2749), read back with the write's own filter. Unlike\n * {@link waitingDecisionOf}, a read that fails is never an answer: it is retried after each of\n * {@link DECISION_REQUEST_WRITE_OUTCOME_READ_DELAYS_MS}, and when every read fails the outcome is UNKNOWN. LANDED only when the\n * row waits for this very decision; any row read that does not, or no row, is NOT_LANDED.\n */\n private async readThrownPauseWrite(owner: ResolvedOwnerVariant, rowFilter: Record<string, unknown>, decisionRef: string): Promise<DecisionRequestWriteOutcome> {\n return readBackThrownDecisionRequestWrite({\n read: async () => {\n const row = await this.systemAccess.readAsSystem<FlowActorExecution>(owner.resourceType, rowFilter, { scopeContext: owner.scopeContext });\n return row?.status === FlowsActors_Status.AWAITING_APPROVAL && row.pendingDecisionRef === decisionRef;\n },\n wait: (delayMs) => this.waitBeforePauseOutcomeRead(delayMs),\n onReadFailure: ({ attempt, retrying, error }) => this.logger.warn('[ConversationalExecution] A thrown approval-pause write could not be read back', {\n executionId: rowFilter.executionId, decisionRef, attempt, retrying, ...projectCaughtErrorLogFields(error),\n }),\n });\n }\n\n /** The wait before the next read-back of a thrown pause write; its own method so a test can make it immediate. */\n private waitBeforePauseOutcomeRead(delayMs: number): Promise<void> {\n return waitBeforeDecisionRequestRead(delayMs);\n }\n\n /**\n * The decision a thread's row waits for, read back after a turn's write on it matched nothing (#2721 review F-1,\n * F-4): its `pendingDecisionRef` ('' when the row names none) while the row is AWAITING_APPROVAL, else `undefined`\n * (the row left waiting, went away, or could not be read). Writes are guarded off a waiting row, and one thread\n * admits overlapping turns, so a miss usually means another turn raised a decision meanwhile.\n *\n * A read that fails answers `undefined` here, which is right after a write that MATCHED NOTHING (nothing this turn\n * wrote can be waiting). After a pause write that THREW it is not: that write may have committed, so a failed read is\n * no answer at all, and {@link readThrownPauseWrite} asks instead (#2749).\n */\n private async waitingDecisionOf(owner: ResolvedOwnerVariant, rowFilter: Record<string, unknown>): Promise<string | undefined> {\n try {\n const row = await this.systemAccess.readAsSystem<FlowActorExecution>(owner.resourceType, rowFilter, { scopeContext: owner.scopeContext });\n return row?.status === FlowsActors_Status.AWAITING_APPROVAL ? (row.pendingDecisionRef ?? '') : undefined;\n } catch (error) {\n this.logger.warn('[ConversationalExecution] A thread could not be read back after a write missed it', {\n executionId: rowFilter.executionId, ...projectCaughtErrorLogFields(error),\n });\n return undefined;\n }\n }\n\n /**\n * Write `fields` and the turn's messages onto the ONE row `rowFilter` selects, merging the turn into the row as it is\n * now rather than replacing the row's transcript (#2743). Answers the written row, or `null` when `rowFilter` matches\n * no row (its status guard refused, or the row is gone): the same answer a filtered `updateAsSystem` gives, so every\n * caller reads a miss back as it did before.\n *\n * Every write that advances, pauses or ends a turn goes through here: the advance, the fresh completion,\n * `finalizeTerminal` (every FAILED / CANCELLED end, `endTurnWithoutPause` included), the pause and the resumed\n * completion. Each used to write `messages` as the turn had computed it from the transcript it READ, so two\n * overlapping turns on one thread erased each other's messages, whichever wrote last.\n *\n * A compare-and-swap on the row's `_version`, through the same system door: read the row with the write's own filter,\n * apply `transcript` to its messages, and write with `ifMatchVersion`. A write that lost to another write on the row\n * (MongoDB answers VERSION_CONFLICT; PostgreSQL does too while the guard still matches) reads the row again and\n * merges again, so nothing a sibling wrote in between is lost; a guard that stopped matching ends the loop on the\n * next read with `null`. Nothing waits between attempts: each miss is another write's success.\n *\n * Why not an atomic array append: a resumed turn's trace UPDATES the tool row its pause stored (one row per call,\n * merged by `toolCallId`), which neither store can do inside an append. See {@link ConversationalTurnTranscript}.\n *\n * The read is the write's own read-before-write, so it does not record a privileged-read audit row of its own: the\n * write it serves records one (`updateAsSystem`), and the turn's opening read already recorded the access.\n */\n private async writeTurnTranscript(\n owner: ResolvedOwnerVariant,\n rowFilter: Record<string, unknown>,\n transcript: ConversationalTurnTranscript,\n /** The fields the write sets; a function of the row as read when a field extends what the row holds (`statusChanges`). */\n fields: Record<string, unknown> | ((row: FlowActorExecution) => Record<string, unknown>),\n /**\n * #2292: the turn's personal-data view, when its reply was written. Its placeholder table and model-side texts are\n * merged with what the row holds NOW, inside the same version-guarded write, so an overlapping turn's are kept.\n */\n personalData?: TurnPersonalDataView,\n ): Promise<FlowActorExecution | null> {\n for (let attempt = 1; ; attempt += 1) {\n const row = await this.systemAccess.readAsSystem<FlowActorExecution & { readonly _version?: unknown }>(\n owner.resourceType, rowFilter, { scopeContext: owner.scopeContext, suppressSystemAudit: true },\n );\n if (!row) return null;\n const version = row._version;\n // Without the version the write could only REPLACE the transcript, which is the defect; refuse rather than do it.\n // Not reachable today: both adapters stamp a version on insert (MongoDB's version key, PostgreSQL's\n // `_version_db_doc = 1`) and bump it on every write. Should it ever be, every caller already ends a write that throws.\n if (typeof version !== 'number' || !Number.isSafeInteger(version) || version < 0) {\n throw new Error(`The conversation ${String(rowFilter.executionId)} was read without its version, so this turn's messages cannot be merged into it`);\n }\n const personalDataToStore = personalData?.stateToStore(row.personalDataModelState);\n const renames = personalDataToStore?.renames ?? new Map<string, string>();\n try {\n const written = await this.systemAccess.updateAsSystem<FlowActorExecution>(owner.resourceType, rowFilter, {\n ...renamedPlaceholdersInTurnFields(typeof fields === 'function' ? fields(row) : fields, renames),\n ...(personalDataToStore !== undefined ? { personalDataModelState: personalDataToStore.state } : {}),\n // One contentless message would fail the whole update and lose what the write records (see the helper).\n messages: toPersistableConversationMessages(renamedPlaceholdersInTurnMessages(row.messages ?? [], transcript(row.messages ?? []), renames)),\n }, { scopeContext: owner.scopeContext, ifMatchVersion: version });\n if (written) {\n personalData?.acceptRenames(renames);\n return written;\n }\n } catch (error) {\n if (!(isWildoBackendError(error) && error.type === ErrorType.CONFLICT && error.customMessageReference === ErrorCustomMessageReference.VERSION_CONFLICT)) throw error;\n }\n if (attempt >= TURN_TRANSCRIPT_WRITE_ATTEMPTS) {\n throw new Error(`The conversation ${String(rowFilter.executionId)} changed under ${attempt} consecutive writes of this turn; its messages were not written`);\n }\n }\n }\n\n\n /**\n * #3325: the schemas declaring what a tool's arguments are, or `undefined` for a tool this agent does not declare (an MCP\n * tool, which has no declarations). The tool's own schema still speaks when its resource cannot be read, with `unreadable`\n * set, since what that resource declares is then unknown.\n */\n private credentialDeclarationsOf(systemRef: string, toolName: string): { readonly schemas: readonly unknown[]; readonly unreadable: boolean } | undefined {\n const resolved = this.resolveApprovalGatedFunctionTool(systemRef, toolName);\n if (resolved.kind !== GatedFunctionToolResolutionKind.FOUND) return undefined;\n const resource = this.argumentResourceSchemasOf(resolved.functionTool);\n return { schemas: [resolved.functionTool.inputSchema, ...(resource ?? [])], unreadable: resource === undefined };\n }\n\n /**\n * #3325: a tool event as the turn's trace keeps and sends it, any declared credential withheld. Here, where the event is\n * recorded, because every ending of a turn writes the trace: a stop, a failure and a pause alike, and a tool that was not\n * gated too. Arguments that cannot be vouched for are withheld whole (`heldCallInput`).\n */\n private toolEventWithCredentialsWithheld(systemRef: string, event: FunctionToolStreamEvent): FunctionToolStreamEvent {\n if (event.input === undefined) return event;\n const declarations = this.credentialDeclarationsOf(systemRef, event.toolName);\n if (!declarations) return event;\n return { ...event, input: heldCallInput(event.input, declarations).withheld };\n }\n\n /**\n * #3325: the messages of a pausing turn as they may be stored, and whether its pending calls may be held at all. Calls that\n * already ran or were refused are rewritten silently: no signature covers them, and a later pause would store them. A\n * pending call holding a credential is refused: `denies` when the kept call can be denied with its copies withheld, and\n * not when another call of the step holds it, a schema renamed the value out of reach, or its declarations cannot be read,\n * which end the turn. Never throws: the routing beside it is guarded for the same reason, and a failure here refuses.\n */\n private heldToolCallsOf(systemRef: string, suspension: AgentApprovalSuspension, personalData: TurnPersonalDataView | undefined): {\n readonly sdkModelMessages: Record<string, unknown>[];\n readonly refusal?: { readonly denies: boolean; readonly argumentPaths: readonly string[]; readonly input: Record<string, unknown>; readonly withheldCalls: readonly { readonly toolCallId: string; readonly input: unknown }[] };\n } {\n const isPlaceholder = (value: string) => personalData?.table?.entryOf(value) !== undefined;\n const input = suspension.toolArgs as Record<string, unknown>;\n try {\n const messages = withSettledToolCallsHeld(suspension.sdkModelMessages, (toolName, callInput) => {\n const declarations = this.credentialDeclarationsOf(systemRef, toolName);\n return declarations ? heldCallInput(callInput, declarations, isPlaceholder).withheld : undefined;\n });\n const pending = pendingToolApprovalCallsOf(messages);\n const kept = pending.find((call) => call.approvalId === suspension.approvalId) ?? { approvalId: suspension.approvalId, toolName: suspension.toolName, input, rawInput: input };\n const findingsIn = (call: Pick<typeof kept, 'toolName' | 'rawInput' | 'input'>) => {\n const declarations = this.credentialDeclarationsOf(systemRef, call.toolName);\n if (!declarations) return { paths: [], unvouched: false, withheld: call.input };\n const raw = heldCallInput(call.rawInput, declarations, isPlaceholder);\n const parsed = heldCallInput(call.input, declarations, isPlaceholder);\n // Raw paths the parse did not keep are dropped keys, unless the schema moved the value somewhere no declaration names.\n const dropped = raw.paths.reduce((remaining, path) => withoutArgumentAt(remaining, path), call.rawInput);\n const renamed = raw.paths.length > 0 && parsed.paths.length === 0 && !isDeepEqualData(dropped, call.input);\n return { paths: [...new Set([...raw.paths, ...parsed.paths])], unvouched: renamed || (parsed.tainted && parsed.paths.length === 0), withheld: parsed.withheld };\n };\n const others = pending.filter((call) => call.approvalId !== kept.approvalId).map((call) => ({ toolCallId: call.toolCallId, ...findingsIn(call) }));\n const own = findingsIn(kept);\n const argumentPaths = [...own.paths, ...others.flatMap((other) => other.paths)];\n const refused = argumentPaths.length > 0 || own.unvouched || others.some((other) => other.unvouched);\n if (!refused) return { sdkModelMessages: messages };\n const withheldInput = own.unvouched ? { withheld: WITHHELD_CREDENTIAL_ARGUMENT } : own.withheld;\n const signingKey = this.agentsBackend.resolveToolApprovalSigningKey();\n const applied = signingKey && others.every((other) => other.paths.length === 0 && !other.unvouched) && !own.unvouched\n ? applyModifiedToolApprovalInput({ sdkModelMessages: messages, approvalId: suspension.approvalId, modifiedInput: withheldInput, signingKey })\n : undefined;\n const denies = applied?.kind === ToolApprovalModificationOutcomeKind.MODIFIED;\n const withheldCalls = [{ toolCallId: suspension.toolCallId, input: withheldInput }, ...others.filter((other) => other.paths.length > 0 || other.unvouched).map((other) => ({ toolCallId: other.toolCallId, input: other.unvouched ? { withheld: WITHHELD_CREDENTIAL_ARGUMENT } : other.withheld }))];\n return { sdkModelMessages: denies ? applied.sdkModelMessages : [], refusal: { denies, argumentPaths, input: withheldInput, withheldCalls } };\n } catch (error) {\n this.logger.error('[ConversationalExecution] The calls of a pausing turn could not be read for credentials; ending the turn', { ...projectCaughtErrorLogFields(error) });\n return { sdkModelMessages: [], refusal: { denies: false, argumentPaths: [], input: {}, withheldCalls: [{ toolCallId: suspension.toolCallId, input: { withheld: WITHHELD_CREDENTIAL_ARGUMENT } }] } };\n }\n }\n\n /** A gated call denied without asking anyone, and the same turn resumed at once so the agent can answer (#1594 D3). */\n private async resumeOnAutomaticDenial(params: Parameters<ConversationalExecutionBackendService['persistApprovalSuspension']>[0], suspension: AgentApprovalSuspension, reason: string, requestedAt: string): Promise<void> {\n const { systemRef, executionId, owner, emitter } = params;\n await this.resumeAfterApproval({\n systemRef, executionId, owner,\n paused: {\n approvalId: suspension.approvalId, sdkModelMessages: suspension.sdkModelMessages,\n pendingToolName: suspension.toolName, pendingToolArgs: suspension.toolArgs, requestedAt,\n ...(suspension.outputModerationAtPause ? { outputModerationAtPause: moderationEntriesOf(suspension.outputModerationAtPause) } : {}),\n // #2292 R8: the same turn resumes at once, under the treatment it paused with.\n ...(params.personalData ? params.personalData.pausedPosture() : UNGUARDED_PAUSED_POSTURE),\n },\n approved: false,\n reason,\n // #2821: an inline resume is the same turn, so a pause it makes belongs to the same work.\n ...(params.continuesWorkRef ? { workRef: params.continuesWorkRef } : {}),\n ...(params.personalData ? { personalData: params.personalData } : {}),\n auth: params.auth,\n resourceServerInstanceRef: params.resourceServerInstanceRef,\n emitter,\n // The work this turn did before it paused, which no write has recorded: the resume writes it with its own.\n transcript: params.transcript,\n requester: params.requester,\n initiationKind: params.initiationKind,\n autonomousTrigger: params.autonomousTrigger,\n automaticDenials: (params.automaticDenials ?? 0) + 1,\n // The SAME turn, resumed inline: its caller's cancel (A2A `tasks/cancel`, an SSE hang-up) still reaches the resumed\n // model call (#2721 gate-4 F4). The owner's Stop reaches every resume, this one included, through the running-turn\n // registry; a resume an answer released later has no caller to hear.\n ...(params.turnAbortSignal ? { abortSignal: params.turnAbortSignal } : {}),\n });\n }\n\n /**\n * Persist a turn that SUSPENDED at a human-in-the-loop approval boundary.\n *\n * Writes `AWAITING_APPROVAL` plus the serialized run state, then tells the client what decision is\n * being asked for. Three properties matter and each is deliberate:\n *\n * - **It is not terminal.** `AWAITING_APPROVAL` projects to A2A `input-required`, which is\n * explicitly exempt from the liveness sweep and from derive-on-read (finding A3-3) — a paused\n * turn holds no lease BY DESIGN, and treating \"no lease\" as \"abandoned\" here would fail every\n * approval one grace window after it was requested.\n * - **The user's turn is persisted with it.** A reload during the wait must still show the\n * question that is pending a decision, not an empty thread.\n * - **A failed write is loud.** If the row does not record the pause, the resume has nothing to\n * load and the turn is unrecoverable — silence here would strand a human decision forever.\n */\n private async persistApprovalSuspension(params: {\n systemRef: string;\n executionId: string;\n owner: ResolvedOwnerVariant;\n auth: SocketAuthResult | undefined;\n resourceServerInstanceRef?: string;\n /** What the turn wrote into the thread before it paused, applied to the row as it stands at the pause write (#2743). */\n transcript: ConversationalTurnTranscript;\n /** #2292: the turn's personal-data view: its table and the paused reply's model-side text are stored with the pause. */\n personalData?: TurnPersonalDataView;\n suspension: AgentApprovalSuspension;\n emitter: FlowsActorsExecutionEmitter;\n /** The door that opened the turn; carried unchanged into a second pause of a resumed turn (#1594 D11). */\n initiationKind?: FlowsActors_InitiationKind | null;\n /** AUTONOMOUS turns: what started the turn, from its row; decides which tools a resume may offer (#1611). */\n autonomousTrigger?: AutonomousTurnTrigger | null;\n /**\n * The requester of a SECOND pause in a resumed turn: the original requester, read from the row —\n * never the person whose answer resumed it (#1594 D11, I10). Absent on a first pause, where the\n * requester is derived from the turn's own verified auth.\n */\n requester?: HumanDecision_Requester;\n /**\n * How many gated calls this turn has already had DENIED because nobody could answer them. An\n * unroutable pause denies the call and resumes the turn so the agent can answer; a model that then asks\n * for a gated tool again would otherwise loop — deny, resume, ask, deny — without end. One automatic\n * denial per turn is what the agent gets; a second ends the turn.\n */\n automaticDenials?: number;\n /**\n * The turn's attribution (#1598), re-opened for the model call this pause makes for itself — composing an agent's\n * question as a form (#2720). The pause runs after the turn's own frame has closed, so without it that call\n * would be recorded with no tenant, case or turn.\n */\n workAttribution: ModelCallAttributionInput;\n /** The turn's stop. Pressed while a question is being composed, the turn ends CANCELLED and asks nothing. */\n turnAbortSignal?: AbortSignal;\n /** #3325: replace what the turn's trace keeps of a call's arguments, before any write reads it. */\n withholdCallInput: ConversationalTurnTrace['withholdInput'];\n /** When the turn (or its resume) started, for the duration its CANCELLED event reports. */\n turnStartedAt: number;\n /**\n * The work this turn continues, named by its first decision (#2821): set when the pausing turn is the continuation of\n * an answered decision (or an inline resume inside one). Absent for a fresh turn, whose pause opens its own work.\n */\n continuesWorkRef?: string;\n }): Promise<PauseAttemptOutcome> {\n const { systemRef, executionId, owner, emitter } = params;\n /*\n * #2292: the call's arguments as PEOPLE and application code read them — the decision card, the routing resolvers,\n * the review record, a question's text — with the values the model only saw as placeholders put back. The SDK\n * messages the turn resumes from keep the placeholders the model wrote; the resumed tool re-identifies them itself.\n */\n const heldCalls = this.heldToolCallsOf(systemRef, params.suspension, params.personalData);\n const heldSuspension = { ...params.suspension, sdkModelMessages: heldCalls.sdkModelMessages };\n const suspension: AgentApprovalSuspension = params.personalData?.table\n ? { ...heldSuspension, toolArgs: params.personalData.table.reidentifyDeep(params.suspension.toolArgs) as AgentApprovalSuspension['toolArgs'] }\n : heldSuspension;\n const requestedAtDate = new Date();\n const requestedAt = requestedAtDate.toISOString();\n\n /*\n * #3325: a credential the model wrote into a gated call is denied here, instead of paused, so no decision is raised on it\n * and no card or record shows it. Startup refuses a tool whose own schema declares one, so this is what is left: an argument its resource\n * declares, on an open schema or as a stray key the schema dropped, which the raw input still holds. Refused like a call\n * nobody can approve, with one chance to answer without it. The call's copies carry the marker from here on, re-signed,\n * so the resumed turn and any later pause of it hold no secret either.\n *\n * assurance-control: WILDO.SECURITY.FAIL_CLOSED — a credential a model proposes is denied, and stored with no call.\n */\n if (heldCalls.refusal) {\n this.logger.warn('[ConversationalExecution] The model wrote a credential into a gated call; denying it instead of pausing', {\n systemRef, executionId, toolName: suspension.toolName, argumentPaths: heldCalls.refusal.argumentPaths,\n });\n // What the event could not see: a value a schema renamed out of reach is in the trace under a name nothing declares.\n for (const call of heldCalls.refusal.withheldCalls) params.withholdCallInput(call.toolCallId, call.input);\n if (!heldCalls.refusal.denies || !params.auth || (params.automaticDenials ?? 0) >= 1 || params.turnAbortSignal?.aborted) {\n await this.endTurnWithoutPause(params, 'The assistant tried to use a credential in an action, which is not allowed, so nothing was run.');\n return PauseAttemptOutcome.ENDED_WITHOUT_PAUSE;\n }\n await this.resumeOnAutomaticDenial(params, { ...suspension, toolArgs: heldCalls.refusal.input }, 'A credential cannot be a tool argument, so this call was not run. Do it without one, or tell the person how to do it themselves.', requestedAt);\n return PauseAttemptOutcome.RESUMED_INLINE;\n }\n\n /*\n * WHO may answer, decided BEFORE anything is written (#1594 D3). A route nobody could answer — a\n * machine-raised decision on an OWNER route, a ROLE route with no organization, an assignee the\n * gate's resolver could not name or who does not hold the role — is REFUSED here, and the tool call\n * is denied: the turn resumes with a denial so the agent can answer it. \"A decision nobody may\n * answer\" therefore never exists to be stranded.\n */\n let routing: Awaited<ReturnType<ConversationalExecutionBackendService['routePendingDecision']>>;\n try {\n routing = await this.routePendingDecision({\n systemRef, executionId, owner, auth: params.auth,\n toolName: suspension.toolName, toolArgs: suspension.toolArgs, requester: params.requester,\n });\n } catch (error) {\n /*\n * Deciding who may answer FAILED (a role fact or a unit could not be read, a gate's code threw): that is not \"nobody\n * can answer\", which would deny the call and tell the agent so, but an error. The turn ends once, like a pause\n * write that throws without landing (`endTurnWithoutPause`, #2721 re-review F-5). Uncaught, it escaped\n * `startConversationalExecution`, which promises never to throw, and the turn ended after STARTED with no event.\n */\n this.logger.error('[ConversationalExecution] Routing an approval-gated call failed; ending the turn', {\n systemRef, executionId, toolName: suspension.toolName, ...projectCaughtErrorLogFields(error),\n });\n await this.endTurnWithoutPause(params, 'The assistant\\'s request for approval could not be routed, so nothing was run.');\n return PauseAttemptOutcome.ENDED_WITHOUT_PAUSE;\n }\n if (routing.kind === HumanDecision_VerdictKind.REFUSED) {\n this.logger.warn('[ConversationalExecution] An approval-gated call has no route anyone could answer; denying it instead of pausing', {\n systemRef, executionId, toolName: suspension.toolName, reason: routing.reason,\n });\n if (!params.auth || (params.automaticDenials ?? 0) >= 1) {\n // Nothing to resume AS, so the denial cannot be handed back to the agent — or the agent already had\n // its one automatic denial this turn and asked again. End the turn rather than leave it PROCESSING\n // with nobody to finish it, or resume it into the same refusal forever.\n if (params.auth) {\n this.logger.warn('[ConversationalExecution] The agent asked again for a call nobody can approve; ending the turn', {\n systemRef, executionId, toolName: suspension.toolName,\n });\n }\n // Recorded and reported once, through the one helper that honours a Stop pressed meanwhile (#2721 gate-4 F3): a turn\n // that ends in silence reads as a success to an A2A caller and leaves a tab RUNNING (#2721 review, refused route).\n await this.endTurnWithoutPause(params, 'The assistant asked to take an action nobody here can approve, so the turn ended.');\n return PauseAttemptOutcome.ENDED_WITHOUT_PAUSE;\n }\n // Stopped while the route was being decided: the person asked the turn to stop, so it ends CANCELLED rather than\n // resuming into another model call (#2721 gate-4 F3).\n if (params.turnAbortSignal?.aborted) {\n await this.endTurnWithoutPause(params, 'The assistant asked to take an action nobody here can approve, so the turn ended.');\n return PauseAttemptOutcome.ENDED_WITHOUT_PAUSE;\n }\n await this.resumeOnAutomaticDenial(params, suspension, 'No one is able to approve this action, so it was not run.', requestedAt);\n return PauseAttemptOutcome.RESUMED_INLINE;\n }\n const { route, requester, agentRef } = routing;\n // #1628: the three clocks, armed from the gate that routed it. The lapse (the hard stop) is the gate's\n // `lapseAfter`, 24 hours by default, and is computed ONCE here and shared by the row, the blob, the audit\n // row and the announcement — two computations would let them disagree about when the decision lapses.\n const armed = this.armDecisionDeadlines(requestedAtDate, routing.gate, suspension.toolName);\n const expiresAtDate = armed.lapseAt;\n const pausedApprovalExpiresAt = expiresAtDate.toISOString();\n // The ONE decision id (#1594 D1): minted here, named by every answer, move and audit row. The SDK's\n // `approvalId` stays inside the blob as the SDK's own correlation id and is never a key outside it.\n const decisionRef = randomUUID();\n // #2720: an agent's QUESTION is asked through a form, composed once, here, on the model of the agent that asked —\n // inside the turn's attribution frame, so its spend lands on the turn it serves (#1598), and inside its spend frame,\n // so its tokens are charged to the allowance the turn draws on (#2935). Not refused: it serves a turn already admitted.\n // #2292: composed from the question AS THE MODEL WROTE IT (a model composes it, so it is never sent a value its agent\n // saw only as a placeholder), then shown to the person with the values back.\n const composedForm = await this.inTurnSpendFrame(params.initiationKind, params.auth, () => runWithWorkAttributionFrame(params.workAttribution, () => this.composePausedQuestionForm({\n systemRef, toolName: suspension.toolName, toolArgs: params.suspension.toolArgs, agentRef, requestedAt,\n traceContext: { sessionRef: executionId, label: `flows-actors:${systemRef}`, attribution: params.workAttribution },\n ...(params.turnAbortSignal ? { abortSignal: params.turnAbortSignal } : {}),\n })));\n // STOPPED while the question was composed: the person asked the turn to stop, so it ends CANCELLED and the\n // question is never raised — the order the turn's own stop check keeps before a pause (#2524).\n if (params.turnAbortSignal?.aborted) {\n this.logger.info('[ConversationalExecution] Turn stopped while its question was being composed; recording CANCELLED', {\n systemRef, executionId, toolName: suspension.toolName,\n });\n // Through the one helper every end before the pause write takes, so it lands only on the row this turn still holds\n // PROCESSING, like its siblings above (#2721 gate-5 L4). The person stopped it, so it records CANCELLED.\n await this.endTurnWithoutPause(params, 'The turn was stopped before its question was asked.');\n return PauseAttemptOutcome.ENDED_WITHOUT_PAUSE;\n }\n const questionForm = composedForm && params.personalData?.table\n ? params.personalData.table.reidentifyDeep(composedForm) as typeof composedForm\n : composedForm;\n\n // #2768: the relationships the requester stands through where the decision is routed, kept with the pause so the\n // answer resumes only through them. A resumed turn pausing again carries the record its first pause made (the\n // requester it resumed as); a first pause reads it from the turn's own auth, in the route's organization.\n const requesterThroughRelationshipIds = params.requester\n ? params.requester.throughRelationshipIds\n : route.organizationId && params.auth ? relationshipStandingOf(params.auth.initiatorRoles, route.organizationId) : undefined;\n // #2923: what answering it will require, as the gate declares it now; the answer reads this copy, never the gate later.\n const pausedStepUp = this.pausedCallStepUpRequirementOf(systemRef, suspension.toolName);\n const pausedAnswerChannels = this.pausedCallAnswerChannelsOf(systemRef, suspension.toolName);\n const pausedApproval = serializeFlowActorPausedApproval({\n approvalId: suspension.approvalId,\n sdkModelMessages: suspension.sdkModelMessages,\n // #3364 step 3: what the replies were judged under, owners' tightenings included; the resume is held to it.\n ...(suspension.outputModerationAtPause ? { outputModerationAtPause: moderationEntriesOf(suspension.outputModerationAtPause) } : {}),\n pendingToolName: suspension.toolName,\n pendingToolArgs: suspension.toolArgs,\n ...(questionForm ? { questionForm } : {}),\n requestedAt,\n // #465: the suspension carries its own expiry. The field was declared, sent to the browser and\n // read there, and never written — so a pending approval never expired.\n //\n // Computed ONCE, above, and shared with the announcement below: two `Date.now()` calls would\n // let the row and the message a client is shown disagree about when the pause lapses.\n expiresAt: pausedApprovalExpiresAt,\n ...(requesterThroughRelationshipIds ? { requesterThroughRelationshipIds } : {}),\n ...(pausedStepUp ? { stepUp: pausedStepUp } : {}),\n ...(pausedAnswerChannels ? { answerChannels: [...pausedAnswerChannels] } : {}),\n // #2292 R8: what a resume compares the policy in force then against (an untreated turn records null).\n ...(params.personalData ? params.personalData.pausedPosture() : UNGUARDED_PAUSED_POSTURE),\n });\n\n const pauseRowFilter = {\n executionId,\n ...owner.ownerFields,\n machineCredentialId: machineCredentialIdOf(params.auth),\n resourceServerInstanceRef: agentInstanceOf(params.resourceServerInstanceRef),\n };\n try {\n const paused = await this.writeTurnTranscript(\n owner,\n {\n ...pauseRowFilter,\n // #2721: a decision is raised only by the turn that is running. A row that left PROCESSING meanwhile (stopped,\n // cancelled, or waiting on another decision) is not paused again, so no earlier decision is overwritten unended.\n status: FlowsActors_Status.PROCESSING,\n },\n // Onto the row as it stands (#2743): a sibling turn that ended while this one ran keeps its messages.\n params.transcript,\n {\n status: FlowsActors_Status.AWAITING_APPROVAL,\n pausedApproval,\n // The route, on the row that holds the resume compare-and-swap (#1594 D2).\n pendingDecisionRef: decisionRef,\n // #2821: the work this decision belongs to — this decision itself for a fresh turn's pause, the work's first\n // decision when the turn continuing an answered decision pauses again.\n pendingDecisionWorkRef: params.continuesWorkRef ?? decisionRef,\n pendingDecisionRouteKind: route.kind,\n pendingDecisionEligibleRole: route.eligibleRole ?? null,\n pendingDecisionOrganizationId: route.organizationId ?? null,\n pendingDecisionOrganizationUnitId: route.organizationUnitId ?? null,\n pendingDecisionRequiredQualificationKinds: route.requiredQualificationKinds?.length ? [...route.requiredQualificationKinds] : null,\n pendingDecisionAssigneeUserId: route.assigneeUserId ?? null,\n pendingDecisionClaimedAt: null,\n pendingDecisionRequesterKind: requester.kind,\n pendingDecisionRequesterRef: requester.ref,\n pendingDecisionRequesterClientId: requester.clientId ?? null,\n pendingDecisionRequestedAt: requestedAtDate,\n pendingDecisionExpiresAt: expiresAtDate,\n pendingDecisionRouteVersion: 0,\n // #1628: the CLAIM and DECISION clocks, with every stage's due instant and no marker fired.\n ...armedDeadlineColumns(armed),\n ...(params.initiationKind ? { initiationKind: params.initiationKind } : {}),\n },\n params.personalData,\n );\n if (!paused) {\n this.logger.error('[ConversationalExecution] Approval-pause write matched no running row; no decision is raised', {\n systemRef, executionId, approvalId: suspension.approvalId,\n consequence: 'the turn left PROCESSING before it could pause (stopped, cancelled, or already waiting), so nothing is pending',\n });\n // The turn still ends where its client can see it (#2721 review N-3): this gated call is not pending anywhere.\n // If the row waits for another turn's decision, that is what the thread holds; otherwise the call is lost, and\n // when the person had stopped the turn meanwhile that is what they are told: they asked for it to stop, and it\n // did (#2721 re-review I-2). Nothing is written either way: the row is no longer this turn's.\n const waitingFor = await this.waitingDecisionOf(owner, pauseRowFilter);\n const stopped = params.turnAbortSignal?.aborted === true;\n this.reportTurnEnd(emitter, systemRef, executionId,\n waitingFor !== undefined ? { kind: TurnEndRecordKind.DECISION_WAITING, decisionRef: waitingFor } : TURN_END_RECORDED,\n () => (stopped\n ? this.emitTurnCancelled(emitter, systemRef, executionId, params.turnStartedAt)\n : this.emitError(emitter, systemRef, executionId, TURN_ENDED_WITHOUT_PAUSE_CODE, 'The conversation moved on before the assistant could ask for approval, so nothing was run.')));\n return PauseAttemptOutcome.ENDED_WITHOUT_PAUSE;\n }\n } catch (error) {\n /*\n * The write may have LANDED before its error reached here (a timeout after the store committed), as the answer path\n * also allows for. Read the row back (#2721 re-review I-2): waiting for THIS decision means the pause stands, and the\n * turn goes on to record and announce it rather than telling the tab it failed while an inbox shows the decision.\n *\n * #2749: a read-back that FAILS is not an answer. It used to be read as \"not waiting\", so a pause that committed and\n * then threw, with its read-back failing too, ended the turn (the guarded end missing the AWAITING row) and reported\n * AGENT_FAILED, while the decision sat in an inbox with no `HUMAN_DECISION_REQUESTED` row and nobody told of it. The\n * read is retried (`readThrownPauseWrite`) and its three answers are kept apart:\n * - LANDED: the pause stands; the request is recorded and announced below, once.\n * - NOT_LANDED: the row was read and holds no such decision; the turn ends as before. Its end may still find THIS\n * decision waiting (the pause committed after the read-back), and then it stands after all.\n * - UNKNOWN: nobody can say whether it was raised. The turn records and announces nothing, and is not told it\n * failed: the decision may be in an inbox, answerable. The request facts are the repair's\n * (`repairUnrecordedDecisionRequests`), which records and announces it once the row can be read, if it waits.\n *\n * Rejected (#2749): recording the request row BEFORE the pause write, keyed by the decision, and marking it withdrawn\n * when the write is known not to have landed. The trail would then say an agent asked for a decision that never\n * existed, a WITHDRAWN resolution would describe a decision taken away from people it never reached, and with every\n * read failing the turn could never decide which to write. The repair derives the row from the one place that says\n * whether the decision exists: the row it waits on.\n */\n const outcome = await this.readThrownPauseWrite(owner, pauseRowFilter, decisionRef);\n if (outcome === DecisionRequestWriteOutcome.UNKNOWN) {\n this.logger.error('[ConversationalExecution] An approval-pause write threw and the row could not be read back; whether the decision was raised is unknown', {\n systemRef, executionId, decisionRef, approvalId: suspension.approvalId, ...projectCaughtErrorLogFields(error),\n consequence: 'nothing is recorded or announced now; if the decision waits, the repair records and announces it once the row can be read, '\n + 'and if it does not, the interrupted-turn sweep fails the turn',\n });\n /*\n * Told the decision may wait (DECISION_PENDING, recoverable, naming it), never that the turn failed. The two errors\n * are not symmetric: a requester told \"pending\" for a pause that did not land waits until the thread's history\n * shows the turn failed (the interrupted-turn sweep writes it); a requester told \"failed\" for a pause that DID land\n * asks again while an approver can still approve the first call, which then runs. A tab reloads its history over\n * this error and shows the decision if it waits; an A2A caller is answered -32015. A dedicated \"unconfirmed\" code\n * was rejected: a new member of the client vocabulary on every surface (the thread's wording, the chat door's\n * treatment, the A2A mapping, the history merge) for a state that needs two independent store faults.\n */\n this.emitDecisionPending(emitter, systemRef, executionId, decisionRef);\n return PauseAttemptOutcome.UNCONFIRMED;\n }\n if (outcome === DecisionRequestWriteOutcome.NOT_LANDED) {\n this.logger.error('[ConversationalExecution] Failed to persist an approval pause; ending the turn', {\n systemRef, executionId, approvalId: suspension.approvalId, ...projectCaughtErrorLogFields(error),\n });\n // Recorded, not left PROCESSING for the interrupted-turn sweep: the end write keeps its own guard, so a row another\n // turn's decision holds is not written and that decision is what the client is told.\n const ended = await this.endTurnWithoutPause(params, 'The assistant\\'s request for approval could not be recorded, so nothing was run.', {\n ownDecisionRef: decisionRef,\n });\n if (!(ended.kind === TurnEndRecordKind.DECISION_WAITING && ended.decisionRef === decisionRef)) return PauseAttemptOutcome.ENDED_WITHOUT_PAUSE;\n this.logger.warn('[ConversationalExecution] An approval pause read back as not landed was found waiting by the end write; the decision stands', {\n systemRef, executionId, decisionRef,\n });\n } else {\n this.logger.warn('[ConversationalExecution] The approval-pause write reported an error but the pause is on the row; the decision stands', {\n systemRef, executionId, decisionRef, ...projectCaughtErrorLogFields(error),\n });\n }\n }\n\n // Recorded once the pause EXISTS, under the requester's own principal, inside the frame of the agent\n // whose gate raised it — so the trail reads \"this agent, working for this person, asked\".\n if (this.auditLogs) {\n const agentFrame = { agentRef: agentRef ?? systemRef, agentExecutionId: executionId, systemRef, toolName: suspension.toolName, decisionRef };\n const requestContext = params.auth\n ? runWithAgentActorFrame(agentFrame, () => this.auditContextFor(params.auth as SocketAuthResult, owner))\n : undefined;\n // Inside the agent's frame as well (#2749 review F6): a pause with no auth to build a context from (a resumed turn\n // pausing again) still names the agent that asked, as the repair's row does; with a context, the context's agent wins.\n void runWithAgentActorFrame(agentFrame, () => this.recordDecisionRequested({\n decisionRef, executionId, systemRef, toolName: suspension.toolName, route, requester,\n ...(agentRef ? { agentRef } : {}),\n expiresAt: pausedApprovalExpiresAt,\n claimDeadlineAt: armed.claimDeadlineAt.toISOString(),\n claimClockBasis: armed.claimBasis,\n decisionDeadlineAt: armed.decisionDeadlineAt.toISOString(),\n decisionClockBasis: armed.decisionBasis,\n }, requestContext)).catch((error: unknown) => {\n // The repair records it (`repairUnrecordedDecisionRequests`). The announcement below still goes out now, so when\n // the repair later records this request it announces it a second time: an announcement carries only the\n // decision's id and makes an inbox re-read, and a request the trail is missing is the worse loss.\n this.logger.warn('[ConversationalExecution] Could not record a raised decision on the audit trail; the pause stands and the repair records it', {\n systemRef, executionId, decisionRef, ...projectCaughtErrorLogFields(error),\n });\n });\n }\n\n // Only announce a pause that was actually RECORDED. Emitting first would invite a client to\n // answer a decision no row can accept.\n /*\n * Built through the NAMED schema rather than as an anonymous `data` bag. The bag is\n * `Record<string, unknown>` on the wire, so nothing typed this announcement and the browser\n * ended up listening on `flows-actors:approval-request` — an event no code ever emitted, removed\n * with #2524 — which meant no shipped screen could observe a paused turn at all (#528). Typing the\n * producer is what lets the consumer parse it instead of guessing at keys.\n *\n * `expiresAt` travels here and nowhere else: since #465 the suspension genuinely carries an\n * expiry, and this block is the only path by which a client can learn it.\n */\n // #2904: the call's file deliverable, bound by its hash as every card of this decision binds it.\n const { deliverables } = await this.decisionDeliverablesOf(systemRef, {\n decisionRef, toolName: suspension.toolName, toolArgs: suspension.toolArgs as Record<string, unknown> | undefined,\n ...(route.organizationId ? { organizationId: route.organizationId } : {}),\n });\n const announcement = this.buildApprovalAnnouncement(systemRef, {\n approvalId: suspension.approvalId,\n decisionRef,\n routeKind: route.kind,\n toolName: suspension.toolName,\n toolArgs: suspension.toolArgs,\n requestedAt,\n expiresAt: pausedApprovalExpiresAt,\n ...(questionForm ? { questionForm } : {}),\n ...(deliverables ? { deliverables } : {}),\n });\n\n emitter(CoreWebSocketEvent.FLOWS_ACTORS_MESSAGE, {\n systemRef,\n executionId,\n messageType: FlowsActors_MessageContentType.PROGRESS,\n // The tool's NAME, as every PROGRESS message carries its call (`conversational-turn-trace`), and never a sentence:\n // the pause is the typed announcement in `data`, which a page words in its reader's language (#3201). The English\n // `Waiting for approval to run \"<tool>\".` this carried was rendered as written, naming the identifier.\n content: suspension.toolName,\n data: announcement,\n timestamp: new Date(),\n });\n // The requester too: an OWNER route is held by the person who raised it, whose inbox holds it since #2527.\n this.announceDecisionRouted(route, decisionRef, undefined, requester);\n return PauseAttemptOutcome.RAISED;\n }\n\n /**\n * The application's business calendar (#1628), or `undefined` when it declares none or the configuration\n * is not loaded in this process.\n */\n private reviewCalendar(): ReviewCalendar | undefined {\n try {\n return this.appConfig?.isInitialized() ? this.appConfig.config.reviewCalendar : undefined;\n } catch {\n return undefined;\n }\n }\n\n /** The gate's deadline declaration with every default applied; the defaults when the gate declares none. */\n private deadlinePolicyOf(gate: FunctionTool_HumanApprovalGate | undefined): ReviewDeadlinePolicy {\n const deadlines = gate?.deadlines;\n return resolveReviewDeadlinePolicy(deadlines ? { ...deadlines, rules: deadlines.rules?.map(({ stage, action }) => ({ stage, action })) } : undefined);\n }\n\n /**\n * Arm a decision's clocks at the moment it pauses (#1628).\n *\n * A CALENDAR clock needs the application's calendar, and startup refuses a gate asking for one in an\n * application that declares none (I6). Reaching the catch below therefore means the calendar could not\n * be read in THIS process at all; the clocks are then armed on elapsed time and the fact is logged as an\n * error, because stranding a person's turn on a missing reminder would be the worse failure.\n */\n private armDecisionDeadlines(requestedAt: Date, gate: FunctionTool_HumanApprovalGate | undefined, toolName: string): ArmedReviewDeadlines {\n const policy = this.deadlinePolicyOf(gate);\n try {\n return armReviewDeadlines({ requestedAt, policy, calendar: this.reviewCalendar() });\n } catch (error) {\n this.logger.error('[ConversationalExecution] A decision\\'s CALENDAR clock could not be armed; counting it in elapsed time', {\n toolName, ...projectCaughtErrorLogFields(error),\n });\n const elapsed = (target: ReviewDeadlinePolicy['claim']) => ({ ...target, basis: ReviewClockBasis.ELAPSED });\n return armReviewDeadlines({ requestedAt, policy: { ...policy, claim: elapsed(policy.claim), decision: elapsed(policy.decision) }, calendar: undefined });\n }\n }\n\n /**\n * WHO may answer a decision the turn is about to raise, and on whose authority (#1594 D3).\n *\n * - The GATE comes from the tool's declaration (`resolveFunctionToolApprovalGate`); an OWNER route when\n * the tool cannot be resolved, because the requester alone answering is the narrowest route.\n * - The REQUESTER is the turn's own verified principal on a first pause, and the original requester,\n * carried from the row, on a second one.\n * - The ORGANIZATION is the owner row's when the conversation is org-owned, else the requester's\n * active organization. A route that needs one and has none is refused.\n * - The UNIT is stamped only when the requester's authority in that organization is confined to\n * exactly one unit; otherwise only org-wide holders match, the stricter reading.\n */\n private async routePendingDecision(params: {\n systemRef: string;\n executionId: string;\n owner: ResolvedOwnerVariant;\n auth: SocketAuthResult | undefined;\n toolName: string;\n toolArgs?: Record<string, unknown>;\n requester?: HumanDecision_Requester;\n }): Promise<\n | { readonly kind: HumanDecision_VerdictKind.ALLOWED; readonly route: HumanDecision_Route; readonly requester: HumanDecision_Requester; readonly agentRef?: string; readonly gate?: FunctionTool_HumanApprovalGate }\n | { readonly kind: HumanDecision_VerdictKind.REFUSED; readonly reason: HumanDecision_RefusalReason }\n > {\n const requester = params.requester ?? humanDecisionRequesterOfAuth(params.auth);\n if (!requester) return { kind: HumanDecision_VerdictKind.REFUSED, reason: HumanDecision_RefusalReason.NOBODY_CAN_ANSWER };\n\n // A registry that cannot resolve the tool is the \"cannot be resolved\" case, never a lost pause: the turn\n // still pauses, on the OWNER route, the narrowest one.\n let resolved: GatedFunctionToolResolution;\n try {\n resolved = this.resolveApprovalGatedFunctionTool(params.systemRef, params.toolName);\n } catch (error) {\n this.logger.warn('[ConversationalExecution] The gated tool could not be resolved for routing; the requester answers', {\n systemRef: params.systemRef, toolName: params.toolName, ...projectCaughtErrorLogFields(error),\n });\n resolved = { kind: GatedFunctionToolResolutionKind.AGENT_MISSING };\n }\n const functionTool = resolved.kind === GatedFunctionToolResolutionKind.FOUND ? resolved.functionTool : undefined;\n const agentRef = resolved.kind === GatedFunctionToolResolutionKind.FOUND ? resolved.agentRef : undefined;\n const gate = (functionTool ? resolveFunctionToolApprovalGate(functionTool) : undefined) ?? { route: HumanDecision_RouteKind.OWNER };\n // #2734: what the decision about to be raised will expose; its answerers are vetted against it.\n const raisedSubject = humanDecisionSubjectOfToolCall(functionTool, params.toolArgs);\n\n const organizationId = params.owner.ownerFields.organizationId ?? params.auth?.initiatorIds?.organizationId;\n const unitEntries = (params.auth?.initiatorRoles ?? []).filter((entry) =>\n entry.relatedPrimaryScope === ResourcePrimaryScope.ORGANIZATIONS && entry.relatedResourceId === organizationId);\n const confinedUnitIds = [...new Set(unitEntries.map((entry) => entry.organizationUnitId))];\n const organizationUnitId = confinedUnitIds.length === 1 && confinedUnitIds[0] ? confinedUnitIds[0] : undefined;\n\n if (gate.route === HumanDecision_RouteKind.OWNER) {\n // A machine answers nothing: an OWNER decision it raised could never be settled.\n if (requester.kind === HumanDecision_RequesterKind.MACHINE) return { kind: HumanDecision_VerdictKind.REFUSED, reason: HumanDecision_RefusalReason.NOBODY_CAN_ANSWER };\n return { kind: HumanDecision_VerdictKind.ALLOWED, requester, agentRef, gate, route: { kind: HumanDecision_RouteKind.OWNER, ...(organizationId ? { organizationId } : {}) } };\n }\n if (!organizationId) return { kind: HumanDecision_VerdictKind.REFUSED, reason: HumanDecision_RefusalReason.ROUTE_HAS_NO_ORGANIZATION };\n\n const base: HumanDecision_Route = {\n kind: gate.route,\n eligibleRole: gate.eligibleRole,\n organizationId,\n ...(organizationUnitId ? { organizationUnitId } : {}),\n // #2967: the qualifications every answerer must also hold, the same floor for a later claim, move or escalation.\n ...(gate.requiredQualificationKinds?.length ? { requiredQualificationKinds: [...gate.requiredQualificationKinds] } : {}),\n };\n if (gate.route === HumanDecision_RouteKind.ROLE) {\n // #1611 (d): a MACHINE requester has nobody to fall back on — no owner, no one watching the turn — so a\n // ROLE nobody in the organization can answer under is refused NOW rather than left to lapse a day later\n // while SKIP_IF_ACTIVE turns away every run in between. A person's request keeps #1594's behaviour.\n if (requester.kind === HumanDecision_RequesterKind.MACHINE && !(await this.roleRouteHasAnAnswerer(base, requester, raisedSubject))) {\n return { kind: HumanDecision_VerdictKind.REFUSED, reason: HumanDecision_RefusalReason.NOBODY_CAN_ANSWER };\n }\n return { kind: HumanDecision_VerdictKind.ALLOWED, requester, agentRef, gate, route: base };\n }\n\n // ASSIGNEE: the declared resolver names one person, who is vetted exactly as any later assignee is (I8).\n const toolContext = params.auth ? this.buildToolExecutionContext(params.auth, params.executionId, params.systemRef) : undefined;\n const assigneeUserId = toolContext && gate.assignee\n ? await gate.assignee(params.toolArgs ?? {}, toolContext).catch((error: unknown) => {\n this.logger.warn('[ConversationalExecution] A gate\\'s assignee resolver failed; refusing the pause', {\n toolName: params.toolName, ...projectCaughtErrorLogFields(error),\n });\n return undefined;\n })\n : undefined;\n if (!assigneeUserId) return { kind: HumanDecision_VerdictKind.REFUSED, reason: HumanDecision_RefusalReason.NOBODY_CAN_ANSWER };\n const route: HumanDecision_Route = { ...base, assigneeUserId };\n const vetted = await this.authorizeDecisionAct({ userId: assigneeUserId, route, requester, act: HumanDecision_Act.ANSWER, subject: raisedSubject });\n if (vetted.kind === HumanDecision_VerdictKind.REFUSED) return { kind: HumanDecision_VerdictKind.REFUSED, reason: vetted.reason };\n return { kind: HumanDecision_VerdictKind.ALLOWED, requester, agentRef, gate, route };\n }\n\n /**\n * Ask the ONE predicate whether this person may act on this decision, with their role facts resolved\n * NOW in the decision's organization. `userId` is a person: a reassignment target or claimant is\n * vetted the same way as someone answering.\n */\n private async authorizeDecisionAct(params: {\n userId: string | undefined;\n /** The acting principal's kind. A move TARGET is always a person, so it defaults to a signed-in user. */\n executionType?: ExecutionContext_ExecutionType;\n route: HumanDecision_Route;\n requester: HumanDecision_Requester;\n act: HumanDecision_Act;\n /** What the decision's card exposes (#2734): `decisionSubjectOfRow` for a waiting decision, the gated call at raise. */\n subject: HumanDecisionSubject;\n }) {\n const roleFacts = params.userId && isReviewerRoute(params.route)\n ? await resolveHumanDecisionRoleFacts(this.humanDecisionRoleFactsPorts(), {\n userId: params.userId, route: params.route, requester: params.requester, subject: params.subject,\n })\n : NO_HUMAN_DECISION_ROLE_FACTS;\n return authorizeHumanDecisionActor({\n actor: { executionType: params.executionType ?? ExecutionContext_ExecutionType.USER_REQUEST, userId: params.userId },\n roleFacts, route: params.route, requester: params.requester, act: params.act,\n });\n }\n\n /** #2797: the act's person held to the decision organization's granting policy, with what the door can prove. */\n private holdToGrantingOrganization(input: Parameters<typeof holdHumanDecisionActorToGrantingOrganization>[1]) {\n return holdHumanDecisionActorToGrantingOrganization({ executionContextCreator: this.executionContextCreator, logger: this.logger }, input);\n }\n\n /** How role facts are resolved against the running application: current roles, the role table, the unit tree. */\n private humanDecisionRoleFactsPorts(): HumanDecisionRoleFactsPorts {\n return createHumanDecisionRoleFactsPorts({\n executionContextCreator: this.executionContextCreator,\n roleHierarchy: (roleKey, scope) => this.authorizer.getRoleHierarchy(roleKey as Roles, scope),\n systemAccess: this.systemAccess,\n resourcesRegistry: this.resourcesRegistry,\n repositoriesRegistry: this.repositoriesRegistry,\n });\n }\n\n /**\n * What a waiting row's decision card exposes (#2734): the record its gated call addresses, when the tool declares the\n * row it acts on. Derived from the paused call and the live tool declaration each time it is asked; a pause that cannot\n * be read, or a tool that can no longer be resolved, names no record, which hides the card from a representative\n * unless the requester acts through the same relationship.\n */\n private decisionSubjectOfRow(row: Pick<FlowActorExecution, 'systemRef' | 'pausedApproval'>): HumanDecisionSubject {\n if (!row.pausedApproval) return HUMAN_DECISION_NAMES_NO_RECORD;\n try {\n const paused = parseFlowActorPausedApproval(row.pausedApproval);\n return this.decisionSubjectOfCall(row.systemRef, paused.pendingToolName, paused.pendingToolArgs as Record<string, unknown> | undefined);\n } catch {\n return HUMAN_DECISION_NAMES_NO_RECORD;\n }\n }\n\n /**\n * The arguments naming another record that an approval's edit changed (#2734), read against the gated tool's\n * declarations: its argument schema and every schema of the resource its arguments describe (main and inheritance\n * variants, as the evaluation export reads them). `changedArgumentKeys` is the modification's own list of changed\n * argument names. `undefined` when the edit cannot be judged (the tool or its resource can no longer be read), which the\n * edit check treats as an edit it may not admit from someone answering only through a relationship.\n */\n private foreignKeyArgumentsEditedIn(systemRef: string, toolName: string, changedArgumentKeys: readonly string[]): string[] | undefined {\n try {\n const resolved = this.resolveApprovalGatedFunctionTool(systemRef, toolName);\n if (resolved.kind !== GatedFunctionToolResolutionKind.FOUND) return undefined;\n const resourceType = resolved.functionTool.argumentsResource?.resourceType;\n const configuration = resourceType ? this.resourcesRegistry.tryGetResourceConfiguration(resourceType) : undefined;\n const resourceSchemas = configuration?.mainSchema\n ? [configuration.mainSchema, ...resourceInheritanceVariantSchemas(configuration.inheritenceSchemaDefinition as never)]\n : undefined;\n return humanDecisionForeignKeyArgumentsEdited({ tool: resolved.functionTool, resourceSchemas, changedArgumentKeys });\n } catch {\n return undefined;\n }\n }\n\n /** The argument a gated tool declares names its file deliverable (#2904), when it declares one. */\n private deliverableFileArgumentOf(systemRef: string, toolName: string): string | undefined {\n try {\n const resolved = this.resolveApprovalGatedFunctionTool(systemRef, toolName);\n return resolved.kind === GatedFunctionToolResolutionKind.FOUND ? resolved.functionTool.deliverableFileArgument : undefined;\n } catch {\n return undefined;\n }\n }\n\n /**\n * A gated call's file deliverable, bound by its content hash (#2904): the ONE resolution the announcement, the history,\n * the inbox and the act read, so they agree on the presentation and its id. Nothing for a tool that declares none.\n */\n private async decisionDeliverablesOf(systemRef: string, call: {\n readonly decisionRef: string;\n readonly toolName: string;\n readonly toolArgs: Readonly<Record<string, unknown>> | undefined;\n readonly organizationId?: string;\n }): Promise<ResolvedDecisionDeliverables> {\n const deliverableArgument = this.deliverableFileArgumentOf(systemRef, call.toolName);\n if (!deliverableArgument) return {};\n return resolveDecisionDeliverables({\n decisionRef: call.decisionRef,\n deliverableArgument,\n toolArgs: call.toolArgs,\n ...(call.organizationId ? { organizationId: call.organizationId } : {}),\n files: this.decisionDeliverableFiles(),\n key: decisionPresentationKeyOfRuntime(this.appConfig),\n onReadFailure: (error) => this.logger.warn('[ConversationalExecution] A decision\\'s file deliverable could not be read; it is shown and sealed as not bound', {\n systemRef, decisionRef: call.decisionRef, toolName: call.toolName, ...projectCaughtErrorLogFields(error),\n }),\n });\n }\n\n /** The file reads a deliverable is bound through, as the system (#2904); undefined when no file service is bound. */\n private decisionDeliverableFiles(): DecisionDeliverableFiles | undefined {\n const files = this.files;\n if (!files) return undefined;\n const context = () => this.executionContextCreator.createForInternalSystemOperation();\n return {\n readFile: async (fileId) => files.getFile(fileId, await context()),\n ensureContentHash: async (fileId) => files.ensureContentHash(fileId, await context()),\n };\n }\n\n /** The argument a gated tool declares as the row it acts on (#2734), when it declares one. */\n private decisionRowIdArgumentOf(systemRef: string, toolName: string): string | undefined {\n try {\n const resolved = this.resolveApprovalGatedFunctionTool(systemRef, toolName);\n return resolved.kind === GatedFunctionToolResolutionKind.FOUND ? resolved.functionTool.argumentsResource?.rowIdArgument : undefined;\n } catch {\n return undefined;\n }\n }\n\n /** What a gated call exposes (#2734): the record its tool declares it acts on, read from `toolArgs`. */\n private decisionSubjectOfCall(systemRef: string, toolName: string, toolArgs: Record<string, unknown> | undefined): HumanDecisionSubject {\n try {\n const resolved = this.resolveApprovalGatedFunctionTool(systemRef, toolName);\n return resolved.kind === GatedFunctionToolResolutionKind.FOUND ? humanDecisionSubjectOfToolCall(resolved.functionTool, toolArgs) : HUMAN_DECISION_NAMES_NO_RECORD;\n } catch {\n return HUMAN_DECISION_NAMES_NO_RECORD;\n }\n }\n\n /**\n * A bare execution context for an audit row written on behalf of a verified principal, with no route to\n * hang it on. Adopts the ambient agent frame, so a caller that opened one gets the agent on the row.\n */\n private auditContextFor(auth: SocketAuthResult, owner: ResolvedOwnerVariant) {\n const operation = this.resourcesRegistry.getResourceConfiguration(owner.resourceType)?.operations.find(\n (candidate: ResourceConfiguration_Operation<any, any, any>) => candidate.operationIdentifier === CoreResourceOperation.UPDATE && candidate.isOperationDefault === true,\n ) as ResourceConfiguration_Operation<any, any, any>;\n return createBareExecutionContextFromVerifiedAuth(operation, auth);\n }\n\n /**\n * The announcement of one pending approval — the ONE derivation both the live pause and the\n * conversation history use (#1601), so a page that loads a paused thread is shown exactly what a page\n * that watched it pause was shown.\n *\n * Typed state only, never a sentence (#3201): what a page SAYS about the pause is worded from this — the presentation's\n * title, the tool's title in `flows_actors_tools` — in the reader's language. The English sentence that accompanied it\n * was rendered as written, naming the tool by its identifier.\n */\n private buildApprovalAnnouncement(systemRef: string, pause: {\n readonly approvalId: string;\n readonly decisionRef?: string;\n readonly routeKind?: HumanDecision_RouteKind;\n readonly toolName: string;\n readonly toolArgs?: Record<string, unknown>;\n readonly requestedAt: string;\n readonly expiresAt?: string;\n /** #2720: the form a question is asked through, when one was composed. */\n readonly questionForm?: HumanInputForm;\n /** #2904: the call's file deliverable, resolved by the caller (`decisionDeliverablesOf`), which the presentation binds. */\n readonly deliverables?: ResolvedDecisionDeliverables['deliverables'];\n }): WS_FlowsActorsApprovalAnnouncementData {\n const toolInputSchema = this.describeGatedToolInputSchema(systemRef, pause.toolName);\n // #2720: an agent's question is shown as the question, rebuilt from the call by the one function every reader uses.\n const question = pause.decisionRef ? this.pausedQuestionOf(systemRef, {\n decisionRef: pause.decisionRef, toolName: pause.toolName, toolArgs: pause.toolArgs, questionForm: pause.questionForm,\n requestedAt: pause.requestedAt, ...(pause.expiresAt ? { expiresAt: pause.expiresAt } : {}),\n }) : undefined;\n const reasonCodes = this.agentWorkDecisions?.declaredReasonCodes() ?? [];\n const riskLevel = this.gatedCallRiskLevel(systemRef, pause.toolName);\n return {\n approvalRequested: true,\n approvalId: pause.approvalId,\n ...(pause.decisionRef ? { decisionRef: pause.decisionRef } : {}),\n ...(pause.routeKind ? { routeKind: pause.routeKind } : {}),\n toolName: pause.toolName,\n toolArgs: pause.toolArgs,\n // The tool's own fields, so an approver who edits the call is not handed a JSON blob (#587).\n // Omitted — never guessed — when the paused tool cannot be resolved.\n ...(toolInputSchema ? { toolInputSchema } : {}),\n requestedAt: pause.requestedAt,\n ...(pause.expiresAt ? { expiresAt: pause.expiresAt } : {}),\n // #1921: the vocabulary the approver may give a reason from when changing or rejecting the call — the same\n // list the answer door checks, so an offered code is never refused. Omitted when nothing is declared.\n ...(reasonCodes.length > 0 ? { reasonCodes: [...reasonCodes] } : {}),\n // #2526: the risk the call's GATE declares, as the decision's inbox card carries it. Omitted, never guessed, when none.\n ...(riskLevel ? { riskLevel } : {}),\n ...(question ? { question } : {}),\n // #2903: what the page shows, built as the inbox card builds it, and the id its answer echoes.\n ...(pause.decisionRef ? (() => {\n const presented = withDecisionPresentation({\n decisionRef: pause.decisionRef, plane: HumanDecision_Plane.CONVERSATIONAL, toolName: pause.toolName,\n toolArgs: pause.toolArgs ?? {}, ...(question ? { request: question } : {}),\n }, decisionPresentationKeyOfRuntime(this.appConfig), pause.deliverables);\n return { presentation: presented.presentation, presentationId: presented.presentationId };\n })() : {}),\n };\n }\n\n /**\n * The approval a stored turn is waiting on, for a page that was not watching when it paused (#1601).\n *\n * The pause is announced once, over the socket that started the turn. A page loaded afterwards —\n * a reload, a second tab, a companion restart — had no way to learn it: the thread showed the\n * person's message and nothing else, while the engine held a decision it was waiting for. Measured\n * 2026-09-25 on the creation workbench: a thread `awaiting_approval` with a proposed build task,\n * rendered as an unanswered message.\n *\n * Reads the backend-only pause AS SYSTEM because a LIST projects it out; the CALLER must already\n * have established that the execution is the principal's own (the history route lists through the\n * owner-filtered variant before asking). Exposes the announcement only, never the stored model\n * messages. `undefined` for a row that is not paused or whose pause cannot be read.\n */\n public async describePendingApproval(\n resourceType: CoreResourceType,\n execution: { readonly executionId: string; readonly systemRef: string; readonly resourceServerInstanceRef?: string },\n ): Promise<WS_FlowsActorsApprovalAnnouncementData | undefined> {\n try {\n const row = await this.systemAccess.readAsSystem<FlowActorExecution>(\n resourceType, { executionId: execution.executionId }, { suppressSystemAudit: true },\n );\n if (!row || row.status !== FlowsActors_Status.AWAITING_APPROVAL || !row.pausedApproval) return undefined;\n const paused = parseFlowActorPausedApproval(row.pausedApproval);\n const { deliverables } = row.pendingDecisionRef ? await this.decisionDeliverablesOf(execution.systemRef, {\n decisionRef: row.pendingDecisionRef, toolName: paused.pendingToolName, toolArgs: paused.pendingToolArgs as Record<string, unknown> | undefined,\n ...(row.pendingDecisionOrganizationId ? { organizationId: row.pendingDecisionOrganizationId } : {}),\n }) : {};\n return this.buildApprovalAnnouncement(execution.systemRef, {\n approvalId: paused.approvalId,\n ...(row.pendingDecisionRef ? { decisionRef: row.pendingDecisionRef } : {}),\n ...(row.pendingDecisionRouteKind ? { routeKind: row.pendingDecisionRouteKind } : {}),\n toolName: paused.pendingToolName,\n toolArgs: paused.pendingToolArgs as Record<string, unknown> | undefined,\n requestedAt: paused.requestedAt,\n ...(paused.expiresAt ? { expiresAt: paused.expiresAt } : {}),\n ...(paused.questionForm ? { questionForm: paused.questionForm } : {}),\n ...(deliverables ? { deliverables } : {}),\n });\n } catch (error) {\n this.logger.warn('[ConversationalExecution] A paused turn\\'s approval could not be described for history', {\n resourceType, executionId: execution.executionId, ...projectCaughtErrorLogFields(error),\n });\n return undefined;\n }\n }\n\n /**\n * Record a human's approval decision and RESUME the suspended turn.\n *\n * ## The three things this must get right\n *\n * 1. **The decision is scoped like every other read of this family.** The filter carries the owner\n * FK, the machine credential and the agent instance, so one principal cannot answer another's\n * pending approval — a decision is an ACTION on someone else's work, which makes it exactly the\n * kind of thing an isolation axis exists for.\n * 2. **`approvalId` must match.** It is the idempotency key AND the anti-replay check: the model\n * SDK binds it to the specific tool call with an HMAC signature, so answering a stale id must\n * refuse rather than approve whatever happens to be pending now.\n * 3. **A DENIAL resumes too.** Denying is not cancelling: the SDK is told the call was refused and\n * the model gets to respond (\"I can't do that without approval\"). Treating denial as a terminal\n * failure would leave the user with a dead thread instead of an answer.\n */\n /**\n * The tool-execution context a turn's grounding tools run under.\n *\n * Extracted so the RESUME cannot drift from the original turn. It was inlined at the start-turn\n * site only, and the resume passed no context at all — `resolveAgentTools` returns `undefined`\n * without one, so a resumed turn ran with NO TOOLS. The approved call could not be executed, and\n * the unresolved `tool_use` reached the provider as\n * \"tool_use ids were found without tool_result blocks\". The approval succeeded and the work never\n * happened.\n *\n * The auth is the APPROVER's, carried from the socket that answered. That is the point rather than\n * an implementation detail: the gated tool runs with a verified identity, so approving cannot\n * escalate anything the approver could not already do. Ambient authority here would make the\n * approval itself a privilege-escalation primitive.\n */\n private buildToolExecutionContext(\n auth: SocketAuthResult,\n executionId: string,\n systemRef: string,\n decisionRef?: string,\n /**\n * Facts of the TURN, read from its row by the caller (at start, from what it is about to write; at a\n * resume, from what the row holds) — never from the model or a client. They decide whether a gated call\n * may pause and which tools are offered (#1611).\n */\n turn?: { initiationKind?: FlowsActors_InitiationKind | null; autonomousTrigger?: AutonomousTurnTrigger | null },\n ): FunctionToolExecutionContext {\n return {\n auth,\n executionId,\n ...(turn?.initiationKind ? { initiationKind: turn.initiationKind } : {}),\n ...(turn?.autonomousTrigger ? { autonomousTrigger: turn.autonomousTrigger } : {}),\n // The decision a resumed turn runs under, so the approved write's row carries `agentActor.decisionRef` (#1594).\n ...(decisionRef ? { decisionRef } : {}),\n // Named on the agent frame each tool call runs in, so an audit row says which system the agent's\n // execution belonged to (#1595).\n systemRef,\n // The org the tools scope reads to = the CALLER's own org from their verified auth (a user's\n // active org, or an org-machine's org), NOT the conversation owner scope. An app-machine\n // caller has no org → undefined (app-scope reads).\n organizationId: auth.initiatorIds?.organizationId,\n services: {\n resourcesRegistry: this.resourcesRegistry,\n servicesRegistryHandler: this.servicesRegistryHandler,\n executionContextCreator: this.executionContextCreator,\n // A tool dispatches a resource operation while bypassing Express, so the operation's own\n // authored `rateLimit?` — whose other consumers are the HTTP route's per-caller and\n // per-address counts, the MCP tool plane and the chat-command door — has no enforcer on this\n // plane unless one is supplied here.\n rateLimitService: this.rateLimitService,\n // Same reason, for the operation's `roles` ACL: bypassing Express also bypasses the\n // CONTROLLER tier, which is the only place that ACL is read. Supplying the authorizer here\n // is what lets the tool factories apply it themselves.\n authorizer: this.authorizer,\n // #2300: the engine's retrieval tool searches the index as the caller, through this.\n ...(this.ragRetrieval ? { ragRetrieval: this.ragRetrieval } : {}),\n // #3008: a tool call refused by the operation's declared rate limit records its window's first refusal.\n ...(this.auditLogs ? { auditLogs: this.auditLogs } : {}),\n },\n };\n }\n\n /**\n * The ONE write that ends a pending decision without resuming its turn — a lapse (the sweep, or an\n * answer that arrived too late), a withdrawal (the work was cancelled), or a requester whose authority\n * no longer holds. Shared, so the terminal row cannot differ by which path noticed first.\n *\n * A compare-and-swap on `status` AND the exact serialized blob the caller read (and the decision id,\n * when there is one). The store decides, not the caller's snapshot: a decision that landed, or a\n * re-pause that replaced the blob, makes this match nothing, and a turn someone just resumed is never\n * ended. Filtered `updateAsSystem` is atomic on both adapters (Mongo `findOneAndUpdate`; PostgreSQL\n * re-asserts the caller's predicates in the UPDATE's own WHERE).\n *\n * The RESOLUTION is written inside the same write (#1594 I4): a crash after it still leaves who\n * decided what, and only the caller that won may record the RESOLVED event.\n *\n * @returns the row as it stood when this call ended the decision, or `null` when the row had already moved on. Record\n * the RESOLVED event and the agent-work settlement from THIS row, never from the one passed in: when a move landed in\n * between, the decision ended on the route it moved to, and the passed row still describes the route it left (its\n * kind, eligible role, claim and missed deadlines; #2528 review F5).\n */\n private async endPendingDecision(params: {\n resourceType: CoreResourceType;\n executionId: string;\n rawPausedApproval: string;\n decisionRef?: string | null;\n /**\n * What ended it, which decides the status the row ends in and, for a failure, its code (#2827,\n * `DECISION_ENDING_TRANSITION`), except for an `erasure`'s ending, which CANCELS the work whatever its outcome (#2865).\n */\n outcome: DecisionEndingOutcome;\n decidedByUserId?: string;\n toolName?: string;\n scopeContext?: { userId?: string; organizationId?: string; applicationId?: string };\n /**\n * The row as read: its claim/request instants are the decision's `presentedAt` (#1599 I8), its route organization\n * is kept on the marker, and a previous decision it still owes a record for is repaid before this write\n * overwrites the resolution columns that record needs (review F3).\n */\n row: FlowActorExecution;\n /** The instant the decision ends; the agent-work record carries the same one. */\n decidedAt?: Date;\n /**\n * The person who already knows the decision ended, so is not told (#2569): whoever ended it from the app. Defaults\n * to `decidedByUserId`. A caller whose decider acted from OUTSIDE the app (a delegated client cancelling the work)\n * passes `null`, because that person's inbox has not seen it end.\n */\n announceExcept?: string | null;\n /**\n * The row is being TORN DOWN (#2582): deleted by a cascade, or scrubbed and kept retained. The write joins the\n * teardown's transaction, so an answer that lands after the teardown's read makes it miss rather than end the decision\n * twice. No decision record is owed: none is repaid first and no marker is written, because the scope goes with its\n * records and an erasure must not write new data about its subject. The holders are told only once that transaction\n * commits, so a teardown that rolls back announces nothing.\n */\n teardown?: { readonly transaction?: TransactionContext };\n /**\n * The decision is ended because a person's ERASURE leaves nobody it could continue for (#2865). The row STAYS, so,\n * unlike a teardown, the decision record is still owed (its marker is written) and the work's ending is still\n * logged; but the write joins the erasure's transaction, and the holders are told and the work logged only once\n * that transaction commits. A previous decision's owed record is repaid inside that transaction too, without the\n * erased person as its decider (review F1): written outside it, the record would outlive a rolled-back erasure and\n * keep their id after the agent-work severer had already run.\n */\n erasure?: { readonly transaction?: TransactionContext; readonly erasedUserId: string };\n }): Promise<FlowActorExecution | null> {\n const now = params.decidedAt ?? new Date();\n // #2865: an erasure's ending CANCELS the work whatever its outcome (see DECISION_ENDED_BY_ERASURE); every other\n // ending ends it as its outcome says.\n const transition = params.erasure ? DECISION_ENDED_BY_ERASURE : DECISION_ENDING_TRANSITION[params.outcome];\n if (params.decisionRef && !params.teardown) await this.repayOwedCorrectionBeforeOverwrite(params.resourceType, params.row, params.decisionRef, params.erasure);\n const transaction = params.teardown?.transaction ?? params.erasure?.transaction;\n const writeOptions = {\n ...(params.scopeContext ? { scopeContext: params.scopeContext } : {}),\n ...(transaction ? { transaction } : {}),\n };\n /*\n * #2569 review A-5: the write also matches the ROUTE VERSION it read, so the holders told below are the ones the\n * decision was actually taken from. A move landing in between changes who holds the decision, not whether it ends:\n * the row is re-read and the decision ended on the route it now has. Bounded, since each extra pass needs another\n * move to land in the window, and the sweep that runs next picks up anything left.\n */\n let row = params.row;\n for (let attempt = 0; attempt < END_PENDING_DECISION_ROUTE_ATTEMPTS; attempt += 1) {\n const ended = await this.systemAccess.updateAsSystem(\n params.resourceType,\n {\n executionId: params.executionId,\n status: FlowsActors_Status.AWAITING_APPROVAL,\n pausedApproval: params.rawPausedApproval,\n ...(params.decisionRef ? { pendingDecisionRef: params.decisionRef, pendingDecisionRouteVersion: row.pendingDecisionRouteVersion ?? 0 } : {}),\n },\n {\n status: transition.status,\n // #2827: the row's history gains the end, with its code for a failure, as every other end's does.\n statusChanges: [...(row.statusChanges ?? []), flowsActorsStatusChange(transition, now)],\n pausedApproval: null,\n finishedAt: now,\n ...PENDING_DECISION_CLEARED,\n ...(params.decisionRef ? {\n lastResolvedDecisionRef: params.decisionRef,\n // #2821: the work this ending ends, carried over from the pause.\n lastResolvedDecisionWorkRef: row.pendingDecisionWorkRef ?? params.decisionRef,\n decidedByUserId: params.decidedByUserId ?? null,\n decidedAt: now,\n decisionOutcome: params.outcome,\n decisionToolName: params.toolName ?? null,\n decisionModifiedArgumentNames: [],\n // #1599 I3: a tool approval is always a proposal, so its ending owes a decision record; the marker is\n // written by the same compare-and-swap, so a crash before the record leaves it for the repair sweep. A\n // teardown owes none (see `teardown`), and neither does an agent's QUESTION, which proposed nothing (#2720).\n ...(params.teardown || this.pausedCallAsksThePerson(row.systemRef, params.toolName ?? '') ? {} : correctionMarkerOf(params.decisionRef, row, now)),\n } : {}),\n },\n Object.keys(writeOptions).length > 0 ? writeOptions : undefined,\n );\n // A write that matched nothing answers null; anything else is the updated row.\n if (ended !== null && ended !== undefined) {\n // #2821: ending the decision ends its work, as the status this write set. Not for a teardown: the row is being\n // deleted or scrubbed, and an erasure must not write new data about its subject.\n if (params.decisionRef && !params.teardown) {\n const workRef = row.pendingDecisionWorkRef ?? params.decisionRef;\n if (params.erasure) {\n // After the erasure commits: the log is a write of its own, and a rolled-back erasure ended nothing.\n this.afterTeardownCommits(transaction, ['human-decision-erasure-work-event', params.resourceType, params.decisionRef].join(':'), () => {\n void this.recordWorkEvent(params.resourceType, { executionId: params.executionId }, workRef, transition).catch((error: unknown) => this.logger.warn(\n '[ConversationalExecution] The work an erasure ended could not be logged on its thread', { executionId: params.executionId, ...projectCaughtErrorLogFields(error) },\n ));\n });\n } else {\n await this.recordWorkEvent(params.resourceType, { executionId: params.executionId }, workRef, transition);\n }\n }\n // #2569: only the write that ended it tells the holders it left them, and never the person who already knows.\n const route = params.decisionRef ? humanDecisionRouteOfRow(row) : undefined;\n const except = params.announceExcept === undefined ? params.decidedByUserId : params.announceExcept ?? undefined;\n if (route && params.decisionRef) {\n const decisionRef = params.decisionRef;\n const requester = humanDecisionRequesterOfRow(row);\n const key = ['human-decision-withdrawn', params.resourceType, decisionRef].join(':');\n const announce = (): void => this.announceDecisionWithdrawn({ route, requester, decisionRef, ...(except ? { except } : {}) });\n if (!transaction) {\n announce();\n } else {\n // #2886 review MED-3: capturable, so a purge the organization-purge sweep captures keeps this withdrawal's\n // announcement with its commit, and the purge's next run sends it once when this effect never runs.\n registerTransactionPostCommitEffect(transaction, capturablePostCommitEffect({\n key,\n execute: async () => announce(),\n capture: decisionEndingCapture({\n effect: 'human-decision-withdrawn',\n auditLogs: () => this.auditLogs,\n announcement: {\n announcement: CapturedHumanDecisionAnnouncement.WITHDRAWN,\n route, decisionRef, ...(requester ? { requester } : {}), ...(except ? { except } : {}),\n },\n tellAnnouncement: (payload) => announceCapturedHumanDecision(this.webSocket, this.logger, payload),\n subjectId: params.executionId,\n onFailure: (error) => this.logger.warn('[ConversationalExecution] A withdrawn decision could not be announced; the purge\\'s next run sends it', {\n executionId: params.executionId, decisionRef, ...projectCaughtErrorLogFields(error),\n }),\n }),\n }));\n }\n }\n return row;\n }\n if (!params.decisionRef) return null;\n const fresh = await this.systemAccess.readAsSystem<FlowActorExecution>(\n params.resourceType, { executionId: params.executionId }, { suppressSystemAudit: true, ...(transaction ? { transaction } : {}) },\n ).catch((error: unknown) => {\n // A teardown cannot read an unreadable row as \"nothing waits\": it is about to delete or scrub that row, so the\n // decision would stay requested forever. It fails the teardown instead, as the settler contract asks (#2582\n // review F6). Every other ending treats the row as gone, as before.\n if (params.teardown || params.erasure) throw error;\n return null;\n });\n const onlyTheRouteMoved = !!fresh\n && fresh.status === FlowsActors_Status.AWAITING_APPROVAL\n && fresh.pausedApproval === params.rawPausedApproval\n && fresh.pendingDecisionRef === params.decisionRef\n && (fresh.pendingDecisionRouteVersion ?? 0) !== (row.pendingDecisionRouteVersion ?? 0);\n if (!onlyTheRouteMoved) return null;\n row = fresh;\n }\n return null;\n }\n\n /**\n * #2903: an answered decision's release and its seal, in ONE transaction: the release lands with its seal or neither\n * lands. The release is a guarded write that answers null when another writer moved the row first; then no seal is\n * written. A service built without the unit of work, the repositories or the application's configuration (a hand-built\n * test service) releases as before and seals nothing: every application container binds all three.\n */\n private async releaseWithSeal<T>(\n executionResourceType: string,\n sealFacts: DecisionSealFacts | undefined,\n release: (serviceOptions: ServiceOptions) => Promise<T | null>,\n ): Promise<{ readonly released: T | null; readonly sealDigest?: string; readonly sealId?: string }> {\n const sealServices = this.repositoriesRegistry && this.applicationIdentity\n ? {\n repositoriesRegistry: this.repositoriesRegistry, systemAccess: this.systemAccess, applicationIdentity: this.applicationIdentity,\n afterCommit: { ...(this.auditLogs ? { auditLogs: this.auditLogs } : {}), ...(this.approvalSealRelay ? { relay: this.approvalSealRelay } : {}) },\n }\n : undefined;\n if (!sealFacts || !sealServices || !this.unitOfWork) return { released: await release({}) };\n return this.unitOfWork.executeTransaction(\n { boundary: 'conversational-decision-release', participants: { execution: executionResourceType, approvalSeals: CoreResourceType.APPROVAL_SEALS } },\n async (serviceOptions) => {\n const released = await release(serviceOptions);\n if (released === null) return { released };\n const sealed = await sealDecisionInTransaction(sealServices, sealFacts, { transaction: serviceOptions.transaction });\n return { released, sealDigest: sealed.decisionPayloadDigest, sealId: sealed.row._id };\n },\n );\n }\n\n /**\n * Record that a decision ended, on the audit trail — called ONLY by the caller that won the write that\n * ended or released it, so there is exactly one RESOLVED row per decision (#1594 I9). Fire-and-forget:\n * the trail must never fail the decision it observes.\n */\n private recordDecisionResolved(params: {\n /** The row as it stood BEFORE the write that ended the decision — the deadline columns are cleared by that write. */\n row: Pick<FlowActorExecution, 'executionId' | 'systemRef' | 'pendingDecisionRef' | 'pendingDecisionRouteKind' | 'pendingDecisionEligibleRole' | 'pendingDecisionRequiredQualificationKinds' | 'pendingDecisionOrganizationId'\n | 'pendingDecisionClaimDeadlineAt' | 'pendingDecisionDecisionDeadlineAt' | 'pendingDecisionClaimMissedFiredAt' | 'pendingDecisionDecisionMissedFiredAt' | 'pendingDecisionClaimedAt'\n | 'pendingDecisionClockPausedAt' | 'pendingDecisionClaimWarningAt' | 'pendingDecisionClaimClockBasis' | 'pendingDecisionDecisionWarningAt' | 'pendingDecisionDecisionClockBasis'>;\n outcome: HumanDecision_Outcome;\n toolName?: string;\n agentRef?: string;\n decidedByUserId?: string;\n deciderRoles?: readonly string[];\n modifiedArgumentNames?: readonly string[];\n reasonGiven?: boolean;\n lateDecisionUserId?: string;\n /** #2664: the chat delivery the answer arrived through; recorded only beside the person who decided. */\n answeredThrough?: HumanDecision_AnsweredThrough;\n /** #2905: how the decider was authenticated; recorded only beside the person who decided. */\n decider?: HumanDecision_DeciderRecord;\n /** #2905: who asked, recorded beside who answered. */\n requester?: HumanDecision_Requester;\n /** #2903: the payload digest of the answer's seal, written with the release. */\n decisionPayloadDigest?: string;\n requestContext?: ReturnType<ConversationalExecutionBackendService['auditContextFor']>;\n principal?: Parameters<AuditLogsBackendService['logHumanDecisionResolved']>[2];\n /**\n * #2886: a captured teardown PREPARES the row through the audit service's capture view: the view replaces the service,\n * the chat cards' note is not written here (the teardown keeps it as a row of its own, #2930), and a failure surfaces\n * so the capture can decline instead of keeping a notice beside a missing record.\n */\n capture?: { readonly auditLogs: AuditLogsBackendService };\n }): Promise<unknown> | undefined {\n const { row } = params;\n const auditLogs = params.capture?.auditLogs ?? this.auditLogs;\n // The decision's chat cards are told how it ended, whatever the audit sink (#2664 S5b gate L3). A stay of this\n // plane is the decision itself: its ref names both the stay and the occurrence.\n const noticeOutcome = this.decisionNoticeOutcomeOf(row, params.outcome);\n if (noticeOutcome && !params.capture) noteHumanDecisionNoticeOutcome(this.decisionNoticeStays, this.logger, noticeOutcome);\n if (!auditLogs || !row.pendingDecisionRef || !row.pendingDecisionRouteKind) return undefined;\n const isReviewer = row.pendingDecisionRouteKind !== HumanDecision_RouteKind.OWNER;\n // #1628: whether each armed service target was met. Computed off the row read before the ending write.\n const deadlineOutcomes = deadlineOutcomesOfRow(row, params.outcome, new Date(), this.reviewCalendar());\n const recorded = auditLogs.logHumanDecisionResolved({\n decisionRef: row.pendingDecisionRef,\n executionId: row.executionId,\n plane: HumanDecision_Plane.CONVERSATIONAL,\n systemRef: row.systemRef,\n ...(params.agentRef ? { agentRef: params.agentRef } : {}),\n ...(params.toolName ? { toolName: params.toolName } : {}),\n routeKind: row.pendingDecisionRouteKind,\n ...(row.pendingDecisionEligibleRole ? { routeEligibleRole: row.pendingDecisionEligibleRole } : {}),\n ...(row.pendingDecisionRequiredQualificationKinds?.length ? { routeRequiredQualificationKinds: [...row.pendingDecisionRequiredQualificationKinds] } : {}),\n ...(row.pendingDecisionOrganizationId ? { organizationId: row.pendingDecisionOrganizationId } : {}),\n outcome: params.outcome,\n ...(params.decidedByUserId ? { decidedByUserId: params.decidedByUserId } : {}),\n ...(params.deciderRoles ? { deciderRoles: [...params.deciderRoles] } : {}),\n ...(isReviewer && params.decidedByUserId && row.pendingDecisionEligibleRole ? { admittedByRouteRole: row.pendingDecisionEligibleRole } : {}),\n modifiedArgumentNames: params.modifiedArgumentNames ?? [],\n reasonGiven: params.reasonGiven ?? false,\n ...(params.lateDecisionUserId ? { lateDecisionUserId: params.lateDecisionUserId } : {}),\n ...(deadlineOutcomes ? { deadlineOutcomes } : {}),\n ...(params.decidedByUserId && params.answeredThrough ? {\n answeredThroughInboundSource: params.answeredThrough.inboundSourceKey,\n answeredThroughInboundDeliveryId: params.answeredThrough.inboundDeliveryId,\n } : {}),\n ...(params.decidedByUserId ? humanDecisionDeciderEventFields(params.decider) : {}),\n ...humanDecisionRequesterEventFields(params.requester),\n ...(params.decidedByUserId && params.decisionPayloadDigest ? { decisionPayloadDigest: params.decisionPayloadDigest } : {}),\n }, params.requestContext, params.principal);\n if (params.capture) return recorded;\n return recorded.catch((error: unknown) => {\n this.logger.warn('[ConversationalExecution] Could not record a resolved decision on the audit trail; the decision stands', {\n executionId: row.executionId, decisionRef: row.pendingDecisionRef, ...projectCaughtErrorLogFields(error),\n });\n });\n }\n\n /**\n * The chat cards' note of how a decision ended (#2664 S5b gate L3), as the ledger takes it: this plane's stay is the\n * decision itself, its ref naming both the stay and the occurrence. A captured teardown keeps it (#2930); `undefined` for a\n * row that names no decision.\n */\n private decisionNoticeOutcomeOf(row: Pick<FlowActorExecution, 'pendingDecisionRef'>, outcome: HumanDecision_Outcome): CapturedDecisionNoticeOutcomePayload | undefined {\n if (!row.pendingDecisionRef) return undefined;\n return { plane: HumanDecision_Plane.CONVERSATIONAL, stayRef: row.pendingDecisionRef, occurrenceRef: row.pendingDecisionRef, outcome };\n }\n\n /**\n * Repay a record this row still OWES for an EARLIER decision before a settle overwrites the resolution columns it\n * would be repaired from (#1599 review F3). The marker is one slot: a record whose write failed, followed by a new\n * pause answered before the repair sweep ran, would otherwise lose the first decision for good. Never throws — if the\n * repayment fails too, the loss is logged at ERROR with the decision it cost, and the settle goes on (refusing the\n * new decision over an old record's bookkeeping would put a store outage in front of every answer).\n */\n private async repayOwedCorrectionBeforeOverwrite(\n resourceType: CoreResourceType,\n row: FlowActorExecution,\n decisionRef: string,\n /** An erasure's repay: inside its transaction, without the erased person, and a failure fails the erasure. */\n erasure?: { readonly transaction?: TransactionContext; readonly erasedUserId: string },\n ): Promise<void> {\n const owed = row.pendingCorrectionRecordRef;\n if (!owed || owed === decisionRef || !this.agentWorkDecisions) return;\n if (erasure) {\n await this.agentWorkDecisions.repairOwedRecordOfExecution(resourceType, row as unknown as ExecutionResolutionRow, erasure);\n return;\n }\n const repaid = await this.agentWorkDecisions.repairOwedRecordOfExecution(resourceType, row as unknown as ExecutionResolutionRow).catch(() => undefined);\n if (!repaid) {\n this.logger.error('[ConversationalExecution] A previous decision\\'s agent-work record is still owed and could not be written; this settle overwrites what it would be repaired from', {\n executionId: row.executionId, owedDecisionRef: owed, settlingDecisionRef: decisionRef,\n });\n }\n }\n\n /**\n * Record a settled decision on the agent's proposal (#1599), for the caller that WON the settling write (I2), and\n * clear the row's marker once the record exists. Never throws: a record that cannot be written leaves the marker,\n * and the repair sweep writes it from the row's resolution columns (I3) — as long as the row is still there, which is\n * why it answers whether the record exists: a deletion may not remove the row the repair would need (#2582).\n *\n * @returns `true` once the record exists (or none is kept: no recorder is bound); `false` when it is still owed.\n */\n private async recordAgentWorkSettlement(params: {\n resourceType: CoreResourceType;\n row: FlowActorExecution;\n decisionRef: string;\n outcome: HumanDecision_Outcome;\n decidedAt: Date;\n /** The pause as parsed; or its raw blob, when the caller did not parse it. The proposal is its tool arguments. */\n paused?: FlowActorExecution_PausedApproval;\n rawPausedApproval?: string;\n toolName?: string;\n modifiedToolArgs?: Record<string, unknown>;\n modifiedArgumentNames?: readonly string[];\n reasonCode?: string;\n reasonText?: string;\n deciderUserId?: string;\n admittedByRole?: string;\n }): Promise<boolean> {\n if (!this.agentWorkDecisions) return true;\n const { row } = params;\n // #2720: an agent's QUESTION asked its person for information and proposed nothing, so it is not agent-work review:\n // counting it would put questions in the override rate's denominator. Nothing is owed (no marker was written for it).\n if (params.toolName && this.pausedCallAsksThePerson(row.systemRef, params.toolName)) return true;\n const owner = agentWorkOwnerOfExecution(params.resourceType, row as unknown as Record<string, unknown>);\n if (!owner) {\n this.logger.warn('[ConversationalExecution] A settled decision\\'s execution names no owner scope; its record is left to the repair sweep', {\n executionId: row.executionId, decisionRef: params.decisionRef,\n });\n return false;\n }\n let paused = params.paused;\n if (!paused && params.rawPausedApproval) {\n try { paused = parseFlowActorPausedApproval(params.rawPausedApproval); } catch { paused = undefined; }\n }\n try {\n await this.agentWorkDecisions.recordDecision({\n owner,\n decisionRef: params.decisionRef,\n surface: AgentWorkDecisionSurface.TOOL_CALL_APPROVAL,\n outcome: params.outcome,\n agentRef: row.systemRef,\n ...(params.toolName ? { toolName: params.toolName } : {}),\n ...(row.caseRef ? { caseRef: row.caseRef } : {}),\n executionRef: { kind: ExecutionRefKind.CONVERSATIONAL_EXECUTION, id: row.executionId },\n ...(paused?.pendingToolArgs !== undefined ? { proposal: paused.pendingToolArgs } : {}),\n ...(params.modifiedToolArgs ? { final: params.modifiedToolArgs } : {}),\n ...(params.modifiedArgumentNames ? { fallbackPaths: params.modifiedArgumentNames } : {}),\n ...(params.reasonCode ? { reasonCode: params.reasonCode } : {}),\n ...(params.reasonText ? { reasonText: params.reasonText } : {}),\n ...(params.deciderUserId ? { deciderUserId: params.deciderUserId } : {}),\n ...(params.admittedByRole ? { admittedByRole: params.admittedByRole } : {}),\n presentedAt: decisionPresentedAtOfRow(row, params.decidedAt),\n decidedAt: params.decidedAt,\n recordSource: AgentWorkDecisionRecordSource.SETTLEMENT,\n ...(row.pendingDecisionOrganizationId ? { routeOrganizationId: row.pendingDecisionOrganizationId } : {}),\n }, { executionResourceType: params.resourceType, executionId: row.executionId });\n return true;\n } catch (error) {\n this.logger.warn('[ConversationalExecution] A settled decision could not be recorded yet; the repair sweep will write it from the row', {\n executionId: row.executionId, decisionRef: params.decisionRef, ...projectCaughtErrorLogFields(error),\n });\n return false;\n }\n }\n\n /**\n * End every decision whose window has closed with nobody answering (#484, #1594 D9).\n *\n * `pendingDecisionExpiresAt` names the instant after which the waiting turn must not resume, and the\n * status vocabulary says such a pause ends FAILED. The sweep SELECTS on that indexed column — it used\n * to list every paused turn and parse every blob to find the lapsed ones — and each candidate is then\n * READ, because the blob the compare-and-swap keys on is backend-only and a listing projects it out.\n *\n * Each lapse writes `decisionOutcome = LAPSED` with no decider inside the ending write, and records one\n * RESOLVED row whose actor is the application. A lapse is its own outcome, never counted as a refusal.\n *\n * A turn paused before decisions were routed carries no expiry column and is not selected; it is\n * answered or left, which this greenfield change accepts rather than carrying a second sweep.\n */\n public async sweepLapsedApprovalPauses(now: Date = new Date()): Promise<LapsedApprovalPauseSweepResult> {\n const result: LapsedApprovalPauseSweepResult = { scanned: 0, lapsed: 0, stillOpen: 0, raced: 0, unreadable: 0 };\n\n for (const resourceType of FLOW_ACTOR_EXECUTION_OWNER_VARIANTS) {\n let candidates: FlowActorExecution[] = [];\n try {\n const listed = await this.systemAccess.listAsSystem<FlowActorExecution>(\n resourceType,\n { status: FlowsActors_Status.AWAITING_APPROVAL, pendingDecisionExpiresAt: { $lte: now } },\n undefined,\n { suppressSystemAudit: true },\n );\n candidates = Array.isArray(listed) ? listed : (listed?.data ?? []);\n } catch (error) {\n // One variant failing must not abort the others: a per-scope outage degrades coverage.\n this.logger.error('[ConversationalExecution] Lapsed-approval sweep could not list paused turns for a scope', {\n resourceType, ...projectCaughtErrorLogFields(error),\n });\n continue;\n }\n\n for (const candidate of candidates) {\n result.scanned += 1;\n const executionId = candidate.executionId;\n let row: FlowActorExecution | null;\n try {\n row = await this.systemAccess.readAsSystem<FlowActorExecution>(resourceType, { executionId }, { suppressSystemAudit: true });\n } catch (error) {\n result.unreadable += 1;\n this.logger.warn('[ConversationalExecution] Lapsed-approval sweep could not read a paused turn', {\n resourceType, executionId, ...projectCaughtErrorLogFields(error),\n });\n continue;\n }\n if (!row || row.status !== FlowsActors_Status.AWAITING_APPROVAL || !row.pendingDecisionRef) {\n // Moved on between the listing and the read — decided, or already ended.\n result.raced += 1;\n continue;\n }\n if (!row.pausedApproval) {\n result.unreadable += 1;\n this.logger.warn('[ConversationalExecution] A turn reads AWAITING_APPROVAL with no pause state; left as it stands', { resourceType, executionId });\n continue;\n }\n if (!row.pendingDecisionExpiresAt || new Date(row.pendingDecisionExpiresAt).getTime() > now.getTime()) {\n result.stillOpen += 1;\n continue;\n }\n const toolName = this.pendingToolNameOf(row.pausedApproval);\n try {\n const decidedAt = new Date();\n const endedOn = await this.endPendingDecision({\n resourceType, executionId, rawPausedApproval: row.pausedApproval, decisionRef: row.pendingDecisionRef,\n outcome: HumanDecision_Outcome.LAPSED, toolName, row, decidedAt,\n });\n if (!endedOn) { result.raced += 1; continue; }\n result.lapsed += 1;\n this.recordDecisionResolved({ row: endedOn, requester: humanDecisionRequesterOfRow(endedOn), outcome: HumanDecision_Outcome.LAPSED, toolName });\n await this.recordAgentWorkSettlement({\n resourceType, row: endedOn, decisionRef: row.pendingDecisionRef, outcome: HumanDecision_Outcome.LAPSED, decidedAt,\n rawPausedApproval: row.pausedApproval, ...(toolName ? { toolName } : {}),\n });\n this.logger.info('[ConversationalExecution] Ended a decision nobody answered in its window', {\n resourceType, executionId, decisionRef: row.pendingDecisionRef, expiresAt: row.pendingDecisionExpiresAt, toolName,\n });\n } catch (error) {\n this.logger.error('[ConversationalExecution] Lapsed-approval sweep could not end an expired decision', {\n resourceType, executionId, ...projectCaughtErrorLogFields(error),\n });\n }\n }\n }\n\n // Logged unconditionally, including the zero case: a sweep that silently finds nothing is\n // indistinguishable from a sweep that silently stopped running.\n this.logger.info('[ConversationalExecution] Lapsed-approval sweep complete', { ...result });\n return result;\n }\n\n /**\n * Record a raised decision's `HUMAN_DECISION_REQUESTED` row under its deterministic id\n * ({@link humanDecisionRequestedAuditEventId}), the one shape both the turn that raised it and the repair write, so\n * their two recordings of one request are one row. Rejects when the row could not be written: each caller decides what\n * that costs (the turn logs it and leaves the request to the repair; the repair tries again next run).\n */\n private recordDecisionRequested(request: {\n readonly decisionRef: string;\n readonly executionId: string;\n readonly systemRef: string;\n readonly agentRef?: string;\n readonly toolName?: string;\n readonly route: HumanDecision_Route;\n readonly requester: HumanDecision_Requester;\n readonly expiresAt?: string;\n readonly claimDeadlineAt?: string;\n readonly claimClockBasis?: ReviewClockBasis;\n readonly decisionDeadlineAt?: string;\n readonly decisionClockBasis?: ReviewClockBasis;\n }, requestContext: ReturnType<ConversationalExecutionBackendService['auditContextFor']> | undefined): Promise<void> {\n if (!this.auditLogs) return Promise.resolve();\n const { route, requester } = request;\n return this.auditLogs.logHumanDecisionRequested({\n decisionRef: request.decisionRef, executionId: request.executionId, plane: HumanDecision_Plane.CONVERSATIONAL, systemRef: request.systemRef,\n ...(request.agentRef ? { agentRef: request.agentRef } : {}),\n ...(request.toolName ? { toolName: request.toolName } : {}),\n routeKind: route.kind,\n ...(route.eligibleRole ? { routeEligibleRole: route.eligibleRole } : {}),\n ...(route.requiredQualificationKinds?.length ? { routeRequiredQualificationKinds: [...route.requiredQualificationKinds] } : {}),\n ...(route.organizationId ? { organizationId: route.organizationId } : {}),\n requesterKind: requester.kind,\n ...(route.assigneeUserId ? { assigneeUserId: route.assigneeUserId } : {}),\n ...(request.expiresAt ? { expiresAt: request.expiresAt } : {}),\n ...(request.claimDeadlineAt ? { claimDeadlineAt: request.claimDeadlineAt } : {}),\n ...(request.claimClockBasis ? { claimClockBasis: request.claimClockBasis } : {}),\n ...(request.decisionDeadlineAt ? { decisionDeadlineAt: request.decisionDeadlineAt } : {}),\n ...(request.decisionClockBasis ? { decisionClockBasis: request.decisionClockBasis } : {}),\n }, requestContext, requester.kind !== HumanDecision_RequesterKind.MACHINE ? requester.ref : undefined, undefined, {\n eventId: humanDecisionRequestedAuditEventId(request.decisionRef),\n });\n }\n\n /**\n * The waiting rows {@link repairUnrecordedDecisionRequests} has found recorded, keyed by row and by when the row last\n * changed: a row that has not changed since still waits on the same decision, so it is not read again. A cache only:\n * emptied, the next run asks again and records nothing twice (the audit row's id is derived from the decision).\n */\n private recordedDecisionRequestKeys = new Set<string>();\n\n /**\n * Record the request of every waiting decision that has no `HUMAN_DECISION_REQUESTED` row, and announce it to its holders\n * (#2749). Derived from the row, the one place that says whether a decision exists, so nothing marks a request as owed.\n *\n * Its population is what the turn could not record: a pause write that threw while its read-back failed too, which the\n * turn reports as possibly waiting and leaves here; a turn whose process died between its pause and its record; and a\n * request row the audit store refused. Only decisions raised more than {@link DECISION_REQUEST_REPAIR_GRACE_MS} ago are\n * asked about (by the listing, and again on the row as read), so the turn that raised one has long finished recording\n * and announcing it. The request is recorded once, whoever records it: under its deterministic id, and only when no row\n * exists for the decision under that id or, for a request recorded before the id was derived, under any id\n * (`hasRecordedHumanDecisionRequest`). The announcement is not always single: when the audit store refused the TURN's\n * row, the turn had already announced the decision, and the repair that records it announces it again. That second\n * announcement carries only the decision's id and makes an inbox re-read; a request missing from the trail is the\n * worse loss.\n *\n * What the repaired row can say is what the waiting row holds: its route, requester, lapse and deadlines as they stand\n * now (a clock act moves the deadlines), and the agent whose gate raised it, read from the agent's declaration. The\n * requester's own request context is gone, so the row names the requester and the agent frame, without the client or\n * relationship the turn's context would have attributed. The holders are announced to only while the route never\n * moved: a move (route version above 0) announced the decision to the holders it moved to.\n *\n * Rides the approval-pause expiry sweep's schedule: the same waiting rows, every minute.\n *\n * assurance-control: WILDO.AUDIT.SECURITY_EVENT — every raised decision has its request row: derived from the waiting row\n * and recorded once, even when the turn that raised it could not learn that it had.\n */\n public async repairUnrecordedDecisionRequests(now: Date = new Date()): Promise<UnrecordedDecisionRequestRepairResult> {\n const result: UnrecordedDecisionRequestRepairResult = { scanned: 0, alreadyRecorded: 0, repaired: 0, raced: 0, failed: 0 };\n const auditLogs = this.auditLogs;\n if (!auditLogs) return result;\n const cutoff = new Date(now.getTime() - DECISION_REQUEST_REPAIR_GRACE_MS);\n const seen = new Set<string>();\n let everyScopeListed = true;\n for (const resourceType of FLOW_ACTOR_EXECUTION_OWNER_VARIANTS) {\n let candidates: FlowActorExecution[] = [];\n try {\n const listed = await this.systemAccess.listAsSystem<FlowActorExecution>(\n resourceType,\n { status: FlowsActors_Status.AWAITING_APPROVAL, pendingDecisionRequestedAt: { $lte: cutoff } },\n undefined,\n { suppressSystemAudit: true },\n );\n candidates = Array.isArray(listed) ? listed : (listed?.data ?? []);\n } catch (error) {\n everyScopeListed = false;\n this.logger.error('[ConversationalExecution] Decision-request repair could not list waiting turns for a scope', {\n resourceType, ...projectCaughtErrorLogFields(error),\n });\n continue;\n }\n for (const candidate of candidates) {\n const changedAt = candidate.updatedAt ? new Date(candidate.updatedAt).getTime() : Number.NaN;\n // A row that names no change instant cannot be told apart from its next decision, so it is asked about every run.\n const key = Number.isNaN(changedAt) ? undefined : `${resourceType}:${candidate.executionId}:${changedAt}`;\n if (key) seen.add(key);\n if (key && this.recordedDecisionRequestKeys.has(key)) continue;\n result.scanned += 1;\n let row: FlowActorExecution | null;\n try {\n row = await this.systemAccess.readAsSystem<FlowActorExecution>(resourceType, { executionId: candidate.executionId }, { suppressSystemAudit: true });\n } catch (error) {\n result.failed += 1;\n this.logger.warn('[ConversationalExecution] Decision-request repair could not read a waiting turn', {\n resourceType, executionId: candidate.executionId, ...projectCaughtErrorLogFields(error),\n });\n continue;\n }\n const decisionRef = row?.status === FlowsActors_Status.AWAITING_APPROVAL ? row.pendingDecisionRef : undefined;\n const route = row && decisionRef ? humanDecisionRouteOfRow(row) : undefined;\n const requester = row && decisionRef ? humanDecisionRequesterOfRow(row) : undefined;\n // The grace again, on the row as read (#2749 review F4): the listing's row may have been answered and paused again\n // since, on a decision its turn is still recording.\n const requestedAt = row?.pendingDecisionRequestedAt ? new Date(row.pendingDecisionRequestedAt).getTime() : Number.NaN;\n if (!row || !decisionRef || !(requestedAt <= cutoff.getTime())) {\n result.raced += 1;\n continue;\n }\n if (!route || !requester) {\n // A pause from before decisions were routed (#1594): no request can be described, and none is owed.\n if (key) this.recordedDecisionRequestKeys.add(key);\n continue;\n }\n try {\n // The derived id first (one indexed read); a miss is asked again by decision, so a request recorded before the id\n // was derived from the decision is not recorded twice.\n if (await auditLogs.hasRecordedAuditEvent(humanDecisionRequestedAuditEventId(decisionRef))\n || await auditLogs.hasRecordedHumanDecisionRequest(HumanDecision_Plane.CONVERSATIONAL, decisionRef)) {\n result.alreadyRecorded += 1;\n if (key) this.recordedDecisionRequestKeys.add(key);\n continue;\n }\n const toolName = row.pausedApproval ? this.pendingToolNameOf(row.pausedApproval) : undefined;\n let agentRef: string | undefined;\n if (toolName) {\n try {\n const resolved = this.resolveApprovalGatedFunctionTool(row.systemRef, toolName);\n agentRef = resolved.kind === GatedFunctionToolResolutionKind.FOUND ? resolved.agentRef : undefined;\n } catch {\n agentRef = undefined;\n }\n }\n const isoOf = (value: Date | string | null | undefined) => (value ? new Date(value).toISOString() : undefined);\n await runWithAgentActorFrame(\n { agentRef: agentRef ?? row.systemRef, agentExecutionId: row.executionId, systemRef: row.systemRef, ...(toolName ? { toolName } : {}), decisionRef },\n () => this.recordDecisionRequested({\n decisionRef, executionId: row.executionId, systemRef: row.systemRef, route, requester,\n ...(agentRef ? { agentRef } : {}),\n ...(toolName ? { toolName } : {}),\n ...(isoOf(row.pendingDecisionExpiresAt) ? { expiresAt: isoOf(row.pendingDecisionExpiresAt) } : {}),\n ...(isoOf(row.pendingDecisionClaimDeadlineAt) ? { claimDeadlineAt: isoOf(row.pendingDecisionClaimDeadlineAt) } : {}),\n ...(row.pendingDecisionClaimClockBasis ? { claimClockBasis: row.pendingDecisionClaimClockBasis } : {}),\n ...(isoOf(row.pendingDecisionDecisionDeadlineAt) ? { decisionDeadlineAt: isoOf(row.pendingDecisionDecisionDeadlineAt) } : {}),\n ...(row.pendingDecisionDecisionClockBasis ? { decisionClockBasis: row.pendingDecisionDecisionClockBasis } : {}),\n }, undefined),\n );\n result.repaired += 1;\n if (key) this.recordedDecisionRequestKeys.add(key);\n if ((row.pendingDecisionRouteVersion ?? 0) === 0) this.announceDecisionRouted(route, decisionRef, undefined, requester);\n this.logger.warn('[ConversationalExecution] Recorded and announced a waiting decision whose request had not been recorded', {\n resourceType, executionId: row.executionId, decisionRef,\n });\n } catch (error) {\n result.failed += 1;\n this.logger.warn('[ConversationalExecution] Decision-request repair could not record a waiting decision\\'s request; the next run tries again', {\n resourceType, executionId: row.executionId, decisionRef, ...projectCaughtErrorLogFields(error),\n });\n }\n }\n }\n // Only rows still waiting are kept; a scope that could not be listed keeps what it had, since nothing was learned.\n if (everyScopeListed) this.recordedDecisionRequestKeys = new Set([...this.recordedDecisionRequestKeys].filter((key) => seen.has(key)));\n // Logged unconditionally, zero included, like every sweep here.\n this.logger.info('[ConversationalExecution] Decision-request repair complete', { ...result });\n return result;\n }\n\n /**\n * End every pending decision raised through a relationship that has ENDED for good (#2573): terminated, withdrawn,\n * expired, or ended because a party was removed.\n *\n * A decision raised through a relationship resumes only through it (#2768), so once it ends none of them can ever run:\n * answering one is refused `REQUESTER_AUTHORITY_LAPSED` at the act. Left alone, each would sit in its reviewer's inbox\n * until its window lapses (ten days for Wonder Ledger's sign-off), asking a person to decide work that cannot happen,\n * and the work it waits on (a close awaiting its sign-off) would read as waiting on a reviewer rather than as over. So\n * the relationship's ending ends them, with the outcome an answer would have met: `REQUESTER_AUTHORITY_LAPSED`, the turn\n * FAILED, one RESOLVED audit row and the agent-work record each, and every holder told (`endPendingDecision`).\n *\n * Called once the ending transaction COMMITS (`endRelationshipReach` registers it), so a rolled-back ending ends\n * nothing. A SUSPENDED relationship is not ended here: its decisions may still be answered once it resumes, and their\n * window decides otherwise.\n *\n * Which decisions: those whose pause recorded the relationship among the ones its requester stood through\n * (`requesterThroughRelationshipIds`). A pause from before that record (#2768) names none; it is still refused at the\n * act and still lapses in its window, and is left to those.\n */\n public async endDecisionsRaisedThroughEndedRelationship(params: {\n relationshipId: string;\n /** The granting organization: where the relationship's decisions are routed. Narrows the organization's executions. */\n organizationId: string;\n }): Promise<EndedRelationshipDecisionsResult> {\n const result: EndedRelationshipDecisionsResult = { scanned: 0, ended: 0, raced: 0, unreadable: 0 };\n for (const resourceType of FLOW_ACTOR_EXECUTION_OWNER_VARIANTS) {\n let candidates: FlowActorExecution[] = [];\n try {\n const listed = await this.systemAccess.listAsSystem<FlowActorExecution>(\n resourceType,\n {\n status: FlowsActors_Status.AWAITING_APPROVAL,\n ...(resourceType === CoreResourceType.ORGANIZATION_FLOW_ACTOR_EXECUTIONS ? { organizationId: params.organizationId } : {}),\n },\n undefined,\n { suppressSystemAudit: true },\n );\n candidates = Array.isArray(listed) ? listed : (listed?.data ?? []);\n } catch (error) {\n this.logger.error('[ConversationalExecution] Could not list paused turns to end the decisions of an ended relationship', {\n resourceType, relationshipId: params.relationshipId, ...projectCaughtErrorLogFields(error),\n });\n continue;\n }\n for (const candidate of candidates) {\n result.scanned += 1;\n const executionId = candidate.executionId;\n let row: FlowActorExecution | null;\n try {\n row = await this.systemAccess.readAsSystem<FlowActorExecution>(resourceType, { executionId }, { suppressSystemAudit: true });\n } catch (error) {\n result.unreadable += 1;\n this.logger.warn('[ConversationalExecution] Could not read a paused turn while ending an ended relationship\\'s decisions', {\n resourceType, executionId, ...projectCaughtErrorLogFields(error),\n });\n continue;\n }\n if (!row || row.status !== FlowsActors_Status.AWAITING_APPROVAL || !row.pendingDecisionRef) { result.raced += 1; continue; }\n if (!row.pausedApproval) { result.unreadable += 1; continue; }\n let raisedThrough: readonly string[] | undefined;\n try {\n raisedThrough = parseFlowActorPausedApproval(row.pausedApproval).requesterThroughRelationshipIds;\n } catch {\n result.unreadable += 1;\n continue;\n }\n if (!raisedThrough?.includes(params.relationshipId)) continue;\n const toolName = this.pendingToolNameOf(row.pausedApproval);\n try {\n const decidedAt = new Date();\n const endedOn = await this.endPendingDecision({\n resourceType, executionId, rawPausedApproval: row.pausedApproval, decisionRef: row.pendingDecisionRef,\n outcome: HumanDecision_Outcome.REQUESTER_AUTHORITY_LAPSED, toolName, row, decidedAt,\n });\n if (!endedOn) { result.raced += 1; continue; }\n result.ended += 1;\n this.recordDecisionResolved({ row: endedOn, requester: humanDecisionRequesterOfRow(endedOn), outcome: HumanDecision_Outcome.REQUESTER_AUTHORITY_LAPSED, toolName });\n await this.recordAgentWorkSettlement({\n resourceType, row: endedOn, decisionRef: row.pendingDecisionRef, outcome: HumanDecision_Outcome.REQUESTER_AUTHORITY_LAPSED, decidedAt,\n rawPausedApproval: row.pausedApproval, ...(toolName ? { toolName } : {}),\n });\n } catch (error) {\n this.logger.error('[ConversationalExecution] Could not end a decision raised through an ended relationship', {\n resourceType, executionId, relationshipId: params.relationshipId, ...projectCaughtErrorLogFields(error),\n });\n }\n }\n }\n // Logged unconditionally, the zero case included: an ending that found nothing reads differently from one that never ran.\n this.logger.info('[ConversationalExecution] Ended the decisions raised through an ended relationship', {\n relationshipId: params.relationshipId, organizationId: params.organizationId, ...result,\n });\n return result;\n }\n\n /** The tool a stored pause gates, for an audit row; `undefined` when the blob cannot be read. */\n private pendingToolNameOf(rawPausedApproval: string): string | undefined {\n try {\n return parseFlowActorPausedApproval(rawPausedApproval).pendingToolName;\n } catch {\n return undefined;\n }\n }\n\n /**\n * Settle the turns a previous process of THIS host left running, as FAILED (#1601).\n *\n * A turn is `PROCESSING` from its first write until it settles, and only the process running it\n * settles it. When that process dies mid-turn (a companion restarted by a rebuild, which in framework\n * development happens every few minutes) the row stays `PROCESSING` for ever and the person's message\n * reads as unanswered with nothing saying why. Measured 2026-09-25 on scratch-journey: three messages\n * in one creation thread, zero replies, and no error anywhere.\n *\n * ## Only for a SOLE host\n *\n * Called at startup, so it assumes no other process is running turns of `systemRefs` against the\n * same store: every `PROCESSING` turn of those systems then belongs to a process that no longer\n * exists. That holds for the development companion, the one process hosting the creation\n * conversation. It does NOT hold for a replicated application backend, where one replica starting\n * would fail another's live turns; there the liveness lease decides instead, through\n * {@link sweepInterruptedTurns} (#1780).\n *\n * The write is guarded on `PROCESSING`, so a turn that settled in the meantime is left alone. Each settle the write\n * WON is audited (`CONVERSATIONAL_TURN_FAILED_BY_SYSTEM`, cause `ORPHANED_AT_STARTUP`, the application as actor, #2800).\n */\n public async settleInterruptedTurns(\n systemRefs: readonly string[],\n now: Date = new Date(),\n ): Promise<{ readonly settled: number; readonly unreadScopes: number }> {\n let settled = 0;\n /*\n * Scopes whose running turns could not be LISTED. Reported beside the count because `settled: 0`\n * alone reads as \"nothing was interrupted\" — which is exactly how a settlement run before its\n * services existed stayed inert on every boot (measured 2026-09-25, #1601).\n */\n let unreadScopes = 0;\n for (const resourceType of FLOW_ACTOR_EXECUTION_OWNER_VARIANTS) {\n for (const systemRef of systemRefs) {\n let candidates: FlowActorExecution[] = [];\n try {\n const listed = await this.systemAccess.listAsSystem<FlowActorExecution>(\n resourceType,\n { status: FlowsActors_Status.PROCESSING, systemRef },\n undefined,\n { suppressSystemAudit: true },\n );\n candidates = Array.isArray(listed) ? listed : (listed?.data ?? []);\n } catch (error) {\n this.logger.error('[ConversationalExecution] Interrupted-turn settlement could not list running turns for a scope', {\n resourceType, systemRef, ...projectCaughtErrorLogFields(error),\n });\n unreadScopes += 1;\n continue;\n }\n for (const candidate of candidates) {\n if (candidate.status !== FlowsActors_Status.PROCESSING || candidate.systemRef !== systemRef) continue;\n try {\n const updated = await this.systemAccess.updateAsSystem(\n resourceType,\n { executionId: candidate.executionId, status: FlowsActors_Status.PROCESSING },\n {\n status: FlowsActors_Status.FAILED,\n // #2827: the turn's process went away, which is what the stored end says.\n statusChanges: [...(candidate.statusChanges ?? []), flowsActorsStatusChange(TURN_INTERRUPTED_END, now)],\n finishedAt: now,\n },\n );\n if (updated !== null) {\n settled += 1;\n // Recorded only by the write that won (#2800): a turn that settled meanwhile records nothing.\n await this.recordTurnFailedBySystem(resourceType, candidate, ActorExecutionInterruptionCause.ORPHANED_AT_STARTUP, updated);\n }\n } catch (error) {\n this.logger.error('[ConversationalExecution] Could not settle an interrupted turn', {\n resourceType, executionId: candidate.executionId, ...projectCaughtErrorLogFields(error),\n });\n }\n }\n }\n }\n if (unreadScopes > 0) {\n this.logger.warn('[ConversationalExecution] Interrupted-turn settlement could not read every scope; turns there were not settled', {\n systemRefs: [...systemRefs], settled, unreadScopes,\n });\n } else {\n this.logger.info('[ConversationalExecution] Interrupted-turn settlement complete', { systemRefs: [...systemRefs], settled });\n }\n return { settled, unreadScopes };\n }\n\n /**\n * Fail the turns whose process died mid-turn, on ANY host, from their liveness lease (#1780).\n *\n * A turn holds its lease for exactly as long as its row says PROCESSING (`holdTurnLease`). So a row\n * that says PROCESSING, has not moved for {@link INTERRUPTED_TURN_GRACE_MS}, and has no lease behind it\n * was left by a process that is gone — unless the lease never could be written, which is what the\n * evidence below tells apart. Unlike {@link settleInterruptedTurns}, which may only run on a sole host,\n * this asks the lease and never assumes, so it is safe on a replicated backend.\n *\n * Every rule is the A2A abandoned-task sweep's, because the reasoning is the lease's, not the plane's:\n * - **abstain** when the lease cannot be written here, or no Redis is bound at all: then every live\n * turn's lease is missing too, and acting would fail the whole fleet;\n * - **the lease decides, never the timestamp**: an old `updatedAt` is a pre-filter only, since a long\n * tool loop keeps an old `updatedAt` and a live lease;\n * - **an absence must explain itself** before it is acted on — only `LEASE_LAPSED` and\n * `CORROBORATED_ABSENCE` are verdicts;\n * - **the write is a compare-and-swap on PROCESSING**, so a turn that ended between the listing and\n * the repair is left as it stands and counted as `raced`, not as a repair.\n *\n * Nothing is announced: the socket the turn was streaming to belonged to the process that died. A\n * reloaded conversation reads FAILED from the row. Each repair the write WON is audited\n * (`CONVERSATIONAL_TURN_FAILED_BY_SYSTEM`, cause `LEASE_LAPSED`, the application as actor, #2800); a RACED row records\n * nothing.\n */\n public async sweepInterruptedTurns(now: Date = new Date()): Promise<InterruptedTurnSweepResult> {\n const result = { scanned: 0, failed: 0, stillAlive: 0, raced: 0, awaitingCorroboration: 0, undetermined: 0, unreadScopes: 0 };\n const lease = this.turnLease;\n if (!lease || !(await lease.isMechanismWritable())) {\n this.logger.warn('[ConversationalExecution] Skipping the interrupted-turn sweep: the turn lease cannot be written here, so liveness cannot be trusted', {\n consequence: 'interrupted turns stay PROCESSING until a run where the lease can be trusted',\n });\n return { ...result, works: NO_ABANDONED_WORK_SWEEP, abstained: true };\n }\n const cutoff = new Date(now.getTime() - INTERRUPTED_TURN_GRACE_MS);\n for (const resourceType of FLOW_ACTOR_EXECUTION_OWNER_VARIANTS) {\n let candidates: FlowActorExecution[] = [];\n try {\n const listed = await this.systemAccess.listAsSystem<FlowActorExecution>(\n resourceType,\n { status: FlowsActors_Status.PROCESSING, updatedAt: { $lt: cutoff } },\n undefined,\n { suppressSystemAudit: true },\n );\n candidates = Array.isArray(listed) ? listed : (listed?.data ?? []);\n } catch (error) {\n this.logger.error('[ConversationalExecution] The interrupted-turn sweep could not list running turns for a scope', {\n resourceType, ...projectCaughtErrorLogFields(error),\n });\n result.unreadScopes += 1;\n continue;\n }\n for (const candidate of candidates) {\n // Re-asserted per row: the listing is a snapshot, and only a PROCESSING row is this sweep's.\n if (candidate.status !== FlowsActors_Status.PROCESSING) continue;\n result.scanned += 1;\n const executionId = candidate.executionId;\n if (await lease.isAlive(executionId)) {\n result.stillAlive += 1;\n continue;\n }\n const evidence = await lease.corroborateAbandonment(executionId);\n if (!abandonmentEvidenceIsAVerdict(evidence)) {\n if (evidence === TurnLeaseAbandonmentEvidence.FIRST_ABSENCE) {\n result.awaitingCorroboration += 1;\n this.logger.info('[ConversationalExecution] A running turn has no lease and no record of ever having had one; left alone pending corroboration', {\n executionId,\n consequence: 'if the absence is still there next run it is failed; if its process merely could not write, its next heartbeat clears this',\n });\n } else {\n result.undetermined += 1;\n this.logger.warn('[ConversationalExecution] Could not establish why a running turn has no lease; nothing was learned and nothing was recorded', {\n executionId, evidence,\n });\n }\n continue;\n }\n try {\n const updated = await this.systemAccess.updateAsSystem(\n resourceType,\n { executionId, status: FlowsActors_Status.PROCESSING },\n {\n status: FlowsActors_Status.FAILED,\n // #2827: the turn's process went away, which is what the stored end says.\n statusChanges: [...(candidate.statusChanges ?? []), flowsActorsStatusChange(TURN_INTERRUPTED_END, now)],\n finishedAt: now,\n },\n );\n if (updated !== null) {\n result.failed += 1;\n // The evidence rides the record of the repair: a run whose repairs are all\n // `corroborated-absence` says a process somewhere cannot write its leases.\n this.logger.info('[ConversationalExecution] Failed a turn its process abandoned', { executionId, systemRef: candidate.systemRef, evidence });\n // Recorded only by the write that won (#2800); `evidence` stays on the log line above.\n await this.recordTurnFailedBySystem(resourceType, candidate, ActorExecutionInterruptionCause.LEASE_LAPSED, updated);\n } else {\n result.raced += 1;\n this.logger.info('[ConversationalExecution] A turn ended between the listing and the repair; left as it stands', { executionId });\n }\n } catch (error) {\n this.logger.error('[ConversationalExecution] Could not fail an abandoned turn', { executionId, ...projectCaughtErrorLogFields(error) });\n }\n }\n }\n // After the turns: a turn this run failed has already ended its work in the log (`recordTurnFailedBySystem` is\n // awaited), so the work pass does not record that work a second time.\n const works = await this.sweepAbandonedWorkContinuations(now);\n // Logged unconditionally, zero included: a sweep that silently finds nothing is indistinguishable from\n // a sweep that silently stopped running.\n this.logger.info('[ConversationalExecution] Interrupted-turn sweep complete', { ...result, works });\n return { ...result, works, abstained: false };\n }\n\n /**\n * Fail the WORKS whose continuation's process died, whichever turn holds their thread (#2829). The second pass of\n * {@link sweepInterruptedTurns}, run after its trust gate, so it abstains exactly when that sweep does.\n *\n * The first pass cannot see these. A continuation whose process dies while ANOTHER turn of the thread holds the row\n * (that turn completed, or paused) leaves a row that is not PROCESSING, and the execution's lease, held by whichever\n * turn runs, cannot say which of two overlapping turns died. The work's own log can: its newest entry stays\n * `PROCESSING`, and an A2A task holding that work read `working` and accepted a cancel that stopped nothing.\n *\n * - **Selection is bounded**: threads whose `workContinuationOpenedAt` (stamped by every `PROCESSING` entry, removed by\n * this pass once nothing on the thread can still be running) is older than {@link INTERRUPTED_TURN_GRACE_MS}. Never\n * every thread whose log ends in `PROCESSING`, which would scan every finished conversation on each run.\n * - **Per work, the lease decides**, under the first pass's rules: a work whose continuation paused again waits on its\n * own decision and is left alone; a held work lease is alive; an absent one must explain itself\n * (`corroborateAbandonment`) before it is a verdict.\n * - **Re-read before acting**: the listing is a snapshot, and a continuation lets its lease go only after its ending\n * entry, so a lease found gone means the ending, if any, is on the row now. The work is failed only if its newest\n * entry is still the one the listing showed.\n * - **The append is guarded** on the `workContinuationOpenedAt` the re-read showed, so a new continuation of the work\n * released in between (a newer instant) makes it land nowhere: counted `raced`, never a repair.\n * - **The column is removed** only when no work on the thread may still be running, with a compare-and-swap on the\n * instant the listing read: a continuation released meanwhile wrote a newer one and keeps the thread selected.\n *\n * A work that is failed here may have ended in fact, its ending lost to a store error: FAILED says only that no process\n * runs it any more, which is all the sweep knows. Each repair the append WON is audited like a failed turn\n * (`CONVERSATIONAL_TURN_FAILED_BY_SYSTEM`, cause `LEASE_LAPSED`).\n */\n private async sweepAbandonedWorkContinuations(now: Date): Promise<AbandonedWorkSweepResult> {\n const lease = this.workLease;\n if (!lease || !this.repositoriesRegistry) return NO_ABANDONED_WORK_SWEEP;\n const result: { -readonly [K in keyof AbandonedWorkSweepResult]: number } = { ...NO_ABANDONED_WORK_SWEEP };\n const cutoff = new Date(now.getTime() - INTERRUPTED_TURN_GRACE_MS);\n for (const resourceType of FLOW_ACTOR_EXECUTION_OWNER_VARIANTS) {\n let threads: FlowActorExecution[] = [];\n try {\n const listed = await this.systemAccess.listAsSystem<FlowActorExecution>(\n resourceType,\n { workContinuationOpenedAt: { $lt: cutoff } },\n undefined,\n { suppressSystemAudit: true },\n );\n threads = Array.isArray(listed) ? listed : (listed?.data ?? []);\n } catch (error) {\n this.logger.error('[ConversationalExecution] The abandoned-work sweep could not list threads with a released continuation for a scope', {\n resourceType, ...projectCaughtErrorLogFields(error),\n });\n result.unreadScopes += 1;\n continue;\n }\n for (const thread of threads) {\n // Re-asserted per row: only a thread whose continuation instant is past the grace is this pass's.\n const openedAt = thread.workContinuationOpenedAt ? new Date(thread.workContinuationOpenedAt) : undefined;\n if (!openedAt || !(openedAt.getTime() < cutoff.getTime())) continue;\n result.scanned += 1;\n let mayStillRun = false;\n for (const entry of worksWithOpenContinuation(thread)) {\n const outcome = await this.sweepOpenWorkContinuation(resourceType, thread, entry, lease);\n result[outcome] += 1;\n if (OPEN_WORK_CONTINUATION_OUTCOMES_KEEPING_THE_MARKER.has(outcome)) mayStillRun = true;\n }\n if (!mayStillRun && await this.settleWorkContinuationMarker(resourceType, thread.executionId, openedAt)) result.settled += 1;\n }\n }\n return result;\n }\n\n /** One work of {@link sweepAbandonedWorkContinuations}: `entry` is its newest `workEvents` entry as LISTED, `PROCESSING`. */\n private async sweepOpenWorkContinuation(\n resourceType: CoreResourceType,\n thread: FlowActorExecution,\n entry: NonNullable<FlowActorExecution['workEvents']>[number],\n lease: TurnLivenessLease,\n ): Promise<OpenWorkContinuationSweepOutcome> {\n const { executionId } = thread;\n const workRef = entry.workRef;\n // A continuation that paused again ended its run by design: the work waits on its own decision, and an answer to it\n // releases a new continuation (a new lease, a newer instant), a withdrawal or a lapse ends it in the log.\n if (decisionWorkOfRow(thread, workRef).standing === ConversationalDecisionWorkStanding.WAITING) return OpenWorkContinuationSweepOutcome.WAITING;\n const leaseId = conversationalWorkLeaseId(executionId, workRef);\n if (await lease.isAlive(leaseId)) return OpenWorkContinuationSweepOutcome.STILL_ALIVE;\n const evidence = await lease.corroborateAbandonment(leaseId);\n if (!abandonmentEvidenceIsAVerdict(evidence)) {\n if (evidence === TurnLeaseAbandonmentEvidence.FIRST_ABSENCE) {\n this.logger.info('[ConversationalExecution] A running work has no lease and no record of ever having had one; left alone pending corroboration', {\n executionId, workRef,\n consequence: 'if the absence is still there next run the work is failed; if its process merely could not write, its next heartbeat clears this',\n });\n return OpenWorkContinuationSweepOutcome.AWAITING_CORROBORATION;\n }\n this.logger.warn('[ConversationalExecution] Could not establish why a running work has no lease; nothing was learned and nothing was recorded', {\n executionId, workRef, evidence,\n });\n return OpenWorkContinuationSweepOutcome.UNDETERMINED;\n }\n // The lease is gone, and a continuation lets it go only after its ending entry: whatever ended the work is on the row\n // NOW, so the decision is taken on a fresh read, never on the listing.\n let current: FlowActorExecution | null;\n try {\n current = await this.systemAccess.readAsSystem<FlowActorExecution>(resourceType, { executionId }, { suppressSystemAudit: true });\n } catch (error) {\n this.logger.warn('[ConversationalExecution] Could not re-read a thread before failing its abandoned work; left as it stands', {\n executionId, workRef, ...projectCaughtErrorLogFields(error),\n });\n return OpenWorkContinuationSweepOutcome.UNDETERMINED;\n }\n const newest = current ? latestWorkEventOf(current, workRef) : undefined;\n const currentOpenedAt = current?.workContinuationOpenedAt;\n if (!current || !newest || newest.status !== FlowsActors_Status.PROCESSING || new Date(newest.at).getTime() !== new Date(entry.at).getTime()\n || !currentOpenedAt) {\n this.logger.info('[ConversationalExecution] A work ended or started again between the listing and the repair; left as it stands', { executionId, workRef });\n return OpenWorkContinuationSweepOutcome.RACED;\n }\n if (decisionWorkOfRow(current, workRef).standing === ConversationalDecisionWorkStanding.WAITING) return OpenWorkContinuationSweepOutcome.WAITING;\n const recorded = await this.recordWorkEvent(resourceType, { executionId, workContinuationOpenedAt: currentOpenedAt }, workRef, TURN_INTERRUPTED_END);\n if (recorded === WorkEventRecording.NO_ROW) {\n this.logger.info('[ConversationalExecution] A continuation was released on the thread before an abandoned work could be failed; left as it stands', { executionId, workRef });\n return OpenWorkContinuationSweepOutcome.RACED;\n }\n if (recorded !== WorkEventRecording.LANDED) return OpenWorkContinuationSweepOutcome.UNDETERMINED;\n // The evidence rides the record of the repair, as for a turn: a run whose repairs are all `corroborated-absence` says\n // a process somewhere cannot write its leases.\n this.logger.info('[ConversationalExecution] Failed a work its continuation\\'s process abandoned', { executionId, workRef, systemRef: thread.systemRef, evidence });\n // The decision whose continuation died, when the row still says so exactly: its last resolved decision is this work's.\n // Another work's answer since then overwrote it, and then no decision is named rather than a wrong one.\n const decisionRef = current.lastResolvedDecisionWorkRef === workRef ? current.lastResolvedDecisionRef ?? undefined : undefined;\n this.auditTurnFailedBySystem(resourceType, current, ActorExecutionInterruptionCause.LEASE_LAPSED, decisionRef, workRef);\n return OpenWorkContinuationSweepOutcome.FAILED;\n }\n\n /**\n * Remove a thread's `workContinuationOpenedAt` once nothing on it may still be running (#2829), with a compare-and-swap on\n * the instant the listing read: a continuation released since wrote a newer one, and the thread stays selected. Answers\n * whether it was removed. Never throws: a removal that fails leaves the thread selected, which costs one more look.\n */\n private async settleWorkContinuationMarker(resourceType: CoreResourceType, executionId: string, openedAt: Date): Promise<boolean> {\n try {\n const settled = await this.repositoriesRegistry?.atomicGuardedMutation(resourceType, { executionId, workContinuationOpenedAt: openedAt }, {\n clear: ['workContinuationOpenedAt'],\n });\n return settled !== null && settled !== undefined;\n } catch (error) {\n this.logger.warn('[ConversationalExecution] Could not settle a thread\\'s released-continuation instant; it is looked at again next run', {\n executionId, ...projectCaughtErrorLogFields(error),\n });\n return false;\n }\n }\n\n /**\n * The audit row of a turn the ENGINE failed because no process runs it any more (#2800): the interrupted-turn sweep's\n * repair and a sole host's startup settle. The conversational sibling of the actor plane's\n * `ACTOR_EXECUTION_ABORTED_BY_SYSTEM`. Called only by the write that won the compare-and-swap on PROCESSING, so a turn\n * that ended between the listing and the write records nothing. The actor is the application. `row` is the row as\n * LISTED: the decision whose continuation the turn was ({@link continuingDecisionOfInterruptedTurn}), and, for an\n * organization's conversation, its tenant (the owner FK of that variant; a user's or the application's names none).\n *\n * The settle never puts a question back (it writes FAILED, and the decision stays answered), so it writes no\n * `HUMAN_DECISION_RESTORED`: the decision's RESOLVED row stands, and this row names it as the answer whose work did not\n * finish.\n *\n * Fire-and-forget like every audit row of this plane: the settle has landed, and a trail that could not be written\n * must not undo it or fail the sweep, so a failure is logged and the settle stands.\n */\n private async recordTurnFailedBySystem(\n resourceType: CoreResourceType,\n row: FlowActorExecution,\n cause: ActorExecutionAbandonmentCause,\n settledRow?: unknown,\n ): Promise<void> {\n const decisionRef = continuingDecisionOfInterruptedTurn(row);\n const workRef = decisionRef ? row.lastResolvedDecisionWorkRef ?? decisionRef : undefined;\n /*\n * #2829 review F1: the row's instants say this turn was the continuation of `decisionRef`'s work, but the WORK's own\n * log may already say it ended. The abandoned-work pass selects on the work's instant and this pass on the row's\n * `updatedAt`, so the work pass can act first: a continuation that died while an overlapping turn's write kept the\n * row PROCESSING (one crash killing both, or a re-pause whose write was never confirmed) is failed there, audited\n * there, and the row is left PROCESSING for this pass on a later run. Read off the row the write RETURNED, which is\n * the newest, else the listed one:\n * - newest entry FAILED: that death is on record already (its entry and its audit row), so nothing more is written.\n * Residual: when an overlapping fresh turn died in the same crash, its own death leaves no separate row; the\n * thread's failure is on the trail once.\n * - newest entry another ending (the work completed, was cancelled, …): the work ended by itself, so the turn that\n * died was not its continuation. Its failure is recorded without naming the work, and the work's ending stands.\n * - PROCESSING, or no entry: the work ran in this turn; it is ended here and audited as its continuation.\n */\n const ended = workRef ? latestWorkEventOf(isFlowActorExecutionRow(settledRow) ? settledRow : row, workRef) : undefined;\n if (workRef && ended && ended.status !== FlowsActors_Status.PROCESSING) {\n if (ended.status === FlowsActors_Status.FAILED) {\n this.logger.info('[ConversationalExecution] A failed turn\\'s work was already recorded failed by the abandoned-work pass; nothing more is recorded', {\n executionId: row.executionId, workRef, cause,\n });\n return;\n }\n this.auditTurnFailedBySystem(resourceType, row, cause, undefined, undefined);\n return;\n }\n this.auditTurnFailedBySystem(resourceType, row, cause, decisionRef, workRef);\n // #2821: a failed continuation ends its WORK, which is what a door holding that work reads (`workEvents`). Both\n // system settles reach here, and only by the write that won. Awaited by both (#2829), so the abandoned-work pass of\n // the same sweep reads the work ended rather than recording it a second time. Never throws.\n if (workRef) {\n await this.recordWorkEvent(resourceType, { executionId: row.executionId }, workRef, TURN_INTERRUPTED_END);\n }\n }\n\n /**\n * The `CONVERSATIONAL_TURN_FAILED_BY_SYSTEM` row of {@link recordTurnFailedBySystem}, and of a work the abandoned-work\n * pass failed (#2829), whose continuation was the turn. `decisionRef` is the decision the turn was continuing, when\n * known; `workRef` the work it continued (review F5), so the row names the work even once another work's answer has\n * moved the thread's last resolved decision. Fire-and-forget: never throws, and a failure is logged.\n */\n private auditTurnFailedBySystem(\n resourceType: CoreResourceType,\n row: FlowActorExecution,\n cause: ActorExecutionAbandonmentCause,\n decisionRef: string | undefined,\n workRef: string | undefined,\n ): void {\n if (!this.auditLogs) return;\n // The owner FK, read directly rather than through `ownerOfRow`: that resolves through `resolveOwnerVariant`, which\n // throws on a row missing its FK, and a fire-and-forget audit side effect must never throw into the settle.\n const organizationId = resourceType === CoreResourceType.ORGANIZATION_FLOW_ACTOR_EXECUTIONS\n ? (row as FlowActorExecution & { organizationId?: string }).organizationId\n : undefined;\n void this.auditLogs.logConversationalTurnFailedBySystem({\n executionId: row.executionId, systemRef: row.systemRef, cause,\n ...(decisionRef ? { decisionRef } : {}),\n ...(workRef ? { workRef } : {}),\n ...(organizationId ? { organizationId } : {}),\n }).catch((error: unknown) => this.logger.warn('[ConversationalExecution] A turn the engine failed could not be recorded; the failure stands', {\n executionId: row.executionId, cause, ...projectCaughtErrorLogFields(error),\n }));\n }\n\n /**\n * Where the work a human decision paused stands now ({@link decisionWorkOfRow}), or `undefined` when the caller's\n * filter matches no row or the row cannot be read.\n *\n * Exists for the A2A task plane, which projects a paused task from the conversation it wraps. When a turn suspends for\n * approval the task is materialised at `input-required`, and NOTHING advances that task when the decision arrives: the\n * resume happens over whichever door took the answer, which knows the execution and not the task. Without this seam the\n * task reports `input-required` forever, for work that finished — and, worse, stays cancellable, because the cancel\n * path compare-and-swaps on the STORED status.\n *\n * Asked by WORK — named by its first decision — not by thread (#2821). It used to answer the execution's status, which is whichever turn of the\n * thread ran last: a task that paused, was approved and finished read as the PROCESSING of a later task's turn in the\n * same thread, so a late cancel of it was recorded and stopped that other task's work.\n *\n * Read through the SAME isolation axes as every other read of this family (owner FK, machine credential, agent\n * instance). The caller has already proved it owns the TASK; that does not license an unfiltered read of the\n * execution, and answering `undefined` on a mismatch keeps not-found and not-yours indistinguishable exactly as the\n * rest of this plane does. The credential is the one the caller's work was opened under (the task row records it), so\n * a machine client's task reads its own conversation rather than the user-delegated sentinel's.\n *\n * Deliberately answers a STANDING, never the row: a richer projection would tempt the transport into reading the\n * transcript, which is the prompt text this plane's isolation rules exist to protect.\n */\n public async readDecisionWork(params: {\n readonly executionId: string;\n /** The caller's work, named by the first decision it paused on. */\n readonly workRef: string;\n readonly scopeContext: ConversationalOwnerScope;\n /** The machine credential the work was opened under; absent for a user-delegated turn. */\n readonly machineCredentialId?: string;\n readonly resourceServerInstanceRef?: string;\n }): Promise<ConversationalDecisionWork | undefined> {\n let owner: ResolvedOwnerVariant;\n try {\n owner = this.resolveOwnerVariant(params.scopeContext);\n } catch {\n return undefined;\n }\n\n try {\n const row = await this.systemAccess.readAsSystem<FlowActorExecution>(\n owner.resourceType,\n {\n executionId: params.executionId,\n ...owner.ownerFields,\n machineCredentialId: params.machineCredentialId ?? FLOWS_ACTORS_NO_MACHINE_CREDENTIAL,\n resourceServerInstanceRef: agentInstanceOf(params.resourceServerInstanceRef),\n },\n { scopeContext: owner.scopeContext },\n );\n return row ? decisionWorkOfRow(row, params.workRef) : undefined;\n } catch (error) {\n // A read that throws must not take down the task read that asked. The caller falls back to\n // the stored task status, which is the pre-existing behaviour — degraded, never broken.\n this.logger.warn('[ConversationalExecution] Could not read where a decision\\'s work stands for a task projection', {\n executionId: params.executionId, workRef: params.workRef, ...projectCaughtErrorLogFields(error),\n });\n return undefined;\n }\n }\n\n /**\n * The WebSocket answer door (#1594): resolves the decision the answer names and hands it to\n * `answerPendingDecision`, the one method every door reaches.\n *\n * `decisionRef` is the key when the client echoes it. A client that does not yet send it is resolved\n * from `executionId` + `approvalId`, read AS THE SYSTEM across the three owner variants: who may answer\n * is the predicate's decision, never the result of filtering by the answerer's own scope — that filter\n * is what made a reviewer's answer on someone else's conversation match nothing and vanish (I2).\n */\n public async respondToApproval(params: {\n systemRef: string;\n executionId: string;\n approvalId: string;\n decisionRef?: string;\n approved: boolean;\n auth?: SocketAuthResult;\n reason?: string;\n /** #1599: a reason code of the application's declared vocabulary. */\n reasonCode?: string;\n /** Back to the person answering: refusals, and the acknowledgement. */\n emitter?: FlowsActorsExecutionEmitter;\n /** The resumed turn's stream goes to the conversation OWNER's room, which may not be the answerer's. */\n ownerEmitterFor?: (owner: ConversationalOwnerScope) => FlowsActorsExecutionEmitter | undefined;\n /**\n * APPROVE-WITH-MODIFICATIONS (#566): arguments the approver authored, replacing the model's.\n *\n * Honoured only on an APPROVAL. On a denial there is no call to run, so arguments attached to\n * one are meaningless rather than dangerous — they are ignored, silently, because refusing a\n * denial over a field that cannot affect anything would block the one decision that must always\n * be available.\n */\n modifiedToolArgs?: Record<string, unknown>;\n /** #2720: the answer to a paused QUESTION, which is settled by this and not by `approved`. */\n answer?: HumanDecision_Answer;\n /** #2903: the presentation the page answered on, from the announcement. */\n presentationId?: string;\n /**\n * #2903: set by the socket door, which carries answers from a page the engine rendered: an answer that echoes no\n * presentation is then refused before anything is read. An in-process caller leaves it unset, and its answer is\n * bound to what the engine built and sent.\n */\n presentationEchoRequired?: boolean;\n }): Promise<void> {\n if (params.presentationEchoRequired === true && params.presentationId === undefined) {\n this.logger.info('[ConversationalExecution] An answer through the conversation did not echo the presentation it was given on; refusing', {\n systemRef: params.systemRef, executionId: params.executionId,\n });\n if (params.emitter) {\n this.emitError(params.emitter, params.systemRef, params.executionId, FlowsActors_ExecutionErrorCode.DECISION_PRESENTATION_STALE, 'This answer did not name what it was given on; open the conversation again to answer the decision as it is now.', true);\n }\n return;\n }\n const decisionRef = params.decisionRef ?? await this.decisionRefOfPause(params.executionId, params.approvalId);\n if (!decisionRef) {\n this.logger.info('[ConversationalExecution] No routed decision matches this response', { systemRef: params.systemRef, executionId: params.executionId, approvalId: params.approvalId });\n this.refuseDecisionAttempt(params.emitter, params.systemRef, params.executionId);\n return;\n }\n await this.answerPendingDecision({\n decisionRef,\n actorAuth: params.auth,\n approved: params.approved,\n reason: params.reason,\n ...(params.reasonCode !== undefined ? { reasonCode: params.reasonCode } : {}),\n modifiedToolArgs: params.modifiedToolArgs,\n ...(params.answer ? { answer: params.answer } : {}),\n expectedApprovalId: params.approvalId,\n ...(params.presentationId !== undefined ? { presentationId: params.presentationId } : {}),\n emitter: params.emitter,\n ownerEmitterFor: params.ownerEmitterFor,\n // #2797: a socket proves only what its session already satisfied; it has no step-up channel.\n actingSession: actingSessionOfConnection(params.auth),\n });\n }\n\n /** The routed decision a paused turn carries, found by its execution and the SDK's approval id. */\n private async decisionRefOfPause(executionId: string, approvalId: string): Promise<string | undefined> {\n for (const resourceType of FLOW_ACTOR_EXECUTION_OWNER_VARIANTS) {\n const row = await this.systemAccess.readAsSystem<FlowActorExecution>(resourceType, { executionId }, { suppressSystemAudit: true }).catch(() => null);\n if (!row?.pendingDecisionRef || !row.pausedApproval) continue;\n try {\n if (parseFlowActorPausedApproval(row.pausedApproval).approvalId === approvalId) return row.pendingDecisionRef;\n } catch {\n return undefined;\n }\n }\n return undefined;\n }\n\n /** The row holding a decision, read by its id ALONE — never filtered by who is asking (#1594 I2). */\n private async findPendingDecision(decisionRef: string): Promise<{ resourceType: CoreResourceType; row: FlowActorExecution } | undefined> {\n for (const resourceType of FLOW_ACTOR_EXECUTION_OWNER_VARIANTS) {\n const row = await this.systemAccess.readAsSystem<FlowActorExecution>(resourceType, { pendingDecisionRef: decisionRef }, { suppressSystemAudit: true }).catch(() => null);\n if (row) return { resourceType, row };\n }\n return undefined;\n }\n\n /** The conversation's owner, read from the ROW — the owner filter for every write that follows comes from here. */\n private ownerOfRow(resourceType: CoreResourceType, row: FlowActorExecution): ResolvedOwnerVariant {\n const fields = row as unknown as { userId?: string; organizationId?: string; applicationId?: string };\n switch (resourceType) {\n case CoreResourceType.USER_FLOW_ACTOR_EXECUTIONS: return this.resolveOwnerVariant({ userId: fields.userId } as ConversationalOwnerScope);\n case CoreResourceType.ORGANIZATION_FLOW_ACTOR_EXECUTIONS: return this.resolveOwnerVariant({ organizationId: fields.organizationId } as ConversationalOwnerScope);\n default: return this.resolveOwnerVariant({ applicationId: fields.applicationId } as ConversationalOwnerScope);\n }\n }\n\n /**\n * \"You cannot answer this decision\" — ONE answer for a decision that does not exist, that was already\n * settled, or whose route does not admit the person: saying which would disclose that a decision exists.\n */\n private refuseDecisionAttempt(emitter: FlowsActorsExecutionEmitter | undefined, systemRef: string, executionId: string): void {\n if (!emitter) return;\n this.emitError(emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.DECISION_NOT_ANSWERABLE, 'This decision cannot be answered by you, or it has already been settled.');\n }\n\n /**\n * Answer a pending decision, and resume its turn under the REQUESTER's current authority (#1594).\n *\n * The one method every answer door reaches. In order, and the order is the design:\n *\n * 1. **Read by `decisionRef` alone.** The owner fields, the machine credential and the agent instance\n * every later write filters on come from the ROW (I2); the answerer only supplies who they are.\n * 2. **Authorize with the one predicate**, role facts resolved now in the decision's organization. A\n * refusal leaves the decision exactly as it was and records HUMAN_DECISION_ANSWER_REFUSED.\n * 3. **A lapsed decision is refused** and ended LAPSED, naming the late answerer.\n * 4. **An edited call is validated** while the pause still stands, so a refused edit costs a message.\n * 5. **Rebuild the requester's authority.** If it no longer holds, the decision ends\n * REQUESTER_AUTHORITY_LAPSED: no tool runs and no model turn starts (I6).\n * 6. **Service consent is checked for the REQUESTER**, whose transcript the resumed turn writes.\n * **An approved call must be able to run** (#3313): what would end the resume is asked here, so nothing is recorded as\n * accepted that was bound not to run.\n * 7. **Release** with a compare-and-swap on status, blob, decision id and `routeVersion` (I5), writing\n * the resolution in the same write (I4). A reassignment that landed first makes this match nothing.\n * A THROWN write fails closed (I7): the row is re-read, and only a recorded release by this person\n * resumes.\n * 8. **The winner records RESOLVED** (I9), then the turn resumes under the rebuilt requester authority;\n * the reviewer's authority never reaches the agent.\n */\n public async answerPendingDecision(params: {\n decisionRef: string;\n actorAuth: SocketAuthResult | undefined;\n /** The verdict on a tool approval. Absent when the door carried an answer naming options of its own (#2720). */\n approved?: boolean;\n /** #2720: the answer to a paused QUESTION: what settles one, and the only thing that does. */\n answer?: HumanDecision_Answer;\n reason?: string;\n /** #1599: a reason code of the application's declared vocabulary; an undeclared one is refused before anything moves. */\n reasonCode?: string;\n modifiedToolArgs?: Record<string, unknown>;\n /** The SDK approval id a legacy door echoed; a mismatch is refused. */\n expectedApprovalId?: string;\n /**\n * #2903: the presentation the answer was given on, echoed by a door that renders the decision. Checked against the\n * row once the route admitted the person: a mismatch is refused as stale. Absent, the door sent the decision where it\n * cannot watch it render (a chat card), and the seal records what was sent.\n */\n presentationId?: string;\n /** #2903 review F2: what the chat card the answer came from carried, set only by the engine's inbound door. */\n sentCardContent?: HumanDecision_SentCardContent;\n emitter?: FlowsActorsExecutionEmitter;\n ownerEmitterFor?: (owner: ConversationalOwnerScope) => FlowsActorsExecutionEmitter | undefined;\n /**\n * Return as soon as the decision is released, and let the resumed turn run on. A request/response door\n * (REST) answers the person who acted; the turn's own stream goes to the owner's room. The socket door\n * leaves it unset and awaits, which is what its tests observe.\n */\n detachResume?: boolean;\n /** #2664: the chat delivery the answer arrived through, set only by the engine's inbound door. */\n answeredThrough?: HumanDecision_AnsweredThrough;\n /**\n * #2664: the one organization the answering door is scoped to (a chat delivery's). A decision routed in any other\n * organization, or in none, is refused before the predicate runs. Set only by the engine's inbound door.\n */\n confinedToOrganizationId?: string;\n /**\n * #2797: what the answering door can prove to a granting organization's authentication policy. A door that states\n * none is held as having no session, the strictest reading.\n */\n actingSession?: ActingSession;\n }): Promise<HumanDecision_ActOutcome> {\n const { decisionRef } = params;\n const found = await this.findPendingDecision(decisionRef);\n if (!found || found.row.status !== FlowsActors_Status.AWAITING_APPROVAL || !found.row.pausedApproval) {\n this.logger.info('[ConversationalExecution] No pending decision matches this answer', { decisionRef });\n this.refuseDecisionAttempt(params.emitter, found?.row.systemRef ?? '', found?.row.executionId ?? '');\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE };\n }\n const { resourceType, row } = found;\n const systemRef = row.systemRef;\n const executionId = row.executionId;\n const rawPausedApproval = row.pausedApproval as string;\n const route = humanDecisionRouteOfRow(row);\n const requester = humanDecisionRequesterOfRow(row);\n if (!route || !requester) {\n this.logger.warn('[ConversationalExecution] A paused turn carries a decision id but no route; refusing the answer', { systemRef, executionId, decisionRef });\n this.refuseDecisionAttempt(params.emitter, systemRef, executionId);\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE };\n }\n\n let paused: FlowActorExecution_PausedApproval;\n try {\n paused = parseFlowActorPausedApproval(rawPausedApproval);\n } catch (parseError) {\n // A corrupted blob fails LOUDLY rather than resuming from garbage — the parse helper's own\n // contract. Resuming from a partial message array would replay a different conversation.\n this.logger.error('[ConversationalExecution] Paused-approval state is unreadable; refusing to resume', {\n systemRef, executionId, decisionRef, ...projectCaughtErrorLogFields(parseError),\n });\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE };\n }\n if (params.expectedApprovalId && paused.approvalId !== params.expectedApprovalId) {\n this.logger.warn('[ConversationalExecution] Answer does not match the pending request; refusing', {\n systemRef, executionId, pendingApprovalId: paused.approvalId, respondedApprovalId: params.expectedApprovalId,\n });\n this.refuseDecisionAttempt(params.emitter, systemRef, executionId);\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE };\n }\n\n const owner = this.ownerOfRow(resourceType, row);\n const answererUserId = params.actorAuth?.initiatorIds?.userId;\n const refusalBase = {\n decisionRef, executionId, plane: HumanDecision_Plane.CONVERSATIONAL, systemRef, toolName: paused.pendingToolName,\n routeKind: route.kind,\n ...(route.eligibleRole ? { routeEligibleRole: route.eligibleRole } : {}),\n ...(route.requiredQualificationKinds?.length ? { routeRequiredQualificationKinds: [...route.requiredQualificationKinds] } : {}),\n ...(route.organizationId ? { organizationId: route.organizationId } : {}),\n // #2811: an answer refused from a chat names the delivery it came through, as the RESOLVED row does, beside the person.\n ...(answererUserId && params.answeredThrough ? answeredThroughRefusalFields(params.answeredThrough) : {}),\n };\n\n // ── 1b. A door scoped to one organization reaches only that organization's decisions (#2664) ──\n //\n // A chat delivery acts as the member its account is linked to in the delivery's organization. That member may also\n // answer decisions elsewhere, and the predicate below would admit them there, by the user alone. The chat proves\n // nothing about the other organization, so its decisions are not reachable from it.\n // assurance-control: WILDO.DATA.TENANT_ISOLATION — an answer through an organization-scoped door reaches only that organization's decisions; any other is refused and recorded.\n if (params.confinedToOrganizationId !== undefined && route.organizationId !== params.confinedToOrganizationId) {\n this.logger.warn('[ConversationalExecution] An answer through an organization-scoped door named a decision outside that organization; refused', {\n systemRef, executionId, decisionRef,\n });\n if (this.auditLogs) {\n void this.auditLogs.logHumanDecisionAnswerRefused({\n ...refusalBase, act: HumanDecision_Act.ANSWER, reason: HumanDecision_RefusalReason.OUTSIDE_THE_DELIVERY_ORGANIZATION,\n ...(answererUserId ? { attemptedByUserId: answererUserId } : {}),\n }, params.actorAuth ? this.auditContextFor(params.actorAuth, owner) : undefined).catch(() => undefined);\n }\n this.refuseDecisionAttempt(params.emitter, systemRef, executionId);\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE };\n }\n\n // ── 2. The one predicate ────────────────────────────────────────────────\n const roleFacts = answererUserId && isReviewerRoute(route)\n ? await resolveHumanDecisionRoleFacts(this.humanDecisionRoleFactsPorts(), { userId: answererUserId, route, requester, subject: this.decisionSubjectOfRow(row) })\n : NO_HUMAN_DECISION_ROLE_FACTS;\n const verdict = authorizeHumanDecisionActor({\n actor: { executionType: params.actorAuth?.executionType ?? ExecutionContext_ExecutionType.PUBLIC_EXECUTION, userId: answererUserId },\n roleFacts, route, requester, act: HumanDecision_Act.ANSWER,\n });\n if (verdict.kind === HumanDecision_VerdictKind.REFUSED) {\n this.logger.info('[ConversationalExecution] An answer was refused by the decision\\'s route', { systemRef, executionId, decisionRef, reason: verdict.reason });\n if (this.auditLogs) {\n void this.auditLogs.logHumanDecisionAnswerRefused({\n ...refusalBase, act: HumanDecision_Act.ANSWER, reason: verdict.reason,\n ...(answererUserId ? { attemptedByUserId: answererUserId } : {}),\n }, params.actorAuth ? this.auditContextFor(params.actorAuth, owner) : undefined).catch(() => undefined);\n }\n this.refuseDecisionAttempt(params.emitter, systemRef, executionId);\n // No reason to the caller: naming why would tell someone the decision was not routed to that it exists.\n // The reason is on the ANSWER_REFUSED row.\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE };\n }\n\n // ── 2'a. Decided by the person in their own name (#2923) ──────────────\n //\n // A tool approval is a REVIEW of what the agent proposed, which commits the person: it is never answered through a\n // client they delegated to (an MCP or A2A client acting for them). A question asks for information (an ANSWER), which\n // such a client may give. The same rule operation approvals apply, through the same predicate. After the predicate\n // admitted them, so naming the reason discloses nothing.\n // assurance-control: WILDO.AI.HUMAN_OVERSIGHT — an agent's proposed action is approved or refused by the person in their own name, never by a client acting for them\n const answerMeaning = this.pausedCallAsksThePerson(systemRef, paused.pendingToolName) ? ApprovalSealMeaning.ANSWER : ApprovalSealMeaning.REVIEW;\n if (params.actorAuth && !humanDecisionDeciderMayDecideMeaning(answerMeaning, humanDecisionDeciderRecordOfActor(params.actorAuth))) {\n this.logger.info('[ConversationalExecution] A tool approval was answered through a client the person delegated to; refused', { systemRef, executionId, decisionRef });\n if (this.auditLogs) {\n void this.auditLogs.logHumanDecisionAnswerRefused({\n ...refusalBase, act: HumanDecision_Act.ANSWER, reason: HumanDecision_RefusalReason.DECIDER_NOT_IN_PERSON,\n ...(answererUserId ? { attemptedByUserId: answererUserId } : {}),\n }, this.auditContextFor(params.actorAuth, owner)).catch(() => undefined);\n }\n this.refuseDecisionAttempt(params.emitter, systemRef, executionId);\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE, reason: HumanDecision_RefusalReason.DECIDER_NOT_IN_PERSON };\n }\n // #2923: and through a channel the call was paused under, when its gate names them (a chat card for a call answered\n // only in the application is given its address there by the chat door).\n // assurance-control: WILDO.AI.HUMAN_OVERSIGHT — an agent's call is answered only through a channel its gate admits\n if (params.actorAuth && !humanDecisionAnswerChannelAdmitted(paused.answerChannels, humanDecisionDeciderRecordOfActor(params.actorAuth))) {\n if (this.auditLogs) {\n void this.auditLogs.logHumanDecisionAnswerRefused({\n ...refusalBase, act: HumanDecision_Act.ANSWER, reason: HumanDecision_RefusalReason.ANSWER_CHANNEL_NOT_ADMITTED,\n ...(answererUserId ? { attemptedByUserId: answererUserId } : {}),\n }, this.auditContextFor(params.actorAuth, owner)).catch(() => undefined);\n }\n this.refuseDecisionAttempt(params.emitter, systemRef, executionId);\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE, reason: HumanDecision_RefusalReason.ANSWER_CHANNEL_NOT_ADMITTED };\n }\n\n // ── 2'. A decision that requires a step-up is answered with a proof bound to it (#2923) ──\n //\n // Declared on the gated tool (`humanApproval.requiresStepUpAuthentication` / `stepUp`), the same declaration and the same\n // check an operation approval has. Read BEFORE the granting organization's policy, which may consume the same token, and\n // consumed only at a settle (`consumeDecisionStepUp` below), so an answer this door then refuses while the pause stands\n // (an edit, a reason code, the requester's consent) costs the person no proof. After the predicate admitted them, so\n // naming the reason discloses nothing. A socket or chat answer carries no proof and is refused here.\n // assurance-control: WILDO.IDENTITY.STEP_UP_AUTHENTICATION — a gated tool call or an agent's question that requires a step-up is answered only with a fresh, single-use proof bound to it and to the presentation answered, as fresh and as strong as the gate declares\n const decisionStepUp = await checkDecisionStepUp(this.consumableTokens, {\n // #2923: what the call was paused under, kept in its pause, never the gate as it is declared now.\n requirement: paused.stepUp,\n session: params.actingSession, userId: answererUserId, decisionRef, presentationId: params.presentationId,\n });\n const refuseForStepUp = (): HumanDecision_ActOutcome => {\n this.logger.info('[ConversationalExecution] An answer carried no step-up proof this decision accepts; refused', { systemRef, executionId, decisionRef });\n if (this.auditLogs) {\n void this.auditLogs.logHumanDecisionAnswerRefused({\n ...refusalBase, act: HumanDecision_Act.ANSWER, reason: HumanDecision_RefusalReason.DECISION_STEP_UP_REQUIRED,\n ...(answererUserId ? { attemptedByUserId: answererUserId } : {}),\n }, params.actorAuth ? this.auditContextFor(params.actorAuth, owner) : undefined).catch(() => undefined);\n }\n // Its own code, not the generic refusal: the person was admitted, the decision still waits, and the remedy (the inbox,\n // which proves a factor first) is theirs to know.\n if (params.emitter) {\n this.emitError(params.emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.DECISION_STEP_UP_REQUIRED,\n 'This decision asks you to confirm it is you before answering; answer it from your decisions inbox.', true);\n }\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE, reason: HumanDecision_RefusalReason.DECISION_STEP_UP_REQUIRED };\n };\n if (decisionStepUp !== undefined && decisionStepUp.kind !== DecisionStepUpProofKind.VALID) return refuseForStepUp();\n const validStepUp = decisionStepUp?.kind === DecisionStepUpProofKind.VALID ? decisionStepUp : undefined;\n\n // ── 2a. A representative is held to the granting organization's authentication policy (#2797) ──\n //\n // The predicate read their roles through a rebuild that carries no policy, and this door built no context for the\n // decision's organization. After the predicate admitted them, so naming the reason discloses nothing.\n const held = await this.holdToGrantingOrganization({ decisionRef, userId: answererUserId, organizationId: route.organizationId, session: params.actingSession });\n if (held.kind === HumanDecisionGrantorHoldKind.REFUSED) {\n if (this.auditLogs) {\n void this.auditLogs.logHumanDecisionAnswerRefused({\n ...refusalBase, act: HumanDecision_Act.ANSWER, reason: held.reason,\n ...(answererUserId ? { attemptedByUserId: answererUserId } : {}),\n }, params.actorAuth ? this.auditContextFor(params.actorAuth, owner) : undefined).catch(() => undefined);\n }\n // An HTTP act is answered as a request into the organization would be: a step-up its frontend answers and replays.\n if (held.refusal) throw held.refusal;\n this.refuseDecisionAttempt(params.emitter, systemRef, executionId);\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE, reason: held.reason };\n }\n /**\n * #2923: the bound proof is used once, at the settle. The granting organization's policy consumed it when it asked for\n * a factor; otherwise it is consumed here, and a proof another act consumed meanwhile is a replay. `true` when there\n * is nothing to consume.\n */\n const consumeDecisionStepUp = async (): Promise<boolean> => !validStepUp || !!held.stepUpMethod || consumeDecisionStepUpProof(this.consumableTokens!, validStepUp);\n /** #2905, #2923: the factor the act consumed and, for the decision's own proof, when it was proven. */\n const deciderOf = (actorAuth: SocketAuthResult) => humanDecisionDeciderRecordOfActor(actorAuth, deciderStepUpEvidenceOf(held.stepUpMethod, validStepUp));\n\n // ── 2b. A QUESTION is answered, never approved (#2720) ─────────────────\n //\n // An agent's question (`askPersonTool`) is settled by the person's answer: their values, checked by the form they\n // were asked through, become the call's `answers`, or they decline and the agent is told to decide. A bare approve\n // would run the tool on answers the MODEL wrote, so a door that sends one is refused, and so is an answer the form\n // refuses. A tool approval is settled by its verdict, as before.\n const question = this.pausedQuestionOf(systemRef, {\n decisionRef, toolName: paused.pendingToolName, toolArgs: paused.pendingToolArgs as Record<string, unknown> | undefined,\n questionForm: paused.questionForm, requestedAt: paused.requestedAt, ...(paused.expiresAt ? { expiresAt: paused.expiresAt } : {}),\n });\n\n // ── 2c. What the person was shown is what the decision is (#2903) ──────\n //\n // Rebuilt from the row, as the card and the announcement build it, and compared with the presentation the door echoed.\n // After the predicate admitted them, so saying it changed discloses nothing. A file deliverable is bound again here,\n // from the file as it is now (#2904): a card shown before its recorded hash changed carries another id, and is stale.\n const deliverable = await this.decisionDeliverablesOf(systemRef, {\n decisionRef, toolName: paused.pendingToolName, toolArgs: paused.pendingToolArgs as Record<string, unknown> | undefined,\n ...(route.organizationId ? { organizationId: route.organizationId } : {}),\n });\n const presentationCheck = acknowledgeDecisionPresentation({\n source: {\n decisionRef, plane: HumanDecision_Plane.CONVERSATIONAL, toolName: paused.pendingToolName,\n toolArgs: (paused.pendingToolArgs ?? {}) as Record<string, unknown>, ...(question ? { request: question } : {}),\n ...(deliverable.deliverables ? { deliverables: deliverable.deliverables } : {}),\n },\n ...(params.presentationId !== undefined ? { echoedPresentationId: params.presentationId } : {}),\n ...(params.sentCardContent !== undefined ? { sentCardContent: params.sentCardContent } : {}),\n key: decisionPresentationKeyOfRuntime(this.appConfig),\n });\n if (presentationCheck.kind === DecisionPresentationCheckKind.STALE) {\n this.logger.info('[ConversationalExecution] An answer echoed a presentation that is not the decision\\'s now; refusing', { systemRef, executionId, decisionRef });\n if (params.emitter) {\n this.emitError(params.emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.DECISION_PRESENTATION_STALE, 'This decision changed since it was shown; open the conversation again to answer it as it is now.', true);\n }\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE, reason: HumanDecision_RefusalReason.PRESENTATION_STALE };\n }\n\n let approved: boolean;\n let modifiedToolArgs = params.modifiedToolArgs;\n let reason = params.reason;\n if (question) {\n const settled = this.settleQuestionAnswer(question, params.answer, paused, params.reason,\n this.pausedQuestionTool(systemRef, paused.pendingToolName)?.questionDeclinedReason ?? ASK_PERSON_DECLINED_REASON);\n if (!settled) {\n this.logger.info('[ConversationalExecution] A paused question was answered without an answer its form accepts; refusing', { systemRef, executionId, decisionRef });\n this.refuseDecisionAttempt(params.emitter, systemRef, executionId);\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE };\n }\n ({ approved, modifiedToolArgs, reason } = settled);\n } else {\n if (params.approved === undefined) {\n this.refuseDecisionAttempt(params.emitter, systemRef, executionId);\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE };\n }\n approved = params.approved;\n if (!approved && !reason) reason = CALL_REFUSED_BY_A_PERSON_REASON;\n }\n\n // ── 3. A lapsed decision is refused, and ended ──────────────────────────\n //\n // #465: honouring a decision on a tool call raised days ago would execute it against a conversation,\n // a world and an intent that have all moved on. The guard at USE; the unattended half is the sweep.\n if (isFlowActorPausedApprovalLapsed(paused, new Date())) {\n this.logger.warn('[ConversationalExecution] A decision was answered after it lapsed; refusing and ending it', {\n systemRef, executionId, decisionRef, expiresAt: paused.expiresAt, toolName: paused.pendingToolName,\n });\n const lapsedAt = new Date();\n const endedOn = await this.endPendingDecision({\n resourceType, executionId, rawPausedApproval, decisionRef,\n outcome: HumanDecision_Outcome.LAPSED, toolName: paused.pendingToolName,\n scopeContext: owner.scopeContext, row, decidedAt: lapsedAt,\n }).catch((error: unknown) => {\n this.logger.error('[ConversationalExecution] Could not end a lapsed decision', { systemRef, executionId, ...projectCaughtErrorLogFields(error) });\n return null;\n });\n if (endedOn) {\n this.recordDecisionResolved({ row: endedOn, requester: humanDecisionRequesterOfRow(endedOn), outcome: HumanDecision_Outcome.LAPSED, toolName: paused.pendingToolName, lateDecisionUserId: answererUserId });\n await this.recordAgentWorkSettlement({\n resourceType, row: endedOn, decisionRef, outcome: HumanDecision_Outcome.LAPSED, decidedAt: lapsedAt, paused, toolName: paused.pendingToolName,\n });\n }\n this.refuseDecisionAttempt(params.emitter, systemRef, executionId);\n return { kind: HumanDecision_ActOutcomeKind.LAPSED };\n }\n\n // #2292: the paused turn's personal-data view, read from the row with the decision: an approver's edit is tokenized\n // through its table, and the resume continues on it.\n const answerPersonalData = this.personalDataViewOfPausedTurn(systemRef, paused.pendingToolName, row, paused);\n\n // ── 4. An edited call is validated while the pause stands ───────────────\n let modifiedResume: PreparedToolCallModification | undefined;\n if (approved && modifiedToolArgs) {\n const prepared = await this.prepareApprovedToolCallModification({\n systemRef, executionId, paused, modifiedToolArgs,\n // #3192: an answer to a question rewrites the call too, but overrules nothing: the agent asked for it.\n reviewerEdited: !question,\n ...(answerPersonalData ? { personalData: answerPersonalData } : {}),\n });\n if (prepared.kind === ToolApprovalModificationOutcomeKind.REFUSED) {\n this.logger.warn('[ConversationalExecution] Refusing an approval whose modified arguments could not be applied; the pause stands', {\n systemRef, executionId, decisionRef, toolName: paused.pendingToolName, reason: prepared.message,\n });\n if (params.emitter) {\n // `recoverable: true` — the decision is still pending and still answerable.\n this.emitError(params.emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.APPROVAL_MODIFICATION_REJECTED, prepared.message, true, prepared.refusal);\n }\n return this.refusedOutcomeOf(prepared);\n }\n modifiedResume = prepared.kind === ToolApprovalModificationOutcomeKind.MODIFIED ? prepared.modification : undefined;\n\n // #2904: the file a person approves is the file they were shown, bound by its bytes. An edit that names another file\n // would approve something nobody was shown, so it is refused, for every approver; approving as proposed stays open.\n const deliverableArgument = question ? undefined : this.deliverableFileArgumentOf(systemRef, paused.pendingToolName);\n if (modifiedResume && deliverableArgument && modifiedResume.modifiedArgumentKeys.includes(deliverableArgument)) {\n const refused = this.callCannotRunRefusal(\n `The file this call to \"${paused.pendingToolName}\" is about cannot be changed in an approval: approve the file you were shown, or deny the call.`,\n { reason: FlowsActors_ApprovalModificationRefusalReason.DELIVERABLE_FILE_NOT_EDITABLE, toolName: paused.pendingToolName, argumentPaths: [deliverableArgument] },\n HumanDecision_RefusalReason.DELIVERABLE_FILE_EDITED,\n );\n this.logger.info('[ConversationalExecution] An approval edited the call\\'s file deliverable; refusing, the pause stands', {\n systemRef, executionId, decisionRef, toolName: paused.pendingToolName, argument: deliverableArgument,\n });\n if (params.emitter) this.emitError(params.emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.APPROVAL_MODIFICATION_REJECTED, refused.message, true, refused.refusal);\n return this.refusedOutcomeOf(refused);\n }\n\n // #2734: an edit can point the call at another record, and the call then runs under the REQUESTER's authority,\n // which may reach a record the answerer's relationship never could. So the edited call is held to the card's rule,\n // for an answerer standing in the organization only through a relationship (the organization's own staff edit as\n // before):\n // - its row is judged like the card's record, and a row edited into something that names no record is refused,\n // since nothing can then say whose record the call reaches (review A3);\n // - an argument that names another record (a declared foreign key, at any depth, on the tool's or the resource's\n // schemas) may not be changed: the engine cannot place it;\n // - an edit it cannot judge (the tool's resource can no longer be read) is refused, naming the arguments changed.\n // An edit that resolved to the proposed arguments (UNCHANGED) runs the call as proposed, which the answerer may\n // answer, so nothing is checked. Refused like any other edit the server will not apply: the pause stands, the\n // approver is told why on every door (the outcome's reason for the REST inbox, the error payload for the socket\n // card), and answering as proposed stays open. Recorded with its own reason.\n if (answererUserId && isReviewerRoute(route) && modifiedResume) {\n const changedArgumentKeys = modifiedResume.modifiedArgumentKeys;\n const rowIdArgument = this.decisionRowIdArgumentOf(systemRef, paused.pendingToolName);\n // Read once, and fail closed (review F1): only roles read now holding an own entry make the answerer the\n // organization's own staff. A read that lapses or finds no entry holds the edit to the relationship rule.\n let standsOnlyThroughRelationship: boolean | undefined;\n const answersOnlyThroughRelationship = async (): Promise<boolean> => {\n if (standsOnlyThroughRelationship === undefined) {\n // A reviewer route naming no organization is refused before this (ROUTE_HAS_NO_ORGANIZATION); read as\n // relationship-only here too, so this check never admits on an absent organization (review N2).\n standsOnlyThroughRelationship = route.organizationId === undefined || !answersAsOrganizationOwnStaff(\n await this.humanDecisionRoleFactsPorts().currentRolesIn(answererUserId, route.organizationId), route.organizationId,\n );\n }\n return standsOnlyThroughRelationship;\n };\n const cardSubject = this.decisionSubjectOfCall(systemRef, paused.pendingToolName, paused.pendingToolArgs as Record<string, unknown> | undefined);\n const editedSubject = this.decisionSubjectOfCall(systemRef, paused.pendingToolName, modifiedToolArgs);\n // The arguments to name when the edit is refused; `undefined` while it is admitted.\n let refusedArguments: readonly string[] | undefined;\n if (editedSubject.kind === HumanDecisionSubjectKind.RECORD) {\n const verdict = authorizeHumanDecisionActor({\n actor: { executionType: params.actorAuth?.executionType ?? ExecutionContext_ExecutionType.PUBLIC_EXECUTION, userId: answererUserId },\n roleFacts: await resolveHumanDecisionRoleFacts(this.humanDecisionRoleFactsPorts(), { userId: answererUserId, route, requester, subject: editedSubject }),\n route, requester, act: HumanDecision_Act.ANSWER,\n });\n if (verdict.kind === HumanDecision_VerdictKind.REFUSED) refusedArguments = rowIdArgument ? [rowIdArgument] : [];\n } else if (cardSubject.kind === HumanDecisionSubjectKind.RECORD && await answersOnlyThroughRelationship()) {\n refusedArguments = rowIdArgument ? [rowIdArgument] : [];\n }\n if (refusedArguments === undefined) {\n const editedForeignKeys = this.foreignKeyArgumentsEditedIn(systemRef, paused.pendingToolName, changedArgumentKeys);\n if ((editedForeignKeys === undefined || editedForeignKeys.length > 0) && await answersOnlyThroughRelationship()) {\n refusedArguments = editedForeignKeys ?? changedArgumentKeys;\n }\n }\n if (refusedArguments !== undefined) {\n this.logger.info('[ConversationalExecution] An approval edited the call onto a record its answerer may not reach; refusing, the pause stands', {\n systemRef, executionId, decisionRef, refusedArguments,\n });\n if (this.auditLogs) {\n void this.auditLogs.logHumanDecisionAnswerRefused({\n ...refusalBase, act: HumanDecision_Act.ANSWER, reason: HumanDecision_RefusalReason.EDITED_CALL_NOT_REACHABLE, attemptedByUserId: answererUserId,\n }, params.actorAuth ? this.auditContextFor(params.actorAuth, owner) : undefined).catch(() => undefined);\n }\n if (params.emitter) {\n this.emitError(params.emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.APPROVAL_MODIFICATION_REJECTED,\n 'That edit points the call at a record you may not reach. Approve the call as proposed, or deny it.', true, {\n reason: FlowsActors_ApprovalModificationRefusalReason.RECORD_NOT_REACHABLE,\n toolName: paused.pendingToolName,\n argumentPaths: [...refusedArguments],\n });\n }\n return { kind: HumanDecision_ActOutcomeKind.MODIFICATION_REJECTED, reason: HumanDecision_RefusalReason.EDITED_CALL_NOT_REACHABLE, argumentNames: [...refusedArguments] };\n }\n }\n }\n\n // ── 4a.i. An edit nothing can vouch for (#3314) ────────────────────────\n //\n // A resource that cannot be read leaves half a shape: the check above read the tool's schema, and cannot say what the\n // resource declares. Refused AFTER the reach check of #2734, so a representative's refused edit keeps its reason and its\n // audit row, and under a reason that is true: this is not known to be a credential.\n if (modifiedResume && !question) {\n const edited = this.resolveApprovalGatedFunctionTool(systemRef, paused.pendingToolName);\n if (edited.kind === GatedFunctionToolResolutionKind.FOUND && this.argumentResourceSchemasOf(edited.functionTool) === undefined) {\n const unjudged = this.callCannotRunRefusal(\n `The arguments of \"${paused.pendingToolName}\" cannot be checked, because the record they describe cannot be read: ${modifiedResume.modifiedArgumentKeys.join(', ')}. The approval is still pending: put them back, or deny it.`,\n { reason: FlowsActors_ApprovalModificationRefusalReason.ARGUMENTS_NOT_RUN_AS_WRITTEN, toolName: paused.pendingToolName, argumentPaths: [...modifiedResume.modifiedArgumentKeys] },\n );\n this.logger.warn('[ConversationalExecution] Refusing an edit whose resource cannot be read; the pause stands', { systemRef, executionId, decisionRef, toolName: paused.pendingToolName });\n if (params.emitter) this.emitError(params.emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.APPROVAL_MODIFICATION_REJECTED, unjudged.message, true, unjudged.refusal);\n return this.refusedOutcomeOf(unjudged);\n }\n }\n\n // ── 4a. A call approved unedited would run (#3295) ─────────────────────\n if (approved && !modifiedResume) {\n const refused = await this.proposedCallRefusal(systemRef, paused, answerPersonalData);\n if (refused) {\n this.logger.warn('[ConversationalExecution] Refusing an approval of a call the tool would refuse; the pause stands', {\n systemRef, executionId, decisionRef, toolName: paused.pendingToolName, argumentNames: refused.refusal.argumentPaths,\n });\n if (params.emitter) {\n this.emitError(params.emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.APPROVAL_MODIFICATION_REJECTED, refused.message, true, refused.refusal);\n }\n return this.refusedOutcomeOf(refused);\n }\n }\n\n // ── 4b. A reason code is one the application declares (#1599) ──────────\n //\n // Refused while the pause stands, like a refused edit: the decision stays answerable, with a declared code or\n // none. A code nobody declared would enter the decision record as an undefined term of its closed vocabulary.\n if (params.reasonCode !== undefined && !this.agentWorkDecisions?.reasonCodeIsDeclared(params.reasonCode)) {\n this.logger.info('[ConversationalExecution] Refusing an answer whose reason code the application does not declare; the pause stands', {\n systemRef, executionId, decisionRef,\n });\n if (params.emitter) {\n this.emitError(params.emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.APPROVAL_REASON_CODE_REJECTED,\n 'That reason is not one this application offers. The approval is still pending: answer it again with an offered reason, or with none.', true);\n }\n return { kind: HumanDecision_ActOutcomeKind.REASON_CODE_REJECTED };\n }\n\n // ── 5. The requester's authority, as it stands NOW ──────────────────────\n const rebuilt = await this.executionContextCreator.rebuildDecisionRequesterAuthority({\n requesterKind: requester.kind,\n requesterRef: requester.ref,\n requesterClientId: requester.clientId,\n organizationId: route.organizationId,\n requestedAt: row.pendingDecisionRequestedAt ? new Date(row.pendingDecisionRequestedAt) : new Date(paused.requestedAt),\n // A MACHINE requester re-resolves its declared principal from the agent the turn ran as (#1611 I4). Every requester\n // resumes only through the relationships it was raised through (#2768).\n ...(row.autonomousAgentRef ? { autonomousAgentRef: row.autonomousAgentRef } : {}),\n ...this.decisionRaisedThroughOf(requester, resourceType, row.executionId, route.organizationId),\n });\n if (rebuilt.standing === DecisionRequesterAuthorityStanding.LAPSED) {\n // #2923: this answer settles the decision, so it spends its proof.\n if (!await consumeDecisionStepUp()) return refuseForStepUp();\n this.logger.info('[ConversationalExecution] A decision was answered but its requester\\'s authority no longer holds; the work will not run', {\n systemRef, executionId, decisionRef, reason: rebuilt.reason,\n });\n const endedAt = new Date();\n const endedOn = await this.endPendingDecision({\n resourceType, executionId, rawPausedApproval, decisionRef,\n outcome: HumanDecision_Outcome.REQUESTER_AUTHORITY_LAPSED, decidedByUserId: answererUserId, toolName: paused.pendingToolName, scopeContext: owner.scopeContext, row, decidedAt: endedAt,\n }).catch(() => null);\n if (endedOn) {\n this.recordDecisionResolved({\n row: endedOn, outcome: HumanDecision_Outcome.REQUESTER_AUTHORITY_LAPSED, toolName: paused.pendingToolName,\n decidedByUserId: answererUserId, reasonGiven: !!params.reason,\n // #2664: the answer that ended it may have come from a chat, like the winner's below.\n ...(params.answeredThrough ? { answeredThrough: params.answeredThrough } : {}),\n ...(params.actorAuth ? { decider: deciderOf(params.actorAuth) } : {}),\n requester,\n requestContext: params.actorAuth ? this.auditContextFor(params.actorAuth, owner) : undefined,\n });\n await this.recordAgentWorkSettlement({\n resourceType, row: endedOn, decisionRef, outcome: HumanDecision_Outcome.REQUESTER_AUTHORITY_LAPSED, decidedAt: endedAt, paused,\n toolName: paused.pendingToolName, ...(answererUserId ? { deciderUserId: answererUserId } : {}),\n });\n }\n if (params.emitter) {\n this.emitError(params.emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.DECISION_REQUESTER_AUTHORITY_LAPSED,\n 'The person this work was done for no longer has the access it needs, so it was not run.');\n }\n return { kind: HumanDecision_ActOutcomeKind.REQUESTER_AUTHORITY_LAPSED };\n }\n // #2665 B7: a chat conversation's resumed turn runs confined like its every turn. A ledger that cannot be read throws\n // here, before anything moved: the decision stays answerable.\n const chatConversation = await this.chatConversationOf(executionId);\n const requesterAuth = this.confineToChatConversation(rebuilt.auth, chatConversation);\n\n // ── 6. Consent, for the REQUESTER ──────────────────────────────────────\n //\n // The resumed turn runs the model and writes the REQUESTER's transcript, so it is held to the\n // requester's consent, not the answerer's (#534 third review M1, #1594 D5). Checked before the\n // release, so a refused decision stays answerable once the requester has consented.\n if (!(await this.admitsUnderServiceConsentRequirement({\n auth: requesterAuth, owner, systemRef, executionId, emitter: params.emitter, recoverable: true,\n }))) {\n return { kind: HumanDecision_ActOutcomeKind.CONSENT_REQUIRED };\n }\n\n // ── 6a. An approved call can run, as things stand (#3313) ──────────────\n //\n // A decision settles before its resume runs, so what would end that resume is asked here, while the pause stands: an\n // acceptance is not recorded for a call that was bound not to run. A denial is not asked: it runs nothing, and it is\n // the remedy these refusals name. The resume keeps its own checks, for what moves between here and there.\n if (approved) {\n const cannotRun = await this.approvedCallCannotRunRefusal(systemRef, paused, requesterAuth, row.initiationKind);\n if (cannotRun) {\n this.logger.warn('[ConversationalExecution] Refusing an approval of a call that cannot run as things stand; the pause stands', {\n systemRef, executionId, decisionRef, toolName: paused.pendingToolName, reason: cannotRun.refusal.reason,\n });\n if (params.emitter) this.emitError(params.emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.APPROVAL_MODIFICATION_REJECTED, cannotRun.message, true, cannotRun.refusal);\n return this.refusedOutcomeOf(cannotRun);\n }\n }\n\n // ── 7. Release, on the route that was authorized ───────────────────────\n // #2665 B2, V1: a chat conversation is owed the resumed turn's reply BEFORE the release, so whatever ends that turn\n // (its own end, a later pause, a crash and the sweep) is posted into the chat. Owed for the decision: the reply waits\n // until the row has moved past it. If the release then misses (another answer, a lapse), the reply still says how the\n // turn ended.\n // #2923: the release settles the decision, so it spends the answer's proof first: a replayed proof moves nothing.\n if (!await consumeDecisionStepUp()) return refuseForStepUp();\n if (chatConversation) await this.chatConversations!.oweReply(chatConversation._id, { decisionRef });\n const outcome = humanDecisionOutcomeOf(\n toolApprovalDecisionRequest({ decisionRef, toolName: paused.pendingToolName, requestedAt: paused.requestedAt, ...(paused.expiresAt ? { expiresAt: paused.expiresAt } : {}) }),\n { decisionId: decisionRef, optionRef: approved ? HumanDecision_ToolApprovalOption.APPROVE : HumanDecision_ToolApprovalOption.DENY, values: [] },\n // A question's answers ride as `answers` on the call, which is how they reach the tool, not an edit of it (#2720).\n { modified: !!modifiedResume && !question },\n );\n const modifiedArgumentNames = modifiedResume && !question ? [...modifiedResume.modifiedArgumentKeys].sort() : [];\n // #2550: subscribed to resumed-turn stops BEFORE the decision instant and the release. A cancel that misses this\n // decision's withdrawal is published after the release, which is after this, so this replica hears it — whether the\n // resume is running then or registers just after (`unmatchedResumedTurnStops`). Arming at registration alone left a\n // cold replica (first turn since boot, or a subscriber that dropped) deaf in exactly that gap. Never rejects; with\n // no Redis it resolves at once and the replica is the only one there is.\n await this.resumedTurnStops?.arm();\n const decidedAt = new Date();\n const rowOwnerFilter = {\n executionId,\n ...owner.ownerFields,\n machineCredentialId: row.machineCredentialId,\n resourceServerInstanceRef: row.resourceServerInstanceRef,\n };\n this.logger.info('[ConversationalExecution] Resuming a suspended turn on a human decision', {\n systemRef, executionId, decisionRef, outcome, toolName: paused.pendingToolName, modifiedArgumentNames,\n });\n // A previous decision on this row whose record is still owed is repaid first: the release overwrites the\n // resolution columns that record would be repaired from (#1599 review F3).\n await this.repayOwedCorrectionBeforeOverwrite(owner.resourceType, row, decisionRef);\n // The resumed turn's lease, taken BEFORE the release writes PROCESSING (#1780) — see `holdTurnLease`.\n const releaseTurnLease = await this.holdTurnLease(executionId);\n let released: boolean;\n let rereadAfterThrow: FlowActorExecution | null | undefined;\n /** Whether a re-read of the row failed: then nothing is known about whether the decision still waits. */\n let rereadFailed = false;\n // #2903: the answer's seal, written in the release's own transaction: a release that lands has one, one that loses\n // (another answer, a move, an end) or rolls back has none. The decider is the one the RESOLVED row records.\n const decider = params.actorAuth ? deciderOf(params.actorAuth) : undefined;\n /*\n * #2924: what the seal attests, which is what it goes with. A tool approval attests the record its call acts on (the\n * row its tool declares, `argumentsResource.rowIdArgument`, read from the arguments the call runs with), so the seal\n * follows that record's retention, its legal holds and its tenant's purge, exactly as an operation approval's seal\n * follows the record its operation acts on. A Wonder Ledger close's sign-off seal goes with the close, not with the\n * conversation it was answered in. A question, or a call that names no row (a create), attests the conversation.\n */\n const sealedCallSubject = question ? HUMAN_DECISION_NAMES_NO_RECORD : this.decisionSubjectOfCall(\n systemRef, paused.pendingToolName,\n (approved && modifiedResume && modifiedToolArgs ? modifiedToolArgs : paused.pendingToolArgs) as Record<string, unknown> | undefined,\n );\n const sealFacts: DecisionSealFacts | undefined = answererUserId && decider && isApprovalSealOutcome(outcome) ? {\n ...(route.organizationId ? { organizationId: route.organizationId } : {}),\n source: ApprovalSource.CONVERSATIONAL_DECISION,\n decisionRef,\n subject: sealedCallSubject.kind === HumanDecisionSubjectKind.RECORD\n ? { resourceType: sealedCallSubject.resourceType, resourceId: sealedCallSubject.recordId }\n : { resourceType: owner.resourceType, resourceId: String(row._id) },\n outcome,\n meaning: question ? ApprovalSealMeaning.ANSWER : ApprovalSealMeaning.REVIEW,\n decidedAt,\n decider,\n approverUserId: answererUserId,\n requester,\n presentation: presentationCheck.presentation,\n // #2904: the file the presentation binds; the seal attests it only when the presentation it seals binds it.\n ...(deliverable.bound ? { deliverableFile: deliverable.bound } : {}),\n statement: decisionStatementOf({\n optionRef: question ? (params.answer?.optionRef ?? HumanDecision_ToolApprovalOption.DENY) : (approved ? HumanDecision_ToolApprovalOption.APPROVE : HumanDecision_ToolApprovalOption.DENY),\n ...(question && params.answer ? { values: params.answer.values } : {}),\n ...(approved && modifiedResume && !question && modifiedToolArgs ? { modifiedToolArgs } : {}),\n ...(params.reasonCode !== undefined ? { reasonCode: params.reasonCode } : {}),\n }),\n } : undefined;\n let sealDigest: string | undefined;\n /** #2904: the seal's id, handed to the resumed turn's tool calls so a consumer recording the decision stores it. */\n let sealId: string | undefined;\n try {\n const updated = await this.releaseWithSeal(owner.resourceType, sealFacts, (serviceOptions) => this.systemAccess.updateAsSystem(owner.resourceType, {\n ...rowOwnerFilter,\n status: FlowsActors_Status.AWAITING_APPROVAL,\n pausedApproval: rawPausedApproval,\n pendingDecisionRef: decisionRef,\n pendingDecisionRouteVersion: row.pendingDecisionRouteVersion ?? 0,\n }, {\n status: FlowsActors_Status.PROCESSING,\n pausedApproval: null,\n ...PENDING_DECISION_CLEARED,\n lastResolvedDecisionRef: decisionRef,\n // #2821: the work this decision belongs to, carried over so the turn it releases stays attributable to that work.\n lastResolvedDecisionWorkRef: row.pendingDecisionWorkRef ?? decisionRef,\n decidedByUserId: answererUserId ?? null,\n decidedAt,\n decisionOutcome: outcome,\n decisionToolName: paused.pendingToolName,\n decisionModifiedArgumentNames: modifiedArgumentNames,\n // #1599 I3: written by the release itself, so a crash before the record leaves the marker for the repair.\n // #2720: a QUESTION asked for information and proposed nothing, so it owes no agent-work record.\n ...(question ? {} : correctionMarkerOf(decisionRef, row, decidedAt, isReviewerRoute(route) && answererUserId ? route.eligibleRole : undefined)),\n }, { ...serviceOptions, scopeContext: owner.scopeContext }));\n released = updated.released !== null;\n sealDigest = updated.sealDigest;\n sealId = updated.sealId;\n } catch (error) {\n // read-failure-in-caller-transaction: N/A — a guarded write in the release's own transaction, not a read made on a caller's behalf; it fails closed below (#3091).\n /*\n * D10 — a THROWN release fails CLOSED. It used to log and resume, on the reading that \"a thrown write\n * is not proof the release did not land\"; that let the tool run with no recorded decider, and let a\n * second answer resume as well. Now the row decides: only a release RECORDED for this decision, by\n * this person, resumes.\n */\n this.logger.error('[ConversationalExecution] The release write for a decision threw; re-reading the row before resuming', {\n systemRef, executionId, decisionRef, ...projectCaughtErrorLogFields(error),\n });\n rereadAfterThrow = await this.systemAccess.readAsSystem<FlowActorExecution>(owner.resourceType, { executionId }, { suppressSystemAudit: true })\n .catch(() => { rereadFailed = true; return null; });\n released = rereadAfterThrow?.lastResolvedDecisionRef === decisionRef && (rereadAfterThrow?.decidedByUserId ?? undefined) === answererUserId;\n }\n if (!released) {\n this.refuseDecisionAttempt(params.emitter, systemRef, executionId);\n await releaseTurnLease();\n /*\n * S5a review F2: the release lost, and the two ways to lose mean opposite things to whoever shows the decision.\n * Another answer, or an end, means nothing waits any more: SUPERSEDED. A MOVE (a claim, a reassignment, an\n * escalation) changed the route between this answer's read and its write, and the decision still waits for\n * the people it now names: NOT_ACTIONABLE, which a shared chat message reads as \"leave it for the others\".\n * The row says which. A row that is GONE holds no decision, so nothing waits: SUPERSEDED. A row that could not be\n * READ says nothing, and NOT_ACTIONABLE is the answer that takes nothing away from the people who may still hold\n * the decision (#2664 review R-3).\n */\n const now = rereadAfterThrow !== undefined\n ? rereadAfterThrow\n : await this.systemAccess.readAsSystem<FlowActorExecution>(owner.resourceType, { executionId }, { suppressSystemAudit: true })\n .catch(() => { rereadFailed = true; return null; });\n const stillWaits = rereadFailed || (now?.status === FlowsActors_Status.AWAITING_APPROVAL && now.pendingDecisionRef === decisionRef);\n this.logger.info('[ConversationalExecution] The decision was settled or moved before this answer could claim it; not resuming', {\n systemRef, executionId, decisionRef,\n consequence: rereadFailed ? 'the row could not be re-read, so the decision may still wait'\n : stillWaits ? 'the route moved and the decision still waits' : 'another answer won, or the decision ended',\n });\n return { kind: stillWaits ? HumanDecision_ActOutcomeKind.NOT_ACTIONABLE : HumanDecision_ActOutcomeKind.SUPERSEDED };\n }\n // #2569: the decision is answered, so it leaves everyone it was routed to but the person who answered it.\n this.announceDecisionWithdrawn({ route, requester, decisionRef, ...(answererUserId ? { except: answererUserId } : {}) });\n\n // ── 8. The winner records it, then the turn resumes as the requester ───\n let resumed: Promise<void>;\n // #2829: the WORK's lease, beside the execution's: taken before the work's PROCESSING entry, let go after its ending.\n let releaseWorkLease: () => Promise<void> = async () => {};\n try {\n this.recordDecisionResolved({\n row, outcome, toolName: paused.pendingToolName, decidedByUserId: answererUserId,\n deciderRoles: (params.actorAuth?.initiatorRoles ?? [])\n .filter((entry) => entry.relatedResourceId === route.organizationId)\n .flatMap((entry) => entry.roles),\n modifiedArgumentNames, reasonGiven: !!params.reason,\n ...(params.answeredThrough ? { answeredThrough: params.answeredThrough } : {}),\n // #2905: how the person who answered was authenticated, from what the door verified, and who had asked.\n ...(decider ? { decider } : {}),\n requester,\n ...(sealDigest ? { decisionPayloadDigest: sealDigest } : {}),\n requestContext: params.actorAuth ? this.auditContextFor(params.actorAuth, owner) : undefined,\n });\n // #1599: the winner records the decision on the agent's proposal (I2), before the turn resumes.\n // #2720: a question asked information and proposed nothing, so it is not agent-work review (the settlement skips it).\n await this.recordAgentWorkSettlement({\n resourceType: owner.resourceType, row, decisionRef, outcome, decidedAt, paused, toolName: paused.pendingToolName,\n ...(modifiedResume && modifiedToolArgs ? { modifiedToolArgs } : {}),\n modifiedArgumentNames,\n ...(params.reasonCode ? { reasonCode: params.reasonCode } : {}),\n ...(params.reason ? { reasonText: params.reason } : {}),\n ...(answererUserId ? { deciderUserId: answererUserId } : {}),\n ...(isReviewerRoute(route) && route.eligibleRole ? { admittedByRole: route.eligibleRole } : {}),\n });\n // #3015: a person's denial takes effect on the record the call was about, when the gate declares what it does.\n // After the sealed decision committed, before the turn resumes, so the model's next reply sees the record moved.\n // A failed effect is said to the resumed turn, so the person hears the record did not move rather than only a log.\n const denialEffectFailed = !question && outcome === HumanDecision_Outcome.REJECTED\n && !(await this.applyDenialEffect({ systemRef, executionId, owner, paused, requesterAuth, decisionRef, row }));\n if (denialEffectFailed) reason = [reason, DENIAL_EFFECT_FAILED_REASON].filter(Boolean).join(' ');\n\n /*\n * The resumed turn's stream reaches the conversation's OWNER and nobody else. It carries what the turn does —\n * tool results, a shown reasoning, the turn's usage for the owner's roles — so it is the owner's to see (#2524).\n *\n * A door that routes by owner (the socket and the REST door) decides alone: when the owner has no personal room\n * — a conversation owned by an organization or the application, which every autonomous turn is — the stream\n * goes to no one. It used to fall back to the ANSWERER's emitter, so a reviewer approving an autonomous turn\n * received that turn's tool results. A reviewer sees the decision they were shown, and the outcome through the\n * decision list, never the turn. A door with no owner routing (A2A, whose caller owns the task) keeps its own.\n */\n const ownerEmitter = params.ownerEmitterFor ? params.ownerEmitterFor(owner.scopeContext as ConversationalOwnerScope) : params.emitter;\n // #2821: the work this decision belongs to starts running again. Appended BEFORE the resume can end it, so the\n // work's newest entry is never the start of a continuation that has already finished.\n const resumedWorkRef = row.pendingDecisionWorkRef ?? decisionRef;\n // #2829: held for the continuation's whole run, so a process that dies inside it leaves a work whose lease lapses,\n // which the interrupted-turn sweep fails whichever turn holds the thread by then.\n releaseWorkLease = await this.holdWorkLease(executionId, resumedWorkRef);\n await this.recordWorkEvent(owner.resourceType, { executionId, ...owner.ownerFields }, resumedWorkRef, { status: FlowsActors_Status.PROCESSING });\n resumed = this.resumeAfterApproval({\n systemRef, executionId, owner, paused, approved,\n reason,\n // The rewritten, re-signed SDK array when the approver authored the arguments; otherwise the\n // resume reads `paused.sdkModelMessages` exactly as before.\n modifiedSdkModelMessages: modifiedResume?.sdkModelMessages,\n storedPersonalDataState: row.personalDataModelState,\n ...(answerPersonalData ? { personalData: answerPersonalData } : {}),\n auth: requesterAuth,\n resourceServerInstanceRef: row.resourceServerInstanceRef,\n emitter: ownerEmitter,\n // The pause recorded everything the turn did before it, so the resume adds only its own work, onto the row as it\n // stands when each of its writes lands (#2743): a message sent while it runs stays.\n transcript: TRANSCRIPT_AS_IT_STANDS,\n decisionRef,\n ...(sealId ? { decisionSealId: sealId } : {}),\n // #2821: the work the answered decision belongs to; the resume continues it, and a pause in it is that work's too.\n workRef: resumedWorkRef,\n requester,\n initiationKind: row.initiationKind,\n autonomousTrigger: row.autonomousTrigger,\n // #1598: the thread's case, from the row the decision was read with.\n caseRef: row.caseRef ?? null,\n // #2550: a stop of this decision arriving after it was decided and before the resume registers is honoured there.\n releasedAt: decidedAt.getTime(),\n // #3313: an acceptance owes a record if its call does not run.\n ...(approved ? { acceptedAs: outcome, ...(row.pendingDecisionOrganizationId ? { acceptedDecisionOrganizationId: row.pendingDecisionOrganizationId } : {}) } : {}),\n });\n } catch (error) {\n // Nothing resumed, so nothing would let the leases go — do it here, or their heartbeats run for ever.\n await releaseWorkLease();\n await releaseTurnLease();\n throw error;\n }\n // Let go when the resumed turn ends, however it ends, whether this call waits for it or not. The work's lease AFTER\n // the resume settled, which is after its ending entry was attempted (`resumeAfterApproval`'s own `finally`).\n resumed = resumed.finally(async () => {\n await releaseWorkLease();\n await releaseTurnLease();\n });\n if (params.detachResume) {\n // `resumeAfterApproval` records its own failures and ends the turn FAILED; nothing here can add to that.\n void resumed.catch((error: unknown) => {\n this.logger.error('[ConversationalExecution] A detached resume failed outside its own handling', {\n systemRef, executionId, decisionRef, ...projectCaughtErrorLogFields(error),\n });\n });\n } else {\n await resumed;\n }\n return { kind: HumanDecision_ActOutcomeKind.APPLIED };\n }\n\n /**\n * Withdraw the decision a turn is waiting on, because the work itself was cancelled (#1594 D8): the\n * pause is ended WITHDRAWN through the same compare-and-swap every other ending uses, and one RESOLVED\n * row names whoever cancelled. `tasks/cancel` used to cancel the task and leave the pause answerable.\n *\n * The work is named by the first decision it paused on (#2821), and only a decision THAT work waits on is withdrawn:\n * the row's waiting decision when the pause recorded it as this work's (`pendingDecisionWorkRef`), which a chained\n * pause of its continuation is and another turn's pause in the same thread never is ({@link decisionWorkOfRow}). It\n * used to withdraw whatever the thread waited on, and a thread outlives its work and admits overlapping non-chat turns:\n * a cancel of one work withdrew the decision another turn of the same thread was waiting on.\n *\n * @returns `true` when a pending decision was withdrawn; `false` when the work was not waiting on one.\n */\n public async withdrawPendingDecision(params: {\n executionId: string;\n /** The cancelled work, named by the first decision it paused on. */\n workRef: string;\n scopeContext: ConversationalOwnerScope;\n /** Whoever cancelled — the conversation's own principal on every door that reaches this. */\n withdrawnBy?: SocketAuthResult;\n /** The agent instance the conversation runs on; with the principal's credential, the full isolation key. */\n resourceServerInstanceRef?: string;\n }): Promise<boolean> {\n let owner: ResolvedOwnerVariant;\n try {\n owner = this.resolveOwnerVariant(params.scopeContext);\n } catch {\n return false;\n }\n const row = await this.systemAccess.readAsSystem<FlowActorExecution>(owner.resourceType, {\n executionId: params.executionId,\n ...owner.ownerFields,\n machineCredentialId: machineCredentialIdOf(params.withdrawnBy),\n resourceServerInstanceRef: agentInstanceOf(params.resourceServerInstanceRef),\n }, { suppressSystemAudit: true }).catch((error: unknown) => {\n // #2582 review R3: a store that failed is not a row that is absent, any more than on the withdrawal below. The cancel\n // stands and the decision, if one waits, stays answerable until answered or lapsed; this line says the read failed.\n this.logger.warn('[ConversationalExecution] The execution of cancelled work could not be read; a decision it holds stays answerable until answered or lapsed', {\n executionId: params.executionId, ...projectCaughtErrorLogFields(error),\n });\n return null;\n });\n if (!row) return false;\n // The decision the cancelled work waits on, if any; any other decision on the thread is another turn's (#2821). The\n // compare-and-swap below is keyed on the row's waiting decision, so an answer landing in between makes it miss.\n const work = decisionWorkOfRow(row, params.workRef);\n if (work.standing !== ConversationalDecisionWorkStanding.WAITING || row.pendingDecisionRef !== work.waitingDecisionRef) return false;\n try {\n const withdrawal = await this.withdrawHeldDecision({\n owner, row,\n withdrawnByUserId: params.withdrawnBy?.initiatorIds?.userId,\n throughDelegatedClient: !!params.withdrawnBy?.delegatingClientId,\n requestContext: params.withdrawnBy ? this.auditContextFor(params.withdrawnBy, owner) : undefined,\n });\n return withdrawal.ended;\n } catch (error) {\n // #2582 review F1: a store that failed is not a decision that was not waiting. The cancel stands; the decision\n // stays answerable until it is answered or its deadline sweep ends it, and this line names it.\n this.logger.warn('[ConversationalExecution] The decision of cancelled work could not be withdrawn; it stays answerable until answered or lapsed', {\n executionId: row.executionId, decisionRef: row.pendingDecisionRef, ...projectCaughtErrorLogFields(error),\n });\n return false;\n }\n }\n\n /**\n * Settle what an execution row holds before the row is DELETED (#2582): a person deleting a discussion, or an\n * administrator deleting a run. Called by the DELETE's prefix (`flow-actor-executions.custom-impl`), so a decision\n * ends the way every other ending does — WITHDRAWN, one RESOLVED record naming who deleted it, the agent-work\n * settlement, its holders told — instead of going with the row and staying requested on the trail forever.\n *\n * Fail-closed, because the row is the last copy of what it holds (#2582 review F1):\n * - a store that fails propagates, so the deletion is refused and the row stays, instead of being read as \"nothing was\n * waiting\";\n * - a record the row owes — the settlement of the decision just ended, or of one that ended earlier — must exist\n * before the row goes, since the repair sweep writes it FROM the row ({@link DeletedExecutionDecisionSettlement});\n * - a compare-and-swap that misses because the row moved (answered and paused again on a NEW decision, review F5) is\n * re-read and the decision it holds NOW is ended, a bounded number of times.\n *\n * The first read is the row the DELETE already read under the deleter's own authorization.\n */\n public async settleDecisionBeforeDeletion(params: {\n resourceType: CoreResourceType;\n row: FlowActorExecution;\n /** The DELETE's own context: who deleted, and the request the RESOLVED record belongs to. */\n deletedBy: ExecutionContext<any>;\n }): Promise<DeletedExecutionDecisionSettlement> {\n // The one owner rule of an execution row (#2582 review F6), the same the agent-work record and its repair read.\n const ownerScope = agentWorkOwnerOfExecution(params.resourceType, params.row as unknown as Record<string, unknown>);\n // No owner scope: no decision on it could be routed, and no record could be repaired from it.\n if (!ownerScope) return DeletedExecutionDecisionSettlement.NOTHING_OWED;\n const owner = this.resolveOwnerVariant(ownerScope);\n let row = params.row;\n for (let attempt = 0; ; attempt += 1) {\n // A record still owed for a decision that ended EARLIER is written first: the withdrawal below overwrites the\n // columns it is repaired from, and the deletion removes them.\n if (!(await this.repayOwedRecordBeforeDeletion(owner.resourceType, row))) return DeletedExecutionDecisionSettlement.RECORD_NOT_WRITTEN;\n if (!holdsPendingDecision(row)) return DeletedExecutionDecisionSettlement.NOTHING_OWED;\n if (attempt >= DELETED_EXECUTION_WITHDRAWAL_ATTEMPTS) return DeletedExecutionDecisionSettlement.STILL_WAITING;\n const withdrawal = await this.withdrawHeldDecision({\n owner, row,\n withdrawnByUserId: params.deletedBy.initiatorIds?.userId,\n throughDelegatedClient: !!params.deletedBy.delegatingClientId,\n requestContext: params.deletedBy,\n });\n if (withdrawal.ended) {\n return withdrawal.recordWritten ? DeletedExecutionDecisionSettlement.SETTLED : DeletedExecutionDecisionSettlement.RECORD_NOT_WRITTEN;\n }\n // Missed: the row moved under the write. Read what it holds now, under the same owner, and settle that.\n const fresh = await this.systemAccess.readAsSystem<FlowActorExecution>(owner.resourceType, {\n executionId: row.executionId, ...owner.ownerFields,\n }, { suppressSystemAudit: true });\n if (!fresh) return DeletedExecutionDecisionSettlement.NOTHING_OWED;\n row = fresh;\n }\n }\n\n /**\n * Settle the decisions of execution rows a TEARDOWN is about to delete or scrub (#2582). Two paths reach a row without\n * its own service tier running, so its DELETE settlement ({@link settleDecisionBeforeDeletion}) never runs for them:\n * - an owner scope's `onParentDelete` cascade DELETES the rows: an organization purge, a person's deletion;\n * - the scrub chokepoint RETAINS them scrubbed: a person's ERASURE, since this resource is impersonalize-and-retain. A\n * retained row is hidden from every ordinary read and frozen to every ordinary write, so a decision left on it could\n * be neither answered nor lapsed, and stayed requested forever.\n *\n * Called by the row-teardown settler {@link registerFlowActorExecutionTeardownSettlement}, BEFORE the teardown's write\n * and inside its transaction. Each decision is ended by the compare-and-swap every ending uses\n * ({@link endPendingDecision}): WITHDRAWN, with no decider, because nobody in the app ended it. Only a write that wins\n * records it, so an answer that landed after the teardown's read makes the write miss and is the decision's only\n * ending (#2582 review F7). Once the teardown commits, the RESOLVED row is recorded and every holder is told, including\n * reviewers in ANOTHER organization (a ROLE decision routed across an organization relationship), whose inbox would\n * otherwise keep a card nobody can act on.\n *\n * NO agent-work record is written, and none owed by an earlier decision is repaid: the scope goes with its records, and\n * an erasure must not write new data about its subject. The trail is the record. A record an earlier decision still owed\n * is lost with the row, and the loss is logged, naming it.\n *\n * A store failure propagates and fails the teardown (the settler contract): the row is the only copy of what it holds.\n */\n public async settleDecisionsBeforeTeardown(event: RowTeardownSettlementEvent): Promise<void> {\n const resourceType = event.resourceType as CoreResourceType;\n const transaction = event.options?.transaction;\n for (const snapshot of event.rows) {\n const row = snapshot as unknown as FlowActorExecution;\n if (row.pendingCorrectionRecordRef) {\n this.logger.warn('[ConversationalExecution] A teardown reached an execution that still owed a decision record; the record is lost with it', {\n executionId: row.executionId, decisionRef: row.pendingCorrectionRecordRef, treatment: event.treatment,\n });\n }\n if (!holdsPendingDecision(row) || !row.pausedApproval || !row.pendingDecisionRef) continue;\n // The one owner rule of an execution row (#2582 review F6). A row with no owner scope routed no decision to anyone.\n const ownerScope = agentWorkOwnerOfExecution(resourceType, snapshot);\n if (!ownerScope) continue;\n const toolName = this.pendingToolNameOf(row.pausedApproval);\n const endedOn = await this.endPendingDecision({\n resourceType, executionId: row.executionId, rawPausedApproval: row.pausedApproval, decisionRef: row.pendingDecisionRef,\n outcome: HumanDecision_Outcome.WITHDRAWN, toolName, row,\n scopeContext: this.resolveOwnerVariant(ownerScope).scopeContext,\n teardown: transaction ? { transaction } : {},\n });\n // Missed: the decision moved on after the teardown's read (answered, lapsed, withdrawn), and the move recorded it.\n if (!endedOn) continue;\n const recordEnding = (): void => {\n void this.recordDecisionResolved({ row: endedOn, requester: humanDecisionRequesterOfRow(endedOn), outcome: HumanDecision_Outcome.WITHDRAWN, toolName, requestContext: event.executionContext });\n };\n if (!transaction) {\n recordEnding();\n continue;\n }\n // #2886 review MED-3: capturable. Under a purge the organization-purge sweep captures, the RESOLVED row is kept in the\n // post-commit effect outbox with the purge's commit, and written once by the purge's next run when this effect never\n // runs. This plane announces no withdrawal to holders here. The chat cards' outcome note is kept too (#2930): written\n // by whichever of this effect and that run settles it, once, since the ledger takes an outcome once.\n const noticeOutcome = this.decisionNoticeOutcomeOf(endedOn, HumanDecision_Outcome.WITHDRAWN);\n registerTransactionPostCommitEffect(transaction, capturablePostCommitEffect({\n key: ['human-decision-teardown-resolved', resourceType, row.pendingDecisionRef].join(':'),\n execute: async () => recordEnding(),\n capture: decisionEndingCapture({\n effect: 'human-decision-teardown-resolved',\n auditLogs: () => this.auditLogs,\n record: (view) => this.recordDecisionResolved({\n row: endedOn, requester: humanDecisionRequesterOfRow(endedOn), outcome: HumanDecision_Outcome.WITHDRAWN, toolName, requestContext: event.executionContext, capture: { auditLogs: view },\n }),\n tellAnnouncement: () => undefined,\n ...(noticeOutcome && this.decisionNoticeStays\n ? { noticeOutcome: { payload: noticeOutcome, record: (payload) => this.decisionNoticeStays!.recordDecisionOutcome(payload) } }\n : {}),\n subjectId: row.executionId,\n onFailure: (error) => this.logger.warn('[ConversationalExecution] A decision a teardown ended could not be recorded; the purge\\'s next run writes it', {\n executionId: row.executionId, decisionRef: row.pendingDecisionRef, ...projectCaughtErrorLogFields(error),\n }),\n }),\n }));\n }\n }\n\n /**\n * ONE step of removing an erased person from a conversation that names them without being theirs (#2865): an\n * organization's or an application's conversation, or another person's, where they raised, were assigned or decided a\n * decision. Inside the erasure's transaction; effects outside the store follow the commit. The caller (the plane's\n * subject-reference severer) reads the row fresh, calls this, and calls again on the re-read row until it answers\n * DONE, so each step is a compare-and-swap on the row as read:\n *\n * - a waiting decision the person RAISED is ended `REQUESTER_AUTHORITY_LAPSED` (CANCELLED, nobody deciding): its answer\n * could only continue work under an authority that no longer exists. Its record is still owed, as for any ending;\n * - a waiting decision ASSIGNED to them goes back to the role it was assigned within (an unclaim's move, next route\n * version), recorded as `HUMAN_DECISION_REASSIGNED` with the trigger `SUBJECT_ERASURE`, naming no target and never\n * the person; with no role to go back to, nobody else may answer it, and it is ended WITHDRAWN;\n * - the person as the LAST DECIDER of the conversation (`decidedByUserId`) is removed; the outcome stays.\n *\n * `LOST` means another writer moved the row after the caller read it: read again. The person's id in the paused call\n * itself (`pausedApproval`) is the call's arguments, the conversation's content, and is not touched here.\n *\n * assurance-control: WILDO.PRIVACY.SUBJECT_ERASURE — an erased person's id leaves the conversations that name them.\n */\n public async severErasedPersonStep(\n resourceType: CoreResourceType,\n row: FlowActorExecution,\n userId: string,\n transaction?: TransactionContext,\n ): Promise<ConversationalErasureStep> {\n const owner = agentWorkOwnerOfExecution(resourceType, row as unknown as Record<string, unknown>);\n const scopeContext = owner ? this.resolveOwnerVariant(owner).scopeContext : undefined;\n const writeOptions = { ...(scopeContext ? { scopeContext } : {}), ...(transaction ? { transaction } : {}) };\n const waiting = holdsPendingDecision(row) && !!row.pausedApproval && !!row.pendingDecisionRef;\n const requester = humanDecisionRequesterOfRow(row);\n const raisedByThem = waiting && !!requester && requester.kind !== HumanDecision_RequesterKind.MACHINE && requester.ref === userId;\n const assignedToThem = waiting && row.pendingDecisionRouteKind === HumanDecision_RouteKind.ASSIGNEE && row.pendingDecisionAssigneeUserId === userId;\n const canReturnToRole = !!row.pendingDecisionEligibleRole && !!row.pendingDecisionOrganizationId;\n\n if (raisedByThem || (assignedToThem && !canReturnToRole)) {\n const outcome = raisedByThem ? HumanDecision_Outcome.REQUESTER_AUTHORITY_LAPSED : HumanDecision_Outcome.WITHDRAWN;\n const toolName = this.pendingToolNameOf(row.pausedApproval as string);\n const endedOn = await this.endPendingDecision({\n resourceType, executionId: row.executionId, rawPausedApproval: row.pausedApproval as string, decisionRef: row.pendingDecisionRef,\n outcome, toolName, row, ...(scopeContext ? { scopeContext } : {}),\n erasure: { ...(transaction ? { transaction } : {}), erasedUserId: userId },\n });\n if (!endedOn) return ConversationalErasureStep.LOST;\n this.afterTeardownCommits(transaction, ['human-decision-erasure-resolved', resourceType, String(row.pendingDecisionRef)].join(':'), () => {\n this.recordDecisionResolved({ row: endedOn, requester: humanDecisionRequesterOfRow(endedOn), outcome, toolName });\n });\n return ConversationalErasureStep.DECISION_ENDED;\n }\n\n if (assignedToThem) {\n const version = row.pendingDecisionRouteVersion ?? 0;\n const moved = await this.systemAccess.updateAsSystem(resourceType, {\n executionId: row.executionId,\n status: FlowsActors_Status.AWAITING_APPROVAL,\n pendingDecisionRef: row.pendingDecisionRef,\n pendingDecisionAssigneeUserId: userId,\n pendingDecisionRouteVersion: version,\n // Review F2: the same write as an unclaim (`actOnDecision`'s move): the next-due instant is computed for the pause\n // state read here, so a pause landing in between makes this match nothing rather than re-arm a paused clock.\n pendingDecisionClockPausedAt: row.pendingDecisionClockPausedAt ?? null,\n }, {\n pendingDecisionRouteKind: HumanDecision_RouteKind.ROLE,\n pendingDecisionAssigneeUserId: null,\n pendingDecisionClaimedAt: null,\n pendingDecisionRouteVersion: version + 1,\n // Back with the role, unclaimed: the CLAIM clock re-opens, as on an unclaim. A paused decision keeps none.\n ...(row.pendingDecisionClockPausedAt ? {} : { pendingDecisionNextDueAt: nextDueAtOfRow(row, { claimed: false }) }),\n }, Object.keys(writeOptions).length > 0 ? writeOptions : undefined);\n if (moved === null || moved === undefined) return ConversationalErasureStep.LOST;\n const route = humanDecisionRouteOfRow({ ...row, pendingDecisionRouteKind: HumanDecision_RouteKind.ROLE, pendingDecisionAssigneeUserId: null, pendingDecisionClaimedAt: null });\n const toolName = this.pendingToolNameOf(row.pausedApproval as string);\n this.afterTeardownCommits(transaction, ['human-decision-erasure-rerouted', resourceType, String(row.pendingDecisionRef), String(version + 1)].join(':'), () => {\n if (!route) return;\n // assurance-control: WILDO.ACCESS.AUTHORIZATION_DECISION_AUDIT — an erasure's move of a waiting decision's route is recorded like every other move, naming nobody it was taken from.\n if (this.auditLogs) {\n void this.auditLogs.logHumanDecisionReassigned({\n ...this.decisionEventBase(row, route, toolName), routeVersion: version + 1, reasonGiven: false, trigger: HumanDecision_RouteChangeTrigger.SUBJECT_ERASURE,\n }, undefined).catch((error: unknown) => this.logger.warn('[ConversationalExecution] An erasure\\'s move of a waiting decision could not be recorded; the move stands', {\n executionId: row.executionId, ...projectCaughtErrorLogFields(error),\n }));\n }\n this.announceDecisionRouted(route, String(row.pendingDecisionRef), undefined, requester);\n });\n return ConversationalErasureStep.DECISION_REROUTED;\n }\n\n if (row.decidedByUserId === userId) {\n const cleared = await this.systemAccess.updateAsSystem(resourceType, { executionId: row.executionId, decidedByUserId: userId }, { decidedByUserId: null },\n Object.keys(writeOptions).length > 0 ? writeOptions : undefined);\n return cleared === null || cleared === undefined ? ConversationalErasureStep.LOST : ConversationalErasureStep.ID_REMOVED;\n }\n\n /*\n * Review F5: the row was found because a person column names them, and no step above removed it. On a row that holds\n * no waiting decision those columns are residue (every ending clears them), so they are cleared; on a WAITING row it\n * is a shape this step does not recognise (a requester with no kind): the step says so, and the severer refuses the\n * erasure rather than report the person gone while the row still names them.\n */\n const residual = (['pendingDecisionRequesterRef', 'pendingDecisionAssigneeUserId'] as const).filter((column) => row[column] === userId);\n if (residual.length > 0) {\n if (waiting) return ConversationalErasureStep.UNRECOGNISED_WAITING_DECISION;\n const cleared = await this.systemAccess.updateAsSystem(resourceType, {\n executionId: row.executionId, status: row.status, ...Object.fromEntries(residual.map((column) => [column, userId])),\n }, Object.fromEntries(residual.map((column) => [column, null])), Object.keys(writeOptions).length > 0 ? writeOptions : undefined);\n return cleared === null || cleared === undefined ? ConversationalErasureStep.LOST : ConversationalErasureStep.ID_REMOVED;\n }\n return ConversationalErasureStep.DONE;\n }\n\n /**\n * Run an effect outside the store (a record on the trail, a notification) once a teardown's transaction commits, or at\n * once when the teardown has none (#2582): a teardown that rolls back must have announced nothing.\n */\n private afterTeardownCommits(transaction: TransactionContext | undefined, key: string, effect: () => void): void {\n if (!transaction) {\n effect();\n return;\n }\n registerTransactionPostCommitEffect(transaction, { key, execute: async () => effect() });\n }\n\n /**\n * Write the record an execution row still owes from an earlier decision, before the row is deleted. `true` when\n * nothing is owed, or the record now exists, or the row cannot carry it (a marker without the resolution it names\n * is a record already lost, which keeping the row would not recover — the repair logs it at ERROR).\n */\n private async repayOwedRecordBeforeDeletion(resourceType: CoreResourceType, row: FlowActorExecution): Promise<boolean> {\n if (!row.pendingCorrectionRecordRef || !this.agentWorkDecisions) return true;\n const resolution = row as unknown as ExecutionResolutionRow;\n if (!owedRecordIsRepairableFromRow(resourceType, resolution)) return true;\n return (await this.agentWorkDecisions.repairOwedRecordOfExecution(resourceType, resolution)) !== undefined;\n }\n\n /**\n * The part of a withdrawal that follows reading the row: end the pause WITHDRAWN and record it. Shared by the work\n * being cancelled and the row being deleted, so the two cannot record a withdrawal differently.\n *\n * A store that fails PROPAGATES (#2582 review F1): each caller decides what that means — the cancel logs it and\n * stands, the deletion is refused. `ended: false` means only that the row was not waiting, or that another writer\n * won the compare-and-swap; `recordWritten` says whether the agent-work record now exists.\n */\n private async withdrawHeldDecision(params: {\n owner: ResolvedOwnerVariant;\n row: FlowActorExecution;\n withdrawnByUserId?: string;\n /** Withdrawn through a delegated client: the person was not in the app, so their inbox is told too (#2569 A-7). */\n throughDelegatedClient: boolean;\n requestContext?: ExecutionContext<any>;\n }): Promise<{ readonly ended: false } | { readonly ended: true; readonly recordWritten: boolean }> {\n const { owner, row } = params;\n if (!holdsPendingDecision(row) || !row.pausedApproval || !row.pendingDecisionRef) return { ended: false };\n const toolName = this.pendingToolNameOf(row.pausedApproval);\n const withdrawnAt = new Date();\n const endedOn = await this.endPendingDecision({\n resourceType: owner.resourceType, executionId: row.executionId, rawPausedApproval: row.pausedApproval,\n decisionRef: row.pendingDecisionRef, outcome: HumanDecision_Outcome.WITHDRAWN, decidedByUserId: params.withdrawnByUserId, toolName, scopeContext: owner.scopeContext, row, decidedAt: withdrawnAt,\n ...(params.throughDelegatedClient ? { announceExcept: null } : {}),\n });\n if (!endedOn) return { ended: false };\n this.recordDecisionResolved({ row: endedOn, requester: humanDecisionRequesterOfRow(endedOn), outcome: HumanDecision_Outcome.WITHDRAWN, toolName, requestContext: params.requestContext });\n const recordWritten = await this.recordAgentWorkSettlement({\n resourceType: owner.resourceType, row: endedOn, decisionRef: row.pendingDecisionRef, outcome: HumanDecision_Outcome.WITHDRAWN,\n decidedAt: withdrawnAt, rawPausedApproval: row.pausedApproval, ...(toolName ? { toolName } : {}),\n ...(params.withdrawnByUserId ? { deciderUserId: params.withdrawnByUserId } : {}),\n });\n return { ended: true, recordWritten };\n }\n\n /**\n * The one entry every REST verb reaches (#1594 D6): ANSWER goes to `answerPendingDecision`, every move to\n * `movePendingDecision`. The act string comes from a URL, so an unknown one is refused like any refusal.\n *\n * #2811: a door that knows the person but holds no authority for them (a chat account linked to a member who was\n * suspended or removed) passes `lapsedActor` instead of `actorAuth`. Their act is refused on the decision's own plane\n * and recorded, and nothing is authorized or changed ({@link HumanDecisionActingActor}).\n */\n public async actOnPendingDecision(params: HumanDecisionActingActor & {\n decisionRef: string;\n act: HumanDecision_Act;\n request: HumanDecision_ActRequest;\n ownerEmitterFor?: (owner: ConversationalOwnerScope) => FlowsActorsExecutionEmitter | undefined;\n /**\n * #2664: the chat delivery an ANSWER arrived through (a Slack button, a Teams card), set only by the engine's inbound\n * door and never from a request body: every plane records it on the decision's RESOLVED row.\n */\n answeredThrough?: HumanDecision_AnsweredThrough;\n /**\n * #2664: the one organization the acting door is scoped to (a chat delivery's), set only by the engine's inbound\n * door. Every plane refuses a decision routed in another organization or in none\n * (`OUTSIDE_THE_DELIVERY_ORGANIZATION`), and such a door may only ANSWER.\n */\n confinedToOrganizationId?: string;\n /**\n * #2797: what the acting door can prove to a granting organization's authentication policy: the inbox's HTTP request\n * (its session and its step-up proof), or nothing at all (a chat delivery). Absent is held as no session.\n */\n actingSession?: ActingSession;\n /**\n * #2903 review F2: what the chat card an ANSWER came from carried of the decision, set only by the engine's inbound\n * door from the application's notice handler; every plane seals an answer without an echo over exactly this.\n */\n sentCardContent?: HumanDecision_SentCardContent;\n }): Promise<HumanDecision_ActOutcome> {\n // A door scoped to one organization answers and does nothing else: moving or pausing a decision from a chat is no\n // act any chat door offers, so it is refused rather than reached.\n if (params.confinedToOrganizationId !== undefined && params.act !== HumanDecision_Act.ANSWER) {\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE, reason: HumanDecision_RefusalReason.ACT_NOT_OFFERED };\n }\n const confinement = {\n ...(params.confinedToOrganizationId === undefined ? {} : { confinedToOrganizationId: params.confinedToOrganizationId }),\n ...(params.actingSession ? { actingSession: params.actingSession } : {}),\n };\n // #2811: exactly one of the two is set, and which one decides everything below: a lapsed actor is never authorized.\n const actor: HumanDecisionActingActor = params.lapsedActor !== undefined\n ? { lapsedActor: params.lapsedActor }\n : { actorAuth: params.actorAuth };\n // A decision held by another plane's host (#1612, #2539) is acted on there, with the same predicate and outcomes.\n // Read by the id alone, like every door here, so asking says nothing about who may act.\n for (const host of this.humanDecisionHosts ?? []) {\n if (await host.holdsDecision(params.decisionRef)) {\n return host.act({\n ...actor, decisionRef: params.decisionRef, act: params.act, request: params.request,\n ...(params.answeredThrough ? { answeredThrough: params.answeredThrough } : {}),\n ...(params.sentCardContent !== undefined ? { sentCardContent: params.sentCardContent } : {}),\n ...confinement,\n });\n }\n }\n if (actor.lapsedActor !== undefined) {\n return this.refuseLapsedDecisionActor({\n decisionRef: params.decisionRef, lapsedActor: actor.lapsedActor, act: params.act,\n ...(params.answeredThrough ? { answeredThrough: params.answeredThrough } : {}),\n ...(params.confinedToOrganizationId === undefined ? {} : { confinedToOrganizationId: params.confinedToOrganizationId }),\n });\n }\n const actorAuth = actor.actorAuth;\n switch (params.act) {\n case HumanDecision_Act.ANSWER: {\n const approved = params.request.answer\n ? toolApprovalVerdictOf(params.decisionRef, params.request.answer)\n : params.request.approved;\n // #2720: an answer naming options of its own settles a QUESTION; the answer door decides what it means.\n if (typeof approved !== 'boolean' && !params.request.answer) return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE };\n return this.answerPendingDecision({\n decisionRef: params.decisionRef,\n actorAuth,\n ...(typeof approved === 'boolean' ? { approved } : {}),\n ...(params.request.answer ? { answer: params.request.answer } : {}),\n reason: params.request.reason,\n ...(params.request.reasonCode !== undefined ? { reasonCode: params.request.reasonCode } : {}),\n modifiedToolArgs: params.request.modifiedToolArgs,\n // #2903: the presentation the door echoed (the REST route requires one); the plane compares it with the row.\n ...(params.request.presentationId !== undefined ? { presentationId: params.request.presentationId } : {}),\n ...(params.sentCardContent !== undefined ? { sentCardContent: params.sentCardContent } : {}),\n ownerEmitterFor: params.ownerEmitterFor,\n detachResume: true,\n ...(params.answeredThrough ? { answeredThrough: params.answeredThrough } : {}),\n ...confinement,\n });\n }\n case HumanDecision_Act.REASSIGN:\n case HumanDecision_Act.ESCALATE:\n case HumanDecision_Act.CLAIM:\n case HumanDecision_Act.UNCLAIM:\n return this.movePendingDecision({\n decisionRef: params.decisionRef, actorAuth, act: params.act,\n targetUserId: params.request.targetUserId, reasonGiven: !!params.request.reason,\n ...(params.actingSession ? { actingSession: params.actingSession } : {}),\n });\n case HumanDecision_Act.PAUSE_CLOCK:\n case HumanDecision_Act.RESUME_CLOCK:\n return this.setPendingDecisionClock({\n decisionRef: params.decisionRef, actorAuth, act: params.act, pauseStateRef: params.request.pauseStateRef,\n ...(params.actingSession ? { actingSession: params.actingSession } : {}),\n });\n default:\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE };\n }\n }\n\n /**\n * #2811: the act of a person this plane's door knows but holds no authority for (a chat account still linked to a member\n * who was suspended or removed), on a CONVERSATIONAL decision. Refused and recorded `HUMAN_DECISION_ANSWER_REFUSED`, with\n * the reason `lapsedActorRefusalReason` gives, the person, the act and the delivery it came through; the decision is not\n * touched and its predicate is never asked. Not disclosed: the person learns nothing about a decision, as any refusal\n * by the route. A decision that is not pending here answers NOT_ACTIONABLE with no row, as it does for anyone; so does\n * a waiting row `answerPendingDecision` would give up on before deciding (no route, no requester, an unreadable paused\n * state), so a lapsed person is never recorded against a row nobody can be refused on.\n *\n * assurance-control: WILDO.ACCESS.AUTHORIZATION_DECISION_AUDIT — an attempt on a conversational decision by a known person whose authority lapsed is recorded on the decision's plane, and changes nothing\n */\n private async refuseLapsedDecisionActor(params: {\n decisionRef: string;\n lapsedActor: HumanDecisionLapsedActor;\n act: HumanDecision_Act;\n answeredThrough?: HumanDecision_AnsweredThrough;\n confinedToOrganizationId?: string;\n }): Promise<HumanDecision_ActOutcome> {\n const { decisionRef, act } = params;\n const found = await this.findPendingDecision(decisionRef);\n const route = found ? humanDecisionRouteOfRow(found.row) : undefined;\n if (!found || found.row.status !== FlowsActors_Status.AWAITING_APPROVAL || !found.row.pausedApproval || !route || !humanDecisionRequesterOfRow(found.row)) {\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE };\n }\n try {\n parseFlowActorPausedApproval(found.row.pausedApproval as string);\n } catch {\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE };\n }\n const { row } = found;\n const reason = lapsedActorRefusalReason({ decisionOrganizationId: route.organizationId, confinedToOrganizationId: params.confinedToOrganizationId });\n this.logger.info('[ConversationalExecution] An act by a person whose authority lapsed was refused', { decisionRef, executionId: row.executionId, reason });\n if (this.auditLogs) {\n const toolName = this.pendingToolNameOf(row.pausedApproval as string);\n void this.auditLogs.logHumanDecisionAnswerRefused({\n decisionRef, executionId: row.executionId, plane: HumanDecision_Plane.CONVERSATIONAL, systemRef: row.systemRef,\n ...(toolName ? { toolName } : {}),\n routeKind: route.kind,\n ...(route.eligibleRole ? { routeEligibleRole: route.eligibleRole } : {}),\n ...(route.requiredQualificationKinds?.length ? { routeRequiredQualificationKinds: [...route.requiredQualificationKinds] } : {}),\n ...(route.organizationId ? { organizationId: route.organizationId } : {}),\n act, reason, attemptedByUserId: params.lapsedActor.userId,\n ...(params.answeredThrough ? answeredThroughRefusalFields(params.answeredThrough) : {}),\n }).catch(() => undefined);\n }\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE };\n }\n\n /**\n * Move a pending decision to someone else, or between a role and one of its holders (#1594 D7).\n *\n * - The mover is authorized by the one predicate, for this act, with role facts read now (I1).\n * - The person it moves TO must be able to ANSWER it under the new route (I8): a move can never hand a\n * decision to someone who could not settle it. There is no default escalation to an administrator —\n * an escalation goes to the gate's declared `escalateTo`, or to the person the escalator names.\n * - The move is a compare-and-swap on status, decision id AND route version, and bumps the version (I5):\n * an answer read under the old route loses, and so does a concurrent move.\n * - Only the route changes. The deadline does not, the requester does not, and nothing is resumed.\n */\n public async movePendingDecision(params: {\n decisionRef: string;\n actorAuth: SocketAuthResult;\n act: HumanDecision_Act.REASSIGN | HumanDecision_Act.ESCALATE | HumanDecision_Act.CLAIM | HumanDecision_Act.UNCLAIM;\n targetUserId?: string;\n reasonGiven?: boolean;\n /** #2797: what the moving door can prove to a granting organization's authentication policy; absent is no session. */\n actingSession?: ActingSession;\n }): Promise<HumanDecision_ActOutcome> {\n const { decisionRef, act } = params;\n const found = await this.findPendingDecision(decisionRef);\n const route = found ? humanDecisionRouteOfRow(found.row) : undefined;\n const requester = found ? humanDecisionRequesterOfRow(found.row) : undefined;\n if (!found || found.row.status !== FlowsActors_Status.AWAITING_APPROVAL || !found.row.pausedApproval || !route || !requester) {\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE };\n }\n const { resourceType, row } = found;\n const owner = this.ownerOfRow(resourceType, row);\n const moverUserId = params.actorAuth.initiatorIds?.userId;\n const toolName = this.pendingToolNameOf(row.pausedApproval as string);\n const base = {\n decisionRef, executionId: row.executionId, plane: HumanDecision_Plane.CONVERSATIONAL, systemRef: row.systemRef,\n ...(toolName ? { toolName } : {}),\n routeKind: route.kind,\n ...(route.eligibleRole ? { routeEligibleRole: route.eligibleRole } : {}),\n ...(route.requiredQualificationKinds?.length ? { routeRequiredQualificationKinds: [...route.requiredQualificationKinds] } : {}),\n ...(route.organizationId ? { organizationId: route.organizationId } : {}),\n };\n const refuse = (reason: HumanDecision_RefusalReason, outcome = HumanDecision_ActOutcomeKind.NOT_ACTIONABLE): HumanDecision_ActOutcome => {\n if (this.auditLogs) {\n void this.auditLogs.logHumanDecisionAnswerRefused(\n { ...base, act, reason, ...(moverUserId ? { attemptedByUserId: moverUserId } : {}) },\n this.auditContextFor(params.actorAuth, owner),\n ).catch(() => undefined);\n }\n // A refused target is reported as such — the mover was admitted, so the decision's existence is theirs to know.\n return outcome === HumanDecision_ActOutcomeKind.TARGET_REFUSED ? { kind: outcome, reason } : { kind: outcome };\n };\n\n // ── The mover ────────────────────────────────────────────────────────────\n const subject = this.decisionSubjectOfRow(row);\n const verdict = await this.authorizeDecisionAct({ userId: moverUserId, executionType: params.actorAuth.executionType, route, requester, act, subject });\n if (verdict.kind === HumanDecision_VerdictKind.REFUSED) return refuse(verdict.reason);\n // #2797: a move is an act in the decision's organization too, held to its granting organization's policy.\n const held = await this.holdToGrantingOrganization({ decisionRef, userId: moverUserId, organizationId: route.organizationId, session: params.actingSession });\n if (held.kind === HumanDecisionGrantorHoldKind.REFUSED) {\n refuse(held.reason);\n if (held.refusal) throw held.refusal;\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE, reason: held.reason };\n }\n\n // ── Where it goes ────────────────────────────────────────────────────────\n let next: HumanDecision_Route;\n let toDeclaredTarget = false;\n switch (act) {\n case HumanDecision_Act.CLAIM:\n next = { ...route, kind: HumanDecision_RouteKind.ASSIGNEE, assigneeUserId: moverUserId, claimedAt: new Date().toISOString() };\n break;\n case HumanDecision_Act.UNCLAIM: {\n const { assigneeUserId: _dropped, claimedAt: _unclaimed, ...rest } = route;\n void _dropped; void _unclaimed;\n next = { ...rest, kind: HumanDecision_RouteKind.ROLE };\n break;\n }\n case HumanDecision_Act.REASSIGN:\n case HumanDecision_Act.ESCALATE: {\n let targetUserId = params.targetUserId;\n if (!targetUserId && act === HumanDecision_Act.ESCALATE) {\n targetUserId = await this.declaredEscalationTarget(row, params.actorAuth);\n toDeclaredTarget = !!targetUserId;\n }\n if (!targetUserId) return refuse(HumanDecision_RefusalReason.NO_TARGET, HumanDecision_ActOutcomeKind.TARGET_REFUSED);\n const { claimedAt: _claim, ...rest } = route;\n void _claim;\n next = { ...rest, kind: HumanDecision_RouteKind.ASSIGNEE, assigneeUserId: targetUserId };\n break;\n }\n }\n\n // ── I8: whoever holds it next must be able to answer it ─────────────────\n if (next.kind === HumanDecision_RouteKind.ASSIGNEE) {\n const target = await this.authorizeDecisionAct({ userId: next.assigneeUserId, route: next, requester, act: HumanDecision_Act.ANSWER, subject });\n if (target.kind === HumanDecision_VerdictKind.REFUSED) return refuse(target.reason, HumanDecision_ActOutcomeKind.TARGET_REFUSED);\n }\n\n // ── The move, on the version that was read ──────────────────────────────\n const version = row.pendingDecisionRouteVersion ?? 0;\n const moved = await this.systemAccess.updateAsSystem(resourceType, {\n executionId: row.executionId,\n ...owner.ownerFields,\n machineCredentialId: row.machineCredentialId,\n resourceServerInstanceRef: row.resourceServerInstanceRef,\n status: FlowsActors_Status.AWAITING_APPROVAL,\n pendingDecisionRef: decisionRef,\n pendingDecisionRouteVersion: version,\n // #1628: the next-due instant below is computed for the pause state read here; a pause landing in\n // between makes this move match nothing rather than re-arm a paused clock.\n pendingDecisionClockPausedAt: row.pendingDecisionClockPausedAt ?? null,\n }, {\n pendingDecisionRouteKind: next.kind,\n pendingDecisionAssigneeUserId: next.assigneeUserId ?? null,\n pendingDecisionClaimedAt: next.claimedAt ? new Date(next.claimedAt) : null,\n pendingDecisionRouteVersion: version + 1,\n // #1628: a claim meets the CLAIM clock and an unclaim re-opens it, so the next stage due moves with the\n // route. A paused decision keeps no next-due instant until it resumes.\n ...(row.pendingDecisionClockPausedAt ? {} : { pendingDecisionNextDueAt: nextDueAtOfRow(row, { claimed: !!next.claimedAt }) }),\n }, { scopeContext: owner.scopeContext }).catch((error: unknown) => {\n this.logger.error('[ConversationalExecution] A decision move could not be written', {\n executionId: row.executionId, decisionRef, act, ...projectCaughtErrorLogFields(error),\n });\n return null;\n });\n if (moved === null || moved === undefined) return { kind: HumanDecision_ActOutcomeKind.SUPERSEDED };\n\n // ── Recorded, and the new holder told ───────────────────────────────────\n if (this.auditLogs && moverUserId) {\n const requestContext = this.auditContextFor(params.actorAuth, owner);\n const onRecordFailure = (error: unknown) => this.logger.warn('[ConversationalExecution] Could not record a decision move; the move stands', {\n decisionRef, act, ...projectCaughtErrorLogFields(error),\n });\n if (act === HumanDecision_Act.CLAIM || act === HumanDecision_Act.UNCLAIM) {\n void this.auditLogs.logHumanDecisionClaimed({\n ...base, claimed: act === HumanDecision_Act.CLAIM, assigneeUserId: moverUserId, routeVersion: version + 1,\n }, requestContext).catch(onRecordFailure);\n } else {\n const move = {\n ...base,\n ...(route.assigneeUserId ? { fromAssigneeUserId: route.assigneeUserId } : {}),\n toAssigneeUserId: next.assigneeUserId as string,\n routeVersion: version + 1,\n reasonGiven: !!params.reasonGiven,\n };\n void (act === HumanDecision_Act.ESCALATE\n ? this.auditLogs.logHumanDecisionEscalated({ ...move, toDeclaredTarget }, moverUserId, requestContext)\n : this.auditLogs.logHumanDecisionReassigned({ ...move, trigger: HumanDecision_RouteChangeTrigger.PERSON }, moverUserId, requestContext)\n ).catch(onRecordFailure);\n }\n }\n // The new holder hears of it — the assignee, or the role's holders after an UNCLAIM. A claim is announced\n // to nobody: the one person it now names is the one who claimed it.\n this.announceDecisionRouted(next, decisionRef, moverUserId);\n // #2569: and whoever held it before hears it left them — a claimer's colleagues, the person it was moved away from.\n this.announceDecisionWithdrawn({ route, requester, decisionRef, routeVersion: version + 1, ...(moverUserId ? { except: moverUserId } : {}) });\n return { kind: HumanDecision_ActOutcomeKind.APPLIED };\n }\n\n /**\n * Could ANYONE answer a decision on this ROLE route (#1611 (d))? The same listing and the same predicate as\n * {@link listReassignCandidates}, asked of the route itself and stopped at the first person it admits.\n *\n * Two directions, deliberately different:\n * - an organization larger than {@link REASSIGN_CANDIDATE_SCAN_LIMIT} whose first page holds nobody is NOT\n * proven empty, so it answers true (logged): refusing there would deny a real reviewer's work, and a\n * pause nobody takes still ends through #1628's lapse;\n * - a store that cannot be read answers false: the gated call is then denied and nothing is written, which\n * is the fail-closed direction for a turn with no person behind it.\n */\n private async roleRouteHasAnAnswerer(route: HumanDecision_Route, requester: HumanDecision_Requester, subject: HumanDecisionSubject): Promise<boolean> {\n try {\n const listed = await this.systemAccess.listAsSystem<OrganizationMember>(\n CoreResourceType.ORGANIZATION_MEMBERS,\n { organizationId: route.organizationId, status: OrganizationMemberStatus.ACTIVE },\n { page: 1, limit: REASSIGN_CANDIDATE_SCAN_LIMIT },\n { suppressSystemAudit: true },\n );\n const members = Array.isArray(listed) ? listed : (listed?.data ?? []);\n for (const member of members) {\n if (!member.userId || member.userId === requester.ref) continue;\n const verdict = await this.authorizeDecisionAct({ userId: member.userId, route, requester, act: HumanDecision_Act.ANSWER, subject });\n if (verdict.kind === HumanDecision_VerdictKind.ALLOWED) return true;\n }\n if (members.length >= REASSIGN_CANDIDATE_SCAN_LIMIT) {\n this.logger.warn('[ConversationalExecution] A ROLE route\\'s answerers were scanned only up to the cap; pausing without proof', {\n organizationId: route.organizationId, eligibleRole: route.eligibleRole, limit: REASSIGN_CANDIDATE_SCAN_LIMIT,\n });\n return true;\n }\n return false;\n } catch (error) {\n this.logger.warn('[ConversationalExecution] Could not establish who may answer a machine\\'s decision; denying the call', {\n organizationId: route.organizationId, eligibleRole: route.eligibleRole, ...projectCaughtErrorLogFields(error),\n });\n return false;\n }\n }\n\n /**\n * The people a decision may be reassigned or escalated to (#1594 D7, I8): the ACTIVE members of the\n * decision's organization who could answer it under an ASSIGNEE route, checked with the one predicate.\n *\n * Only for a caller who may REASSIGN it; anyone else gets NOT_ACTIONABLE, the answer an unknown decision\n * gets. The requester and the current holder are never offered — the first could not answer it (SoD) and\n * the second already holds it. Bounded: an organization larger than {@link REASSIGN_CANDIDATE_SCAN_LIMIT}\n * members is scanned only that far, and the log says so.\n */\n public async listReassignCandidates(params: {\n decisionRef: string;\n actorAuth: SocketAuthResult;\n }): Promise<HumanDecision_ReassignCandidatesResponse | undefined> {\n const found = await this.findPendingDecision(params.decisionRef);\n const route = found ? humanDecisionRouteOfRow(found.row) : undefined;\n const requester = found ? humanDecisionRequesterOfRow(found.row) : undefined;\n if (!found || found.row.status !== FlowsActors_Status.AWAITING_APPROVAL || !route || !requester || !route.organizationId) return undefined;\n const subject = this.decisionSubjectOfRow(found.row);\n const mover = await this.authorizeDecisionAct({\n userId: params.actorAuth.initiatorIds?.userId, executionType: params.actorAuth.executionType, route, requester, act: HumanDecision_Act.REASSIGN, subject,\n });\n if (mover.kind === HumanDecision_VerdictKind.REFUSED) return undefined;\n\n const listed = await this.systemAccess.listAsSystem<OrganizationMember>(\n CoreResourceType.ORGANIZATION_MEMBERS,\n { organizationId: route.organizationId, status: OrganizationMemberStatus.ACTIVE },\n { page: 1, limit: REASSIGN_CANDIDATE_SCAN_LIMIT },\n { suppressSystemAudit: true },\n );\n const members = Array.isArray(listed) ? listed : (listed?.data ?? []);\n if (members.length >= REASSIGN_CANDIDATE_SCAN_LIMIT) {\n this.logger.warn('[ConversationalExecution] Reassignment candidates were scanned only up to the cap', {\n decisionRef: params.decisionRef, limit: REASSIGN_CANDIDATE_SCAN_LIMIT,\n });\n }\n const moverUserId = params.actorAuth.initiatorIds?.userId;\n // The route each candidate is vetted on: the decision as it would stand once assigned to them. A claim does\n // not travel with a reassignment, so it is dropped rather than carried onto someone who never took it.\n const { claimedAt: _droppedClaim, ...unclaimedRoute } = route;\n const candidates: HumanDecision_ReassignCandidate[] = [];\n for (const member of members) {\n // Not the requester (separation of duties), not whoever holds it now, and not the mover — moving a\n // decision to yourself is a CLAIM, which is its own act with its own record.\n if (!member.userId || member.userId === requester.ref || member.userId === route.assigneeUserId || member.userId === moverUserId) continue;\n const verdict = await this.authorizeDecisionAct({\n userId: member.userId, route: { ...unclaimedRoute, kind: HumanDecision_RouteKind.ASSIGNEE, assigneeUserId: member.userId }, requester, act: HumanDecision_Act.ANSWER, subject,\n });\n if (verdict.kind === HumanDecision_VerdictKind.ALLOWED) {\n candidates.push({ userId: member.userId, ...(member.userEmail ? { email: member.userEmail } : {}) });\n }\n }\n return { candidates };\n }\n\n /**\n * The escalation target the gate DECLARES for this call, or `undefined` when it declares none. Asked under\n * the escalator's authority: it only names a person, who is then vetted like any other target (I8).\n */\n private async declaredEscalationTarget(row: FlowActorExecution, escalatorAuth: SocketAuthResult): Promise<string | undefined> {\n try {\n const paused = parseFlowActorPausedApproval(row.pausedApproval as string);\n const resolved = this.resolveApprovalGatedFunctionTool(row.systemRef, paused.pendingToolName);\n if (resolved.kind !== GatedFunctionToolResolutionKind.FOUND) return undefined;\n const gate = resolveFunctionToolApprovalGate(resolved.functionTool);\n if (!gate?.escalateTo) return undefined;\n return await gate.escalateTo(paused.pendingToolArgs ?? {}, this.buildToolExecutionContext(escalatorAuth, row.executionId, row.systemRef));\n } catch (error) {\n this.logger.warn('[ConversationalExecution] The gate\\'s escalation target could not be resolved', {\n executionId: row.executionId, ...projectCaughtErrorLogFields(error),\n });\n return undefined;\n }\n }\n\n\n // ════════════════════════════════════════════════════════════════════════════\n // Decision deadlines (#1628)\n //\n // Two service-target clocks (CLAIM, DECISION) beside the lapse. A stage firing changes who is ASKED and\n // who is TOLD, never what is decided: nothing below writes an outcome, and only the lapse sweep ends a\n // decision (I1). Each stage fires once across every host, through the compare-and-swap on its own\n // marker column (I3). A pause stops both clocks and never the lapse (I4).\n // ════════════════════════════════════════════════════════════════════════════\n\n /** The approval gate a paused row was raised through, or `undefined` when its tool no longer resolves. */\n private gateOfRow(row: FlowActorExecution, toolName: string | undefined): FunctionTool_HumanApprovalGate | undefined {\n if (!toolName) return undefined;\n try {\n const resolved = this.resolveApprovalGatedFunctionTool(row.systemRef, toolName);\n return resolved.kind === GatedFunctionToolResolutionKind.FOUND ? resolveFunctionToolApprovalGate(resolved.functionTool) : undefined;\n } catch {\n return undefined;\n }\n }\n\n /**\n * Stop or restart a pending decision's CLAIM and DECISION clocks — PAUSE_CLOCK and RESUME_CLOCK.\n *\n * - Admitted by the ONE predicate exactly as an answer is: whoever may answer may pause while they wait on\n * something outside their control. A pause names one of the gate's declared pause states.\n * - A compare-and-swap on the pause state that was read, so a pause and a resume never both land twice.\n * - A pause clears the next-due instant, so the sweep selects nothing while it holds. A resume adds the\n * paused time to each still-running target, counted on that target's own basis (a CALENDAR target counts\n * only the working time the pause covered), and re-arms the next-due instant.\n * - The lapse is never touched (I4): the lapse sweep selects on `pendingDecisionExpiresAt`, which neither\n * write changes, so a paused decision still ends LAPSED when its window closes.\n */\n public async setPendingDecisionClock(params: {\n decisionRef: string;\n actorAuth: SocketAuthResult;\n act: HumanDecision_Act.PAUSE_CLOCK | HumanDecision_Act.RESUME_CLOCK;\n pauseStateRef?: string;\n /** #2797: what the acting door can prove to a granting organization's authentication policy; absent is no session. */\n actingSession?: ActingSession;\n }): Promise<HumanDecision_ActOutcome> {\n const { decisionRef, act } = params;\n const found = await this.findPendingDecision(decisionRef);\n const route = found ? humanDecisionRouteOfRow(found.row) : undefined;\n const requester = found ? humanDecisionRequesterOfRow(found.row) : undefined;\n if (!found || found.row.status !== FlowsActors_Status.AWAITING_APPROVAL || !found.row.pausedApproval || !route || !requester) {\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE };\n }\n const { resourceType, row } = found;\n const owner = this.ownerOfRow(resourceType, row);\n const actorUserId = params.actorAuth.initiatorIds?.userId;\n const toolName = this.pendingToolNameOf(row.pausedApproval as string);\n const base = this.decisionEventBase(row, route, toolName);\n const recordRefusal = (reason: HumanDecision_RefusalReason): void => {\n if (!this.auditLogs) return;\n void this.auditLogs.logHumanDecisionAnswerRefused(\n { ...base, act, reason, ...(actorUserId ? { attemptedByUserId: actorUserId } : {}) },\n this.auditContextFor(params.actorAuth, owner),\n ).catch(() => undefined);\n };\n\n const verdict = await this.authorizeDecisionAct({ userId: actorUserId, executionType: params.actorAuth.executionType, route, requester, act, subject: this.decisionSubjectOfRow(row) });\n if (verdict.kind === HumanDecision_VerdictKind.REFUSED) {\n recordRefusal(verdict.reason);\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE };\n }\n // From here the actor was admitted, so the decision's existence is theirs to know and a refusal names why.\n const refuseAdmitted = (reason: HumanDecision_RefusalReason): HumanDecision_ActOutcome => {\n recordRefusal(reason);\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE, reason };\n };\n // #2797: pausing a decision's clock is an act in its organization, held to its granting organization's policy.\n const held = await this.holdToGrantingOrganization({ decisionRef, userId: actorUserId, organizationId: route.organizationId, session: params.actingSession });\n if (held.kind === HumanDecisionGrantorHoldKind.REFUSED) {\n const refused = refuseAdmitted(held.reason);\n if (held.refusal) throw held.refusal;\n return refused;\n }\n const now = new Date();\n const filter = {\n executionId: row.executionId,\n ...owner.ownerFields,\n machineCredentialId: row.machineCredentialId,\n resourceServerInstanceRef: row.resourceServerInstanceRef,\n status: FlowsActors_Status.AWAITING_APPROVAL,\n pendingDecisionRef: decisionRef,\n pendingDecisionClockPausedAt: row.pendingDecisionClockPausedAt ?? null,\n // The next-due instant a resume writes depends on whether the decision is claimed; a claim landing\n // meanwhile makes this match nothing rather than leave that instant stale (#1628 review L1).\n pendingDecisionRouteVersion: row.pendingDecisionRouteVersion ?? 0,\n };\n const write = (update: Partial<FlowActorExecution>) => this.systemAccess.updateAsSystem(resourceType, filter, update, { scopeContext: owner.scopeContext })\n .catch((error: unknown) => {\n this.logger.error('[ConversationalExecution] A decision clock change could not be written', {\n executionId: row.executionId, decisionRef, act, ...projectCaughtErrorLogFields(error),\n });\n return null;\n });\n\n if (act === HumanDecision_Act.PAUSE_CLOCK) {\n if (row.pendingDecisionClockPausedAt) return refuseAdmitted(HumanDecision_RefusalReason.CLOCK_ALREADY_PAUSED);\n const pauseStates = this.deadlinePolicyOf(this.gateOfRow(row, toolName)).pauseStates;\n if (!params.pauseStateRef || !pauseStates.includes(params.pauseStateRef)) return refuseAdmitted(HumanDecision_RefusalReason.PAUSE_STATE_NOT_DECLARED);\n const paused = await write({\n pendingDecisionClockPausedAt: now,\n pendingDecisionClockPauseStateRef: params.pauseStateRef,\n pendingDecisionNextDueAt: null,\n });\n if (paused === null || paused === undefined) return { kind: HumanDecision_ActOutcomeKind.SUPERSEDED };\n if (this.auditLogs && actorUserId) {\n void this.auditLogs.logHumanDecisionClockPaused(\n { ...base, pauseStateRef: params.pauseStateRef, pausedByUserId: actorUserId },\n this.auditContextFor(params.actorAuth, owner),\n ).catch(() => undefined);\n }\n return { kind: HumanDecision_ActOutcomeKind.APPLIED };\n }\n\n if (!row.pendingDecisionClockPausedAt) return refuseAdmitted(HumanDecision_RefusalReason.CLOCK_NOT_PAUSED);\n const pausedAt = new Date(row.pendingDecisionClockPausedAt);\n const targets = serviceTargetsOfRow(row);\n let resumed = targets;\n try {\n resumed = resumeReviewServiceTargets(targets, pausedAt, now, this.reviewCalendar());\n } catch (error) {\n // Only a CALENDAR target without a readable calendar lands here; count it as elapsed time, loudly.\n this.logger.error('[ConversationalExecution] A paused CALENDAR clock could not be resumed on its calendar; counting elapsed time', {\n decisionRef, ...projectCaughtErrorLogFields(error),\n });\n resumed = resumeReviewServiceTargets({ ...targets, claimBasis: ReviewClockBasis.ELAPSED, decisionBasis: ReviewClockBasis.ELAPSED }, pausedAt, now, undefined);\n }\n const columns = serviceTargetColumns(resumed);\n const pausedMs = Math.max(0, now.getTime() - pausedAt.getTime());\n const pauseStateRef = row.pendingDecisionClockPauseStateRef ?? '';\n const restarted = await write({\n ...columns,\n pendingDecisionClockPausedAt: null,\n pendingDecisionClockPauseStateRef: null,\n pendingDecisionClockPausedMs: (row.pendingDecisionClockPausedMs ?? 0) + pausedMs,\n pendingDecisionNextDueAt: nextDueAtOfRow({ ...row, ...columns } as FlowActorExecution),\n });\n if (restarted === null || restarted === undefined) return { kind: HumanDecision_ActOutcomeKind.SUPERSEDED };\n if (this.auditLogs && actorUserId) {\n void this.auditLogs.logHumanDecisionClockResumed(\n { ...base, pauseStateRef, resumedByUserId: actorUserId, pausedMs },\n this.auditContextFor(params.actorAuth, owner),\n ).catch(() => undefined);\n }\n return { kind: HumanDecision_ActOutcomeKind.APPLIED };\n }\n\n /**\n * What an inbox card shows of a decision's clocks (#1628): while paused, the pause and no deadline; else\n * the CLAIM deadline until it is claimed or missed, then the DECISION deadline until it is missed.\n */\n private deadlineCardFields(row: FlowActorExecution): Pick<HumanDecision_PendingCard, 'nextDeadline' | 'clockPause'> {\n if (row.pendingDecisionClockPausedAt) {\n return {\n clockPause: {\n pausedAt: new Date(row.pendingDecisionClockPausedAt).toISOString(),\n pauseStateRef: row.pendingDecisionClockPauseStateRef ?? '',\n },\n };\n }\n // A deadline at or after the lapse never fires, so the card never shows it: the expiry is the real limit.\n const lapseMs = row.pendingDecisionExpiresAt ? new Date(row.pendingDecisionExpiresAt).getTime() : Number.POSITIVE_INFINITY;\n const beforeLapse = (instant: Date | null | undefined): boolean => !!instant && new Date(instant).getTime() < lapseMs;\n const claimOpen = !row.pendingDecisionClaimedAt && !row.pendingDecisionClaimMissedFiredAt && beforeLapse(row.pendingDecisionClaimDeadlineAt);\n if (claimOpen) return { nextDeadline: { kind: ReviewDeadlineKind.CLAIM, dueAt: new Date(row.pendingDecisionClaimDeadlineAt as Date).toISOString() } };\n if (!row.pendingDecisionDecisionMissedFiredAt && beforeLapse(row.pendingDecisionDecisionDeadlineAt)) {\n return { nextDeadline: { kind: ReviewDeadlineKind.DECISION, dueAt: new Date(row.pendingDecisionDecisionDeadlineAt).toISOString() } };\n }\n return {};\n }\n\n /** The fields every decision audit row carries, read off the row. */\n private decisionEventBase(row: FlowActorExecution, route: HumanDecision_Route, toolName: string | undefined) {\n return {\n decisionRef: row.pendingDecisionRef as string, executionId: row.executionId, plane: HumanDecision_Plane.CONVERSATIONAL, systemRef: row.systemRef,\n ...(toolName ? { toolName } : {}),\n routeKind: route.kind,\n ...(route.eligibleRole ? { routeEligibleRole: route.eligibleRole } : {}),\n ...(route.requiredQualificationKinds?.length ? { routeRequiredQualificationKinds: [...route.requiredQualificationKinds] } : {}),\n ...(route.organizationId ? { organizationId: route.organizationId } : {}),\n };\n }\n\n /**\n * Fire every deadline stage that is due (#1628).\n *\n * SELECTS on the indexed `pendingDecisionNextDueAt` (a paused decision holds none, so it is never\n * selected), READS each candidate because the columns are backend-only, and fires its due stages in order\n * through {@link fireDecisionDeadlineStage}. Safe to run on every host at once: a stage's marker is set\n * by a compare-and-swap that requires it null, so one writer wins and only it acts.\n *\n * A row selected with nothing actually due — its next-due instant went stale behind a concurrent write —\n * has the instant recomputed, so it is not selected again for nothing.\n *\n * A listing is one page; a backlog larger than a page drains over the following runs.\n */\n public async sweepDueDecisionDeadlines(now: Date = new Date()): Promise<DecisionDeadlineSweepResult> {\n const result: DecisionDeadlineSweepResult = { scanned: 0, fired: 0, raced: 0, unreadable: 0, repaired: 0 };\n for (const resourceType of FLOW_ACTOR_EXECUTION_OWNER_VARIANTS) {\n let candidates: FlowActorExecution[] = [];\n try {\n const listed = await this.systemAccess.listAsSystem<FlowActorExecution>(\n resourceType,\n { status: FlowsActors_Status.AWAITING_APPROVAL, pendingDecisionNextDueAt: { $lte: now }, pendingDecisionClockPausedAt: null },\n undefined,\n { suppressSystemAudit: true },\n );\n candidates = Array.isArray(listed) ? listed : (listed?.data ?? []);\n } catch (error) {\n this.logger.error('[ConversationalExecution] Decision-deadline sweep could not list due decisions for a scope', {\n resourceType, ...projectCaughtErrorLogFields(error),\n });\n continue;\n }\n\n for (const candidate of candidates) {\n result.scanned += 1;\n let row = await this.systemAccess.readAsSystem<FlowActorExecution>(resourceType, { executionId: candidate.executionId }, { suppressSystemAudit: true })\n .catch(() => null);\n if (!row) { result.unreadable += 1; continue; }\n if (row.status !== FlowsActors_Status.AWAITING_APPROVAL || !row.pendingDecisionRef || !row.pausedApproval || row.pendingDecisionClockPausedAt) {\n result.raced += 1;\n continue;\n }\n // A decision whose lapse has passed is the lapse sweep's to end; no reminder describes it any more.\n const lapsedAlready = !!row.pendingDecisionExpiresAt && new Date(row.pendingDecisionExpiresAt).getTime() <= now.getTime();\n // A row no stage can ever fire on (its route or requester unreadable) is not re-selected every minute.\n const unfireable = !humanDecisionRouteOfRow(row) || !humanDecisionRequesterOfRow(row);\n const stages = lapsedAlready || unfireable ? [] : dueReviewDeadlineStages(deadlineStageScheduleOfRow(row), now);\n if (stages.length === 0) {\n const repaired = await this.systemAccess.updateAsSystem(resourceType, {\n executionId: row.executionId, status: FlowsActors_Status.AWAITING_APPROVAL, pendingDecisionRef: row.pendingDecisionRef,\n pendingDecisionClockPausedAt: null,\n }, { pendingDecisionNextDueAt: lapsedAlready || unfireable ? null : nextDueAtOfRow(row) }).catch(() => null);\n if (repaired) result.repaired += 1;\n continue;\n }\n for (const stage of stages) {\n const fired = await this.fireDecisionDeadlineStage(resourceType, row, stage, now).catch((error: unknown) => {\n this.logger.error('[ConversationalExecution] A decision deadline stage could not be fired', {\n resourceType, executionId: row?.executionId, stage, ...projectCaughtErrorLogFields(error),\n });\n return false;\n });\n if (!fired) { result.raced += 1; break; }\n result.fired += 1;\n // The next stage is judged on the row as the winning write left it.\n row = await this.systemAccess.readAsSystem<FlowActorExecution>(resourceType, { executionId: candidate.executionId }, { suppressSystemAudit: true })\n .catch(() => null);\n if (!row || row.status !== FlowsActors_Status.AWAITING_APPROVAL) break;\n }\n }\n }\n // Logged unconditionally, including the zero case: a sweep that silently finds nothing is\n // indistinguishable from a sweep that silently stopped running.\n this.logger.info('[ConversationalExecution] Decision-deadline sweep complete', { ...result });\n return result;\n }\n\n /**\n * Fire ONE deadline stage of one decision. Returns `false` when another writer got there first — the\n * stage already fired, the decision ended, was paused, or (for a reassignment) was moved meanwhile.\n *\n * 1. **What the stage does** comes from the gate's rules as they stand now (the defaults when it\n * declares none, or when its tool no longer resolves). A rule is a function of the application's code,\n * so it cannot be stored; WHEN each stage is due was stored at pause and is never re-read from the gate.\n * 2. **A REASSIGN rule** (the first declared at this stage wins) resolves its target under the REQUESTER's\n * authority as it stands now, and the target must be able to ANSWER the decision (I2, #1594 I8). A\n * target that resolves to nobody, or to someone who may not answer, moves nothing: the stage notifies\n * instead, and the refusal is recorded (`targetResolved: false`).\n * 3. **One compare-and-swap** sets the marker (which must be null) and, for a move, the route and its\n * version (which must be the version read). Both land or neither does, so a reassignment is never lost\n * after its stage is marked, and never applied twice.\n * 4. **Only then** are the audit rows written and the people told. A crash between the write and the sends\n * loses at most those sends — accepted: a notice grants nothing and the decision stays in the inbox.\n *\n * Never writes an outcome (I1).\n */\n private async fireDecisionDeadlineStage(resourceType: CoreResourceType, row: FlowActorExecution, stage: ReviewDeadlineStage, now: Date): Promise<boolean> {\n const route = humanDecisionRouteOfRow(row);\n const requester = humanDecisionRequesterOfRow(row);\n const decisionRef = row.pendingDecisionRef;\n if (!route || !requester || !decisionRef || !row.pausedApproval) return false;\n const owner = this.ownerOfRow(resourceType, row);\n const toolName = this.pendingToolNameOf(row.pausedApproval);\n const gate = this.gateOfRow(row, toolName);\n const rulesAtStage = this.deadlinePolicyOf(gate).rules.filter((rule) => rule.stage === stage);\n const reassignRule = (gate?.deadlines?.rules ?? []).find((rule) => rule.stage === stage && rule.action === ReviewEscalationActionKind.REASSIGN);\n const notifyDeclared = rulesAtStage.some((rule) => rule.action === ReviewEscalationActionKind.NOTIFY);\n\n // ── The reassignment, decided before anything is written ───────────────\n let movedTo: HumanDecision_Route | undefined;\n let targetResolved: boolean | undefined;\n let targetRefusalReason: HumanDecision_RefusalReason | undefined;\n if (reassignRule && isReviewerRoute(route)) {\n const targetUserId = await this.resolveEscalationRuleTarget(resourceType, row, route, requester, reassignRule.target, toolName);\n if (!targetUserId) {\n targetResolved = false;\n targetRefusalReason = HumanDecision_RefusalReason.NO_TARGET;\n } else if (targetUserId === route.assigneeUserId) {\n // The target already holds it: there is nowhere to move it, and nobody new to tell.\n targetResolved = true;\n } else {\n const { claimedAt: _claim, ...unclaimed } = route;\n void _claim;\n const next: HumanDecision_Route = { ...unclaimed, kind: HumanDecision_RouteKind.ASSIGNEE, assigneeUserId: targetUserId };\n // assurance-control: WILDO.ACCESS.REQUESTER_REVIEWER_SEPARATION — a deadline rule can only hand a decision to someone the gate would have admitted to answer it, never the requester.\n const vetted = await this.authorizeDecisionAct({ userId: targetUserId, route: next, requester, act: HumanDecision_Act.ANSWER, subject: this.decisionSubjectOfRow(row) });\n if (vetted.kind === HumanDecision_VerdictKind.ALLOWED) {\n movedTo = next;\n targetResolved = true;\n } else {\n targetResolved = false;\n targetRefusalReason = vetted.reason;\n }\n }\n }\n\n // ── The one write: the marker, and the move with it ─────────────────────\n const markerColumn = DEADLINE_STAGE_FIRED_COLUMN[stage];\n const version = row.pendingDecisionRouteVersion ?? 0;\n const written = await this.systemAccess.updateAsSystem(resourceType, {\n executionId: row.executionId,\n ...owner.ownerFields,\n machineCredentialId: row.machineCredentialId,\n resourceServerInstanceRef: row.resourceServerInstanceRef,\n status: FlowsActors_Status.AWAITING_APPROVAL,\n pendingDecisionRef: decisionRef,\n pendingDecisionClockPausedAt: null,\n [markerColumn]: null,\n // Always the version read (#1628 review L1): a claim or a move landing meanwhile changes who should be\n // told — or whether the CLAIM stage applies at all — so this stage is re-judged on the new route.\n pendingDecisionRouteVersion: version,\n }, {\n [markerColumn]: now,\n pendingDecisionNextDueAt: nextDueAtOfRow(row, { firedStage: stage, firedAt: now, claimed: movedTo ? false : !!row.pendingDecisionClaimedAt }),\n ...(movedTo ? {\n pendingDecisionRouteKind: HumanDecision_RouteKind.ASSIGNEE,\n pendingDecisionAssigneeUserId: movedTo.assigneeUserId,\n pendingDecisionClaimedAt: null,\n pendingDecisionRouteVersion: version + 1,\n } : {}),\n }, { scopeContext: owner.scopeContext });\n if (written === null || written === undefined) return false;\n\n // ── Who is told ─────────────────────────────────────────────────────────\n const shouldNotify = notifyDeclared || (!!reassignRule && !movedTo);\n const recipients: DecisionDeadlineNoticeRecipient[] = movedTo\n ? [{ userId: movedTo.assigneeUserId as string, audience: DecisionDeadlineNoticeAudience.REASSIGNEE }]\n : shouldNotify ? await this.decisionNoticeRecipients(resourceType, row, route, requester, stage) : [];\n\n // ── Recorded ────────────────────────────────────────────────────────────\n const base = this.decisionEventBase(row, route, toolName);\n if (this.auditLogs) {\n const onRecordFailure = (error: unknown) => this.logger.warn('[ConversationalExecution] Could not record a decision deadline stage; the stage stands', {\n decisionRef, stage, ...projectCaughtErrorLogFields(error),\n });\n if (!isReviewWarningStage(stage)) {\n const kind = reviewDeadlineKindOfStage(stage);\n const deadlineAt = noticedDeadlineOfStage(row, stage);\n if (deadlineAt) {\n void this.auditLogs.logHumanDecisionDeadlineMissed({\n ...base, kind,\n deadlineAt: deadlineAt.toISOString(),\n basis: (kind === ReviewDeadlineKind.CLAIM ? row.pendingDecisionClaimClockBasis : row.pendingDecisionDecisionClockBasis) ?? ReviewClockBasis.ELAPSED,\n }).catch(onRecordFailure);\n }\n }\n if (reassignRule || notifyDeclared) {\n void this.auditLogs.logHumanDecisionEscalationFired({\n ...base, stage,\n action: movedTo ? ReviewEscalationActionKind.REASSIGN : ReviewEscalationActionKind.NOTIFY,\n reassignAttempted: !!reassignRule && isReviewerRoute(route),\n ...(targetResolved !== undefined ? { targetResolved } : {}),\n ...(targetRefusalReason ? { targetRefusalReason } : {}),\n ...(movedTo ? {\n ...(route.assigneeUserId ? { fromAssigneeUserId: route.assigneeUserId } : {}),\n toAssigneeUserId: movedTo.assigneeUserId,\n routeVersion: version + 1,\n } : {}),\n recipientCount: recipients.length,\n }).catch(onRecordFailure);\n }\n if (movedTo) {\n void this.auditLogs.logHumanDecisionReassigned({\n ...base,\n ...(route.assigneeUserId ? { fromAssigneeUserId: route.assigneeUserId } : {}),\n toAssigneeUserId: movedTo.assigneeUserId as string,\n routeVersion: version + 1,\n reasonGiven: false,\n trigger: HumanDecision_RouteChangeTrigger.ESCALATION_RULE,\n stage,\n }, undefined).catch(onRecordFailure);\n }\n }\n if (movedTo) {\n this.announceDecisionRouted(movedTo, decisionRef);\n // #2569: a missed deadline took it away from whoever held it.\n this.announceDecisionWithdrawn({ route, requester, decisionRef, routeVersion: version + 1, ...(movedTo.assigneeUserId ? { except: movedTo.assigneeUserId } : {}) });\n }\n await this.sendDecisionDeadlineNotices(row, stage, recipients, toolName);\n this.logger.info('[ConversationalExecution] A decision deadline stage fired', {\n resourceType, executionId: row.executionId, decisionRef, stage, reassigned: !!movedTo, recipients: recipients.length,\n });\n return true;\n }\n\n /**\n * Where the requester authority rebuild reads the relationships a decision was raised through (#2768): the record the\n * pause kept with the requester, else, for a turn paused before it was kept, the waiting row's relationship provenance.\n * Only an organization's execution row carries provenance; an older pause on a person's own execution\n * (`userFlowActorExecutions`) records nothing, and its requester is compared with nothing.\n */\n private decisionRaisedThroughOf(\n requester: HumanDecision_Requester,\n resourceType: CoreResourceType,\n executionId: string,\n organizationId: string | undefined,\n ): { raisedThroughRelationshipIds?: readonly string[]; waitingWork?: DecisionWaitingWorkRef } {\n if (requester.throughRelationshipIds) return { raisedThroughRelationshipIds: requester.throughRelationshipIds };\n return resourceType === CoreResourceType.ORGANIZATION_FLOW_ACTOR_EXECUTIONS && organizationId\n ? { waitingWork: { resourceType, key: { executionId, organizationId } } }\n : {};\n }\n\n /**\n * The person a REASSIGN rule names, resolved under the REQUESTER's authority as it stands now — the\n * authority the decision would run under, never a reviewer's. `undefined` when the rule names nobody, the\n * requester's authority no longer holds, or the resolver fails.\n */\n private async resolveEscalationRuleTarget(\n resourceType: CoreResourceType,\n row: FlowActorExecution,\n route: HumanDecision_Route,\n requester: HumanDecision_Requester,\n target: ((args: unknown, context: FunctionToolExecutionContext) => Promise<string | undefined>) | undefined,\n toolName: string | undefined,\n ): Promise<string | undefined> {\n if (!target) return undefined;\n try {\n const rebuilt = await this.executionContextCreator.rebuildDecisionRequesterAuthority({\n requesterKind: requester.kind,\n requesterRef: requester.ref,\n requesterClientId: requester.clientId,\n organizationId: route.organizationId,\n requestedAt: row.pendingDecisionRequestedAt ? new Date(row.pendingDecisionRequestedAt) : new Date(),\n ...(row.autonomousAgentRef ? { autonomousAgentRef: row.autonomousAgentRef } : {}),\n ...this.decisionRaisedThroughOf(requester, resourceType, row.executionId, route.organizationId),\n });\n if (rebuilt.standing !== DecisionRequesterAuthorityStanding.HOLDS) return undefined;\n const paused = parseFlowActorPausedApproval(row.pausedApproval as string);\n // #2665 B7: the authority the decision would run under, confined as its resume would be.\n const requesterAuth = this.confineToChatConversation(rebuilt.auth, await this.chatConversationOf(row.executionId));\n return await target(paused.pendingToolArgs ?? {}, this.buildToolExecutionContext(requesterAuth, row.executionId, row.systemRef, row.pendingDecisionRef ?? undefined));\n } catch (error) {\n this.logger.warn('[ConversationalExecution] A deadline rule\\'s reassignment target could not be resolved; notifying instead', {\n executionId: row.executionId, toolName, ...projectCaughtErrorLogFields(error),\n });\n return undefined;\n }\n }\n\n /**\n * Who a stage tells (I5): exactly the people who may ANSWER the decision at this moment — its requester on\n * an OWNER route, its assignee on an ASSIGNEE route, every eligible holder in its organization (never the\n * requester) on a ROLE route, each re-checked with the one predicate now, so a holder who lost the role is\n * not told. At a DECISION stage the gate's owner — the person whose request is waiting — is told too, in\n * their own words. Never an organization-wide room.\n */\n private async decisionNoticeRecipients(\n resourceType: CoreResourceType,\n row: FlowActorExecution,\n route: HumanDecision_Route,\n requester: HumanDecision_Requester,\n stage: ReviewDeadlineStage,\n ): Promise<DecisionDeadlineNoticeRecipient[]> {\n // The shared walk (#2664 review M3): every active membership, keyset to the end, each re-checked with THIS plane's\n // ANSWER predicate. It read the first 100 members until then, so a holder past them was never told.\n const subject = this.decisionSubjectOfRow(row);\n const answerers = new Set(await collectHumanDecisionAnswerers({\n repositoriesRegistry: this.repositoriesRegistry,\n mayAnswer: async (userId) =>\n (await this.authorizeDecisionAct({ userId, route, requester, act: HumanDecision_Act.ANSWER, subject })).kind === HumanDecision_VerdictKind.ALLOWED,\n logger: this.logger,\n }, { decisionRef: row.pendingDecisionRef ?? '', route, requester }));\n const recipients: DecisionDeadlineNoticeRecipient[] = [...answerers].map((userId) => ({ userId, audience: DecisionDeadlineNoticeAudience.ANSWERER }));\n if (reviewDeadlineKindOfStage(stage) === ReviewDeadlineKind.DECISION) {\n const gateOwner = this.ownerOfRow(resourceType, row).ownerFields.userId\n ?? (requester.kind !== HumanDecision_RequesterKind.MACHINE ? requester.ref : undefined);\n if (gateOwner && !answerers.has(gateOwner)) recipients.push({ userId: gateOwner, audience: DecisionDeadlineNoticeAudience.REQUESTER });\n }\n return recipients;\n }\n\n /**\n * Tell each recipient, in-app (their own room) and by email. Best-effort per recipient and per channel: a\n * notice that cannot be sent is logged, and the decision is still in their inbox. Carries the decision id,\n * the tool name and the instants — never the proposed arguments.\n */\n private async sendDecisionDeadlineNotices(\n row: FlowActorExecution,\n stage: ReviewDeadlineStage,\n recipients: readonly DecisionDeadlineNoticeRecipient[],\n toolName: string | undefined,\n ): Promise<void> {\n if (recipients.length === 0) return;\n const deadlineAt = noticedDeadlineOfStage(row, stage);\n const lapsesAt = row.pendingDecisionExpiresAt ? new Date(row.pendingDecisionExpiresAt) : undefined;\n const organizationId = row.pendingDecisionOrganizationId ?? undefined;\n const config = this.appConfig?.isInitialized() ? this.appConfig.config : undefined;\n const frontendServiceName = this.appConfig?.isInitialized() ? this.appConfig.resolveDefaultFrontendServiceName() : undefined;\n const frontendUrl = config && frontendServiceName ? AuthControllerUtils.lookupFrontendPublicUrl(config, frontendServiceName) ?? undefined : undefined;\n\n for (const recipient of recipients) {\n const identifier = inAppNoticeOfDeadlineStage(stage, recipient.audience);\n // Where the notice leads, in-app AND in the email (#2578): the decision inbox for someone who may act on it, nowhere\n // for the requester, whom the inbox refuses every act on their own decision, so a button would open an empty page.\n // The email's button is the same page under the frontend's public URL, so the two cannot disagree.\n const destination = inAppDestinationOfDeadlineNotice(recipient.audience);\n const appUrl = frontendUrl && destination ? `${frontendUrl.replace(/\\/+$/, '')}${destination}` : undefined;\n void this.webSocket?.notifyUser(recipient.userId, {\n type: isReviewWarningStage(stage) || recipient.audience === DecisionDeadlineNoticeAudience.REQUESTER ? NotificationLevel.INFO : NotificationLevel.WARNING,\n identifier,\n data: { decisionRef: row.pendingDecisionRef, stage, ...(toolName ? { toolName } : {}), ...(deadlineAt ? { deadlineAt: deadlineAt.toISOString() } : {}) },\n destination,\n ...(organizationId ? { organizationId } : {}),\n }).catch((error: unknown) => this.logger.warn('[ConversationalExecution] A deadline notice could not be sent in-app; it is in the inbox', {\n decisionRef: row.pendingDecisionRef, stage, ...projectCaughtErrorLogFields(error),\n }));\n\n if (!this.emailService || !config || !deadlineAt) continue;\n try {\n const user = await this.systemAccess.readAsSystem<User>(CoreResourceType.USERS, { _id: recipient.userId }, { suppressSystemAudit: true });\n const email = (user as { email?: string } | null)?.email;\n if (!email) continue;\n await this.emailService.send({\n templateRef: SystemEmailTemplateRef.HUMAN_DECISION_DEADLINE,\n locale: this.recipientLanguage ? await this.recipientLanguage.forUser(recipient.userId) : getConfiguredPrimaryLanguage(config),\n type: EmailTemplateType.TRANSACTIONAL,\n to: email,\n // The decision's organization: its branding while in effect (#2306), and its sender.\n ...(organizationId ? { organizationId } : {}),\n context: {\n currentObject: { email },\n objectContext: {\n primaryScopeContext: {\n appName: applicationDisplayName(config.appIdentity),\n applicationId: this.appConfig?.applicationId,\n logoUrl: this.appConfig?.resolveBrandLogoAbsoluteUrl({ composition: BrandAssetComposition.LOCKUP, purpose: BrandAssetPurpose.EMAIL }) ?? undefined,\n },\n },\n userContext: { userId: recipient.userId, email },\n additionalContext: {\n stage,\n reassignedToYou: recipient.audience === DecisionDeadlineNoticeAudience.REASSIGNEE,\n forRequester: recipient.audience === DecisionDeadlineNoticeAudience.REQUESTER,\n decisionRef: row.pendingDecisionRef,\n ...(toolName ? { toolName } : {}),\n deadlineAt: deadlineAt.toISOString(),\n ...(lapsesAt ? { lapsesAt: lapsesAt.toISOString() } : {}),\n ...(appUrl ? { appUrl } : {}),\n },\n },\n });\n } catch (error) {\n this.logger.warn('[ConversationalExecution] A deadline notice could not be emailed; it is in the inbox', {\n decisionRef: row.pendingDecisionRef, stage, ...projectCaughtErrorLogFields(error),\n });\n }\n }\n }\n\n /**\n * The pending decisions this person may act on, as decision cards (#1594 D6).\n *\n * Candidates are SELECTED on indexed columns built from the person — decisions assigned to them, OWNER\n * decisions they raised, and ROLE decisions in organizations they hold a role entry in, an organization they reach\n * through a live relationship included (#2792, `resolveHumanDecisionListingOrganizationIds`) — then each is READ (the\n * route columns are backend-only, so a listing projects them out) and re-checked with the same predicate\n * an answer is (I3). A card appears only if the person may answer it now; `permittedActs` says what else.\n * The organizations are resolved once and handed to every other host, so each plane selects from the same set.\n *\n * The card is the decision and never the conversation: tool, proposed arguments, deadline, route.\n */\n public async listPendingDecisions(actorAuth: SocketAuthResult): Promise<HumanDecision_PendingCard[]> {\n const userId = actorAuth.initiatorIds?.userId;\n if (actorAuth.executionType !== ExecutionContext_ExecutionType.USER_REQUEST || !userId) return [];\n const organizationIds = await resolveHumanDecisionListingOrganizationIds(\n { executionContextCreator: this.executionContextCreator, logger: this.logger }, actorAuth,\n );\n const waiting = { status: FlowsActors_Status.AWAITING_APPROVAL };\n const filters: Record<string, unknown>[] = [\n { ...waiting, pendingDecisionAssigneeUserId: userId },\n { ...waiting, pendingDecisionRouteKind: HumanDecision_RouteKind.OWNER, pendingDecisionRequesterRef: userId },\n ...organizationIds.map((organizationId) => ({ ...waiting, pendingDecisionRouteKind: HumanDecision_RouteKind.ROLE, pendingDecisionOrganizationId: organizationId })),\n ];\n\n const candidates = new Map<string, CoreResourceType>();\n for (const resourceType of FLOW_ACTOR_EXECUTION_OWNER_VARIANTS) {\n for (const filter of filters) {\n const listed = await this.systemAccess.listAsSystem<FlowActorExecution>(\n resourceType, filter, { page: 1, limit: PENDING_DECISION_LIST_LIMIT }, { suppressSystemAudit: true },\n ).catch((error: unknown) => {\n this.logger.warn('[ConversationalExecution] Could not list pending decisions for one scope', { resourceType, ...projectCaughtErrorLogFields(error) });\n return [] as FlowActorExecution[];\n });\n const rows = Array.isArray(listed) ? listed : (listed?.data ?? []);\n if (rows.length >= PENDING_DECISION_LIST_LIMIT) {\n this.logger.warn('[ConversationalExecution] A pending-decision selection reached its cap; the list is partial', {\n resourceType, userId, limit: PENDING_DECISION_LIST_LIMIT,\n });\n }\n for (const candidate of rows) candidates.set(candidate.executionId, resourceType);\n }\n }\n\n const cards: HumanDecision_PendingCard[] = [];\n const deliverablesByDecision = new Map<string, NonNullable<ResolvedDecisionDeliverables['deliverables']>>();\n for (const [executionId, resourceType] of candidates) {\n const row = await this.systemAccess.readAsSystem<FlowActorExecution>(resourceType, { executionId }, { suppressSystemAudit: true }).catch(() => null);\n const described = row ? this.decisionCardOfRow(row, new Date()) : undefined;\n if (!described) continue;\n const { card, route, requester } = described;\n const permittedActs: HumanDecision_Act[] = [];\n // One row whose facts cannot be read (a unit read, a qualification register read, #2967) is left out of this listing\n // with a warning, never the whole inbox emptied: the actor plane isolates its rows the same way.\n let roleFacts: HumanDecision_RoleFacts;\n try {\n roleFacts = isReviewerRoute(route)\n ? await resolveHumanDecisionRoleFacts(this.humanDecisionRoleFactsPorts(), { userId, route, requester, subject: this.decisionSubjectOfRow(row!) })\n : NO_HUMAN_DECISION_ROLE_FACTS;\n } catch (error) {\n this.logger.warn('[ConversationalExecution] A pending decision\\'s role facts could not be read; it is left out of this listing', {\n executionId, userId, ...projectCaughtErrorLogFields(error),\n });\n continue;\n }\n for (const act of Object.values(HumanDecision_Act)) {\n const verdict = authorizeHumanDecisionActor({ actor: { executionType: actorAuth.executionType, userId }, roleFacts, route, requester, act });\n if (verdict.kind === HumanDecision_VerdictKind.ALLOWED) permittedActs.push(act);\n }\n // I3: only what the person could ANSWER. A supervisor who may only take a decision over does not see\n // it listed as theirs; they reach it through the decision id.\n if (!permittedActs.includes(HumanDecision_Act.ANSWER)) continue;\n cards.push({ ...card, permittedActs });\n // #2904: the call's file deliverable, bound by its hash as the act that answers it binds it.\n const resolved = await this.decisionDeliverablesOf(card.systemRef, {\n decisionRef: card.decisionRef, toolName: card.toolName, toolArgs: card.toolArgs,\n ...(route.organizationId ? { organizationId: route.organizationId } : {}),\n });\n if (resolved.deliverables) deliverablesByDecision.set(card.decisionRef, resolved.deliverables);\n }\n // Decisions held by another plane's host (#1612, #2539), re-checked by that host with the same predicate.\n for (const host of this.humanDecisionHosts ?? []) cards.push(...await host.listCards(actorAuth, { organizationIds }));\n // #2903: every card carries what it presents and the id an answer echoes, built by the one function each plane's act\n // rebuilds it with.\n const presentationKey = decisionPresentationKeyOfRuntime(this.appConfig);\n // Soonest deadline first: that is the one a person must not miss.\n return cards\n .map((card) => withDecisionPresentation(card, presentationKey, card.plane === HumanDecision_Plane.CONVERSATIONAL ? deliverablesByDecision.get(card.decisionRef) : undefined))\n .sort((a, b) => (a.expiresAt ?? '\\uffff').localeCompare(b.expiresAt ?? '\\uffff'));\n }\n\n /**\n * A waiting row's decision card WITHOUT `permittedActs`, the one field that depends on who views it (#2664 S5b): the\n * inbox adds the viewer's acts, and a decision's notice is built from the card as everyone who may answer sees it.\n * `undefined` when the row holds no decision anyone could answer: not waiting, no route or requester, or a pause that\n * is unreadable or lapsed. The card is the decision and never the conversation: tool, proposed arguments, deadline,\n * route.\n */\n private decisionCardOfRow(row: FlowActorExecution, now: Date): {\n readonly card: Omit<HumanDecision_PendingCard, 'permittedActs'>;\n readonly route: HumanDecision_Route;\n readonly requester: HumanDecision_Requester;\n } | undefined {\n const route = humanDecisionRouteOfRow(row);\n const requester = humanDecisionRequesterOfRow(row);\n if (row.status !== FlowsActors_Status.AWAITING_APPROVAL || !row.pausedApproval || !row.pendingDecisionRef || !route || !requester) return undefined;\n let paused: FlowActorExecution_PausedApproval;\n try {\n paused = parseFlowActorPausedApproval(row.pausedApproval);\n } catch {\n return undefined;\n }\n if (isFlowActorPausedApprovalLapsed(paused, now)) return undefined;\n const toolInputSchema = this.describeGatedToolInputSchema(row.systemRef, paused.pendingToolName);\n // #2526: the system's own name, read from the registry; absent when it is no longer registered.\n const system = this.registeredActorSystem(row.systemRef);\n // #2526 review F2: the risk of THIS call, as its gate declares it — not the system's, which says how far the\n // assistant is trusted overall and would badge a deletion \"low\" because the assistant is.\n const riskLevel = this.gateOfRow(row, paused.pendingToolName)?.riskLevel;\n return {\n route,\n requester,\n card: {\n decisionRef: row.pendingDecisionRef,\n plane: HumanDecision_Plane.CONVERSATIONAL,\n executionId: row.executionId,\n systemRef: row.systemRef,\n ...(system?.displayName ? { systemDisplayName: system.displayName } : {}),\n ...(riskLevel ? { riskLevel } : {}),\n toolName: paused.pendingToolName,\n toolArgs: (paused.pendingToolArgs ?? {}) as Record<string, unknown>,\n ...(toolInputSchema ? { toolInputSchema } : {}),\n // #2720: an agent's question is answered as a question, through its form, in the inbox as in the chat.\n ...((() => {\n const question = this.pausedQuestionOf(row.systemRef, {\n decisionRef: row.pendingDecisionRef as string, toolName: paused.pendingToolName, toolArgs: paused.pendingToolArgs as Record<string, unknown> | undefined,\n questionForm: paused.questionForm, requestedAt: paused.requestedAt, ...(paused.expiresAt ? { expiresAt: paused.expiresAt } : {}),\n });\n return question ? { request: question } : {};\n })()),\n requestedAt: paused.requestedAt,\n ...(paused.expiresAt ? { expiresAt: paused.expiresAt } : {}),\n route,\n routeVersion: row.pendingDecisionRouteVersion ?? 0,\n requesterKind: requester.kind,\n ...(requester.kind !== HumanDecision_RequesterKind.MACHINE ? { requesterUserId: requester.ref } : {}),\n declaresEscalationTarget: this.gateDeclaresEscalationTarget(row.systemRef, paused.pendingToolName),\n // #1628: the next service target ahead of it, the pause it is in, and the pause states it offers.\n ...this.deadlineCardFields(row),\n pauseStates: this.deadlinePolicyOf(this.gateOfRow(row, paused.pendingToolName)).pauseStates,\n // #1921: a tool approval is always a review of agent work, so its answer may carry a declared reason code.\n reasonCodes: this.agentWorkDecisions?.declaredReasonCodes() ?? [],\n // #2923: the step-up an answer must carry, so the inbox asks for it before answering.\n ...(paused.stepUp ? { stepUp: paused.stepUp } : {}),\n ...(paused.answerChannels ? { answerChannels: paused.answerChannels } : {}),\n },\n };\n }\n\n // ─── #2664 S5b: this plane as a decision-notice source ─────────────────────\n //\n // A stay is keyed by the decision id, unique across the three owner variants (`pendingDecisionRef`), and its route\n // version moves with every claim, reassignment and escalation. Only a decision routed IN an organization has one: that\n // organization is the one a chat answer is confined to (`answerPendingDecision`), and a chat link belongs to it.\n\n public readonly plane = HumanDecision_Plane.CONVERSATIONAL;\n\n /**\n * One page of the waiting decisions, by keyset on `_id` within each owner variant in turn. The cursor names the\n * variant and the last `_id` read; a variant is finished only when it answers an EMPTY page (a short page proves\n * nothing: a repository clamps a page to its ceiling). A page whose rows all hold no stay has no stays and a `next`.\n */\n public async listLiveStays(after: string | undefined, limit: number): Promise<HumanDecisionNoticeLiveStayPage> {\n if (!this.repositoriesRegistry) throw new Error('No repository is bound in this process, so the waiting decisions cannot be listed.');\n const separator = after?.indexOf('|') ?? -1;\n let variantIndex = after === undefined || separator < 0 ? 0 : Number(after.slice(0, separator));\n let afterId = after === undefined || separator < 0 ? undefined : after.slice(separator + 1) || undefined;\n const waiting = { status: FlowsActors_Status.AWAITING_APPROVAL };\n const now = new Date();\n for (; variantIndex < FLOW_ACTOR_EXECUTION_OWNER_VARIANTS.length; variantIndex += 1, afterId = undefined) {\n const rows = await this.repositoriesRegistry.findManyForInfrastructure<FlowActorExecution & { _id: unknown }>(\n FLOW_ACTOR_EXECUTION_OWNER_VARIANTS[variantIndex]!,\n afterId === undefined ? waiting : { $and: [waiting, { _id: { $gt: afterId } }] },\n undefined,\n undefined,\n { sort: [{ field: '_id', order: SortOrder.ASC }], limit },\n );\n if (rows.length === 0) continue;\n return {\n stays: rows.flatMap((row) => { const stay = this.noticeStayOfRow(row, now); return stay ? [stay] : []; }),\n next: `${variantIndex}|${String(rows[rows.length - 1]!._id)}`,\n };\n }\n return { stays: [] };\n }\n\n public async stayStateOf(stayRef: string): Promise<HumanDecisionNoticeStayState> {\n const read = await this.readDecisionRowForNotice(stayRef);\n if (read === UNREADABLE_DECISION_ROW) return { kind: HumanDecisionNoticeStayLiveness.UNREADABLE };\n const stay = read ? this.noticeStayOfRow(read, new Date()) : undefined;\n return stay ? { kind: HumanDecisionNoticeStayLiveness.LIVE, stay } : { kind: HumanDecisionNoticeStayLiveness.NOT_LIVE };\n }\n\n public async describeStay(stayRef: string): Promise<HumanDecisionNoticeStayDescription | undefined> {\n const read = await this.readDecisionRowForNotice(stayRef);\n if (read === UNREADABLE_DECISION_ROW || !read) return undefined;\n const now = new Date();\n const stay = this.noticeStayOfRow(read, now);\n const described = stay ? this.decisionCardOfRow(read, now) : undefined;\n if (!stay || !described) return undefined;\n // What only the in-app inbox uses: the moves, the clock pauses, the edit schema.\n const { declaresEscalationTarget: _moves, pauseStates: _pauses, clockPause: _clock, toolInputSchema: _edit, ...card } = described.card;\n const { route, requester } = described;\n const answererUserIds = await collectHumanDecisionAnswerers({\n repositoriesRegistry: this.repositoriesRegistry,\n mayAnswer: this.noticeAnswerPredicateOf(read, described),\n logger: this.logger,\n }, { decisionRef: stay.decisionRef, route, requester });\n return { stay, card, answererUserIds };\n }\n\n /** #2756: which of `userIds` may answer the decision now, by the predicate `describeStay` walks the organization with. */\n public async answerersAmong(stayRef: string, userIds: readonly string[]): Promise<HumanDecisionNoticeAnswererCheck> {\n const read = await this.readDecisionRowForNotice(stayRef);\n if (read === UNREADABLE_DECISION_ROW) return { kind: HumanDecisionNoticeStayLiveness.UNREADABLE };\n const now = new Date();\n const stay = read ? this.noticeStayOfRow(read, now) : undefined;\n const described = read && stay ? this.decisionCardOfRow(read, now) : undefined;\n if (!read || !stay || !described) return { kind: HumanDecisionNoticeStayLiveness.NOT_LIVE };\n const answererUserIds = await admitHumanDecisionAnswerers({ mayAnswer: this.noticeAnswerPredicateOf(read, described), logger: this.logger }, { decisionRef: stay.decisionRef, userIds });\n return { kind: HumanDecisionNoticeStayLiveness.LIVE, stay, answererUserIds };\n }\n\n /**\n * The CHAT-OFFERABLE answer predicate, person by person: this plane's own ANSWER predicate (as the deadline notices\n * ask it), then the granting organization's authentication policy as a chat answer would meet it, with no session\n * (#2797). The walk and the re-check share it.\n */\n private noticeAnswerPredicateOf(\n read: FlowActorExecution,\n described: { readonly route: HumanDecision_Route; readonly requester: HumanDecision_Requester },\n ): (userId: string) => Promise<boolean> {\n const { route, requester } = described;\n const subject = this.decisionSubjectOfRow(read);\n // #2797: a chat card's reader answers with no session, so one the granting organization's policy would refuse is\n // never offered the card.\n return chatOfferableAnswerPredicate(\n { executionContextCreator: this.executionContextCreator, logger: this.logger },\n { decisionRef: read.pendingDecisionRef ?? '', organizationId: route.organizationId },\n async (userId) =>\n (await this.authorizeDecisionAct({ userId, route, requester, act: HumanDecision_Act.ANSWER, subject })).kind === HumanDecision_VerdictKind.ALLOWED,\n );\n }\n\n /**\n * The row holding a decision, for a notice: `null` when no variant holds it, {@link UNREADABLE_DECISION_ROW} when a\n * variant could not be read. Unlike `findPendingDecision`, a read error is not an absence: a notice must never be\n * withdrawn because a read failed.\n */\n /**\n * The chat-conversation ledger row of a conversation, when it lives in a chat (#2665 B7): `null` when it does not, or\n * when no ledger store is bound. A failed read throws, so no caller runs a turn unconfined on a guess.\n */\n private async chatConversationOf(executionId: string): Promise<ChatConversation | null> {\n return this.chatConversations ? this.chatConversations.readByExecutionId(executionId) : null;\n }\n\n /**\n * `auth` confined to the chat conversation's organization (#2665 B7, B10: that organization's entries and the\n * application's `APP_USER`, read through the LIVE role table), or as it is when the conversation lives in no chat.\n */\n private confineToChatConversation(auth: SocketAuthResult, chatConversation: ChatConversation | null): SocketAuthResult {\n return chatConversation ? this.confineToChatOrganization(auth, chatConversation.organizationId) : auth;\n }\n\n private confineToChatOrganization(auth: SocketAuthResult, organizationId: string): SocketAuthResult {\n return confineAuthorityToChatConversationOrganization(auth, organizationId, (roleKey, scope) => this.authorizer.getRoleHierarchy(roleKey as never, scope));\n }\n\n /**\n * What a chat message would meet, asked BEFORE the chat door owes it a reply (#2665 S6, plan V1): read-only, through the\n * same predicates the start applies, so every refusal is decided before anything is written and the start then runs\n * on the answer. A person's conversation, confined to the chat's organization as the start confines it once the\n * conversation's ledger row exists (B7), so consent is asked of the authority the turn will hold, and the token budget\n * the door checks bills that organization.\n *\n * In order: the message already held (the conversation took it: final, whatever else holds), then the refusals that\n * end the message (consent, a system that cannot converse), then the thread's state (a decision waiting, a turn\n * running). A thread that cannot be read THROWS: whether the message is already held is not something to guess. So does\n * a consent requirement that could not be evaluated: it is not the person's refusal (review M1).\n */\n public async previewChatTurn(params: {\n readonly systemRef: string;\n readonly executionId: string;\n readonly auth: SocketAuthResult;\n readonly organizationId: string;\n readonly userMessageId: string;\n }): Promise<ChatTurnPreview> {\n const { systemRef, executionId, organizationId, userMessageId } = params;\n const userId = params.auth.initiatorIds?.userId;\n if (!userId) return { kind: ChatTurnPreviewKind.REFUSED, errorCode: FlowsActors_ExecutionErrorCode.NO_OWNER };\n const owner = this.resolveOwnerVariant({ userId });\n const auth = this.confineToChatOrganization(params.auth, organizationId);\n\n const existing = await this.readChatConversationRow(owner, auth, executionId);\n if (existing && (existing.messages ?? []).some((message) => message.id === userMessageId)) return { kind: ChatTurnPreviewKind.ALREADY_RECEIVED };\n\n // Three answers, not two (#2665 S6 review M1): a requirement that could not be evaluated is not the person's refusal.\n // Answering it as one would tell them to record a consent they may hold and discard their message, so it throws and\n // the delivery is tried again, like a thread that cannot be read.\n const consent = await this.serviceConsentVerdictForTurn({ auth, owner, systemRef, executionId });\n if (consent === ServiceConsentRequirementVerdict.NOT_EVALUATED) throw new ChatTurnConsentNotEvaluatedError(executionId);\n if (consent === ServiceConsentRequirementVerdict.REFUSED) {\n return { kind: ChatTurnPreviewKind.REFUSED, errorCode: FlowsActors_ExecutionErrorCode.SERVICE_CONSENT_REQUIRED };\n }\n const system = this.conversationalActorSystemOf(systemRef);\n if (system.refusal) return { kind: ChatTurnPreviewKind.REFUSED, errorCode: system.refusal.errorCode };\n if (!this.resolveChatAgentRef(system.actorSystem!)) return { kind: ChatTurnPreviewKind.REFUSED, errorCode: FlowsActors_ExecutionErrorCode.NO_CHAT_ACTOR };\n // The same launch gate the start asks, so a member the system is not open to is told before anything is written.\n if (!(await this.admitsSystemStart({ auth, owner, actorSystem: system.actorSystem!, organizationId, refusedSurface: `flows-actors:turn:${FlowsActors_InitiationKind.CHAT_MESSAGE}` }))) {\n return { kind: ChatTurnPreviewKind.REFUSED, errorCode: FlowsActors_ExecutionErrorCode.SYSTEM_ROLE_NOT_HELD };\n }\n\n if (existing?.status === FlowsActors_Status.AWAITING_APPROVAL) {\n const decisionRef = existing.pendingDecisionRef ?? '';\n const replyAnswer = decisionRef ? this.replyAnswerOfWaitingDecision(existing, decisionRef) : null;\n return { kind: ChatTurnPreviewKind.WAITING_FOR_DECISION, decisionRef, ...(replyAnswer ? { replyAnswer } : {}) };\n }\n if (existing && conversationRefusesArrivingTurn(existing, FlowsActors_InitiationKind.CHAT_MESSAGE)) return { kind: ChatTurnPreviewKind.BUSY };\n return { kind: ChatTurnPreviewKind.ADMITTED, auth };\n }\n\n /**\n * How a person's next message would answer the decision `row` waits on (#2751), or `null`: the question its paused call\n * asks, read through `pausedQuestionOf` (the one reader the card, the inbox and the answer door share), and held to\n * `humanDecisionReplyAnswerOf`. A pause that cannot be read answers nothing: the message is refused as before.\n */\n private replyAnswerOfWaitingDecision(row: FlowActorExecution, decisionRef: string): HumanDecisionReplyAnswer | null {\n if (!row.pausedApproval) return null;\n let paused: FlowActorExecution_PausedApproval;\n try {\n paused = parseFlowActorPausedApproval(row.pausedApproval);\n } catch {\n return null;\n }\n return humanDecisionReplyAnswerOf(this.pausedQuestionOf(row.systemRef, {\n decisionRef, toolName: paused.pendingToolName, toolArgs: paused.pendingToolArgs as Record<string, unknown> | undefined,\n questionForm: paused.questionForm, requestedAt: paused.requestedAt, ...(paused.expiresAt ? { expiresAt: paused.expiresAt } : {}),\n }));\n }\n\n /**\n * Whether the person's conversation `executionId` already holds the chat message `userMessageId` (#2665 S6 review\n * L12): the preview's own read. The chat door asks it of every OTHER epoch a retried message could have joined, so a\n * message whose turn started in one epoch is never started again in a later one that has since widened over it. A\n * thread that cannot be read throws.\n */\n public async chatConversationHoldsMessage(params: {\n readonly executionId: string;\n readonly auth: SocketAuthResult;\n readonly organizationId: string;\n readonly userMessageId: string;\n }): Promise<boolean> {\n const userId = params.auth.initiatorIds?.userId;\n if (!userId) return false;\n const owner = this.resolveOwnerVariant({ userId });\n const existing = await this.readChatConversationRow(owner, this.confineToChatOrganization(params.auth, params.organizationId), params.executionId);\n return (existing?.messages ?? []).some((message) => message.id === params.userMessageId);\n }\n\n /**\n * The application's service consent requirement, asked of a chat turn's authority confined to the chat's organization\n * (#2665 S6 review M1): the start refused a chat message for consent, and the chat door asks again which of the three it\n * was. REFUSED is the person's to remedy; NOT_EVALUATED, and an ADMITTED that came too late, are tried again.\n */\n public async chatTurnConsentVerdict(params: {\n readonly systemRef: string;\n readonly executionId: string;\n readonly auth: SocketAuthResult;\n readonly organizationId: string;\n }): Promise<ServiceConsentRequirementVerdict> {\n const userId = params.auth.initiatorIds?.userId;\n if (!userId) return ServiceConsentRequirementVerdict.NOT_EVALUATED;\n const owner = this.resolveOwnerVariant({ userId });\n const auth = this.confineToChatOrganization(params.auth, params.organizationId);\n return this.serviceConsentVerdictForTurn({ auth, owner, systemRef: params.systemRef, executionId: params.executionId });\n }\n\n /**\n * A person's conversation row as the start reads it: the same owner fields, credential axis and agent instance (a chat\n * turn arrives through no A2A agent). A row that cannot be read throws.\n */\n private async readChatConversationRow(owner: ResolvedOwnerVariant, auth: SocketAuthResult, executionId: string): Promise<FlowActorExecution | null> {\n return this.systemAccess.readAsSystem<FlowActorExecution>(\n owner.resourceType,\n { executionId, ...owner.ownerFields, machineCredentialId: machineCredentialIdOf(auth), resourceServerInstanceRef: agentInstanceOf(undefined) },\n { scopeContext: owner.scopeContext },\n );\n }\n\n private async readDecisionRowForNotice(decisionRef: string): Promise<FlowActorExecution | null | typeof UNREADABLE_DECISION_ROW> {\n if (!decisionRef) return null;\n let unreadable = false;\n for (const resourceType of FLOW_ACTOR_EXECUTION_OWNER_VARIANTS) {\n try {\n const row = await this.systemAccess.readAsSystem<FlowActorExecution>(resourceType, { pendingDecisionRef: decisionRef }, { suppressSystemAudit: true });\n if (row) return row;\n } catch (error) {\n unreadable = true;\n this.logger.warn('[ConversationalExecution] A decision could not be read for its notice', { decisionRef, resourceType, ...projectCaughtErrorLogFields(error) });\n }\n }\n return unreadable ? UNREADABLE_DECISION_ROW : null;\n }\n\n /** The stay a row holds, or `undefined` when it holds none: no answerable decision, or none routed in an organization. */\n private noticeStayOfRow(row: FlowActorExecution, now: Date): HumanDecisionNoticeLiveStay | undefined {\n const described = this.decisionCardOfRow(row, now);\n const organizationId = described?.route.organizationId;\n if (!described || !organizationId) return undefined;\n return {\n plane: this.plane,\n stayRef: described.card.decisionRef,\n occurrenceRef: described.card.decisionRef,\n decisionRef: described.card.decisionRef,\n routeVersion: described.card.routeVersion,\n organizationId,\n ...(described.card.expiresAt ? { expiresAt: new Date(described.card.expiresAt) } : {}),\n };\n }\n\n /**\n * Re-invoke the agent with the human's decision appended, and finish the turn.\n *\n * The resume payload is the SDK's own message array captured at suspension, plus a\n * `tool-approval-response` carrying the decision. We do not reconstruct the conversation: the\n * array is opaque to us by contract, and rebuilding it would silently change what the model sees.\n * An approved response's `reason` reaches no model; a reviewer's edit is told through the mark on the call (#3192,\n * `reviewerEditStatementsOf`).\n *\n * A resumed turn is the work of the principal it resumes as (#2722): the requester, rebuilt, so what its system writes\n * create is that principal's relationship's (see {@link startConversationalExecution}).\n */\n private async resumeAfterApproval(params: ResumeAfterApprovalParams): Promise<void> {\n const ending: ResumedTurnEnding = {};\n try {\n return await runAsRelationshipProvenanceOf(\n params.auth,\n params.owner.ownerFields.organizationId ?? params.auth?.initiatorIds?.organizationId ?? undefined,\n () => this.runResumeAfterApproval(params, ending),\n );\n } finally {\n await this.recordResumedWorkEnding(params, ending);\n await this.recordAcceptedCallNotRun(params, ending);\n }\n }\n\n /**\n * #3313: a turn resumed on an acceptance ended and its tool never ran, so the acceptance did not take effect. The decision's\n * own rows stay as they are, since the person did accept and the trail is append-only: this row is the correction. A\n * COMPLETED ending counts: the SDK can refuse the approved call and tell the model, which then answers normally. Not for a\n * turn its owner stopped (`CANCELLED`), which is its own recorded act, nor one that paused again, which has not ended; and\n * it never throws: a resume that has ended cannot be failed by its bookkeeping.\n */\n private async recordAcceptedCallNotRun(params: ResumeAfterApprovalParams, ending: ResumedTurnEnding): Promise<void> {\n const ended = ending.status === FlowsActors_Status.FAILED || ending.status === FlowsActors_Status.COMPLETED;\n if (!params.acceptedAs || !params.decisionRef || !ended || ending.acceptedCallReached) return;\n const { executionId, systemRef, decisionRef, paused, owner } = { ...params, decisionRef: params.decisionRef };\n // The tenant the decision's RESOLVED row is on, which a user's conversation does not name itself.\n const organizationId = params.acceptedDecisionOrganizationId ?? owner.ownerFields.organizationId;\n this.logger.warn('[ConversationalExecution] A resumed turn ended without the accepted call running', { systemRef, executionId, decisionRef, toolName: paused.pendingToolName, errorCode: ending.errorCode });\n try {\n await this.auditLogs?.logHumanDecisionAcceptedCallNotRun({\n decisionRef, executionId, systemRef, toolName: paused.pendingToolName, outcome: params.acceptedAs,\n ...(ending.errorCode !== undefined ? { errorCode: ending.errorCode } : {}),\n ...(organizationId ? { organizationId } : {}),\n });\n } catch (error) {\n this.logger.warn('[ConversationalExecution] An accepted call that did not run could not be recorded; the turn\\'s end stands', {\n executionId, decisionRef, ...projectCaughtErrorLogFields(error),\n });\n }\n }\n\n /**\n * Append the ending of the WORK a resume continued to `workEvents` (#2821), once the resume is over, however it ended.\n * Only a resume that continues a work (an answered decision's, or an inline resume inside one) has one to record, and\n * only when its own end sites set one ({@link ResumedTurnEnding}): nothing is read back from the row. Never throws.\n */\n private async recordResumedWorkEnding(params: ResumeAfterApprovalParams, ending: ResumedTurnEnding): Promise<void> {\n const workRef = params.workRef ?? params.decisionRef;\n const { status } = ending;\n if (!workRef || status === undefined) return;\n await this.recordWorkEvent(params.owner.resourceType, { executionId: params.executionId, ...params.owner.ownerFields }, workRef, resumedWorkTransitionOf({ ...ending, status }));\n }\n\n /**\n * Append one entry to a conversation's per-work log, `workEvents` (#2821): `{ workRef, status, at }`, the newest\n * {@link CONVERSATION_WORK_EVENTS_RETAINED} kept. An atomic array addition through the repository, filtered on the row's\n * identity alone, so it lands whatever the row's status is: while the row waits on another work's decision, or after\n * an overlapping turn ended it. Best-effort and never throws: a lost entry leaves the work read from an older entry or\n * from the row's own fields, which is logged here rather than failing the turn it describes.\n *\n * A `PROCESSING` entry also stamps `workContinuationOpenedAt` with its own instant, in the same statement (#2829), so a\n * thread holding a running work is always one the interrupted-turn sweep selects, and no entry can exist without it.\n * The sweep's own `FAILED` adds that column to `rowFilter`, so its append lands only if no continuation was released\n * since it read the row. Answers what the append did ({@link WorkEventRecording}).\n */\n private async recordWorkEvent(\n resourceType: ResolvedOwnerVariant['resourceType'],\n rowFilter: { readonly executionId: string } & Record<string, unknown>,\n workRef: string,\n /** The work's new status, with its code for a failure (#2827), so a door holding the work can say why it failed. */\n transition: FlowsActors_StatusTransition,\n ): Promise<WorkEventRecording> {\n const { executionId } = rowFilter;\n const { status } = transition;\n if (!this.repositoriesRegistry) {\n this.logger.warn('[ConversationalExecution] No repository is bound here, so a work\\'s life is not recorded; doors read it from the row\\'s own fields', { executionId, workRef, status });\n return WorkEventRecording.NOT_RECORDED;\n }\n const at = new Date();\n try {\n const landed = await this.repositoriesRegistry.atomicGuardedMutation(resourceType, rowFilter, {\n ...(status === FlowsActors_Status.PROCESSING ? { set: { workContinuationOpenedAt: at } } : {}),\n arrayAdditions: [{\n path: 'workEvents',\n values: [{ workRef, status, at, ...(transition.status === FlowsActors_Status.FAILED ? { failureCode: transition.failureCode } : {}) }],\n placement: RepositoryArrayAdditionPlacement.TAIL,\n distinctOnly: false,\n maxLength: CONVERSATION_WORK_EVENTS_RETAINED,\n }],\n });\n return landed !== null && landed !== undefined ? WorkEventRecording.LANDED : WorkEventRecording.NO_ROW;\n } catch (error) {\n this.logger.warn('[ConversationalExecution] A work\\'s life could not be recorded; a door asking about it reads an older entry or the row\\'s own fields', {\n executionId, workRef, status, ...projectCaughtErrorLogFields(error),\n });\n return WorkEventRecording.NOT_RECORDED;\n }\n }\n\n private async runResumeAfterApproval(params: ResumeAfterApprovalParams, ending: ResumedTurnEnding): Promise<void> {\n const { systemRef, executionId, owner, paused, approved } = params;\n const resumedAt = Date.now();\n\n /*\n * A resumed turn ENDS like a fresh one (#2521): one terminal event to the owner, and a transcript\n * that is the prior one plus whatever this turn added — never less.\n *\n * The browser leaves RUNNING only on `FLOWS_ACTORS_COMPLETED` or `FLOWS_ACTORS_ERROR`\n * (`FlowsActorsContext`), and answering an approval puts it back in RUNNING. A resume that ended\n * on a bare final MESSAGE therefore left the chat's composer locked and the workbench's\n * \"build now\" waiting for a turn that had finished. Every exit below ends through one of these two.\n */\n /** What the resumed turn did before it ended, once its agent is known (#2524); stored on every exit. */\n let resumeTrace: ConversationalTurnTrace | undefined;\n // #2827: every resumed failure names its code, recorded with the end and told to the client.\n const endFailed = async (errorCode: FlowsActors_ExecutionErrorCode, errorMessage: string): Promise<void> => {\n ending.status = FlowsActors_Status.FAILED;\n ending.errorCode = errorCode;\n const ended = await this.finalizeTerminal(systemRef, executionId, owner, (current) => (resumeTrace ? resumeTrace.appendTo(params.transcript(current)) : params.transcript(current)), { status: FlowsActors_Status.FAILED, failureCode: errorCode },\n machineCredentialIdOf(params.auth), agentInstanceOf(params.resourceServerInstanceRef));\n this.reportTurnEnd(params.emitter, systemRef, executionId, ended, () => {\n if (params.emitter) this.emitError(params.emitter, systemRef, executionId, errorCode, errorMessage);\n });\n };\n\n const resumeMessages = [\n ...(params.modifiedSdkModelMessages ?? paused.sdkModelMessages),\n {\n role: 'tool',\n content: [{\n type: 'tool-approval-response',\n approvalId: paused.approvalId,\n approved,\n ...(params.reason ? { reason: params.reason } : {}),\n }],\n },\n ];\n\n // A resumed turn is as stoppable as a fresh one (#2524): its owner's Stop reaches it through the same registry, and an\n // inline resume also hears the turn it continues (`abortSignal`).\n // #2550: TWO sites resume a turn — `answerPendingDecision`'s release (every answer door reaches it, detached or not),\n // and the inline automatic denial in the pause path. Only the first is registered as a decision RESUME, reachable by\n // execution id wherever it runs (`stopResumedTurns`): an A2A `tasks/cancel` lands on any replica and holds no handle\n // on a continuation somebody else's answer released. The inline one continues the turn that paused, on the same\n // replica, under that turn's own abort, so its opener stops it the way it stops the turn — and a stop aimed at a\n // released decision's continuation in the same thread must not reach it. `releasedAt` is what tells them apart.\n // #2821: registered under the WORK it continues (its first decision), so a stop reaches that work's continuations only,\n // a chained one included, and never another turn's in the same thread.\n const releasedByAnswer = params.releasedAt !== undefined;\n const resumedWorkRef = params.workRef ?? params.decisionRef;\n const acceptedToolCallId = params.acceptedAs ? pendingToolCallIdOf(paused.sdkModelMessages, paused.approvalId) : undefined;\n const turnAbort = this.registerRunningTurn(executionId, owner, params.abortSignal, releasedByAnswer ? resumedWorkRef : undefined, params.releasedAt);\n try {\n // The system or its agent can be gone: on a denial, which the door does not ask about, or since the door asked (#3313).\n // The decision is already settled, so nothing can resume it: the turn ends FAILED with its transcript, not wedged at\n // PROCESSING until the liveness sweep finds it. The resolver's refusal is the turn's end, reported once\n // by `endFailed` (#2721 re-review R-1): emitted first, it was followed by DECISION_PENDING whenever the\n // row read back waiting, two terminal events for one turn.\n const resolved = this.conversationalActorSystemOf(systemRef);\n if (resolved.refusal) {\n await endFailed(resolved.refusal.errorCode, resolved.refusal.errorMessage);\n return;\n }\n const actorSystem = resolved.actorSystem;\n const agentRef = this.resolveChatAgentRef(actorSystem);\n if (!agentRef) {\n await endFailed(FlowsActors_ExecutionErrorCode.NO_CHAT_ACTOR, `System '${systemRef}' has no agentic actor bound to an agent.`);\n return;\n }\n\n // The tool context is what makes a resume able to DO anything. Without it the agent resolves\n // no tools, so the approved call cannot execute and the provider rejects the unresolved\n // `tool_use`. A resume that cannot run the tool is not a resume.\n if (!params.auth) {\n this.logger.error('[ConversationalExecution] Cannot resume without the requester\\'s auth; the tool would have no identity to run as', {\n systemRef, executionId, approvalId: paused.approvalId,\n });\n await endFailed(FlowsActors_ExecutionErrorCode.AGENT_FAILED, 'The assistant failed to produce a response.');\n return;\n }\n\n /*\n * ONE id for every delta and the final event, exactly as a fresh turn does (`assistantMessageId`\n * above). The client merges a streamed message BY this id: deltas append, the final event replaces.\n * Without it each delta and the final full text arrived as separate one-shot messages, so the page\n * rendered the reply followed by the reply again — seen on the creation assistant's first approved\n * turn, 2026-09-24 (#1464). The persisted message was always right; only the live view doubled.\n */\n const resumedAssistantMessageId = randomUUID();\n // #2292 R8: the organizations' policies as they are NOW. The paused call carries what the tools returned under the\n // treatment it paused with, so a resume under a stricter one would send the model what that one withholds: refused,\n // and the person asks again under the policy as it is.\n const turnPolicies = await this.turnAgentPolicies(params.auth);\n if (turnPolicies.unreadable !== undefined) {\n this.logger.error('[ConversationalExecution] An organization\\'s agent policy could not be read; the resume is refused rather than run untightened', {\n systemRef, executionId, approvalId: paused.approvalId, reason: turnPolicies.unreadable,\n });\n await endFailed(FlowsActors_ExecutionErrorCode.AGENT_FAILED, 'The assistant failed to produce a response.');\n return;\n }\n const pausedUnder = paused.personalDataTreatment ?? undefined;\n const currentGuardrails = this.turnGuardrailsOf(agentRef, turnPolicies);\n if (this.contentPolicyTightenedSincePause(paused, agentRef, turnPolicies)) {\n this.logger.warn('[ConversationalExecution] The organization tightened its agents\\' content policy since this call paused; the resume is refused', {\n systemRef, executionId, approvalId: paused.approvalId,\n pausedUnder: pausedUnder ?? 'none', currentTreatment: currentGuardrails?.personalData?.treatment,\n });\n await endFailed(FlowsActors_ExecutionErrorCode.CONTENT_POLICY_TIGHTENED, 'The organization tightened its content policy since this action was paused. Ask again.');\n return;\n }\n // #2292: the turn's personal-data view: the same placeholders as the turn that paused, read back from the row.\n // #3295: a resume with no view of its own (the paused tool is gone, on a denial) still holds the paused messages, so\n // it opens from their posture. From the current guardrails, a relaxed treatment would leave a later pause with none.\n const personalData = params.personalData ?? TurnPersonalDataView.open(\n pausedUnder ? this.guardrailsOfPausedPosture(paused) : currentGuardrails,\n params.initiationKind,\n params.storedPersonalDataState,\n );\n // #3295: the paused messages are in the form this treatment wrote, placeholders included, and only a guard under it\n // can read them back. So a treatment relaxed since the pause reaches the NEXT turn, not the one holding them: without\n // this the resume has no guard, and writes a placeholder into the record as if it were the value, or the SDK refuses\n // a typed field holding one. It can only hold the treatment up (the merge is tighten-only), and a treatment\n // tightened since the pause was refused above. Handed to the run on `heldPersonalDataTreatment`.\n const heldGuardrails = pausedUnder ? effectiveAgentContentGuardrails(currentGuardrails, [{ personalDataTreatment: pausedUnder }]) : currentGuardrails;\n // A second pause of this resumed turn records the looser of what its messages were built under: the paused posture\n // (the replayed messages) and the guardrails it resumes with (what it runs now, held as above, or the next resume\n // would run with no guard over the same placeholders).\n personalData.recordMessagesAlsoBuiltUnder(looserPausedPosture(pausedPostureOfGuardrails(heldGuardrails), {\n personalDataTreatment: paused.personalDataTreatment ?? null,\n personalDataReidentifiesForMachineReaders: paused.personalDataReidentifiesForMachineReaders === true,\n promptInjectionScreening: paused.promptInjectionScreening ?? null,\n }));\n const resumeToolContext = this.buildToolExecutionContext(params.auth, executionId, systemRef, params.decisionRef, {\n initiationKind: params.initiationKind,\n autonomousTrigger: params.autonomousTrigger,\n });\n // #2904: the answer's seal, beside the decision it seals, for a tool that records the decision.\n if (params.decisionSealId) resumeToolContext.decisionSealId = params.decisionSealId;\n if (personalData.table) resumeToolContext.personalDataPlaceholders = personalData.table;\n if (pausedUnder) resumeToolContext.heldPersonalDataTreatment = pausedUnder;\n // #3364 step 3: the records its owners tightened moderation for are in the replayed messages.\n if (paused.outputModerationAtPause?.length) {\n resumeToolContext.heldOutputModeration = Object.fromEntries(paused.outputModerationAtPause.map((entry) => [entry.category, entry.blockAtOrAbove]));\n }\n if (acceptedToolCallId) resumeToolContext.onFunctionToolExecuting = (toolCallId) => { if (toolCallId === acceptedToolCallId) ending.acceptedCallReached = true; };\n resumeTrace = this.openTurnTrace(systemRef, executionId, agentRef, params.emitter ?? (() => {}), params.auth?.initiatorIds?.organizationId);\n const trace = resumeTrace;\n // #1598 (I2): the resume is a separate request with no frame of its own, so its spend was uncorrelated.\n // It reopens the turn's attribution from the row: the owner's tenant, the thread's case, this execution.\n const resumeCaseRef = params.caseRef !== undefined ? params.caseRef ?? undefined : await this.readTurnCaseRef(owner, executionId, params.auth, params.resourceServerInstanceRef);\n const resumeAttribution = this.workAttributionOf(owner, executionId, resumeCaseRef, params.auth);\n // #2935: the resumed call is charged as the principal it runs as (the requester re-resolved before release), through\n // the door the turn was opened through: the agent service charges it, as it charges the turn's first call.\n const result = await this.inTurnSpendFrame(params.initiationKind, params.auth, () => runWithWorkAttributionFrame(resumeAttribution, () => this.inTurnPolicyFrame(turnPolicies, () => this.agentsBackend.invokeAgentStreaming(\n { agentRef, input: { messages: resumeMessages } } as any,\n {\n abortSignal: turnAbort.signal,\n onDelta: (delta) => {\n const released = personalData.streamDelta(delta);\n if (released.length === 0) return;\n params.emitter?.(CoreWebSocketEvent.FLOWS_ACTORS_MESSAGE, {\n systemRef, executionId, messageType: FlowsActors_MessageContentType.MARKDOWN,\n messageId: resumedAssistantMessageId,\n content: released, isFinal: false, timestamp: new Date(),\n });\n },\n // A resumed turn runs the approved tool and may call more: its trace is recorded like a fresh turn's (#2524).\n onToolEvent: (event) => trace.recordToolEvent(personalData.toolEventForReader(this.toolEventWithCredentialsWithheld(systemRef, event))),\n onReasoningDelta: (delta) => trace.recordReasoningDelta(personalData.reasoningDelta(delta)),\n onSource: trace.recordSource,\n },\n resumeToolContext,\n { sessionRef: executionId, label: `flows-actors:${systemRef}`, attribution: resumeAttribution },\n ))));\n trace.recordReasoningDelta(personalData.flushReasoning());\n const heldBack = personalData.flushStream();\n if (heldBack.length > 0) {\n params.emitter?.(CoreWebSocketEvent.FLOWS_ACTORS_MESSAGE, {\n systemRef, executionId, messageType: FlowsActors_MessageContentType.MARKDOWN,\n messageId: resumedAssistantMessageId, content: heldBack, isFinal: false, timestamp: new Date(),\n });\n }\n\n // STOPPED by its owner (#2524): CANCELLED, keeping what it did and what it had said — the same arm a fresh\n // turn takes, read from the signal we own (an aborted stream ends cleanly, it does not throw).\n if (turnAbort.signal.aborted) {\n ending.status = FlowsActors_Status.CANCELLED;\n const partial = personalData.recordReply(resumedAssistantMessageId, this.extractAssistantText(result.output));\n const cancelledAt = new Date();\n const ended = await this.finalizeTerminal(systemRef, executionId, owner, (current) => [\n ...trace.appendTo(params.transcript(current), cancelledAt),\n ...(partial.length > 0 ? [{\n id: resumedAssistantMessageId,\n role: FlowsActors_ConversationRole.ASSISTANT,\n contentType: FlowsActors_MessageContentType.MARKDOWN,\n content: partial,\n createdAt: cancelledAt,\n }] : []),\n ], { status: FlowsActors_Status.CANCELLED }, machineCredentialIdOf(params.auth), agentInstanceOf(params.resourceServerInstanceRef), { personalData });\n this.reportTurnEnd(params.emitter, systemRef, executionId, ended, () => params.emitter && this.emitTurnCancelled(params.emitter, systemRef, executionId, resumedAt));\n return;\n }\n\n // A resumed turn can suspend AGAIN — a multi-step agent may hit a second gated tool. That is\n // ordinary, not an error, so it is persisted the same way rather than recorded as completed.\n const nextSuspension = (result as { approvalSuspension?: AgentApprovalSuspension }).approvalSuspension;\n if (nextSuspension) {\n const secondPauseText = personalData.recordReply(resumedAssistantMessageId, this.extractAssistantText(result.output));\n const pauseOutcome = await this.persistApprovalSuspension({\n systemRef, executionId, owner, auth: params.auth,\n resourceServerInstanceRef: params.resourceServerInstanceRef,\n // What the resumed turn did, onto the row as it stands (#2743). This once wrote `[]` as the row's messages,\n // erasing the whole conversation the moment a resumed turn met a second gated tool; the first pause records its\n // work for the same reason: a reload during the wait must still show the thread.\n transcript: (current) => this.pausedTurnMessages(trace.appendTo(params.transcript(current)), {\n id: resumedAssistantMessageId, text: secondPauseText, data: trace.replyData(),\n }),\n personalData,\n suspension: nextSuspension,\n emitter: params.emitter ?? (() => {}),\n // A NEW decision, raised by the same requester as the first (#1594 D11): the person whose answer\n // resumed this turn never becomes its requester, so they cannot answer their own escalation.\n requester: params.requester,\n initiationKind: params.initiationKind,\n autonomousTrigger: params.autonomousTrigger,\n automaticDenials: params.automaticDenials,\n workAttribution: resumeAttribution,\n turnAbortSignal: turnAbort.signal,\n withholdCallInput: trace.withholdInput,\n turnStartedAt: resumedAt,\n // #2821: a pause in the continuation of an answered decision belongs to that decision's work.\n ...((params.workRef ?? params.decisionRef) ? { continuesWorkRef: params.workRef ?? params.decisionRef } : {}),\n });\n // #2821: the work's log follows what the attempt DID, never a later read of the row: once the pause lands, an\n // answer (an automated approver's) can release the new decision before this line, and a read would then take its\n // running continuation for an ending. RAISED and RESUMED_INLINE end nothing here (the work waits, or the inline\n // resume recorded its own ending); UNCONFIRMED records nothing (see the enum); only a pause that never happened\n // ends the work, as its exits ended the turn.\n if (pauseOutcome === PauseAttemptOutcome.ENDED_WITHOUT_PAUSE) {\n if (turnAbort.signal.aborted) {\n ending.status = FlowsActors_Status.CANCELLED;\n } else {\n // #2827: the code `endTurnWithoutPause` recorded on the row and told the client.\n ending.status = FlowsActors_Status.FAILED;\n ending.errorCode = TURN_ENDED_WITHOUT_PAUSE_CODE;\n }\n }\n return;\n }\n\n // PERSIST THE ANSWER, not just the status.\n //\n // This wrote `status` + `finishedAt` only, so the agent's reply was emitted to the live socket\n // and then dropped: a reload after a decision showed the thread with the question and no\n // answer. It matters most for a DENIAL, where the reply (\"I can't do that without approval\")\n // IS the entire outcome of the turn — the same reason the pause path persists the user's turn\n // alongside the suspension.\n const assistantText = personalData.recordReply(resumedAssistantMessageId, this.extractAssistantText(result.output));\n const finishedAt = new Date();\n const replyData = trace.replyData();\n // Onto the row as it stands (#2743): a message sent while this resumed turn ran is a sibling turn's, and stays.\n const resumedTranscript: ConversationalTurnTranscript = (current) => (assistantText.length > 0\n ? [...trace.appendTo(params.transcript(current), finishedAt), {\n id: resumedAssistantMessageId,\n role: FlowsActors_ConversationRole.ASSISTANT,\n contentType: FlowsActors_MessageContentType.MARKDOWN,\n content: assistantText,\n ...(replyData ? { data: replyData } : {}),\n createdAt: finishedAt,\n }]\n : trace.appendTo(params.transcript(current), finishedAt));\n\n const resumedRowFilter = {\n executionId, ...owner.ownerFields,\n machineCredentialId: machineCredentialIdOf(params.auth),\n resourceServerInstanceRef: agentInstanceOf(params.resourceServerInstanceRef),\n };\n // #2821: the work's ending is its own, written to `workEvents` whether or not this row write lands: an overlapping\n // turn that paused the thread refuses the row write below, and the work has finished all the same.\n ending.status = FlowsActors_Status.COMPLETED;\n const resumedCompleted = await this.writeTurnTranscript(owner, {\n ...resumedRowFilter,\n // #2721 review F-1: never over a row waiting for a decision. A message admitted while this resumed turn ran\n // starts an overlapping turn, which may pause the thread on a decision of its own.\n status: { $nin: [FlowsActors_Status.AWAITING_APPROVAL] },\n }, resumedTranscript, {\n status: FlowsActors_Status.COMPLETED,\n finishedAt,\n }, personalData);\n const waitingFor = resumedCompleted ? undefined : await this.waitingDecisionOf(owner, resumedRowFilter);\n const ended: TurnEndRecord = waitingFor === undefined ? TURN_END_RECORDED : { kind: TurnEndRecordKind.DECISION_WAITING, decisionRef: waitingFor };\n if (waitingFor !== undefined) {\n this.logger.warn('[ConversationalExecution] An overlapping turn paused the thread for a decision; the resumed turn\\'s reply is not persisted', { systemRef, executionId });\n }\n\n trace.finishReasoning();\n params.emitter?.(CoreWebSocketEvent.FLOWS_ACTORS_MESSAGE, {\n systemRef, executionId, messageType: FlowsActors_MessageContentType.MARKDOWN,\n messageId: resumedAssistantMessageId,\n content: assistantText, ...(replyData ? { data: replyData } : {}), isFinal: true, timestamp: new Date(),\n });\n // The terminal event a fresh turn emits after its final message (#2521). Without it the client\n // kept the turn RUNNING: the final MESSAGE carries the text, not the end of the turn.\n const usage = this.turnUsageShownTo(params.auth, result);\n this.reportTurnEnd(params.emitter, systemRef, executionId, ended, () => params.emitter?.(CoreWebSocketEvent.FLOWS_ACTORS_COMPLETED, {\n systemRef, executionId, status: FlowsActors_Status.COMPLETED, duration: Date.now() - resumedAt, ...(usage ? { usage } : {}),\n }));\n } catch (error) {\n // A transport that THROWS on abort (most end the stream cleanly) still reports a stop as a stop (#2524).\n if (turnAbort.signal.aborted) {\n ending.status = FlowsActors_Status.CANCELLED;\n const ended = await this.finalizeTerminal(systemRef, executionId, owner, (current) => (resumeTrace ? resumeTrace.appendTo(params.transcript(current)) : params.transcript(current)), { status: FlowsActors_Status.CANCELLED },\n machineCredentialIdOf(params.auth), agentInstanceOf(params.resourceServerInstanceRef));\n this.reportTurnEnd(params.emitter, systemRef, executionId, ended, () => params.emitter && this.emitTurnCancelled(params.emitter, systemRef, executionId, resumedAt));\n return;\n }\n if (error instanceof AgentOutputWithheldError) {\n // #2292 Phase 3: the resumed turn's output was withheld (the approved call ran; what the model wrote after it did not\n // pass). Ended FAILED under the withholding's code, as on a fresh turn.\n this.logger.warn('[ConversationalExecution] The resumed turn\\'s output was withheld by its output moderation', {\n systemRef, executionId, approvalId: paused.approvalId, code: error.code, outputKind: error.withholding.outputKind,\n });\n await endFailed(error.code, error.message);\n return;\n }\n if (agentSuspensionRefusalOf(error)?.reason === AgentSuspensionRefusalReason.SUSPENDED) {\n // #2843: the agent was suspended after the door asked (#3313), or on a denial's continuation. The decision is settled;\n // the continuation is a new model call, and the suspension refuses it before the model runs.\n this.logger.warn('[ConversationalExecution] The agent was suspended while its turn waited; the resume is refused', {\n systemRef, executionId, approvalId: paused.approvalId,\n });\n await endFailed(FlowsActors_ExecutionErrorCode.AGENT_SUSPENDED, 'This assistant has been suspended by an administrator.');\n return;\n }\n this.logger.error('[ConversationalExecution] Resumed turn failed after the approval decision', {\n systemRef, executionId, approvalId: paused.approvalId, ...projectCaughtErrorLogFields(error),\n ...(error instanceof AgentModelCallFailedError ? { statusCode: error.statusCode } : {}),\n });\n // What the turn did, onto the row as it stands: the empty list this once passed was written as the row's messages\n // and erased the whole conversation when a resumed model call threw (#2521).\n await endFailed(FlowsActors_ExecutionErrorCode.AGENT_FAILED, 'The assistant failed to produce a response.');\n } finally {\n this.unregisterRunningTurn(executionId, turnAbort);\n }\n }\n\n // ── Approve-with-modifications (#566) ──────────────────────────────────────\n\n /**\n * A modification that survived every server-side check and is ready to resume.\n *\n * Carries the rewritten array AND what the audit trail needs, because both are produced by the\n * same walk of the SDK's message array — recomputing either afterwards would mean walking it a\n * second time and could disagree with the version that was signed.\n */\n /**\n * #2292: the personal-data view of a paused turn, opened from the row its decision was read with, or `undefined` when\n * the agent that paused it can no longer be resolved (the decision is then refused or resumed without one, as before).\n */\n private personalDataViewOfPausedTurn(\n systemRef: string,\n pendingToolName: string,\n row: Pick<FlowActorExecution, 'personalDataModelState' | 'initiationKind'>,\n /**\n * #2292 R8: the treatment the turn paused under, as the pause recorded it — which an organization's policy may have\n * raised above the declaration. The view is the PAUSED turn's; a resume under a stricter policy is refused before it\n * runs on this view.\n */\n paused: Pick<FlowActorExecution_PausedApproval, 'personalDataTreatment' | 'personalDataReidentifiesForMachineReaders' | 'promptInjectionScreening'>,\n ): TurnPersonalDataView | undefined {\n const resolved = this.resolveApprovalGatedFunctionTool(systemRef, pendingToolName);\n if (resolved.kind !== GatedFunctionToolResolutionKind.FOUND) return undefined;\n return TurnPersonalDataView.open(this.guardrailsOfPausedPosture(paused), row.initiationKind, row.personalDataModelState);\n }\n\n /** The guardrails a turn paused under, as the pause recorded them: what its stored messages were built with. */\n private guardrailsOfPausedPosture(\n paused: Pick<FlowActorExecution_PausedApproval, 'personalDataTreatment' | 'personalDataReidentifiesForMachineReaders' | 'promptInjectionScreening'>,\n ): FlowsActors_AgentContentGuardrails {\n return {\n ...(paused.personalDataTreatment\n ? { personalData: { treatment: paused.personalDataTreatment, reidentifyForMachineReaders: paused.personalDataReidentifiesForMachineReaders === true } }\n : {}),\n ...(paused.promptInjectionScreening ? { promptInjection: { screening: paused.promptInjectionScreening } } : {}),\n };\n }\n\n /**\n * #2292 R8: the agent policies of the organizations this turn acts for — the caller's organization, and each\n * representing organization it stands there through — read once for the turn. When one could not be read the lookup\n * says so (`unreadable`): the turn refuses, and the frame carries the same lookup, so the agent service refuses the\n * call too rather than read again or run it untightened.\n */\n private async turnAgentPolicies(auth: SocketAuthResult | undefined): Promise<AgentPolicyLookup> {\n return readAgentPolicies(this.repositoriesRegistry, this.turnOrganizationIdsOf(auth));\n }\n\n /** The organizations a turn acts for: its own, and each representing organization it stands there through. */\n private turnOrganizationIdsOf(auth: SocketAuthResult | undefined) {\n const organizationId = auth?.initiatorIds?.organizationId ?? undefined;\n return turnPolicyOrganizationIds(organizationId, resolveRepresentingOrganizationIdsInOrganization(auth?.initiatorRoles, organizationId));\n }\n\n /**\n * #2292 R8: whether the policies as they are now are stricter than the ones a call paused under. The paused call carries\n * what its tools returned under that treatment, so a resume under a stricter one would send the model what that one\n * withholds. Asked at the door of an approval (#3313) and again by the resume, which may run later.\n */\n private contentPolicyTightenedSincePause(paused: FlowActorExecution_PausedApproval, agentRef: string, policies: AgentPolicyLookup): boolean {\n const pausedUnder = paused.personalDataTreatment ?? undefined;\n const current = this.turnGuardrailsOf(agentRef, policies);\n // The machine-reader half is asked only while a treatment is still current: a relax to no treatment is no tightening.\n const machineReadersNowKeepPlaceholders = pausedUnder !== undefined && paused.personalDataReidentifiesForMachineReaders === true\n && current?.personalData?.treatment !== undefined && current.personalData.reidentifyForMachineReaders !== true;\n // The paused messages carry its tool results as its model read them; screened then, or they reach the model unscreened.\n const screeningNowOn = current?.promptInjection?.screening !== undefined && !paused.promptInjectionScreening;\n return isStricterPersonalDataTreatment(current?.personalData?.treatment, pausedUnder) || machineReadersNowKeepPlaceholders || screeningNowOn;\n }\n\n /** #2292 R8: an agent's guardrails under the turn's policies: its declaration, tightened by each. */\n private turnGuardrailsOf(agentRef: string, policies: AgentPolicyLookup): FlowsActors_AgentContentGuardrails | undefined {\n const declared = this.flowsActorsRegistry.getAgent(agentRef)?.contentGuardrails;\n return policies.unreadable === undefined && policies.policies.length > 0 ? effectiveAgentContentGuardrails(declared, policies.policies) : declared;\n }\n\n /**\n * #2292 R8: run the agent call inside the turn's policy frame — an unreadable result included, so the agent service\n * refuses the call on THIS reading (before any model call, through the turn's failure path) instead of reading again.\n */\n private inTurnPolicyFrame<T>(policies: AgentPolicyLookup, fn: () => T): T {\n return runWithAgentPolicyFrame(policies, fn);\n }\n\n private async prepareApprovedToolCallModification(params: {\n systemRef: string;\n executionId: string;\n paused: FlowActorExecution_PausedApproval;\n modifiedToolArgs: Record<string, unknown>;\n /** #3192: a person reviewing the call edited it, as opposed to answering a question it asked. */\n reviewerEdited: boolean;\n /**\n * #2292/#2855: the paused turn's view. Under any treatment the rewritten call is marked person-authored, so the model\n * is sent its personal arguments treated; under `TOKENIZE` the executed copy also carries them as placeholders.\n */\n personalData?: TurnPersonalDataView;\n }): Promise<ToolCallModificationPreparation> {\n const { paused, modifiedToolArgs } = params;\n\n /*\n * The agent, and the FunctionTool behind the name the model was shown.\n *\n * A gated tool is always a FunctionTool: `requiresHumanApproval` is declared on that interface\n * and nothing else contributes to the approval-gated set — an MCP tool is discovered from a\n * server at turn start and no author can gate one. So a pending approval whose tool this cannot\n * find is a disagreement between the paused row and the live registry, not an unsupported case.\n */\n const resolved = this.resolveApprovalGatedFunctionTool(params.systemRef, paused.pendingToolName);\n if (resolved.kind !== GatedFunctionToolResolutionKind.FOUND) return this.goneCallRefusal(resolved, paused.pendingToolName);\n const { functionTool } = resolved;\n // The agent the tool was resolved THROUGH — the resumed turn runs on it, so it comes from the same lookup.\n const { agentRef } = resolved;\n if (!resolveFunctionToolApprovalGate(functionTool)) {\n // Not pedantry: it means the registry no longer gates this tool, so the resumed turn would run\n // arguments a human authored under a gate that has since been removed.\n return { kind: ToolApprovalModificationOutcomeKind.REFUSED, message: `The tool \"${paused.pendingToolName}\" no longer requires approval, so this pending decision is stale. Deny it and ask again.`, refusal: { reason: FlowsActors_ApprovalModificationRefusalReason.TOOL_NO_LONGER_GATED, toolName: paused.pendingToolName } };\n }\n\n // #3314: a secret is not a tool argument. Whatever the treatment, a call's arguments are kept on the paused row, in the\n // transcript's tool trace and in the agent-work record, and under `REMOVE` or none the executed copy holds them as\n // typed, so a credential typed here would be stored at rest, three times. Refused for every agent rather than for the\n // treatments that happened to leak, and before the schema reads the value, whose error text could quote it. It reads\n // what the field is DECLARED to be, on the tool's schema and every schema of its resource, at any depth: free text\n // nothing classifies is outside what any check can see (#3325).\n // Rejected: scrubbing the copies afterwards, which leaves a secret to be found in every store a later feature adds.\n const typedCredentials = editedCredentialPaths(modifiedToolArgs, paused.pendingToolArgs, [functionTool.inputSchema, ...(this.argumentResourceSchemasOf(functionTool) ?? [])]).sort();\n if (typedCredentials.length > 0) {\n // #3317: leaving it out cannot help where the tool requires it.\n const requiredCredentials = await this.credentialsNobodyCanSupply(functionTool, (paused.pendingToolArgs ?? {}) as Record<string, unknown>, typedCredentials);\n if (requiredCredentials.length > 0) return this.argumentsFinalRefusal(paused.pendingToolName, requiredCredentials);\n return this.callCannotRunRefusal(\n `A credential cannot be typed into \"${paused.pendingToolName}\": ${typedCredentials.join(', ')}. The approval is still pending: leave it out, or deny it.`,\n { reason: FlowsActors_ApprovalModificationRefusalReason.CREDENTIAL_NOT_ACCEPTED, toolName: paused.pendingToolName, argumentPaths: typedCredentials },\n HumanDecision_RefusalReason.CREDENTIAL_NOT_ACCEPTED,\n );\n }\n\n /*\n * Step 2 of the issue's order: the SERVER validates, against the tool's OWN schema.\n *\n * The browser's validation is a convenience — an approver editing a call is authoring a call the\n * agent never proposed, and the only schema that can judge it is the one the tool declares. The\n * SDK re-validates too (`validate-tool-approvals.ts` throws `InvalidToolInputError`), so this is\n * not what makes it SAFE; it is what makes it USABLE. Its refusal arrives while the pause is\n * still standing and names the offending argument, whereas the SDK's arrives mid-resume as an\n * exception, which reaches a person as a turn that died.\n *\n * The RAW edit is what gets validated, written and signed — never the parse OUTPUT. A schema\n * with a transform would otherwise make the persisted arguments something the approver did not\n * type, and it keeps an approver's input treated exactly like a model's. #3295 holds that to what\n * runs: an edit that is not its own parse is refused below, once it is known to be an edit.\n */\n // An approver's edit arrives as JSON, like a model's call (#3478): validated against the tool schema's JSON form.\n const validation = await jsonParsingSchemaOf(functionTool.inputSchema).safeParseAsync(modifiedToolArgs);\n if (!validation.success) {\n const detail = validation.error.issues\n .map((issue) => `${issue.path.join('.') || '(root)'}: ${issue.message}`)\n .join('; ');\n return { kind: ToolApprovalModificationOutcomeKind.REFUSED, message: `Those arguments are not valid for \"${paused.pendingToolName}\" — ${detail}. The approval is still pending: correct them, or approve the call as proposed.`, refusal: {\n reason: FlowsActors_ApprovalModificationRefusalReason.ARGUMENTS_INVALID,\n toolName: paused.pendingToolName,\n // Paths only: the issue MESSAGES are Zod's English, and the values are what the approver typed.\n argumentPaths: [...new Set(validation.error.issues.map((issue) => issue.path.join('.') || '(root)'))],\n } };\n }\n\n const signingKey = this.agentsBackend.resolveToolApprovalSigningKey();\n if (!signingKey) {\n // Unreachable while the turn is running — a turn with an approval-gated tool is refused\n // outright when the key cannot be derived — but stated rather than assumed, because signing\n // with nothing would silently produce an approval the SDK refuses at resume.\n return { kind: ToolApprovalModificationOutcomeKind.REFUSED, message: 'The approval-signing key is not configured, so a modified call cannot be re-bound to this approval. Approve the call as proposed, or deny it.', refusal: { reason: FlowsActors_ApprovalModificationRefusalReason.SIGNING_KEY_NOT_CONFIGURED } };\n }\n\n // #2292/#2855: what the MODEL is sent of the person's arguments, by the one treatment every record field goes through\n // (`PersonalDataGuard.treatAuthoredArguments`), on the resource the tool's guarded arguments are re-identified into\n // (`personalDataArgumentsResourceOf`, #2848). Two halves, because the SDK EXECUTES the call it finds in the messages:\n // - the rewritten call is MARKED person-authored under any treatment, and every model step of the resume is sent its\n // personal arguments treated (`modelCopyOfPersonAuthoredToolCalls`, at the agent service's model boundary). Under\n // `REMOVE` that is the only treatment: a withheld marker cannot be executed, signed or stored, so the executed copy\n // keeps the approver's values and the model reads `⟦withheld:…⟧`. Before #2855 nothing treated it, and the resumed\n // model call received the value the approver typed in clear;\n // - under `TOKENIZE` the executed copy carries placeholders too, as the model's own proposal did: a value the approver\n // kept is the same placeholder and reads as unchanged, a value they typed is a new one the conversation stores, and\n // the resumed tool puts them back before it runs.\n // The approver read and validated the real values either way.\n const recordsResource = personalDataArgumentsResourceOf(functionTool);\n const treatment = params.personalData?.treatment;\n const table = params.personalData?.table;\n // The guard the resume runs under: the paused treatment, which `runResumeAfterApproval` holds the turn to (#3295).\n const runGuard = this.pausedCallGuard(treatment, table);\n const tokenizer = table ? runGuard : undefined;\n // #3315: what the person kept is the model's, in the model's form, so re-identifying it for the card did not hand it back.\n // Only a reviewer's edit. A question's answers are the person's own, even where the model wrote some of its own in that\n // place, which the tool's description tells it not to and its schema allows; what the question asked is already in the\n // model's form.\n const keptInModelForm = table && params.reviewerEdited\n ? withKeptStringsInModelForm(modifiedToolArgs, pendingToolCallInputOf(paused.sdkModelMessages, paused.approvalId), (value) => table.reidentifyDeep(value) as string)\n : modifiedToolArgs;\n const modifiedInput = tokenizer && recordsResource !== undefined\n ? tokenizer.treatAuthoredArguments(keptInModelForm, tokenizer.personalFieldsOf(recordsResource))\n : keptInModelForm;\n const applied = applyModifiedToolApprovalInput({\n sdkModelMessages: paused.sdkModelMessages,\n approvalId: paused.approvalId,\n modifiedInput,\n signingKey,\n ...(params.reviewerEdited ? { reviewerEdit: { isDeclaredArgument: declaredArgumentPredicateOf(functionTool.inputSchema) } } : {}),\n ...(treatment !== undefined && recordsResource !== undefined ? { personAuthoredArgumentsResourceType: recordsResource } : {}),\n });\n if (applied.kind === ToolApprovalModificationOutcomeKind.REFUSED) {\n this.logger.error('[ConversationalExecution] A paused turn\\'s resume payload does not contain the call its approval names', {\n systemRef: params.systemRef, executionId: params.executionId,\n approvalId: paused.approvalId, refusal: applied.refusal, detail: applied.detail,\n });\n return { kind: ToolApprovalModificationOutcomeKind.REFUSED, message: 'This pending call could not be rewritten with your arguments. Approve it as proposed, or deny it.', refusal: { reason: FlowsActors_ApprovalModificationRefusalReason.CALL_NOT_REWRITABLE } };\n }\n\n /*\n * Nothing changed, so nothing is a modification.\n *\n * An approver who opens the editor, changes their mind and approves has approved the call as\n * proposed — resuming through the rewritten array would still be correct (the signature is over\n * identical bytes), but it would put a row on the audit trail claiming a person authored\n * arguments they did not, which is the one thing this event exists to mean.\n */\n if (applied.modifiedArgumentKeys.length === 0) {\n return { kind: ToolApprovalModificationOutcomeKind.UNCHANGED };\n }\n\n /*\n * #3295: an edit runs exactly as written, or it is refused here, while the pause stands.\n *\n * The decision settles BEFORE the resume, and two things can still stop or change the call after it: the SDK, which runs\n * a value only if its schema parses it to itself, and `execute`, which under a guard puts placeholders back and parses\n * again. So an edit either of them would refuse used to be recorded as accepted and then not run, and one `execute`\n * would rewrite ran as something other than what was sealed. This is the last moment that can be told to the person, so\n * the door REHEARSES both, with their own code, on the copy the SDK will execute, and requires what `execute` would\n * receive to be `modifiedToolArgs`, which is what the seal, the agent-work record and the reach check of #2734 read. It\n * rehearses under the paused treatment, which the resume is held to (`heldPersonalDataTreatment`).\n *\n * Comes after UNCHANGED on purpose: an edit that resolved to the proposal is an approval of the proposal, which\n * `proposedCallRefusal` rehearses on the SDK's own pair, and a kept value need not be a fixed point (a transform the\n * model's raw input went through).\n *\n * Rejected: writing the SDK's pair instead (`inputSchemaInput` = the edit, the call's input = its parse). That runs, but\n * it runs and seals values the approver never wrote, which is the divergence this exists to remove.\n *\n * This covers the ARGUMENTS. A resume can still end before the call runs for other reasons (the exits of\n * `runResumeAfterApproval`, #3313), and a tool can fail once it runs.\n */\n const rehearsal = await rehearsedToolArguments(functionTool, runGuard, modifiedInput);\n const notRunAsWritten = await argumentsNotRunAsWritten(sdkInputSchemaOfFunctionTool(functionTool, runGuard), modifiedInput)\n ?? ('refusedArguments' in rehearsal ? rehearsal.refusedArguments : argumentsRunOtherwiseThanWritten(rehearsal.ran, modifiedToolArgs));\n if (notRunAsWritten) return this.notRunAsWrittenRefusal(paused.pendingToolName, notRunAsWritten, await this.noValueCouldRun(functionTool, (paused.pendingToolArgs ?? {}) as Record<string, unknown>, modifiedToolArgs, notRunAsWritten));\n\n return {\n kind: ToolApprovalModificationOutcomeKind.MODIFIED,\n modification: {\n agentRef,\n sdkModelMessages: applied.sdkModelMessages,\n toolName: applied.toolName,\n modifiedArgumentKeys: applied.modifiedArgumentKeys,\n },\n };\n }\n\n /** #3295: a guard over the paused turn's table, or a fresh one under `REMOVE`, which keeps none. `undefined` under no treatment. */\n private pausedCallGuard(treatment: FlowsActors_PersonalDataModelTreatment | undefined, table: PersonalDataPlaceholderTable | undefined): PersonalDataGuard | undefined {\n if (treatment === undefined) return undefined;\n return new PersonalDataGuard(treatment, table ?? new PersonalDataPlaceholderTable(), (resourceType) => this.resourcesRegistry.tryGetResourceConfiguration(resourceType as never) as never);\n }\n\n /**\n * #3295: the refusal of a call that would not run as the person read it. Names only, so no value reaches a log or a card.\n * #3317: or, when `final`, of one nothing they could enter would let run, which must not ask them to correct it.\n */\n private notRunAsWrittenRefusal(toolName: string, argumentNames: string[], final = false): ToolCallRefusal {\n return final\n ? this.argumentsFinalRefusal(toolName, argumentNames)\n : this.callCannotRunRefusal(\n `\"${toolName}\" would not run these arguments as written: ${argumentNames.join(', ')}. The approval is still pending: correct them, or deny it.`,\n { reason: FlowsActors_ApprovalModificationRefusalReason.ARGUMENTS_NOT_RUN_AS_WRITTEN, toolName, argumentPaths: argumentNames },\n );\n }\n\n private argumentsFinalRefusal(toolName: string, argumentNames: string[]): ToolCallRefusal {\n return this.callCannotRunRefusal(\n `\"${toolName}\" cannot run with these arguments, whatever is entered: ${argumentNames.join(', ')}. Deny it, and ask again.`,\n { reason: FlowsActors_ApprovalModificationRefusalReason.ARGUMENTS_CANNOT_BE_CORRECTED, toolName, argumentPaths: argumentNames },\n HumanDecision_RefusalReason.ARGUMENTS_CANNOT_BE_CORRECTED,\n );\n }\n\n /** #3316: a refusal as the outcome a door with no error payload reads: its reason, and the arguments it is about, by name. */\n private refusedOutcomeOf(refused: ToolCallRefusal): HumanDecision_ActOutcome {\n const argumentNames = refused.refusal.argumentPaths;\n return {\n kind: HumanDecision_ActOutcomeKind.MODIFICATION_REJECTED,\n ...(refused.humanDecisionRefusalReason ? { reason: refused.humanDecisionRefusalReason } : {}),\n ...(argumentNames?.length ? { argumentNames: [...argumentNames] } : {}),\n };\n }\n\n /**\n * #3317: the credentials of `paths` the call cannot do without and the person cannot supply: what they were shown holds none\n * there (nothing, or a marker), and the tool's schema asks for one. A value they were shown can be kept, and an optional\n * parent left out, so neither is final.\n */\n private async credentialsNobodyCanSupply(functionTool: FunctionTool, shown: Record<string, unknown>, paths: readonly string[]): Promise<string[]> {\n const required = await Promise.all(paths.map(async (path) => {\n if (!isWithheldOrAbsentAt(shown, path)) return false;\n const parsed = await jsonParsingSchemaOf(functionTool.inputSchema).safeParseAsync(withoutArgumentAt(shown, path)).catch(() => undefined);\n return parsed !== undefined && !parsed.success && parsed.error.issues.some((issue) => issue.path.join('.') === path);\n }));\n return paths.filter((_path, index) => required[index]);\n }\n\n /**\n * #3317: whether nothing the person could enter would let these refused arguments run, on evidence and not by assumption,\n * because the refusal then stops asking them to correct anything. Two kinds of evidence: the tool REQUIRES a credential the\n * person cannot supply (#3314); or its schema keeps rewriting what the person reads, so no value survives the second parse\n * a guard makes (`schemaKeepsRewriting`). Anything else stays a call they can correct. `read` is the arguments as the\n * person read or wrote them.\n */\n private async noValueCouldRun(functionTool: FunctionTool, shown: Record<string, unknown>, read: Record<string, unknown>, names: readonly string[]): Promise<boolean> {\n const schemas = [functionTool.inputSchema, ...(this.argumentResourceSchemasOf(functionTool) ?? [])];\n const untypeable = names.filter((name) => editedCredentialPaths({ [name]: 'any value' }, undefined, schemas).length > 0);\n if ((await this.credentialsNobodyCanSupply(functionTool, shown, untypeable)).length > 0) return true;\n return schemaKeepsRewriting(functionTool.inputSchema, read);\n }\n\n /** #3313: the refusal of a call whose agent or tool is gone since the pause, edited or not. */\n private goneCallRefusal(resolved: Exclude<GatedFunctionToolResolution, { kind: GatedFunctionToolResolutionKind.FOUND }>, toolName: string): ToolCallRefusal {\n return resolved.kind === GatedFunctionToolResolutionKind.AGENT_MISSING\n ? this.callCannotRunRefusal('The agent that raised this approval is no longer registered, so this call cannot run. Deny it, and ask again.', { reason: FlowsActors_ApprovalModificationRefusalReason.AGENT_NOT_REGISTERED }, HumanDecision_RefusalReason.CALL_CANNOT_RUN)\n : this.callCannotRunRefusal(`The agent no longer declares the tool \"${toolName}\", so this call cannot run. Deny it, and ask again.`, { reason: FlowsActors_ApprovalModificationRefusalReason.TOOL_NOT_DECLARED, toolName }, HumanDecision_RefusalReason.CALL_CANNOT_RUN);\n }\n\n /**\n * #3313: why an approved call could not run as things stand, whatever its arguments, or `undefined` when it can: the\n * questions the resume would ask, asked of the requester whose turn resumes, so the person is told while the decision\n * stands instead of an acceptance being recorded for a turn bound to fail. Each is the resume's own reading (the same\n * resolution, the same policy comparison, the agent service's admission), and a record that cannot be read refuses, as\n * it would refuse the call.\n */\n private async approvedCallCannotRunRefusal(\n systemRef: string,\n paused: FlowActorExecution_PausedApproval,\n requesterAuth: SocketAuthResult | undefined,\n initiationKind: FlowActorExecution['initiationKind'],\n ): Promise<ToolCallRefusal | undefined> {\n const toolName = paused.pendingToolName;\n const resolved = this.resolveApprovalGatedFunctionTool(systemRef, toolName);\n if (resolved.kind !== GatedFunctionToolResolutionKind.FOUND) return this.goneCallRefusal(resolved, toolName);\n // The route a tool declares is read again for the resumed turn, and a route that no longer admits a decision for this\n // requester has the SDK deny the call a person just accepted (`buildToolApprovalConfiguration`).\n const gate = resolveFunctionToolApprovalGate(resolved.functionTool);\n if (gate && !admitsDecisionSuspension({ executionType: requesterAuth?.executionType, initiationKind, routeKind: gate.route })) {\n return this.callCannotRunRefusal(\n `The way \"${toolName}\" is approved has changed since this action was paused, so it cannot run. Deny it, and ask again.`,\n { reason: FlowsActors_ApprovalModificationRefusalReason.APPROVAL_ROUTE_CHANGED, toolName },\n HumanDecision_RefusalReason.CALL_CANNOT_RUN,\n );\n }\n const unreadable = () => this.callCannotRunRefusal(\n 'What this assistant answers to could not be read, so this call cannot run now. The approval is still pending: try again, or deny it.',\n { reason: FlowsActors_ApprovalModificationRefusalReason.AGENT_STANDING_UNREADABLE, toolName },\n HumanDecision_RefusalReason.CALL_CANNOT_RUN,\n );\n const policies = await this.turnAgentPolicies(requesterAuth);\n if (policies.unreadable !== undefined) return unreadable();\n if (this.contentPolicyTightenedSincePause(paused, resolved.agentRef, policies)) {\n return this.callCannotRunRefusal(\n 'The organization tightened its content policy since this action was paused, so it cannot run. Deny it, and ask again.',\n { reason: FlowsActors_ApprovalModificationRefusalReason.CONTENT_POLICY_TIGHTENED, toolName },\n HumanDecision_RefusalReason.CALL_CANNOT_RUN,\n );\n }\n const admission = await this.agentsBackend.readCallAdmission(resolved.agentRef, this.turnOrganizationIdsOf(requesterAuth));\n switch (admission) {\n case AgentCallAdmission.ADMITTED: return undefined;\n case AgentCallAdmission.UNREADABLE: return unreadable();\n case AgentCallAdmission.SUSPENDED: return this.callCannotRunRefusal(\n 'This assistant has been suspended by an administrator, so this call cannot run. Deny it, or answer once it is back.',\n { reason: FlowsActors_ApprovalModificationRefusalReason.AGENT_SUSPENDED, toolName },\n HumanDecision_RefusalReason.CALL_CANNOT_RUN,\n );\n case AgentCallAdmission.AGENT_NOT_ACTIVE: return this.callCannotRunRefusal(\n 'This assistant is no longer active, so this call cannot run. Deny it, and ask again.',\n { reason: FlowsActors_ApprovalModificationRefusalReason.AGENT_NOT_ACTIVE, toolName },\n HumanDecision_RefusalReason.CALL_CANNOT_RUN,\n );\n }\n }\n\n private callCannotRunRefusal(\n message: string,\n refusal: WS_FlowsActorsApprovalModificationRefusal,\n humanDecisionRefusalReason: HumanDecision_RefusalReason = HumanDecision_RefusalReason.CALL_NOT_RUN_AS_READ,\n ): ToolCallRefusal {\n return { kind: ToolApprovalModificationOutcomeKind.REFUSED, message, refusal, humanDecisionRefusalReason };\n }\n\n /** The schemas of the resource a tool's arguments describe; `undefined` when it names one that cannot be read. */\n private argumentResourceSchemasOf(functionTool: FunctionTool): readonly unknown[] | undefined {\n const resourceType = personalDataArgumentsResourceOf(functionTool);\n if (resourceType === undefined) return [];\n try {\n const configuration = this.resourcesRegistry.tryGetResourceConfiguration(resourceType as never);\n return configuration?.mainSchema ? [configuration.mainSchema, ...resourceInheritanceVariantSchemas(configuration.inheritenceSchemaDefinition as never)] : undefined;\n } catch {\n return undefined;\n }\n }\n\n /**\n * #3295: the same rehearsal for a call approved as the model proposed it (or an edit that resolved to that). The SDK is\n * asked its own question of the stored pair, since a parse output that did not survive the pause's JSON no longer equals\n * the call; and `execute` of the proposal, which can refuse a `⟦withheld:…⟧` marker or a placeholder that cannot be put\n * back, and under a guard parses a value already parsed, so a transform would run something other than the card shows.\n * Each would be recorded as accepted and not run, or run differently. Editing the value is a real remedy.\n */\n private async proposedCallRefusal(systemRef: string, paused: FlowActorExecution_PausedApproval, personalData: TurnPersonalDataView | undefined) {\n const resolved = this.resolveApprovalGatedFunctionTool(systemRef, paused.pendingToolName);\n // A tool or agent gone since the pause is not an argument: the door refuses it after the requester's standing (#3313).\n if (resolved.kind !== GatedFunctionToolResolutionKind.FOUND) return undefined;\n const proposal = pendingToolCallInputOf(paused.sdkModelMessages, paused.approvalId);\n if (!proposal) return undefined;\n const runGuard = this.pausedCallGuard(personalData?.treatment, personalData?.table);\n const refused = await argumentsNotRunAsWritten(\n sdkInputSchemaOfFunctionTool(resolved.functionTool, runGuard),\n pendingToolCallSchemaInputOf(paused.sdkModelMessages, paused.approvalId, proposal),\n proposal,\n );\n const rehearsal = await rehearsedToolArguments(resolved.functionTool, runGuard, proposal);\n const named = refused ?? ('refusedArguments' in rehearsal\n ? rehearsal.refusedArguments\n : argumentsRunOtherwiseThanWritten(rehearsal.ran, rehearsal.readAs as Record<string, unknown>));\n return named ? this.notRunAsWrittenRefusal(paused.pendingToolName, named, await this.noValueCouldRun(resolved.functionTool, (paused.pendingToolArgs ?? proposal) as Record<string, unknown>, (paused.pendingToolArgs ?? proposal) as Record<string, unknown>, named)) : undefined;\n }\n\n // ── Internals ──────────────────────────────────────────────────────────────\n\n /**\n * Resolve the target system as an ACTOR system. If it is a FLOW system, fail\n * closed with a typed \"not implemented\" (v1 has no flow conversational\n * runtime); if it does not exist at all, report not-found.\n */\n private resolveConversationalActorSystem(\n systemRef: string,\n executionId: string,\n emitter: FlowsActorsExecutionEmitter,\n ): ActorSystem | undefined {\n const resolved = this.conversationalActorSystemOf(systemRef);\n if (resolved.refusal) {\n this.emitError(emitter, systemRef, executionId, resolved.refusal.errorCode, resolved.refusal.errorMessage);\n return undefined;\n }\n return resolved.actorSystem;\n }\n\n /**\n * The same resolution, answering the refusal instead of emitting it, for a turn that reports its own end: a resumed\n * turn records FAILED first and then reports either this refusal or the decision that now holds the thread, never\n * both (#2721 re-review R-1).\n */\n private conversationalActorSystemOf(systemRef: string): ConversationalActorSystemResolution {\n const actor = this.flowsActorsRegistry.getSystem(systemRef, FlowActorSystem_Kind.ACTOR);\n if (actor) return { actorSystem: actor as ActorSystem };\n\n if (this.flowsActorsRegistry.getSystem(systemRef, FlowActorSystem_Kind.FLOW)) {\n return { refusal: { errorCode: FlowsActors_ExecutionErrorCode.FLOW_CONVERSATION_NOT_IMPLEMENTED, errorMessage: `System '${systemRef}' is a FLOW system; conversational execution of flows is not yet implemented.` } };\n }\n return { refusal: { errorCode: FlowsActors_ExecutionErrorCode.SYSTEM_NOT_FOUND, errorMessage: `No actor system registered for ref '${systemRef}'.` } };\n }\n\n /**\n * The budget a turn of `agentRef`'s conversation replays its transcript within (#2750): from the agent's model's\n * documented limits when it is an LLM-arm agent on a catalog model, otherwise the framework floor; less the agent's own\n * authored prompt material (`promptSpec`), which the system prompt is compiled from and which rides every call.\n */\n private conversationReplayBudgetOf(agentRef: string): ConversationReplayBudget {\n const agent = this.flowsActorsRegistry.getAgent(agentRef);\n // An agent with no config arm (a registry entry being replaced, a test double) is not an LLM-arm agent: the floor applies.\n const llmConfig = agent?.config && isLLMAgentConfiguration(agent.config) ? agent.config : undefined;\n // A registry provider's model states its limits in the provider's declaration, not in the engine's catalog (#2750).\n const declaredLimits = llmConfig?.model && llmConfig.providerRef && !isLLMCatalogModel(llmConfig.model)\n ? this.flowsActorsRegistry.declaredModelContextLimits(agentRef, llmConfig.providerRef, llmConfig.model)\n : undefined;\n return conversationReplayBudget({\n model: llmConfig?.model,\n ...(typeof llmConfig?.maxTokens === 'number' ? { configuredMaxOutputTokens: llmConfig.maxTokens } : {}),\n ...(declaredLimits ? { declaredLimits } : {}),\n promptOverheadText: agent?.promptSpec ? JSON.stringify(agent.promptSpec) : '',\n });\n }\n\n /** Pick the agent-backed actor to converse with (first AGENTIC actor with an agentRef). */\n private resolveChatAgentRef(actorSystem: ActorSystem): string | undefined {\n return chatAgentRefOfActorSystem(actorSystem);\n }\n\n /** Read the user's turn from the free-form start input (`message` or `prompt`). */\n private extractUserText(initialInput?: Record<string, unknown>): string | undefined {\n if (!initialInput) return undefined;\n const candidate = initialInput.message ?? initialInput.prompt;\n if (typeof candidate === 'string' && candidate.trim().length > 0) return candidate;\n return undefined;\n }\n\n /**\n * The resource a tool READS, when it is one of the engine's resource-read function tools — whose\n * name the engine itself mints from `resource.<resourceType>.read` (the provider may rewrite the\n * dots to underscores). Answers the resource TYPE, an identifier the browser resolves to the\n * resource's authored title; `undefined` for every other tool.\n *\n * It used to answer WORDS — \"Looking up your todos…\", humanized from the same match — which no\n * translator could reach (#1283).\n */\n private resourceTypeReadByTool(toolName: string): string | undefined {\n // One reading of the name, shared with the agent operation record (#2841).\n return resourceTypeReadByToolName(toolName);\n }\n\n /**\n * The recorder of one turn's work (#2524), for the agent answering it: its reasoning is shown only when that agent\n * declares it (`FlowsActors_Agent.disclosure.reasoning`), read here rather than passed down so every turn — fresh or\n * resumed — reads the same declaration.\n */\n private openTurnTrace(\n systemRef: string, executionId: string, agentRef: string, emitter: FlowsActorsExecutionEmitter,\n /** The organization the turn's tools read in (`buildToolExecutionContext`): where a show-records call read its records. */\n toolsOrganizationId?: string,\n ): ConversationalTurnTrace {\n return new ConversationalTurnTrace({\n systemRef,\n executionId,\n emitter,\n showsReasoning: this.flowsActorsRegistry.getAgent(agentRef)?.disclosure?.reasoning === true,\n readsResourceTypeOf: (toolName) => this.resourceTypeReadByTool(toolName),\n presentsRecordsOf: (toolName) => this.functionToolOfAgent(agentRef, toolName)?.presentsRecords === true,\n ...(toolsOrganizationId ? { toolsOrganizationId } : {}),\n });\n }\n\n /**\n * The registered function tool an agent's model calls under `toolName`, read from the agent's own grants: the same\n * reverse lookup a paused call resolves through (`resolveApprovalGatedFunctionTool`), for the agent answering now.\n */\n private functionToolOfAgent(agentRef: string, toolName: string): FunctionTool | undefined {\n const functionRef = (this.flowsActorsRegistry.getAgent(agentRef)?.capabilities?.tools?.functionRefs ?? [])\n .find((ref) => modelToolNameForFunctionRef(ref) === toolName);\n return functionRef ? this.flowsActorsRegistry.getFunctionTool(functionRef) : undefined;\n }\n\n /**\n * Tell the watcher a turn ended because it was stopped (#2524): `FLOWS_ACTORS_COMPLETED` with status CANCELLED.\n *\n * Every cancel arm used to record CANCELLED on the row and emit nothing, so the person who stopped a turn kept\n * watching one that would never end — the defect #2521 closed for a resumed turn, on the cancel path.\n */\n private emitTurnCancelled(emitter: FlowsActorsExecutionEmitter, systemRef: string, executionId: string, startedAt: number): void {\n emitter(CoreWebSocketEvent.FLOWS_ACTORS_COMPLETED, {\n systemRef, executionId, status: FlowsActors_Status.CANCELLED, duration: Date.now() - startedAt,\n });\n }\n\n /**\n * The tokens a turn spent, for its COMPLETED event — only when the person may read model cost (#2524).\n *\n * The roles that read it are `MODEL_COST_READ_ROLES`, held at APPLICATION scope (the same test the cost summary route\n * applies, so a role key typed into an organization membership does not count). A run's reader is told its tokens on\n * the run's page (#2574, decided B, `modelUsageDisclosureOf`); this live line reaches whoever is chatting, end users\n * included, which that decision did not cover, so it keeps the narrower audience. `undefined` too when the agent\n * reported no usage.\n */\n private turnUsageShownTo(auth: SocketAuthResult | undefined, result: unknown): WS_FlowsActorsTurnUsage | undefined {\n // The one rule for who reads model usage, shared with the cost summary and an execution's usage (#2528).\n if (!auth || !callerReadsModelCost(auth, this.authorizer)) return undefined;\n const usage = (result as { executionContext?: { usage?: Record<string, unknown> } } | undefined)?.executionContext?.usage;\n if (!usage) return undefined;\n const count = (value: unknown): number | undefined => (typeof value === 'number' && Number.isFinite(value) && value >= 0 ? Math.round(value) : undefined);\n const shown: WS_FlowsActorsTurnUsage = {\n ...(count(usage.promptTokens) !== undefined ? { inputTokens: count(usage.promptTokens) } : {}),\n ...(count(usage.completionTokens) !== undefined ? { outputTokens: count(usage.completionTokens) } : {}),\n ...(count(usage.reasoningTokens) !== undefined ? { reasoningTokens: count(usage.reasoningTokens) } : {}),\n ...(count(usage.totalTokens) !== undefined ? { totalTokens: count(usage.totalTokens) } : {}),\n };\n return Object.keys(shown).length > 0 ? shown : undefined;\n }\n\n /**\n * #2935: run `fn` in the turn's SPEND frame: its door and the principal it runs as. Every model call `fn` makes (the\n * turn's own, a tool's nested agent, the form a paused question is composed through) is charged by the agent service\n * to the allowance that door and principal draw on, the first call and every resume alike (#1855: one mechanism).\n * Before #2935 the runtime reported each invocation's usage itself, which reached only the invocations it made.\n *\n * A row that recorded no door (written before doors were recorded) runs OUTSIDE any spend frame, an outer one\n * included: its calls are charged to the organization its work is attributed to, as a call outside any door is, and\n * never inherit an outer door's per-call refusal.\n */\n private inTurnSpendFrame<T>(initiationKind: FlowsActors_InitiationKind | null | undefined, auth: SocketAuthResult | undefined, fn: () => T): T {\n if (!initiationKind || !auth) return runOutsideModelSpendFrame(fn);\n return runWithModelSpendFrame({ door: modelSpendDoorOfInitiationKind(initiationKind), auth }, fn);\n }\n\n /** Normalize the agent output (chat `{message:{content}}` or text `{text}`) to a string. */\n private extractAssistantText(output: unknown): string {\n if (typeof output === 'string') return output;\n if (output && typeof output === 'object') {\n const record = output as Record<string, unknown>;\n const message = record.message;\n if (message && typeof message === 'object' && typeof (message as Record<string, unknown>).content === 'string') {\n return (message as Record<string, unknown>).content as string;\n }\n if (typeof record.text === 'string') return record.text;\n }\n return typeof output === 'undefined' ? '' : JSON.stringify(output);\n }\n\n /**\n * The transcript a PAUSED turn stores: the work it did, then what it had said before it paused (#2525 review M1).\n *\n * The person read that text as it streamed. It used to be dropped at the pause — only a cancelled turn kept its\n * partial reply — so a reload lost it, and the client, which keeps a live turn's messages across the decision, drew it\n * fused with the resumed reply under one id. Stored under the id it streamed with, a re-read replaces the live copy by\n * identity, and the resumed reply follows it as its own message. Nothing is stored for a turn that said nothing.\n */\n private pausedTurnMessages(\n work: FlowActorExecution_Message[],\n reply: { readonly id: string; readonly text: string; readonly data: ReturnType<ConversationalTurnTrace['replyData']> },\n ): FlowActorExecution_Message[] {\n if (reply.text.length === 0) return work;\n return [...work, {\n id: reply.id,\n role: FlowsActors_ConversationRole.ASSISTANT,\n contentType: FlowsActors_MessageContentType.MARKDOWN,\n content: reply.text,\n ...(reply.data ? { data: reply.data } : {}),\n createdAt: new Date(),\n }];\n }\n\n /**\n * The actor system's registration, for its display name on a decision (#2526). `undefined` for a system no longer\n * registered.\n */\n private registeredActorSystem(systemRef: string): ActorSystem | undefined {\n return this.flowsActorsRegistry.getSystem(systemRef, FlowActorSystem_Kind.ACTOR) as ActorSystem | undefined;\n }\n\n /**\n * The risk of a gated call, as its gate declares it (#2526 review F2): the one read the live announcement makes, as the\n * inbox card makes it through `gateOfRow`, so the two badge a decision alike. `undefined` when the gate declares none or\n * the tool can no longer be resolved — never defaulted, and never the system's own `riskLevel`.\n */\n private gatedCallRiskLevel(systemRef: string, pendingToolName: string): ResourceOperationRiskLevel | undefined {\n try {\n const resolved = this.resolveApprovalGatedFunctionTool(systemRef, pendingToolName);\n return resolved.kind === GatedFunctionToolResolutionKind.FOUND ? resolveFunctionToolApprovalGate(resolved.functionTool)?.riskLevel : undefined;\n } catch {\n return undefined;\n }\n }\n\n /**\n * Run the gate's `onDenied` for a person's REJECTED answer (#3015): what the denial does to the record the call was\n * about. Called once the sealed denial committed, with the context `execute` would have had (the requester's rebuilt\n * authority, the decision's ref, inside the requester's relationship provenance), on the arguments the model\n * proposed, inside the agent's actor frame. Never throws: the decision is sealed and stands whatever the effect does.\n * Answers whether the record was left as the denial requires (`false` only when a declared effect failed): the\n * failure is logged, and the caller tells the resumed turn, so the person learns the record did not move. A gate that\n * declares nothing, or a tool no longer resolvable, answers `true`.\n *\n * Not repaired: a process that dies between the denial's commit and its effect leaves the record as it was, as an\n * approved call whose resume dies leaves its work undone. The decision itself is sealed either way.\n */\n private async applyDenialEffect(params: {\n readonly systemRef: string;\n readonly executionId: string;\n readonly owner: ResolvedOwnerVariant;\n readonly paused: FlowActorExecution_PausedApproval;\n readonly requesterAuth: SocketAuthResult;\n readonly decisionRef: string;\n readonly row: Pick<FlowActorExecution, 'initiationKind' | 'autonomousTrigger'>;\n }): Promise<boolean> {\n try {\n const resolved = this.resolveApprovalGatedFunctionTool(params.systemRef, params.paused.pendingToolName);\n if (resolved.kind !== GatedFunctionToolResolutionKind.FOUND) return true;\n const onDenied = resolveFunctionToolApprovalGate(resolved.functionTool)?.onDenied;\n if (!onDenied) return true;\n const context = this.buildToolExecutionContext(params.requesterAuth, params.executionId, params.systemRef, params.decisionRef, {\n initiationKind: params.row.initiationKind,\n autonomousTrigger: params.row.autonomousTrigger,\n });\n // The frame `execute` runs in (`agentActorForToolCall`): the effect's own audit rows then name the agent, the tool\n // by its functionRef, and the decision, so the trail reads \"the denial of this agent's call\", never the requester\n // acting alone.\n const agentFrame = {\n agentRef: resolved.agentRef, agentExecutionId: params.executionId, systemRef: params.systemRef,\n toolName: resolved.functionTool.functionRef, decisionRef: params.decisionRef,\n };\n await runAsRelationshipProvenanceOf(\n params.requesterAuth,\n params.owner.ownerFields.organizationId ?? params.requesterAuth?.initiatorIds?.organizationId ?? undefined,\n () => runWithAgentActorFrame(agentFrame, () => onDenied(params.paused.pendingToolArgs, context)),\n );\n return true;\n } catch (error) {\n this.logger.error('[ConversationalExecution] A denied call\\'s declared effect failed; the denial stands, sealed, and the record it was about did not move', {\n systemRef: params.systemRef, executionId: params.executionId, decisionRef: params.decisionRef,\n toolName: params.paused.pendingToolName, ...projectCaughtErrorLogFields(error),\n });\n return false;\n }\n }\n\n /**\n * The FunctionTool behind a paused approval's model-facing tool name — the ONE lookup both the\n * approval announcement and the modification check use (#587).\n *\n * A pause keeps only the name the model was shown (`modelToolNameForFunctionRef`), so the tool is\n * found by walking the chat agent's declared function refs back to that name. It lives in one place\n * because the two callers must agree on which tool a name means: an editor offering one tool's\n * fields while the server validated against another would refuse every edit it invited.\n */\n private resolveApprovalGatedFunctionTool(systemRef: string, pendingToolName: string): GatedFunctionToolResolution {\n const actorSystem = this.flowsActorsRegistry.getSystem(systemRef, FlowActorSystem_Kind.ACTOR) as ActorSystem | undefined;\n const agentRef = actorSystem ? this.resolveChatAgentRef(actorSystem) : undefined;\n const agent = agentRef ? this.flowsActorsRegistry.getAgent(agentRef) : undefined;\n if (!agent || !agentRef) return { kind: GatedFunctionToolResolutionKind.AGENT_MISSING };\n\n const functionRef = (agent.capabilities?.tools?.functionRefs ?? [])\n .find((ref) => modelToolNameForFunctionRef(ref) === pendingToolName);\n const functionTool = functionRef ? this.flowsActorsRegistry.getFunctionTool(functionRef) : undefined;\n return functionTool\n ? { kind: GatedFunctionToolResolutionKind.FOUND, agentRef, functionTool }\n : { kind: GatedFunctionToolResolutionKind.TOOL_MISSING };\n }\n\n /**\n * The gated tool's input schema as a serialized descriptor for the approval announcement (#587), or\n * `undefined` when it cannot honestly be described.\n *\n * Only for a tool that STILL requires approval. A pause whose tool is no longer gated is stale and\n * the modification path refuses it, so offering its fields would invite an edit that cannot land.\n *\n * Never throws. The announcement is what tells a client a decision is waiting; a descriptor failure\n * must cost the form, never the announcement.\n */\n /**\n * Whether the gated tool's approval gate declares `escalateTo`. Read, never invoked: the list only needs to\n * know an escalation naming nobody has somewhere to go, and resolving the person is the escalation's job.\n * A tool that can no longer be resolved declares nothing.\n */\n private gateDeclaresEscalationTarget(systemRef: string, pendingToolName: string): boolean {\n try {\n const resolved = this.resolveApprovalGatedFunctionTool(systemRef, pendingToolName);\n return resolved.kind === GatedFunctionToolResolutionKind.FOUND && resolveFunctionToolApprovalGate(resolved.functionTool)?.escalateTo !== undefined;\n } catch {\n return false;\n }\n }\n\n /**\n * The question a paused call asks, when it is an agent's QUESTION to its person (#2720, `askPersonTool`); `undefined`\n * for an ordinary approval. Whether it is a question is read from the REGISTERED tool, never from the pause, and the\n * question is rebuilt from the call by `askPersonDecisionRequest`, the one function the chat card, the inbox card and\n * the answer door all read it through.\n */\n private pausedQuestionOf(systemRef: string, pause: {\n readonly decisionRef: string;\n readonly toolName: string;\n readonly toolArgs?: Record<string, unknown>;\n readonly questionForm?: HumanInputForm;\n readonly requestedAt: string;\n readonly expiresAt?: string;\n }): HumanDecision_Request | undefined {\n if (!this.pausedCallAsksThePerson(systemRef, pause.toolName)) return undefined;\n try {\n return askPersonDecisionRequest({\n decisionId: pause.decisionRef, args: pause.toolArgs ?? {}, requestedAt: pause.requestedAt,\n ...(pause.questionForm ? { form: pause.questionForm } : {}), ...(pause.expiresAt ? { expiresAt: pause.expiresAt } : {}),\n });\n } catch (error) {\n this.logger.warn('[ConversationalExecution] A paused question\\'s arguments could not be read as a question', {\n systemRef, toolName: pause.toolName, ...projectCaughtErrorLogFields(error),\n });\n return undefined;\n }\n }\n\n /** Whether the paused call is an agent's question to its person, from the registered tool (#2720). */\n private pausedCallAsksThePerson(systemRef: string, pendingToolName: string): boolean {\n return this.pausedQuestionTool(systemRef, pendingToolName) !== undefined;\n }\n\n /**\n * The step-up an answer to a paused call will require (#2923), from its gate's declaration (`humanApproval\n * .requiresStepUpAuthentication` / `stepUp`) through the one reader every plane uses; `undefined` when it requires none.\n *\n * Read once, when the turn pauses, and kept in the pause (`stepUp`), which is what the answer and the card read: a gate\n * whose declaration changes, or a tool removed, while the call waits holds it to what it was paused under.\n */\n private pausedCallStepUpRequirementOf(systemRef: string, pendingToolName: string): HumanDecision_StepUpRequirement | undefined {\n const resolved = this.resolveApprovalGatedFunctionTool(systemRef, pendingToolName);\n if (resolved.kind !== GatedFunctionToolResolutionKind.FOUND) return undefined;\n // Never swallowed: a gate that no longer resolves cannot say it requires nothing.\n return humanDecisionStepUpRequirementOf(resolveFunctionToolApprovalGate(resolved.functionTool));\n }\n\n /** The channels that may answer a paused call (#2923), from its gate, read when the turn pauses like its step-up. */\n private pausedCallAnswerChannelsOf(systemRef: string, pendingToolName: string): HumanDecision_AnswerChannels | undefined {\n const resolved = this.resolveApprovalGatedFunctionTool(systemRef, pendingToolName);\n if (resolved.kind !== GatedFunctionToolResolutionKind.FOUND) return undefined;\n return resolveFunctionToolApprovalGate(resolved.functionTool)?.answerChannels;\n }\n\n /** The registered question tool a paused call names (`asksThePerson`), or `undefined` for any other call. */\n private pausedQuestionTool(systemRef: string, pendingToolName: string): FunctionTool | undefined {\n try {\n const resolved = this.resolveApprovalGatedFunctionTool(systemRef, pendingToolName);\n return resolved.kind === GatedFunctionToolResolutionKind.FOUND && resolved.functionTool.asksThePerson === true ? resolved.functionTool : undefined;\n } catch {\n return undefined;\n }\n }\n\n /**\n * Compose the form a paused question is asked through (#2720), on the model of the agent that asked. `undefined` for\n * an ordinary approval, and whenever no usable form came back: the question is then asked through its default form.\n */\n private async composePausedQuestionForm(params: {\n readonly systemRef: string;\n readonly toolName: string;\n readonly toolArgs: Record<string, unknown> | undefined;\n readonly agentRef: string | undefined;\n readonly requestedAt: string;\n readonly traceContext: AgentTraceContext;\n readonly abortSignal?: AbortSignal;\n }): Promise<HumanInputForm | undefined> {\n if (!params.agentRef) return undefined;\n // A host that asks its questions as written (`composesQuestionForm: false`, #2731) gets the default form.\n if (this.pausedQuestionTool(params.systemRef, params.toolName)?.composesQuestionForm === false) return undefined;\n const question = this.pausedQuestionOf(params.systemRef, {\n decisionRef: 'composing', toolName: params.toolName, toolArgs: params.toolArgs, requestedAt: params.requestedAt,\n });\n if (!question) return undefined;\n return composeHumanInputForm({\n agents: this.agentsBackend, logger: this.logger, agentRef: params.agentRef, request: question, traceContext: params.traceContext,\n ...(params.abortSignal ? { abortSignal: params.abortSignal } : {}),\n });\n }\n\n /**\n * What an answer to a paused question means for the call (#2720): the person's values as its `answers`, read the way\n * the agent reads them (`humanDecisionAgentValues`: an amount in its major unit, a day as a day), or a decline that\n * does not run it. A note the person added travels with either: as `comment` beside the answers, or after the\n * decline's own words. `undefined` when there is no answer or its form refuses it.\n */\n private settleQuestionAnswer(\n question: HumanDecision_Request, answer: HumanDecision_Answer | undefined, paused: FlowActorExecution_PausedApproval, note: string | undefined,\n /** What the agent is told on a decline: the tool's own (`questionDeclinedReason`), else `ASK_PERSON_DECLINED_REASON`. */\n declinedReason: string,\n ): { approved: boolean; modifiedToolArgs: Record<string, unknown> | undefined; reason: string | undefined } | undefined {\n if (!answer) return undefined;\n let resolved: ReturnType<typeof resolveHumanDecisionAnswer>;\n try {\n resolved = resolveHumanDecisionAnswer(question, answer);\n } catch (error) {\n if (error instanceof HumanDecisionAnswerError) return undefined;\n throw error;\n }\n // A door with no cap of its own (the WebSocket's `comment`) can send a longer note than the tool takes; it is cut to\n // the one length every door shares, rather than turning a valid answer into a refused edit (#2720 review).\n const comment = note?.trim().slice(0, HUMAN_DECISION_NOTE_MAX_LENGTH) || undefined;\n if (resolved.option.intent !== HumanDecision_ResponseIntent.PROCEED_WITH_VALUES) {\n return { approved: false, modifiedToolArgs: undefined, reason: comment ? `${declinedReason} They added: ${comment}` : declinedReason };\n }\n // The call's own arguments, without anything the model wrote where only the engine may: the person's answers and\n // note replace them, and a note the person did not give is absent rather than the model's.\n // #2292: from the call AS THE MODEL WROTE IT, which goes back to the model: `pendingToolArgs` is the form people read,\n // with any value the model saw as a placeholder put back.\n const { answers: _modelAnswers, comment: _modelComment, ...asked } = (pendingToolCallInputOf(paused.sdkModelMessages, paused.approvalId) ?? paused.pendingToolArgs ?? {}) as Record<string, unknown>;\n return {\n approved: true,\n modifiedToolArgs: { ...asked, answers: humanDecisionAgentValues(question, resolved.values), ...(comment ? { comment } : {}) },\n reason: undefined,\n };\n }\n\n private describeGatedToolInputSchema(systemRef: string, pendingToolName: string): Record<string, unknown> | undefined {\n try {\n const resolved = this.resolveApprovalGatedFunctionTool(systemRef, pendingToolName);\n if (resolved.kind !== GatedFunctionToolResolutionKind.FOUND || !resolveFunctionToolApprovalGate(resolved.functionTool)) {\n return undefined;\n }\n const descriptor = serializeZodSchema(resolved.functionTool.inputSchema);\n return descriptor ? (descriptor as unknown as Record<string, unknown>) : undefined;\n } catch (error) {\n this.logger.warn('[ConversationalExecution] Could not describe a gated tool input schema; the approval is announced without it', {\n systemRef, toolName: pendingToolName, ...projectCaughtErrorLogFields(error),\n });\n return undefined;\n }\n }\n\n /** Emit a `FLOWS_ACTORS_ERROR` payload. */\n /**\n * The system's launch gate (`config.accessControl[].roles`, #2544 follow-up), asked of the authority a turn will hold:\n * `false` when the system declares the roles that may start it and the principal holds none of them in\n * `organizationId` (or, for an APPLICATION entry, as an application role).\n *\n * Decided by the authorizer (`admitsFlowsActorsSystemStart`), which also records a refusal on the denial trail; the\n * context it is handed names the transcript's default CREATE, as the consent gate's does, so the row says which\n * resource the refused turn would have written. A turn with no verified identity is refused by a gated system (fail\n * closed: no principal can be shown to hold a role) and admitted by an ungated one, as before the gate existed.\n *\n * assurance-control: WILDO.ACCESS.AUTHORIZATION_DECISION_AUDIT — the launch gate is enforced on every conversational\n * door (in-app, A2A, chat, autonomous) and its refusals are recorded.\n */\n private async admitsSystemStart(params: {\n auth: SocketAuthResult | undefined;\n owner: ResolvedOwnerVariant;\n actorSystem: ActorSystem;\n organizationId: string | undefined;\n refusedSurface: string;\n }): Promise<boolean> {\n const { auth, owner, actorSystem, organizationId, refusedSurface } = params;\n if (flowsActorsAccessControlStartRoles(actorSystem.config?.accessControl).length === 0) return true;\n if (!auth) return false;\n const operation = this.transcriptDefaultCreateOperation(owner.resourceType);\n const executionContext = createBareExecutionContextFromVerifiedAuth(operation as ResourceConfiguration_Operation<any, any, any>, auth);\n return this.authorizer.admitsFlowsActorsSystemStart({ system: actorSystem, executionContext, organizationId, refusedSurface });\n }\n\n /**\n * The transcript resource's default CREATE: what a gate answered before the turn's own write names on its denial row.\n * It is INTERNAL_CALL (no URL-bearing default exists), so it is read from the resource's declared operations.\n */\n private transcriptDefaultCreateOperation(resourceType: ResolvedOwnerVariant['resourceType']): ResourceConfiguration_Operation<any, any, any> | undefined {\n return this.resourcesRegistry.getResourceConfiguration(resourceType)?.operations.find(\n (candidate: ResourceConfiguration_Operation<any, any, any>) =>\n candidate.operationIdentifier === CoreResourceOperation.CREATE && candidate.isOperationDefault === true,\n ) as ResourceConfiguration_Operation<any, any, any> | undefined;\n }\n\n /**\n * Hold a conversational turn to the application's declared service consent requirement\n * (`compliance.serviceConsentRequirement.requiredPurposes`) AND to the transcript resource's own\n * `consentGate` declaration, if it has one (#1258 Step 3, D1).\n *\n * A2A and WebSocket turns never pass through `authorizeInController`, yet the model call and the transcript\n * write they perform ARE the person using the service. A requirement refused on every REST, MCP and manual\n * controller operation but not here would let a person who has not consented use the application through its\n * chat surfaces (#534 re-review R2). Both doors into a model call reach it: starting a turn, and resuming one\n * after an approval decision (#534 third review M1) — a purpose withdrawn while a turn was paused must not be\n * answered by a resumed reply.\n *\n * The authorizer's own gate decides, on a context carrying the caller's verified identity and the transcript's\n * CREATE operation, so the preferences read, the fail-closed default, the machine-principal exemption and the\n * denial audit are exactly the ones every other surface gets.\n *\n * Deliberately NOT a blanket \"nothing required application-wide → admitted\" return: the transcript resource's\n * default CREATE operation may declare its OWN `consentGate`, and only `assertServiceConsentRequirementMet`\n * below can see that declaration — it needs the resolved operation, found a few lines down. Short-circuiting\n * here on `serviceConsentRequiredPurposes().length === 0` alone would duplicate half of that gate's own early\n * return (R12: `required.length === 0 && !declaration`) without being able to see `declaration`, silently\n * exempting the chat surfaces from a per-operation declaration every other entry point enforces. This mirrors\n * the identical correction already made to `evaluateServiceConsentRequirementForPrincipal` below. Nothing is\n * resolved or read when nothing is required AND the operation declares nothing — `assertServiceConsentRequirementMet`'s\n * own R12 early return still makes that the cheap path.\n *\n * Fail closed: a check that cannot be evaluated — including a caller with no verified identity — refuses the\n * turn, for the same reason the gate treats an unreadable preferences row as nothing granted.\n *\n * assurance-control: WILDO.PRIVACY.CONSENT_ENFORCEMENT — a declared service consent requirement, and a capability's\n * own consent-gate declaration, are both enforced on conversational turns (A2A and WebSocket, started or\n * resumed) as on every other user-initiated surface.\n *\n * @param recoverable - `true` when the refused decision is still answerable afterwards (a resume leaves the\n * pause standing), so the client keeps it rather than ending the attempt.\n * @returns `false` when the turn was refused; the refusal has already been emitted when an emitter was given.\n */\n private async admitsUnderServiceConsentRequirement(params: {\n auth: SocketAuthResult | undefined;\n owner: ResolvedOwnerVariant;\n systemRef: string;\n executionId: string;\n emitter?: FlowsActorsExecutionEmitter;\n recoverable?: boolean;\n }): Promise<boolean> {\n const { systemRef, executionId, emitter, recoverable = false } = params;\n if ((await this.serviceConsentVerdictForTurn(params)) === ServiceConsentRequirementVerdict.ADMITTED) return true;\n if (emitter) {\n this.emitError(\n emitter,\n systemRef,\n executionId,\n FlowsActors_ExecutionErrorCode.SERVICE_CONSENT_REQUIRED,\n 'This application requires consent you have not granted. Record it in your privacy preferences, then try again.',\n recoverable,\n );\n }\n return false;\n }\n\n /**\n * The verdict {@link admitsUnderServiceConsentRequirement} refuses on, in the authorizer's three answers: ADMITTED,\n * REFUSED (the person has not granted a required purpose; on the denial trail), or NOT_EVALUATED (no verified identity,\n * or the check failed). Every caller but the chat door refuses on both of the last two; the chat door tries the\n * message again on NOT_EVALUATED. So the warning it logs says only that the check could not be made, and each caller's\n * own outcome says what followed (review L-A).\n */\n private async serviceConsentVerdictForTurn(params: {\n auth: SocketAuthResult | undefined;\n owner: ResolvedOwnerVariant;\n systemRef: string;\n executionId: string;\n }): Promise<ServiceConsentRequirementVerdict> {\n const { auth, owner, systemRef, executionId } = params;\n if (!auth) {\n this.logger.warn('Service consent requirement cannot be evaluated for a conversational turn with no verified identity', {\n systemRef, executionId,\n });\n return ServiceConsentRequirementVerdict.NOT_EVALUATED;\n }\n\n try {\n // The operation is what the denial audit records. The transcript's CREATE is INTERNAL_CALL — no URL-bearing\n // default exists — so it is resolved from the resource's declared operations rather than from a path.\n const operation = this.transcriptDefaultCreateOperation(owner.resourceType);\n if (!operation) {\n // Still decided — the refusal is the control — but a refusal here would leave no audit row, and that\n // must be visible rather than silent (#534 third review L3).\n this.logger.warn('Transcript resource declares no default CREATE; a service consent refusal on this turn will leave no audit row', {\n systemRef, executionId, resourceType: owner.resourceType,\n });\n }\n // Built from the verified auth as a whole, so a delegated caller's client reaches the refusal row (#1595).\n const executionContext = createBareExecutionContextFromVerifiedAuth(operation as ResourceConfiguration_Operation<any, any, any>, auth);\n await this.authorizer.assertServiceConsentRequirementMet(owner.resourceType, executionContext);\n return ServiceConsentRequirementVerdict.ADMITTED;\n } catch (error) {\n // Both refusals `assertServiceConsentRequirementMet` can throw — the whole-application requirement and the\n // transcript resource's own capability declaration (#1258 Step 3) — are a clean, expected refusal here, not\n // an evaluation failure; only anything else should warn.\n const isConsentRefusal = isWildoBackendError(error) && (\n error.customMessageReference === ErrorCustomMessageReference.AUTHORIZATIONS_SERVICE_CONSENT_REQUIRED\n || error.customMessageReference === ErrorCustomMessageReference.AUTHORIZATIONS_CAPABILITY_CONSENT_REQUIRED\n );\n if (isConsentRefusal) return ServiceConsentRequirementVerdict.REFUSED;\n this.logger.warn('Service consent requirement could not be evaluated for a conversational turn', {\n systemRef,\n executionId,\n ...projectCaughtErrorLogFields(error),\n });\n return ServiceConsentRequirementVerdict.NOT_EVALUATED;\n }\n }\n\n /**\n * The thread waits for `decisionRef`, so this message or turn end is not the client's (#2721): RECOVERABLE, and naming\n * the decision as a field (#2721 re-review R-2) so a tab keeps its card only when it holds that same decision.\n */\n private emitDecisionPending(emitter: FlowsActorsExecutionEmitter, systemRef: string, executionId: string, decisionRef: string): void {\n emitter(CoreWebSocketEvent.FLOWS_ACTORS_ERROR, {\n systemRef,\n executionId,\n errorCode: FlowsActors_ExecutionErrorCode.DECISION_PENDING,\n errorMessage: decisionPendingMessage(decisionRef),\n recoverable: true,\n waitingDecisionRef: decisionRef,\n } satisfies WS_FlowsActorsErrorPayload);\n }\n\n private emitError(\n emitter: FlowsActorsExecutionEmitter,\n systemRef: string,\n executionId: string,\n errorCode: FlowsActors_ExecutionErrorCode,\n errorMessage: string,\n /**\n * `true` when the turn is still answerable — the caller may fix the input and try again.\n *\n * Defaults to `false`, which is what every pre-existing caller means: a missing system, a flow\n * system, an empty input all end the attempt. A REFUSED ARGUMENT EDIT does not: the pause is\n * deliberately left standing, so telling the client otherwise would make the surface hide the\n * decision that is still waiting for it.\n */\n recoverable = false,\n /** The structured refusal of an argument edit — what the approval card renders, as labels (#1186). */\n approvalModificationRefusal?: WS_FlowsActorsApprovalModificationRefusal,\n ): void {\n emitter(CoreWebSocketEvent.FLOWS_ACTORS_ERROR, {\n systemRef,\n executionId,\n errorCode,\n errorMessage,\n recoverable,\n ...(approvalModificationRefusal ? { approvalModificationRefusal } : {}),\n });\n }\n}\n\n/**\n * Register the row-teardown settler that ends the decisions of execution rows a teardown deletes or scrubs (#2582), for\n * each execution owner variant: an owner scope's cascade, and a person's erasure. See\n * {@link ConversationalExecutionBackendService.settleDecisionsBeforeTeardown}.\n *\n * The service is resolved at dispatch, not at registration. Every runtime that runs this startup binds it today (the\n * application backend and the minion containers both do), and the bound check is what keeps a container that did not\n * from failing a purge or an erasure: a settler that throws fails its teardown.\n *\n * In a MINION the ending is also bounded by the minion's `resourceAccess` (#2582 review L1, F6). The ending writes\n * through `SystemAccessBackendService.updateAsSystem`, and when that write misses because the decision's route moved,\n * re-reads the row through `readAsSystem`. Both resolve the services registry at call time, and a minion rebinds that\n * registry to its scoped proxy, which refuses a write or a read of a resource its allowlist does not name. So a minion\n * whose code deletes or erases an owner (a person, an organization) that holds an execution waiting on a decision must\n * also be allowed to `write` AND `read` that execution resource, or the teardown fails with\n * `ResourceAccessForbiddenError` naming it (a refused re-read fails the teardown too, rather than leaving the decision\n * requested). That is the remedy: add the resource to both lists. The cascade's own delete needs neither, because it\n * goes through the repositories. Writing the ending through the repositories as well was rejected: it would leave the\n * one service write every ending shares (the route-version compare-and-swap and its update hooks) and give a minion a\n * write its configuration never granted. The actor plane is not bounded this way: its persistence ends a question\n * through the repositories registry.\n *\n * assurance-control: WILDO.ACCESS.AUTHORIZATION_DECISION_AUDIT — a decision a purge or an erasure removes is recorded as\n * ended, and its holders are told, rather than left requested on the trail.\n */\nexport function registerFlowActorExecutionTeardownSettlement(\n servicesRegistry: ServicesRegistryHandlerBackendService,\n container: Container,\n): void {\n for (const resourceType of FLOW_ACTOR_EXECUTION_OWNER_VARIANTS) {\n servicesRegistry.registerRowTeardownSettler(resourceType, async (event) => {\n if (!container.isBound(SAAS_SERVICE_TYPES.ConversationalExecutionBackendService)) return;\n await container.get<ConversationalExecutionBackendService>(SAAS_SERVICE_TYPES.ConversationalExecutionBackendService).settleDecisionsBeforeTeardown(event);\n });\n }\n}\n\n/** #3364 step 3: an output-moderation policy as the entries a paused record stores (the organization policy's own shape). */\nfunction moderationEntriesOf(policy: FlowsActors_OutputModerationPolicy): Array<{ category: ContentSafety_HarmCategory; blockAtOrAbove: ContentSafety_HarmSeverity }> {\n return outputModerationCategories(policy).map((category) => ({ category, blockAtOrAbove: policy[category]! }));\n}\n"]}
|
|
1
|
+
{"version":3,"file":"conversational-execution.backend.service.js","sourceRoot":"","sources":["../../../../src/flows-actors/services/conversational-execution.backend.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAEzD,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AACpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,qEAAqE,CAAC;AAC3G,OAAO,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAC;AAC7F,OAAO,EAAE,2BAA2B,EAAE,MAAM,8EAA8E,CAAC;AAC3H,OAAO,EAAE,yBAAyB,EAAE,MAAM,6FAA6F,CAAC;AACxI,OAAO,EAAE,+BAA+B,EAAE,MAAM,0EAA0E,CAAC;AAC3H,OAAO,EAAE,qCAAqC,EAAE,MAAM,6FAA6F,CAAC;AAEpJ,OAAO,EAAE,mCAAmC,EAA2B,MAAM,gEAAgE,CAAC;AAC9I,OAAO,EACL,0BAA0B,EAC1B,qBAAqB,GAEtB,MAAM,sFAAsF,CAAC;AAC9F,OAAO,EAAE,iCAAiC,EAAE,MAAM,kFAAkF,CAAC;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0BAA0B,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,CAAC,QAAQ,CAAE,EAAE,CAAC,CAAC,CAAC;AACjH,CAAC","sourcesContent":["import 'reflect-metadata';\nimport { injectable, inject, optional } from 'inversify';\nimport type { Container } from 'inversify';\nimport { randomUUID } from 'crypto';\n\nimport { SAAS_SERVICE_TYPES } from '~wildo-backend-lib/inject/models/service-types';\nimport { callerReadsModelCost } from '~wildo-backend-lib/flows-actors/services/model-cost.backend.service';\nimport { LoggerService } from '~wildo-backend-lib/monitoring/logger/services/logger.service';\nimport { projectCaughtErrorLogFields } from '~wildo-backend-lib/errors/utils/error-log-level-classification.backend.utils';\nimport { ConversationalErasureStep } from '~wildo-backend-lib/flows-actors/services/conversational-execution-erasure-severance.backend';\nimport { ResourcesRegistryBackendService } from '~wildo-backend-lib/resources/services/resources-registry.backend.service';\nimport { ServicesRegistryHandlerBackendService } from '~wildo-backend-lib/base-classes/services/services/services-registry-handler.backend.service';\nimport type { RowTeardownSettlementEvent } from '~wildo-backend-lib/base-classes/services/services/row-teardown-settlement.backend.schemas';\nimport { registerTransactionPostCommitEffect, type TransactionContext } from '~wildo-backend-lib/databases/models/transaction.shared.schemas';\nimport {\n capturablePostCommitEffect,\n decisionEndingCapture,\n type CapturedDecisionNoticeOutcomePayload,\n} from '~wildo-backend-lib/base-classes/services/services/post-commit-effect-capture.backend';\nimport { CapturedHumanDecisionAnnouncement } from '~wildo-backend-lib/base-classes/models/post-commit-effect-outbox.backend.schemas';\nimport { SystemAccessBackendService } from '~wildo-backend-lib/base-classes/services/services/system-access.backend.service';\nimport type { RedisService } from '~wildo-backend-lib/databases/services/redis.service';\nimport {\n TURN_LEASE_TTL_SECONDS,\n TurnLeaseAbandonmentEvidence,\n TurnLivenessLease,\n abandonmentEvidenceIsAVerdict,\n} from '~wildo-backend-lib/flows-actors/services/turn-liveness-lease.backend.utils';\nimport { ResumedTurnStopBroadcast } from '~wildo-backend-lib/flows-actors/services/resumed-turn-stop-broadcast.backend.utils';\nimport { DecisionRequesterAuthorityStanding, ExecutionContextCreatorBackendService } from '~wildo-backend-lib/runtime/services/execution-context-creator.backend.service';\nimport type { DecisionWaitingWorkRef } from '~wildo-backend-lib/runtime/services/execution-context-creator.backend.service';\nimport { actingSessionOfConnection, createBareExecutionContextFromVerifiedAuth, type ActingSession, type ExecutionContext, type SocketAuthResult } from '~wildo-backend-lib/runtime/models/execution-context.backend.schemas';\nimport type { WebSocketService } from '~wildo-backend-lib/requests/service/websocket.service';\nimport type { FunctionTool, FunctionToolExecutionContext } from '~wildo-backend-lib/flows-actors/models/function-tools.backend.definitions';\nimport { chatAgentRefOfActorSystem, modelToolNameForFunctionRef, rehearsedToolArguments, sdkInputSchemaOfFunctionTool, personalDataArgumentsResourceOf, resolveFunctionToolApprovalGate } from '~wildo-backend-lib/flows-actors/models/function-tools.backend.definitions';\nimport type { AuditLogsBackendService } from '~wildo-backend-lib/compliance/audit-trails/services/audit-logs.backend.service';\nimport { WITHHELD_CREDENTIAL_ARGUMENT, editedCredentialPaths, heldCallInput, isWithheldOrAbsentAt } from '~wildo-backend-lib/flows-actors/utils/agent-work-correction.backend.utils';\nimport { applyModifiedToolApprovalInput, argumentsNotRunAsWritten, argumentsRunOtherwiseThanWritten, declaredArgumentPredicateOf, pendingToolCallIdOf, pendingToolCallInputOf, pendingToolApprovalCallsOf, pendingToolCallSchemaInputOf, schemaKeepsRewriting, ToolApprovalModificationOutcomeKind, withKeptStringsInModelForm, withoutArgumentAt, withSettledToolCallsHeld } from '~wildo-backend-lib/flows-actors/utils/tool-approval-modification.backend.utils';\nimport {\n applicationDisplayName,\n ASK_PERSON_DECLINED_REASON,\n HUMAN_DECISION_NOTE_MAX_LENGTH,\n HumanDecisionAnswerError,\n HumanDecision_ResponseIntent,\n askPersonDecisionRequest,\n humanDecisionAgentValues,\n resolveHumanDecisionAnswer,\n type HumanDecision_Answer,\n type HumanDecision_Request,\n type HumanInputForm,\n jsonParsingSchemaOf,\n} from '@wildo-ai/saas-models';\nimport {\n effectiveAgentContentGuardrails,\n isStricterPersonalDataTreatment,\n resolveRepresentingOrganizationIdsInOrganization,\n type FlowsActors_AgentContentGuardrails,\n} from '@wildo-ai/saas-models';\nimport { outputModerationCategories, type FlowsActors_OutputModerationPolicy } from '@wildo-ai/saas-models';\nimport { flowsActorsAccessControlStartRoles } from '@wildo-ai/saas-models';\nimport { DecisionStepUpProofKind, humanDecisionAnswerChannelAdmitted, humanDecisionDeciderMayDecideMeaning, humanDecisionStepUpRequirementOf, type HumanDecision_AnswerChannels, type HumanDecision_StepUpRequirement } from '@wildo-ai/saas-models';\nimport { checkDecisionStepUp, consumeDecisionStepUpProof, deciderStepUpEvidenceOf } from '~wildo-backend-lib/flows-actors/utils/decision-step-up.backend.utils';\nimport type { ConsumableTokenBackendService } from '~wildo-backend-lib/security/consumable-tokens/services/consumable-token.backend.service';\nimport type { ContentSafety_HarmCategory, ContentSafety_HarmSeverity } from '@wildo-ai/external-connectors-models';\nimport { isLLMCatalogModel } from '@wildo-ai/external-connectors-models';\nimport { readAgentPolicies, runWithAgentPolicyFrame, turnPolicyOrganizationIds, type AgentPolicyLookup } from '~wildo-backend-lib/flows-actors/content-guardrails/agent-policy.backend';\nimport {\n TurnPersonalDataView,\n UNGUARDED_PAUSED_POSTURE,\n looserPausedPosture,\n pausedPostureOfGuardrails,\n} from '~wildo-backend-lib/flows-actors/content-guardrails/turn-personal-data.backend.utils';\nimport { PersonalDataGuard, PersonalDataPlaceholderTable, renamePlaceholders } from '~wildo-backend-lib/flows-actors/content-guardrails/personal-data-guard.backend.utils';\nimport { composeHumanInputForm } from '~wildo-backend-lib/flows-actors/services/human-input-form-composer.backend';\nimport { serializeZodSchema } from '@wildo-ai/zod-decorators';\n\n/**\n * What the lookup behind a paused approval's tool name found (#587). Named so the announcement and the\n * modification check branch on the same members — the two must agree on which tool a name means.\n */\nenum GatedFunctionToolResolutionKind {\n /** The chat agent declares a function tool shown to the model under this name. */\n FOUND = 'found',\n /** The system has no chat agent any more, so no tool can be resolved at all. */\n AGENT_MISSING = 'agent-missing',\n /** The agent exists but no longer declares a tool under this name. */\n TOOL_MISSING = 'tool-missing',\n}\n\ntype GatedFunctionToolResolution =\n | { kind: GatedFunctionToolResolutionKind.FOUND; agentRef: string; functionTool: NonNullable<ReturnType<FlowsActorsRegistryService['getFunctionTool']>> }\n | { kind: GatedFunctionToolResolutionKind.AGENT_MISSING }\n | { kind: GatedFunctionToolResolutionKind.TOOL_MISSING };\nimport type { RateLimitBackendService } from '~wildo-backend-lib/errors/services/rate-limit.backend.service';\nimport { ServiceConsentRequirementVerdict, type AuthorizationsBackendService } from '~wildo-backend-lib/security/authorizations/services/authorizations.backend.service';\nimport { relationshipStandingOf, runAsRelationshipProvenanceOf } from '~wildo-backend-lib/security/authorizations/relationship-record-separation.backend';\nimport { FlowsActorsRegistryService } from './flows-actors-registry.service';\nimport { AgentCallAdmission, AgentsBackendService, AgentModelCallFailedError, AgentStreamingUnsupportedError, agentSuspensionRefusalOf, type AgentApprovalSuspension, type FunctionToolStreamEvent } from './agents.backend.service';\nimport { isDeepEqualData } from 'ai';\nimport { AgentOutputWithheldError } from '~wildo-backend-lib/flows-actors/content-guardrails/output-moderation.backend.utils';\nimport { ConversationalTurnTrace, isReplayedTurn, resourceTypeReadByToolName } from './conversational-turn-trace.backend.utils';\nimport {\n AgentSuspensionRefusalReason,\n CoreResourceType,\n CoreWebSocketEvent,\n resolveRelationshipWorkAttribution,\n FlowActorSystem_Kind,\n FlowsActors_ConversationRole,\n FlowsActors_MessageContentType,\n FLOWS_ACTORS_DEFAULT_AGENT_INSTANCE,\n isFlowActorPausedApprovalLapsed,\n parseFlowActorPausedApproval,\n type FlowActorExecution_PausedApproval,\n serializeFlowActorPausedApproval,\n FLOWS_ACTORS_NO_MACHINE_CREDENTIAL,\n FlowsActors_Status,\n type ActorSystem,\n type AgentTraceContext,\n type ExecutionContext_InitiatorIds,\n type ChatConversation,\n type FlowActorExecution,\n type FlowActorExecution_Message,\n type Inbound_Arrival,\n type FlowsActors_Agent_Invocation,\n type WS_FlowsActorsApprovalAnnouncementData,\n type WS_FlowsActorsTurnUsage,\n admitsDecisionSuspension,\n FlowsActors_ExecutionErrorCode,\n FlowsActors_ApprovalModificationRefusalReason,\n resourceInheritanceVariantSchemas,\n type WS_FlowsActorsApprovalModificationRefusal,\n type WS_FlowsActorsErrorPayload,\n CoreResourceOperation,\n ErrorCustomMessageReference,\n ErrorType,\n isWildoBackendError,\n type ResourceConfiguration_Operation,\n FlowsActors_InitiationKind,\n ExecutionContext_ExecutionType,\n type ResourceOperationRiskLevel,\n ResourcePrimaryScope,\n SortOrder,\n type Roles,\n HumanDecision_Act,\n HumanDecision_Outcome,\n HumanDecision_Plane,\n type FlowsActors_PersonalDataModelTreatment,\n HumanDecision_RefusalReason,\n HumanDecision_SentCardContent,\n HumanDecision_RequesterKind,\n HumanDecision_RouteKind,\n HumanDecision_VerdictKind,\n HumanDecision_ToolApprovalOption,\n HumanDecision_ActOutcomeKind,\n type HumanDecision_ActOutcome,\n type HumanDecision_ActRequest,\n type HumanDecision_AnsweredThrough,\n type HumanDecision_PendingCard,\n type HumanDecision_ReassignCandidate,\n type HumanDecision_ReassignCandidatesResponse,\n type OrganizationMember,\n OrganizationMemberStatus,\n authorizeHumanDecisionActor,\n humanDecisionOutcomeOf,\n type HumanDecision_Requester,\n type HumanDecision_Route,\n type HumanDecision_RoleFacts,\n type AutonomousPrincipalSource,\n type AutonomousTurnTrigger,\n type WorkUnitRef,\n ExecutionRefKind,\n AgentWorkDecisionRecordSource,\n AgentWorkDecisionSurface,\n type ModelCallAttributionInput,\n // #1628 — decision deadlines.\n BrandAssetComposition,\n BrandAssetPurpose,\n EmailTemplateType,\n HumanDecision_RouteChangeTrigger,\n NotificationLevel,\n ReviewClockBasis,\n ReviewDeadlineKind,\n ReviewDeadlineStage,\n ReviewEscalationActionKind,\n SystemEmailTemplateRef,\n armReviewDeadlines,\n dueReviewDeadlineStages,\n isReviewWarningStage,\n resolveReviewDeadlinePolicy,\n resumeReviewServiceTargets,\n reviewDeadlineKindOfStage,\n type ArmedReviewDeadlines,\n type ReviewCalendar,\n type ReviewDeadlinePolicy,\n type User,\n ActorExecutionInterruptionCause,\n type ActorExecutionAbandonmentCause,\n modelSpendDoorOfInitiationKind,\n flowsActorsStatusChange,\n storedTurnFailureCodeOf,\n flowsActorsExecutionErrorCodeOf,\n type FlowsActors_StatusTransition,\n isLLMAgentConfiguration,\n} from '@wildo-ai/saas-models';\nimport { boundReplayedTranscript, conversationReplayBudget, ReplayBoundOutcome, type ConversationReplayBudget } from '~wildo-backend-lib/flows-actors/utils/transcript-bound.backend.utils';\nimport { carryDroppedTurns, DroppedTurnsReplayKind, parseDroppedTurnsSummary, serializeDroppedTurnsSummary } from '~wildo-backend-lib/flows-actors/services/conversation-dropped-turns-summary.backend';\nimport { runWithAgentActorFrame } from '~wildo-backend-lib/runtime/models/agent-actor-frame.als.backend';\nimport { runWithWorkAttributionFrame } from '~wildo-backend-lib/runtime/models/work-attribution.als.backend';\nimport { runOutsideModelSpendFrame, runWithModelSpendFrame } from '~wildo-backend-lib/runtime/models/model-spend-frame.als.backend';\nimport type { HumanDecisionActingActor, HumanDecisionHost, HumanDecisionLapsedActor } from '~wildo-backend-lib/flows-actors/models/human-decision-host.backend.port';\nimport { humanDecisionDeciderEventFields, humanDecisionDeciderRecordOfActor, humanDecisionRequesterEventFields } from '~wildo-backend-lib/flows-actors/utils/human-decision-decider.backend.utils';\nimport { humanDecisionReplyAnswerOf, type HumanDecisionReplyAnswer } from '~wildo-backend-lib/flows-actors/utils/human-decision-reply-answer.backend.utils';\nimport { sealDecisionInTransaction, type DecisionSealFacts } from '~wildo-backend-lib/compliance/approval-seals/approval-seal-store.backend';\nimport {\n DecisionPresentationCheckKind,\n acknowledgeDecisionPresentation,\n decisionPresentationKeyOfRuntime,\n decisionStatementOf,\n resolveDecisionDeliverables,\n resolveDecisionSubjectRecord,\n withDecisionPresentation,\n type DecisionDeliverableFiles,\n type ResolvedDecisionDeliverables,\n} from '~wildo-backend-lib/compliance/approval-seals/decision-presentation.backend';\nimport type { FilesBackendService } from '~wildo-backend-lib/files/services/files.backend.service';\nimport type { ResourcePersistenceUnitOfWorkBackendService } from '~wildo-backend-lib/databases/services/resource-persistence-unit-of-work.backend.service';\nimport type { ServiceOptions } from '~wildo-backend-lib/base-classes/models/repositories.backend.schemas';\nimport type { ApplicationIdentityBackendService } from '~wildo-backend-lib/applications/services/application-identity.backend.service';\nimport type { ApprovalSealRelayBackendService } from '~wildo-backend-lib/compliance/approval-seals/approval-seal-relay.backend.service';\nimport { ApprovalSealMeaning, ApprovalSource, isApprovalSealOutcome } from '@wildo-ai/saas-models';\nimport type { HumanDecision_DeciderRecord, HumanDecision_PresentedRecord } from '@wildo-ai/saas-models';\nimport {\n agentWorkOwnerOfExecution,\n owedRecordIsRepairableFromRow,\n type AgentWorkDecisionsBackendService,\n type ExecutionResolutionRow,\n} from '~wildo-backend-lib/flows-actors/services/agent-work-decisions.backend.service';\nimport {\n NO_HUMAN_DECISION_ROLE_FACTS,\n PENDING_DECISION_CLEARED,\n humanDecisionRequesterOfAuth,\n humanDecisionRequesterOfRow,\n humanDecisionRouteOfRow,\n announceHumanDecisionRouted,\n announceCapturedHumanDecision,\n announceHumanDecisionWithdrawn,\n admitHumanDecisionAnswerers,\n chatOfferableAnswerPredicate,\n collectHumanDecisionAnswerers,\n holdHumanDecisionActorToGrantingOrganization,\n HumanDecisionGrantorHoldKind,\n END_PENDING_DECISION_ROUTE_ATTEMPTS,\n isReviewerRoute,\n resolveHumanDecisionListingOrganizationIds,\n resolveHumanDecisionRoleFacts,\n humanDecisionSubjectOfToolCall,\n humanDecisionForeignKeyArgumentsEdited,\n answersAsOrganizationOwnStaff,\n HUMAN_DECISION_NAMES_NO_RECORD,\n HumanDecisionSubjectKind,\n type HumanDecisionSubject,\n toolApprovalDecisionRequest,\n toolApprovalVerdictOf,\n type HumanDecisionRoleFactsPorts,\n createHumanDecisionRoleFactsPorts,\n answeredThroughRefusalFields,\n lapsedActorRefusalReason,\n DECISION_REQUEST_REPAIR_GRACE_MS,\n DecisionRequestWriteOutcome,\n humanDecisionRequestedAuditEventId,\n readBackThrownDecisionRequestWrite,\n waitBeforeDecisionRequestRead,\n type UnrecordedDecisionRequestRepairResult,\n} from './pending-human-decision.backend.utils';\nimport {\n HumanDecisionNoticeStayLiveness,\n type HumanDecisionNoticeAnswererCheck,\n type HumanDecisionNoticeLiveStay,\n type HumanDecisionNoticeLiveStayPage,\n type HumanDecisionNoticeSource,\n type HumanDecisionNoticeStayDescription,\n type HumanDecisionNoticeStayState,\n} from '~wildo-backend-lib/flows-actors/models/human-decision-notice-source.backend.port';\nimport type { RepositoriesRegistryHandlerBackendService } from '~wildo-backend-lib/base-classes/services/repositories/repositories-registry-handler.backend.service';\nimport { RepositoryArrayAdditionPlacement } from '~wildo-backend-lib/base-classes/services/repositories/repository-guarded-mutation.backend.types';\nimport {\n DEADLINE_STAGE_FIRED_COLUMN,\n DecisionDeadlineNoticeAudience,\n armedDeadlineColumns,\n deadlineOutcomesOfRow,\n deadlineStageScheduleOfRow,\n inAppNoticeOfDeadlineStage,\n inAppDestinationOfDeadlineNotice,\n nextDueAtOfRow,\n noticedDeadlineOfStage,\n serviceTargetColumns,\n serviceTargetsOfRow,\n type DecisionDeadlineNoticeRecipient,\n} from './pending-decision-deadlines.backend.utils';\nimport type { FunctionTool_HumanApprovalGate } from '~wildo-backend-lib/flows-actors/models/function-tools.backend.definitions';\nimport type { AppConfigurationService } from '~wildo-backend-lib/config/services/app-configuration.backend.service';\nimport type { EmailBackendService } from '~wildo-backend-lib/notifications/email/services/email.backend.service';\nimport { getConfiguredPrimaryLanguage } from '~wildo-backend-lib/config/services/app-configuration.backend.utils';\nimport { AuthControllerUtils } from '~wildo-backend-lib/security/authentications/services/utils/auth-controller.utils';\nimport type { RecipientLanguageBackendService } from '~wildo-backend-lib/notifications/services/recipient-language.backend.service';\nimport { noteHumanDecisionNoticeOutcome, type HumanDecisionNoticeStayStoreBackendService } from '~wildo-backend-lib/flows-actors/services/human-decision-notice-stay-store.backend.service';\nimport type { ChatConversationStoreBackendService } from '~wildo-backend-lib/flows-actors/services/chat-conversation-store.backend.service';\nimport { confineAuthorityToChatConversationOrganization } from '~wildo-backend-lib/flows-actors/services/chat-conversation-confinement.backend.utils';\nimport type { RagRetrievalBackendService } from '~wildo-backend-lib/rag/services/rag-retrieval.backend.service';\n\n/**\n * Transport-agnostic sink for the server→client events a conversational\n * execution emits. The WebSocket layer supplies an implementation bound to the\n * initiating user's room; this service never imports `WebSocketService`, which\n * (a) keeps the runtime independent of the transport (Decision A's honest seam —\n * a future SSE/other transport could supply a different emitter) and (b) avoids\n * a circular DI dependency between the two services.\n *\n * The `event` is one of the `CoreWebSocketEvent.FLOWS_ACTORS_*` server→client\n * events; `payload` matches the corresponding `WS_FlowsActors*PayloadSchema`.\n */\nexport type FlowsActorsExecutionEmitter = (event: CoreWebSocketEvent, payload: unknown) => void;\n\n/**\n * How many candidates one indexed selection may return when listing a person's pending decisions. A\n * person with more waiting than this has a queue no list view serves; the soonest are shown and the\n * log says the cap was reached.\n */\nconst PENDING_DECISION_LIST_LIMIT = 200;\n\n/**\n * How many ACTIVE members of a decision's organization are considered when listing who it may be moved to.\n * Each is vetted with a fresh read of their roles, so the bound keeps one request's cost proportionate.\n */\nconst REASSIGN_CANDIDATE_SCAN_LIMIT = 100;\n\n/**\n * The three owner-scope variants an execution can live on — the population the lapsed-approval\n * sweep walks. Declared as data so a fourth variant is a visible omission rather than a scope the\n * sweep silently never reaches (the credential-expiry sweep's lesson, #413).\n */\n/**\n * The key namespace of conversational turn leases (#1780): `flows-actors:execution:lease:<executionId>`\n * and its two siblings. Distinct from the A2A task namespace on purpose — an A2A turn holds both, one per\n * row it keeps truthful (the task, and the conversation it runs), and neither may answer for the other.\n */\nexport const CONVERSATIONAL_TURN_LEASE_NAMESPACE = 'flows-actors:execution';\n\n/**\n * The key namespace of a WORK's liveness lease (#2829): `flows-actors:work:lease:<executionId>:<workRef>` and its two\n * siblings. Held by the continuation an answered decision releases, for its whole run, beside the execution's own lease.\n * The execution's lease cannot answer for a work: one thread runs many turns, non-chat turns may overlap on it, and the\n * one id is held by whichever of them is running, so it stays alive when the continuation of one work dies under another\n * turn. Distinct namespace for the same reason as the A2A one: neither lease may answer for the other.\n */\nexport const CONVERSATIONAL_WORK_LEASE_NAMESPACE = 'flows-actors:work';\n\n/** The id one work's lease is held under: a work is named by its first decision, which is unique to its thread. */\nexport function conversationalWorkLeaseId(executionId: string, workRef: string): string {\n return `${executionId}:${workRef}`;\n}\n\n/**\n * How long a stop of a decision's continuation that found no resumed turn is remembered, so a resume of that decision\n * released before it and registering after it is still stopped (#2550, #2821). The gap it covers is one row write and one record write; a minute is far beyond it,\n * and short enough that the memory stays a handful of entries.\n */\nconst UNMATCHED_RESUMED_TURN_STOP_MEMORY_MS = 60_000;\n\n/**\n * How long a PROCESSING row must have been still before the interrupted-turn sweep even asks its lease —\n * four lease lifetimes, the A2A sweep's window. Generous on purpose: waiting one more run to fail a dead\n * turn costs nothing, while mistaking a live one for dead kills real work.\n */\nexport const INTERRUPTED_TURN_GRACE_MS = TURN_LEASE_TTL_SECONDS * 1000 * 4;\n\n/**\n * The decision a running turn is CARRYING OUT, read off its row (#2800): the turn is that decision's continuation.\n *\n * The answer's release swaps the row to PROCESSING and stamps `lastResolvedDecisionRef` + `decidedAt` in the same write,\n * and every end of a turn stamps `finishedAt` (a completion, a failure, a cancel, and an ending of the decision itself,\n * which writes `finishedAt` equal to `decidedAt`). So a row whose last resolved decision has had no end written since\n * (`finishedAt` absent or EARLIER than `decidedAt`) is still running that decision's continuation. A thread reuses its\n * row, so `lastResolvedDecisionRef` stays after the continuation ends: a later fresh turn on the thread sees a\n * `finishedAt` at or after `decidedAt` and continues nothing.\n *\n * Read from the row as LISTED, before the settle writes its own `finishedAt`. The two instants may be written by\n * different processes, so the comparison trusts their clocks to agree to within one model call; a skew larger than the\n * continuation's whole run could name a decision whose continuation had in fact ended.\n */\nexport function continuingDecisionOfInterruptedTurn(\n row: Pick<FlowActorExecution, 'status' | 'lastResolvedDecisionRef' | 'decidedAt' | 'finishedAt'>,\n): string | undefined {\n if (row.status !== FlowsActors_Status.PROCESSING || !lastResolvedDecisionContinuationIsOpen(row)) return undefined;\n return row.lastResolvedDecisionRef ?? undefined;\n}\n\n/**\n * Whether the work the row's LAST RESOLVED decision released has had no end written since (#2800, #2821): `decidedAt` is\n * set and `finishedAt` is absent or earlier than it. The one reading of the two instants, so the interrupted-turn sweep\n * ({@link continuingDecisionOfInterruptedTurn}) and a door addressing work by its decision ({@link decisionWorkOfRow})\n * cannot disagree about when a continuation ended. Same clock caveat as the former.\n */\nfunction lastResolvedDecisionContinuationIsOpen(row: Pick<FlowActorExecution, 'lastResolvedDecisionRef' | 'decidedAt' | 'finishedAt'>): boolean {\n if (!row.lastResolvedDecisionRef || !row.decidedAt) return false;\n const decidedAtMs = new Date(row.decidedAt).getTime();\n if (Number.isNaN(decidedAtMs)) return false;\n if (row.finishedAt) {\n const finishedAtMs = new Date(row.finishedAt).getTime();\n if (Number.isNaN(finishedAtMs) || finishedAtMs >= decidedAtMs) return false;\n }\n return true;\n}\n\n/**\n * How many entries of `workEvents` a conversation row keeps (#2821): the newest. Each work appends at most two per decision\n * it raises (its continuation starting, then ending), so fifty covers every live work of any thread by a wide margin. A\n * work whose entries were all dropped is read from the row's own fields again ({@link decisionWorkOfRow}).\n */\nexport const CONVERSATION_WORK_EVENTS_RETAINED = 50;\n\n/** The newest `workEvents` entry of one work, or `undefined` when the row holds none for it. */\nfunction latestWorkEventOf(\n row: Pick<FlowActorExecution, 'workEvents'>,\n workRef: string,\n): NonNullable<FlowActorExecution['workEvents']>[number] | undefined {\n const events = row.workEvents ?? [];\n for (let index = events.length - 1; index >= 0; index -= 1) {\n if (events[index]?.workRef === workRef) return events[index];\n }\n return undefined;\n}\n\n/** Whether a write's answer is a conversation row (a repository answers the row it wrote, a store double may not). */\nfunction isFlowActorExecutionRow(value: unknown): value is FlowActorExecution {\n return typeof value === 'object' && value !== null && typeof (value as { executionId?: unknown }).executionId === 'string';\n}\n\n/**\n * Where a piece of WORK stands NOW, read off the conversation row (#2821). A work is what one fresh turn started and\n * every continuation of its answered decisions carried on, and it is named by its FIRST decision. For a door that holds\n * work by that decision rather than by the thread: one thread runs many turns, and non-chat turns may even overlap\n * (`conversationalAdvanceGuard`), so the thread's status is whichever turn wrote last, and a door reading it about an\n * earlier turn reads someone else's work (an A2A task that paused, was approved and finished, read as the PROCESSING of\n * a later task's turn in the same thread).\n */\nexport enum ConversationalDecisionWorkStanding {\n /**\n * The work waits for a human decision: the one it opened with, or one a continuation of it raised after an earlier\n * decision of it was answered. `waitingDecisionRef` names the decision that waits. Only a decision the pause RECORDED as\n * this work's (`pendingDecisionWorkRef`) is ever reported here, never one another turn of the thread raised.\n */\n WAITING = 'waiting',\n /** A decision of the work was answered and the turn continuing it has not ended (its newest `workEvents` entry). */\n CONTINUING = 'continuing',\n /**\n * The work has ended. `endedStatus` is how: the work's own newest `workEvents` entry. Absent only on the FALLBACK path\n * of {@link decisionWorkOfRow} (no entry for the work) when the row's own fields no longer say: the work ended, how is\n * not known.\n */\n ENDED = 'ended',\n}\n\n/** {@link ConversationalDecisionWorkStanding}, with what each standing carries. */\nexport type ConversationalDecisionWork =\n | { readonly standing: ConversationalDecisionWorkStanding.WAITING; readonly waitingDecisionRef: string }\n | { readonly standing: ConversationalDecisionWorkStanding.CONTINUING }\n | {\n readonly standing: ConversationalDecisionWorkStanding.ENDED;\n readonly endedStatus?: FlowsActors_Status;\n /** #2827: why the work ended FAILED, when it did and the ending recorded why. */\n readonly endedFailureCode?: FlowsActors_ExecutionErrorCode;\n };\n\n/** The decision outcomes that END a decision without an answer (`endPendingDecision`). */\ntype DecisionEndingOutcome = HumanDecision_Outcome.LAPSED | HumanDecision_Outcome.WITHDRAWN | HumanDecision_Outcome.REQUESTER_AUTHORITY_LAPSED;\n\n/**\n * #2827: what ending a decision without an answer writes, by its outcome: a withdrawal ends the work CANCELLED, a lapse\n * and a lapsed requester authority end it FAILED, with the code its client is told. Total over the ending outcomes, so the\n * code cannot be forgotten for one; {@link STATUS_WRITTEN_BY_DECISION_ENDING} reads its statuses here. One cause overrides\n * the outcome: an ERASURE's ending CANCELS the work whatever its outcome ({@link DECISION_ENDED_BY_ERASURE}, #2865).\n */\nconst DECISION_ENDING_TRANSITION: Readonly<Record<DecisionEndingOutcome, ConversationalTurnTerminalEnding>> = Object.freeze({\n [HumanDecision_Outcome.LAPSED]: { status: FlowsActors_Status.FAILED, failureCode: FlowsActors_ExecutionErrorCode.DECISION_LAPSED },\n [HumanDecision_Outcome.WITHDRAWN]: { status: FlowsActors_Status.CANCELLED },\n [HumanDecision_Outcome.REQUESTER_AUTHORITY_LAPSED]: { status: FlowsActors_Status.FAILED, failureCode: FlowsActors_ExecutionErrorCode.DECISION_REQUESTER_AUTHORITY_LAPSED },\n});\n\n/**\n * #2865: what ending a decision because a person's ERASURE leaves nobody it could continue for writes, whatever its\n * outcome (`REQUESTER_AUTHORITY_LAPSED` for one they raised, `WITHDRAWN` for one assigned to them with no role to go back\n * to). The work is CANCELLED: nothing in it went wrong, and nobody is left to ask again, so it is not a failure and owes no\n * failure code (#2827). The OUTCOME still says why on the decision's record; the CAUSE decides how the work ends. The\n * actor plane ends the same case ABORTED, its own non-failure ending (`endSuspendedExecutionForErasure`).\n *\n * A separate constant rather than a row of {@link DECISION_ENDING_TRANSITION}, because that table is keyed by the outcome,\n * and the same outcome ends work FAILED when an ANSWER meets a lapsed authority (the person was told to ask again). Keying\n * the work's ending on the outcome alone is what turned an erasure's ending FAILED when #2827 replaced the per-call status\n * with the table.\n */\nconst DECISION_ENDED_BY_ERASURE: ConversationalTurnTerminalEnding = Object.freeze({ status: FlowsActors_Status.CANCELLED });\n\n/**\n * The status a decision's OWN ending writes onto the row, by its outcome (`endPendingDecision`), as\n * {@link DECISION_ENDING_TRANSITION} states it. An ANSWER (accepted, modified, rejected) ends nothing: it releases a\n * continuation, whose own end is the work's. Total over the vocabulary, so an outcome added tomorrow must be classified here.\n *\n * Not what an ERASURE's ending wrote ({@link DECISION_ENDED_BY_ERASURE}): a reader with the row's history reads the\n * ending's own entry first (`decisionEndingEntryOf`), and this table answers only for a row whose entry is missing.\n */\nconst STATUS_WRITTEN_BY_DECISION_ENDING: Readonly<Record<HumanDecision_Outcome, FlowsActors_Status | undefined>> = Object.freeze({\n [HumanDecision_Outcome.ACCEPTED]: undefined,\n [HumanDecision_Outcome.ACCEPTED_WITH_MODIFICATIONS]: undefined,\n [HumanDecision_Outcome.REJECTED]: undefined,\n [HumanDecision_Outcome.LAPSED]: DECISION_ENDING_TRANSITION[HumanDecision_Outcome.LAPSED].status,\n [HumanDecision_Outcome.WITHDRAWN]: DECISION_ENDING_TRANSITION[HumanDecision_Outcome.WITHDRAWN].status,\n [HumanDecision_Outcome.REQUESTER_AUTHORITY_LAPSED]: DECISION_ENDING_TRANSITION[HumanDecision_Outcome.REQUESTER_AUTHORITY_LAPSED].status,\n});\n\n/** The statuses a conversational turn ENDS in; a row in any other status is running or waiting. */\nconst CONVERSATIONAL_TURN_ENDINGS: ReadonlySet<FlowsActors_Status> = new Set([\n FlowsActors_Status.COMPLETED, FlowsActors_Status.FAILED, FlowsActors_Status.CANCELLED, FlowsActors_Status.ABORTED,\n]);\n\n/**\n * The `statusChanges` entry a decision's own ending appended (#2865): `endPendingDecision` writes it at the instant it\n * writes as `decidedAt`, with the status the ending set. The newest such entry, or `undefined` for a row written before\n * the ending recorded one, or whose history lost it.\n */\nfunction decisionEndingEntryOf(\n row: Pick<FlowActorExecution, 'decidedAt' | 'statusChanges'>,\n): { readonly status: FlowsActors_Status; readonly failureCode?: string | null } | undefined {\n const decidedAtMs = row.decidedAt ? new Date(row.decidedAt).getTime() : Number.NaN;\n if (Number.isNaN(decidedAtMs)) return undefined;\n for (const entry of [...(row.statusChanges ?? [])].reverse()) {\n if (!entry?.timestamp || new Date(entry.timestamp).getTime() !== decidedAtMs) continue;\n if (entry.status && CONVERSATIONAL_TURN_ENDINGS.has(entry.status as FlowsActors_Status)) {\n return entry as { readonly status: FlowsActors_Status; readonly failureCode?: string | null };\n }\n }\n return undefined;\n}\n\n/**\n * Where the work named by `workRef` (its FIRST decision) stands, read off its conversation row (#2821). Pure; the row is\n * read by the caller under the conversation's isolation axes.\n *\n * Decided from what the row records about THIS work, never from the thread's own status or instants, which belong to\n * whichever turn wrote last once non-chat turns overlap:\n *\n * - WAITING: the row waits on a decision whose pause recorded it as this work's (`pendingDecisionWorkRef`: the decision\n * itself for a fresh turn, the work's first decision for a continuation that paused again). A decision an overlapping\n * turn raised is never this work's.\n * - Otherwise this work's newest `workEvents` entry: `PROCESSING` (an answer released a decision of it and that\n * continuation has not ended) → CONTINUING; an ending status → ENDED with that status. Each entry is appended by its own\n * work's release or ending through a write that does not depend on the row's status, so another turn completing,\n * pausing, or having its own decision answered in the meantime changes nothing here.\n * - FALLBACK, only when the row holds no entry for this work (a row written before the log existed, entries dropped by\n * the bound, or a process with no repository to append through): the row's own fields, as before #2821's per-work log.\n * This work holds the last resolved decision (`lastResolvedDecisionWorkRef`) and no end was written since it was\n * decided → CONTINUING; the decision's own ending → ENDED as its own `statusChanges` entry at `decidedAt` says\n * (`decisionEndingEntryOf`, #2865), or as its outcome says ({@link STATUS_WRITTEN_BY_DECISION_ENDING}) when that entry is\n * missing; the row's ending when no turn has started on the thread since → ENDED with it; else ENDED, how unknown.\n * These read the thread's instants and are exact only while no turn overlaps this work's — the reason the log exists.\n *\n * A continuation whose PROCESS dies leaves its work's newest entry PROCESSING, and so does an ending append lost to a\n * store error (logged at `recordWorkEvent`). Neither reads CONTINUING for long (#2829): the continuation holds its WORK's\n * liveness lease ({@link CONVERSATIONAL_WORK_LEASE_NAMESPACE}) from before its PROCESSING entry until after its ending\n * entry, and the interrupted-turn sweep records FAILED for a work whose lease is gone, on a thread it finds by\n * `workContinuationOpenedAt` whatever the thread's status (`sweepAbandonedWorkContinuations`). Between the death and that\n * sweep (its grace window, then one run, or two when the lease never could be written) the work still reads CONTINUING.\n * A lost ending is recorded FAILED, not as the ending that was lost: the sweep knows only that nothing runs the work.\n */\nexport function decisionWorkOfRow(\n row: Pick<FlowActorExecution, 'status' | 'pendingDecisionRef' | 'pendingDecisionWorkRef' | 'lastResolvedDecisionRef' | 'lastResolvedDecisionWorkRef'\n | 'decidedAt' | 'finishedAt' | 'decisionOutcome' | 'messages' | 'workEvents' | 'statusChanges'>,\n workRef: string,\n): ConversationalDecisionWork {\n // A row written before the work columns existed names no work: its decision is taken to open its own.\n if (row.status === FlowsActors_Status.AWAITING_APPROVAL && row.pendingDecisionRef && (row.pendingDecisionWorkRef ?? row.pendingDecisionRef) === workRef) {\n return { standing: ConversationalDecisionWorkStanding.WAITING, waitingDecisionRef: row.pendingDecisionRef };\n }\n const latest = latestWorkEventOf(row, workRef);\n if (latest) {\n if (latest.status === FlowsActors_Status.PROCESSING) return { standing: ConversationalDecisionWorkStanding.CONTINUING };\n if (CONVERSATIONAL_TURN_ENDINGS.has(latest.status)) {\n return {\n standing: ConversationalDecisionWorkStanding.ENDED,\n endedStatus: latest.status,\n ...(latest.status === FlowsActors_Status.FAILED && latest.failureCode ? { endedFailureCode: latest.failureCode } : {}),\n };\n }\n }\n // FALLBACK: no entry for this work (see above).\n if ((row.lastResolvedDecisionWorkRef ?? row.lastResolvedDecisionRef) !== workRef) return { standing: ConversationalDecisionWorkStanding.ENDED };\n if (lastResolvedDecisionContinuationIsOpen(row)\n && (row.status === FlowsActors_Status.PROCESSING || row.status === FlowsActors_Status.AWAITING_APPROVAL)) {\n return { standing: ConversationalDecisionWorkStanding.CONTINUING };\n }\n const endingStatus = row.decisionOutcome ? STATUS_WRITTEN_BY_DECISION_ENDING[row.decisionOutcome] : undefined;\n if (endingStatus) {\n // #2865: the ending's own history entry says how it ended the work, which the outcome alone cannot for an erasure's\n // ending (CANCELLED, where an answer meeting the same lapsed authority ends it FAILED). The outcome answers only for\n // a row whose entry is missing.\n const entry = decisionEndingEntryOf(row);\n if (entry) {\n const failureCode = entry.status === FlowsActors_Status.FAILED ? flowsActorsExecutionErrorCodeOf(entry.failureCode) : undefined;\n return { standing: ConversationalDecisionWorkStanding.ENDED, endedStatus: entry.status, ...(failureCode ? { endedFailureCode: failureCode } : {}) };\n }\n // #2827: the decision's own ending decides the code too.\n const transition = DECISION_ENDING_TRANSITION[row.decisionOutcome as DecisionEndingOutcome];\n return {\n standing: ConversationalDecisionWorkStanding.ENDED,\n endedStatus: endingStatus,\n ...(transition?.status === FlowsActors_Status.FAILED ? { endedFailureCode: transition.failureCode } : {}),\n };\n }\n const decidedAtMs = row.decidedAt ? new Date(row.decidedAt).getTime() : Number.NaN;\n const turnStartedSince = Number.isNaN(decidedAtMs) || (row.messages ?? []).some((message) => message.role === FlowsActors_ConversationRole.USER\n && !(new Date(message.createdAt).getTime() < decidedAtMs));\n if (CONVERSATIONAL_TURN_ENDINGS.has(row.status) && !turnStartedSince) {\n const failureCode = storedTurnFailureCodeOf(row);\n return { standing: ConversationalDecisionWorkStanding.ENDED, endedStatus: row.status, ...(failureCode ? { endedFailureCode: failureCode } : {}) };\n }\n return { standing: ConversationalDecisionWorkStanding.ENDED };\n}\n\n/** What one interrupted-turn sweep did. `failed` counts repairs only; every other count is a row left alone, and why. */\nexport interface InterruptedTurnSweepResult {\n /** True when the run did nothing because the lease could not be trusted here. */\n readonly abstained: boolean;\n readonly scanned: number;\n readonly failed: number;\n readonly stillAlive: number;\n /** Rows that ended between the listing and the repair — NOT repairs. */\n readonly raced: number;\n /** Rows whose missing lease is not yet explained; this run recorded the absence for the next. */\n readonly awaitingCorroboration: number;\n /** Rows about which this run learned nothing. */\n readonly undetermined: number;\n /** Owner scopes whose running turns could not be listed. */\n readonly unreadScopes: number;\n /** The second pass of the same run: works whose continuation's process is gone, on any thread (#2829). */\n readonly works: AbandonedWorkSweepResult;\n}\n\n/**\n * What the abandoned-work pass of one interrupted-turn sweep did (#2829). `failed` counts repairs only. The other work\n * counts say why a work was left alone; `scanned` and `settled` count THREADS.\n */\nexport interface AbandonedWorkSweepResult {\n /** Threads listed because a continuation was released on them and not yet seen to end. */\n readonly scanned: number;\n /** Works recorded FAILED: their continuation's lease is gone, and nothing else ended them. */\n readonly failed: number;\n /** Works whose continuation still holds its lease. */\n readonly stillAlive: number;\n /** Works whose continuation paused again: the thread waits on that work's decision, so nothing runs it, by design. */\n readonly waiting: number;\n /** Works that ended, or started a new continuation, between the listing and the repair — NOT repairs. */\n readonly raced: number;\n /** Works whose missing lease is not yet explained; this run recorded the absence for the next. */\n readonly awaitingCorroboration: number;\n /** Works about which this run learned nothing (the lease enquiry, the re-read or the append failed). */\n readonly undetermined: number;\n /** Threads whose `workContinuationOpenedAt` was removed: every work on them was seen ended or waiting. */\n readonly settled: number;\n /** Owner scopes whose threads could not be listed. */\n readonly unreadScopes: number;\n}\n\nconst NO_ABANDONED_WORK_SWEEP: AbandonedWorkSweepResult = Object.freeze({\n scanned: 0, failed: 0, stillAlive: 0, waiting: 0, raced: 0, awaitingCorroboration: 0, undetermined: 0, settled: 0, unreadScopes: 0,\n});\n\n/**\n * The works of a thread whose newest `workEvents` entry is `PROCESSING`, each with that entry: the works a continuation\n * was released for and that nothing recorded ending since (#2829). Ordered by that entry, oldest first.\n */\nexport function worksWithOpenContinuation(row: Pick<FlowActorExecution, 'workEvents'>): ReadonlyArray<NonNullable<FlowActorExecution['workEvents']>[number]> {\n const newest = new Map<string, NonNullable<FlowActorExecution['workEvents']>[number]>();\n for (const event of row.workEvents ?? []) {\n newest.delete(event.workRef);\n newest.set(event.workRef, event);\n }\n return [...newest.values()].filter((event) => event.status === FlowsActors_Status.PROCESSING);\n}\n\nexport const FLOW_ACTOR_EXECUTION_OWNER_VARIANTS: readonly CoreResourceType[] = Object.freeze([\n CoreResourceType.USER_FLOW_ACTOR_EXECUTIONS,\n CoreResourceType.ORGANIZATION_FLOW_ACTOR_EXECUTIONS,\n CoreResourceType.APPLICATION_FLOW_ACTOR_EXECUTIONS,\n]);\n\n/**\n * What one lapsed-approval sweep did (#484). Counted apart because each wants a different reaction\n * from whoever reads the batch output:\n *\n * - `lapsed` — a pause nobody answered in its window, now FAILED. The repair.\n * - `stillOpen` — paused and inside its window (or paused under the pre-#465 contract, with no\n * expiry at all). Correctly left alone.\n * - `raced` — lapsed when read, but the row had moved on by the time the compare-and-swap ran: a\n * decision landed, or a re-pause replaced the blob. NOT a repair, and counting it as one is how a\n * sweep claims work it did not do.\n * - `unreadable` — `AWAITING_APPROVAL` with a missing or unparseable blob. Not failed here: without\n * a readable expiry nothing says the window closed, and the resume path already refuses such a row\n * loudly. Reported so a run that is mostly this is visibly degraded rather than quiet.\n */\nexport interface LapsedApprovalPauseSweepResult {\n scanned: number;\n lapsed: number;\n stillOpen: number;\n raced: number;\n unreadable: number;\n}\n\n/** What {@link ConversationalExecutionBackendService.endDecisionsRaisedThroughEndedRelationship} did. */\nexport interface EndedRelationshipDecisionsResult {\n /** Paused turns read and judged. */\n scanned: number;\n /** Decisions ended, raised through the relationship that ended. */\n ended: number;\n /** Turns that moved on between the listing and the ending write. */\n raced: number;\n /** Turns whose pause state could not be read; left as they stand. */\n unreadable: number;\n}\n\n/**\n * When a decision was put before the person who took it (#1599 I8): the instant it was CLAIMED, when someone claimed\n * it, else the instant it was requested — both read off the row before the settling write clears them. Never the\n * moment the record is written.\n */\nexport function decisionPresentedAtOfRow(row: Pick<FlowActorExecution, 'pendingDecisionClaimedAt' | 'pendingDecisionRequestedAt'> | undefined, fallback: Date): Date {\n const instant = row?.pendingDecisionClaimedAt ?? row?.pendingDecisionRequestedAt;\n return instant ? new Date(instant) : fallback;\n}\n\n/**\n * The columns a settling compare-and-swap writes so that its decision record survives a crash (#1599 I3): the\n * decision the record is owed for, and when it was presented. Spread INTO the settling write — never written apart\n * from it, which is the one mutation that would lose a record to a crash between the two writes.\n */\nexport function correctionMarkerOf(\n decisionRef: string,\n row: Pick<FlowActorExecution, 'pendingDecisionClaimedAt' | 'pendingDecisionRequestedAt' | 'pendingDecisionOrganizationId'> | undefined,\n decidedAt: Date,\n admittedByRole?: string,\n): { pendingCorrectionRecordRef: string; pendingCorrectionPresentedAt: Date; pendingCorrectionOrganizationId: string | null; pendingCorrectionAdmittedByRole: string | null } {\n return {\n pendingCorrectionRecordRef: decisionRef,\n pendingCorrectionPresentedAt: decisionPresentedAtOfRow(row, decidedAt),\n // Review F4: the same write clears the route columns, so the marker keeps what a repaired record needs of them.\n pendingCorrectionOrganizationId: row?.pendingDecisionOrganizationId ?? null,\n pendingCorrectionAdmittedByRole: admittedByRole ?? null,\n };\n}\n\n/**\n * What one decision-deadline sweep did (#1628). `raced` counts a stage another writer settled first — the\n * stage had already fired, the decision ended or was paused, or a reassignment's route moved meanwhile.\n * `repaired` counts a row selected with nothing actually due, whose next-due instant was recomputed.\n */\nexport interface DecisionDeadlineSweepResult {\n scanned: number;\n fired: number;\n raced: number;\n unreadable: number;\n repaired: number;\n}\n\n/**\n * Owner scope of a conversation — EXACTLY ONE owner. Selects the persisted\n * polymorphic variant resource and its owner FK:\n * - `{ userId }` → `userFlowActorExecutions` (WS chat + user-delegated A2A)\n * - `{ organizationId }` → `organizationFlowActorExecutions` (org-machine A2A)\n * - `{ applicationId }` → `applicationFlowActorExecutions` (app-machine A2A)\n *\n * A conversation is owned by exactly one scope; the runtime never mixes owners on\n * one row. Resolved to `{ resourceType, ownerFields, scopeContext }` by\n * `resolveOwnerVariant`.\n */\nexport type ConversationalOwnerScope =\n | { userId: string }\n | { organizationId: string }\n | { applicationId: string };\n\n/**\n * One approve-with-modifications decision, prepared and ready to resume (#566).\n *\n * Produced by ONE walk of the SDK's message array, which is why the argument names ride here rather\n * than being recomputed at the emit site: a second walk could disagree with the version that was signed.\n * The resolved decision records the NAMES only (#1594); input digests were retired from the trail, since\n * an unkeyed digest of low-entropy arguments is reversible by enumeration and the ledger cannot be scrubbed.\n */\ninterface PreparedToolCallModification {\n /** The agent whose declaration gated the tool — for the trail, so a row reads back to a config. */\n agentRef: string;\n /** The tool name AS THE SDK ARRAY DECLARES IT, which is what the re-signature was computed over. */\n toolName: string;\n /** The rewritten, re-signed resume payload. */\n sdkModelMessages: Record<string, unknown>[];\n /** Argument NAMES the approver changed, sorted. Names only — never values. */\n modifiedArgumentKeys: string[];\n}\n\n/** `message` is for the log; `refusal` is what the approver is shown, as labels (#1186). */\ninterface ToolCallRefusal {\n kind: ToolApprovalModificationOutcomeKind.REFUSED;\n message: string;\n refusal: WS_FlowsActorsApprovalModificationRefusal;\n /** #3295: for the doors that get only the outcome (the inbox), which have no error payload to read `refusal` from. */\n humanDecisionRefusalReason?: HumanDecision_RefusalReason;\n}\n\n/**\n * The outcome of preparing a modification, discriminated by\n * {@link ToolApprovalModificationOutcomeKind} — see that enum for why the discriminant is a named\n * string rather than an `ok` boolean (this package compiles with `strict: false`, under which a\n * boolean-literal discriminant narrows nothing).\n *\n * `UNCHANGED` is the honest encoding of an edit that changed nothing: the turn resumes untouched and\n * no audit row is written, because a person who typed the same arguments back did not author them.\n */\ntype ToolCallModificationPreparation =\n | { kind: ToolApprovalModificationOutcomeKind.MODIFIED; modification: PreparedToolCallModification }\n | { kind: ToolApprovalModificationOutcomeKind.UNCHANGED }\n | ToolCallRefusal;\n\n/**\n * What a deletion found between itself and an execution row's decision (#2582). The DELETE's door reads it and refuses\n * every outcome but the first two: the row is the only thing a missing record could be repaired from, and the only\n * thing a decision still waiting could be ended on, so it may not go while either is true.\n */\nexport enum DeletedExecutionDecisionSettlement {\n /** The row held no decision and owed no record: nothing stands between it and the delete. */\n NOTHING_OWED = 'nothing_owed',\n /** Its decision was ended WITHDRAWN, recorded and announced, and the agent-work record it owed is written. */\n SETTLED = 'settled',\n /**\n * A record the row owes could not be written: the settlement of the decision just ended, or of one that ended\n * earlier. The row keeps the marker the repair sweep writes it from, so it must stay until the record exists.\n */\n RECORD_NOT_WRITTEN = 'record_not_written',\n /**\n * The run paused on a NEW decision each time the last was ended, past {@link DELETED_EXECUTION_WITHDRAWAL_ATTEMPTS}.\n * The latest is still waiting, so the delete is refused; a retry ends it.\n */\n STILL_WAITING = 'still_waiting',\n}\n\n/**\n * How many times a deletion re-reads a row whose decision it could not end because the row moved under it (#2582\n * review F5): answered and paused again on a new decision, or ended by another writer. Each extra pass needs another\n * decision to be raised in the window; a run that keeps doing so is refused rather than chased.\n */\nexport const DELETED_EXECUTION_WITHDRAWAL_ATTEMPTS = 3;\n\n/** Whether an execution row is paused on a decision a person could still answer. */\nfunction holdsPendingDecision(row: Pick<FlowActorExecution, 'status' | 'pausedApproval' | 'pendingDecisionRef'>): boolean {\n return row.status === FlowsActors_Status.AWAITING_APPROVAL && !!row.pausedApproval && !!row.pendingDecisionRef;\n}\n\n/**\n * What the resumed turn is told, beside the denier's own reason, when a denial's declared effect failed (#3015): the\n * refusal stands, and the record it was about is unchanged, so the model can say so rather than imply it moved.\n */\nconst DENIAL_EFFECT_FAILED_REASON = 'The refusal could not be applied to the record this action was about: that record is unchanged.';\n\n/** An owner scope resolved to its persisted variant + owner FK + `*AsSystem` scope map. */\nexport interface ResolvedOwnerVariant {\n resourceType: CoreResourceType;\n ownerFields: Record<string, string>;\n scopeContext: { userId?: string; organizationId?: string; applicationId?: string };\n}\n\n/** Parameters to start one conversational execution of an actor system. */\nexport interface StartConversationalExecutionParams {\n /**\n * The A2A agent this turn arrived through — absent for the WebSocket surface, which has no agent,\n * and for the default (unnamed) A2A agent. Normalised to the sentinel on the way to storage and\n * part of the continuation filter thereafter, so a held `contextId` cannot load this transcript\n * into a different agent's context (review finding G5-8).\n */\n resourceServerInstanceRef?: string;\n /** Ref of the flow/actor system to converse with. */\n systemRef: string;\n /** Client-supplied execution id; a new one is minted when absent. */\n executionId?: string;\n /** Free-form start input from the client; the user's turn is read from it. */\n initialInput?: Record<string, unknown>;\n /** Authenticated initiator identity (from the socket / A2A auth). */\n initiator: ExecutionContext_InitiatorIds;\n /**\n * Full verified auth of the caller (user OR machine principal). Used to build\n * the tool `ExecutionContext` when running the agent's tools, so tools read/write\n * as the caller with the caller's own visibility (never trusting LLM-supplied\n * identity).\n */\n auth: SocketAuthResult;\n /** Owner scope of the persisted execution (selects the variant + owner FK). */\n scopeContext: ConversationalOwnerScope;\n /**\n * The context the client opened this conversation in, canonicalised by\n * `canonicalizeFlowsActorsContextRef` — persisted on a NEW thread as `contextRef` so history can\n * be listed per context. Ignored on a continuation: the thread keeps the context it was opened in.\n */\n contextRef?: string;\n /** Sink for the server→client stream of this execution. */\n emitter: FlowsActorsExecutionEmitter;\n /**\n * Which door opened this turn (#1594). Required, so every door states it: a decision raised later in\n * the turn is routed and re-authorized by it, and it cannot be recovered from the row afterwards.\n */\n initiationKind: FlowsActors_InitiationKind;\n /**\n * The stored inbound delivery the user's message arrived through (#2665): set by the chat door from the delivery it\n * runs for, never by a request. Recorded on the user message, so the transcript says which messages came from chat\n * (the reply posted there answers those, never an in-app one) and an audit reader can join a message to its delivery.\n */\n arrivedThrough?: Inbound_Arrival;\n /**\n * Cooperative cancellation for this turn's model call. Supplied by the A2A transport\n * when the turn is addressable as a task (so `tasks/cancel` can reach it); absent for\n * WebSocket chat, where the client cancels by disconnecting.\n */\n abortSignal?: AbortSignal;\n /**\n * INSERT a new thread and never continue one (#1611 I5). The autonomous entry point sets it: its\n * `executionId` is derived from the occurrence, so an id that already exists is the same occurrence\n * arriving twice, never a conversation to append to. With it set the thread is not read at all; a row\n * that already exists makes the insert fail and the turn is reported `PERSIST_FAILED`, which the entry\n * point answers as \"already started\" after re-reading the id.\n */\n createOnly?: boolean;\n /** AUTONOMOUS turns only (#1611): what the entry point resolved, written on the new row and never updated. */\n autonomous?: ConversationalAutonomousTurnFacts;\n /**\n * The CASE this conversation works on (#1598): a row of a resource declared `workUnit: true`. Every model call\n * of the turn, and of its resumes, is attributed to it. Written on the NEW row only (the column is never\n * updated), so the thread keeps the case it was opened on and a resume, which is a different request, reopens\n * it from the row.\n *\n * The caller's boundary has ALREADY checked it (`WorkUnitCaseBackendService.admitClientCaseRef`): the\n * resource is a work unit and the caller can READ the row. This service never trusts an unchecked case.\n * An autonomous turn passes its case through `autonomous.caseRef` instead.\n */\n caseRef?: WorkUnitRef;\n /**\n * The id to store the person's message under, as the client minted it (#2525 review N1): a page that draws the message\n * before the record holds it recognises it there by identity. Ignored when the thread already holds that id — the\n * server then mints its own, so a client can never overwrite or alias a stored message.\n */\n userMessageId?: string;\n}\n\n/** What the autonomous entry point records on the row of a turn it opens (#1611). */\nexport interface ConversationalAutonomousTurnFacts {\n readonly autonomousAgentRef: string;\n readonly trigger: AutonomousTurnTrigger;\n readonly principalSource: AutonomousPrincipalSource;\n readonly caseRef?: WorkUnitRef;\n /** `SKIP_IF_ACTIVE` agents only: the concurrency slot this turn holds while active. */\n readonly activeSlotKey?: string;\n}\n\n/**\n * Drives a **conversational execution** of a flows-actors system: resolve the\n * system, find its chat actor's agent, stream the agent's token-by-token answer\n * (executing its grounding tools mid-turn), and persist the execution + full\n * message log to the owner's `*FlowActorExecutions` variant — streaming server→client\n * events over the supplied emitter throughout.\n *\n * PERSISTENCE + MULTI-TURN (server-authoritative): one execution row per\n * discussion accumulates every turn's messages. Each turn READS the existing row\n * (owner-scoped via `scopeContext` — the USER_SELF filter resolves from the scope\n * context-map, never LLM- or client-supplied identity), builds the LLM context\n * from that DURABLE transcript, and writes its user + assistant turns onto the row\n * AS IT STANDS at each write (#2743: a turn overlapping it on the same thread may have\n * written meanwhile, and a write that replaced the transcript erased that turn's\n * messages; see {@link ConversationalTurnTranscript}). Reload history is served from the same rows by the controller's\n * `/flows-actors/history` endpoint under the caller's own EC. No client-supplied\n * history is trusted, and nothing is stored browser-side.\n *\n * SCOPE: the actor conversational path streams a real round-trip against\n * `AgentsBackendService.invokeAgentStreaming` (buffered fallback for non-streaming\n * transports) with tool execution. The richer actor plan/task orchestration\n * (`actorState` graph state) is not produced yet — see the schema note.\n *\n * KIND-AGNOSTIC (Invariant): the record persisted is kind-discriminated. v1\n * implements the ACTOR conversational path only; a FLOW system fails closed with\n * a typed \"not implemented\" rather than pretending to run.\n */\n/**\n * Keep only conversation messages that can actually be PERSISTED — i.e. those carrying content.\n *\n * WHY: `FlowActorExecution_Message.content` is declared `z.string()`, which maps to a REQUIRED\n * mongoose string, and mongoose treats `''` as ABSENT — so a message with empty content fails the\n * write with `messages.<n>.content: Path 'content' is required`. That matters far beyond the one\n * message: the execution row is persisted by writing the WHOLE messages array together with the\n * terminal status, so ONE contentless message used to fail the entire update — discarding the user's\n * own turn and leaving the row wedged at PROCESSING. An assistant turn legitimately produces no text\n * (a reasoning-only step, or a tool loop whose continuation yielded nothing), so this is a real state\n * that must not cost the rest of the history.\n *\n * Dropping such a message is honest rather than lossy: an empty message carries no information, and\n * its absence — next to a COMPLETED status — is itself the signal. Callers should log the empty-reply\n * case so it stays visible.\n */\nexport function toPersistableConversationMessages(\n messages: readonly FlowActorExecution_Message[],\n): FlowActorExecution_Message[] {\n return messages.filter((message) => typeof message?.content === 'string' && message.content.length > 0);\n}\n\n/**\n * What one turn writes into its thread's transcript, as a FUNCTION of the transcript as it stands when the write lands\n * (#2743).\n *\n * One thread admits overlapping turns: two in-app or A2A messages sent before the first reply ended, or a message sent\n * while a resumed turn runs. Each turn starts from the transcript it read, and every write that advanced or ended a turn\n * used to REPLACE the row's `messages` with that turn's own snapshot. So whichever turn wrote last erased the other's\n * messages: T1 wrote `[…, u1, a1]`, T2 then wrote `[…, u2, a2]`, both replies had streamed, and a reload showed one.\n *\n * So a turn never carries a transcript. It carries what it does to one, and\n * {@link ConversationalExecutionBackendService} applies it to the row as it is at the moment the write lands, under a\n * compare-and-swap on the row's `_version` (`writeTurnTranscript`). A sibling turn's messages written meanwhile are in\n * `current`, so they stay.\n *\n * A function rather than a list of messages to append: a turn does not only append. Its trace UPDATES the tool row a\n * pause stored (`ConversationalTurnTrace.appendTo` merges a call by `toolCallId`, keeping one row per call across the\n * pause), and no array append on either store can express that. Rejected: an atomic `$push` (the guarded mutation's\n * array addition) for every write but the resumed one, which would leave two mechanisms for one invariant and the\n * resumed turn still replacing.\n */\nexport type ConversationalTurnTranscript = (current: readonly FlowActorExecution_Message[]) => FlowActorExecution_Message[];\n\n/** #2827: the end the interrupted-turn sweep records, for a turn and for the work it ran: its process went away. */\nconst TURN_INTERRUPTED_END = { status: FlowsActors_Status.FAILED, failureCode: FlowsActors_ExecutionErrorCode.TURN_INTERRUPTED } as const satisfies FlowsActors_StatusTransition;\n\n/**\n * #2827: the code a turn that ended without the pause it reached for records, tells its client, and leaves on the work it\n * ran. One constant because three sites state it (`endTurnWithoutPause`'s write, its client message, and the resumed\n * work's ending, which reads `PauseAttemptOutcome.ENDED_WITHOUT_PAUSE` and must agree with what was written). The words\n * differ per exit (the failure message); the code does not, since no exit has a remedy the client could branch on.\n */\nexport const TURN_ENDED_WITHOUT_PAUSE_CODE = FlowsActors_ExecutionErrorCode.AGENT_FAILED;\n\n/**\n * How a turn ENDS without completing (#2827): CANCELLED, or FAILED with the code its client is told. A FAILED end without\n * a code is not expressible, so every terminal failure of a turn is stored with the code a reload, a chat reply and an\n * A2A task read back.\n */\ntype ConversationalTurnTerminalEnding =\n | { readonly status: FlowsActors_Status.CANCELLED }\n | { readonly status: FlowsActors_Status.FAILED; readonly failureCode: FlowsActors_ExecutionErrorCode };\n\n/** The transcript as it stands: for a turn whose earlier work the row already holds (a resumed turn after its answer). */\nexport const TRANSCRIPT_AS_IT_STANDS: ConversationalTurnTranscript = (current) => [...current];\n\n/**\n * #2292: a turn's own write fields with its placeholders renamed to the names the conversation stores them under (see\n * `TurnPersonalDataView.stateToStore`). Only `pausedApproval` carries them: the paused call as the model wrote it, and its\n * arguments when the reader is shown placeholders.\n */\nfunction renamedPlaceholdersInTurnFields(fields: Record<string, unknown>, renames: ReadonlyMap<string, string>): Record<string, unknown> {\n if (renames.size === 0 || typeof fields.pausedApproval !== 'string') return fields;\n return { ...fields, pausedApproval: renamePlaceholders(fields.pausedApproval, renames) };\n}\n\n/**\n * #2292: the transcript to write, with this turn's placeholders renamed in the messages THIS turn added (those the row\n * did not hold). A message another turn wrote keeps its names: they are that turn's, and the row binds them.\n */\nfunction renamedPlaceholdersInTurnMessages(\n current: readonly FlowActorExecution_Message[],\n next: FlowActorExecution_Message[],\n renames: ReadonlyMap<string, string>,\n): FlowActorExecution_Message[] {\n if (renames.size === 0) return next;\n const held = new Set(current.map((message) => message.id));\n return next.map((message) => (held.has(message.id) || typeof message.content !== 'string'\n ? message\n : { ...message, content: renamePlaceholders(message.content, renames) }));\n}\n\n/**\n * The transcript with the turn's own `message` on it: left where an earlier write of the same turn put it (the user's\n * message, written when the turn advanced the row), and appended when the row does not hold it.\n */\nexport function transcriptWithTurnMessage(\n transcript: readonly FlowActorExecution_Message[],\n message: FlowActorExecution_Message,\n): FlowActorExecution_Message[] {\n return transcript.some((held) => held.id === message.id) ? [...transcript] : [...transcript, message];\n}\n\n/**\n * How many consecutive compare-and-swap misses a transcript write tolerates before it gives up (#2743). A miss means\n * ANOTHER write landed on the same row between this write's read and its write, so each one is progress for some turn.\n * Bounded only so that a row rewritten without pause can never hold a turn's end forever; reaching it throws, and every\n * caller already handles a write that throws.\n */\nconst TURN_TRANSCRIPT_WRITE_ATTEMPTS = 10;\n\n/**\n * The machine credential that owns a turn, normalised for storage and filtering.\n *\n * A user-delegated turn has none — the human is the principal and the `userId` owner FK already\n * discriminates — so it stores the sentinel rather than a null, keeping the filter a plain\n * equality on both persistence adapters.\n */\n/**\n * The agent instance a turn arrived through, normalised for storage and filtering.\n *\n * The WebSocket surface has no agent and the default A2A agent is an identity of its own; both\n * store the sentinel. One resolver rather than the expression repeated at each of the five\n * owner-scoped sites — see `.claude/rules/invariant-call-site-enumeration.md`.\n */\nfunction agentInstanceOf(resourceServerInstanceRef: string | undefined): string {\n return resourceServerInstanceRef ?? FLOWS_ACTORS_DEFAULT_AGENT_INSTANCE;\n}\n\n/**\n * The machine credential a turn's owner-scoped rows are keyed by, or the sentinel when the caller is not a machine.\n * Typed on {@link SocketAuthResult} itself, whose `initiatorIds` is NULLABLE: a hand-written structural parameter\n * omitted the `null` and so accepted no real auth result under `strictNullChecks` (#3583).\n */\nfunction machineCredentialIdOf(auth: Pick<SocketAuthResult, 'initiatorIds'> | undefined): string {\n return auth?.initiatorIds?.machineCredential?.credentialId ?? FLOWS_ACTORS_NO_MACHINE_CREDENTIAL;\n}\n\n/**\n * The server's sentence for a message refused because the thread waits for a decision (#2721). Door-neutral (#2721\n * review F-5): the decision settles by an answer, a lapse or, on the A2A door only, `tasks/cancel`, so naming one way\n * on would promise a door the reader may not have. A client words the refusal from its own labels; this sentence\n * reaches an A2A client as the JSON-RPC error's message and the log.\n */\nexport function decisionPendingMessage(decisionRef: string | undefined): string {\n return `This conversation is waiting for a decision${decisionRef ? ` (${decisionRef})` : ''}, and takes no new message until it is settled.`;\n}\n\n/** What {@link ConversationalExecutionBackendService.previewChatTurn} found (#2665 S6, plan V1). */\nexport enum ChatTurnPreviewKind {\n /** The turn may start, with the authority given (confined to the chat's organization). */\n ADMITTED = 'admitted',\n /** The conversation already holds this message. */\n ALREADY_RECEIVED = 'already_received',\n /**\n * The conversation waits for a human decision and takes no new message until it settles. When the decision is a\n * question the person's next message can answer (`replyAnswer`, #2751), the chat door answers it with the message.\n */\n WAITING_FOR_DECISION = 'waiting_for_decision',\n /** A turn is running in the conversation: the message waits for it to end. */\n BUSY = 'busy',\n /** The message cannot start a turn: consent, or a system that cannot converse. */\n REFUSED = 'refused',\n}\n\nexport type ChatTurnPreview =\n | { readonly kind: ChatTurnPreviewKind.ADMITTED; readonly auth: SocketAuthResult }\n | { readonly kind: ChatTurnPreviewKind.ALREADY_RECEIVED }\n | {\n readonly kind: ChatTurnPreviewKind.WAITING_FOR_DECISION;\n readonly decisionRef: string;\n /**\n * #2751: how the person's message answers the waiting decision, when it is an agent's question whose whole answer is\n * one piece of prose (`humanDecisionReplyAnswerOf`). Absent for every other decision, which the message cannot answer.\n */\n readonly replyAnswer?: HumanDecisionReplyAnswer;\n }\n | { readonly kind: ChatTurnPreviewKind.BUSY }\n | { readonly kind: ChatTurnPreviewKind.REFUSED; readonly errorCode: FlowsActors_ExecutionErrorCode };\n\n/**\n * The preview could not tell whether the application's consent requirement admits the turn (#2665 S6 review M1): not the\n * person's refusal, so the delivery fails this attempt and is tried again, named in its attempt record.\n */\nexport class ChatTurnConsentNotEvaluatedError extends Error {\n override readonly name = 'ChatTurnConsentNotEvaluatedError';\n\n constructor(executionId: string) {\n super(`The application's consent requirement could not be evaluated for the chat conversation ${executionId}; the message is tried again`);\n }\n}\n\n/** The server's sentence for a message refused because a chat turn admits no second turn beside it (#2665). */\nexport const CONVERSATION_BUSY_MESSAGE = 'A turn is already running in this conversation; send the message again once it ends.';\n\n/** The refusal of a turn by the system's launch gate (`SYSTEM_ROLE_NOT_HELD`, #2544 follow-up). */\nconst SYSTEM_ROLE_NOT_HELD_MESSAGE = 'This assistant is open only to certain roles, and you hold none of them here. An administrator can give you one.';\n\n/**\n * Whether a turn arriving from `arrivingKind` must wait for the turn running on `row` (#2665 A6). A conversation that a\n * chat turn is running in, or that a chat turn arrives at while any turn runs, admits ONE turn at a time: the chat\n * reply is posted where the person wrote, and two turns beside it would interleave two replies in one thread and\n * interleave two transcripts. Two in-app or A2A turns may still overlap, as before; each writes its messages onto the row\n * as it stands, so neither erases the other's (#2743, `writeTurnTranscript`).\n *\n * Decided per turn from the door, not from a column: every turn records its own door on the row, and a waiting row\n * (AWAITING_APPROVAL) is refused separately and keeps the door of the turn that paused, so the rule holds across a\n * resume. {@link conversationalAdvanceGuard} is the same rule as the advance write's filter, so a turn started between\n * the read and the write is refused too.\n */\nexport function conversationRefusesArrivingTurn(\n row: Pick<FlowActorExecution, 'status' | 'initiationKind'>,\n arrivingKind: FlowsActors_InitiationKind | null | undefined,\n): boolean {\n if (row.status !== FlowsActors_Status.PROCESSING) return false;\n return arrivingKind === FlowsActors_InitiationKind.CHAT_MESSAGE || row.initiationKind === FlowsActors_InitiationKind.CHAT_MESSAGE;\n}\n\n/**\n * The condition the single advance write puts on the row's status (#2721, #2665 A6): never out of AWAITING_APPROVAL, and\n * never onto a row a turn runs in when {@link conversationRefusesArrivingTurn} would refuse it. A chat turn excludes\n * every running row; any other turn excludes only a row a CHAT turn runs in. A running row that predates recording the\n * door (no `initiationKind`) stays advanceable: `$ne` matches a missing value on both stores (PostgreSQL compiles it as\n * `IS DISTINCT FROM`, for parity with MongoDB), pinned on both by the native lane.\n */\nexport function conversationalAdvanceGuard(arrivingKind: FlowsActors_InitiationKind | null | undefined): Record<string, unknown> {\n const notWaitingNorRunning = { status: { $nin: [FlowsActors_Status.AWAITING_APPROVAL, FlowsActors_Status.PROCESSING] } };\n if (arrivingKind === FlowsActors_InitiationKind.CHAT_MESSAGE) return notWaitingNorRunning;\n return {\n $or: [\n notWaitingNorRunning,\n { status: FlowsActors_Status.PROCESSING, initiationKind: { $ne: FlowsActors_InitiationKind.CHAT_MESSAGE } },\n ],\n };\n}\n\n/**\n * What a turn-ending write found (#2721 review N-1). A turn reports its own end only when its end was RECORDED; when\n * another turn's decision holds the thread its end is not written, and the client is told the decision waits.\n */\nenum TurnEndRecordKind {\n /** The end was written, or the write failed with nothing waiting on the row: the turn reports its own end. */\n RECORDED = 'recorded',\n /** The row waits for a decision another turn on the thread raised meanwhile: nothing was written. */\n DECISION_WAITING = 'decision_waiting',\n}\n\ntype TurnEndRecord =\n | { readonly kind: TurnEndRecordKind.RECORDED }\n | { readonly kind: TurnEndRecordKind.DECISION_WAITING; readonly decisionRef: string };\n\nconst TURN_END_RECORDED: TurnEndRecord = { kind: TurnEndRecordKind.RECORDED };\n\n/*\n * #2820: the read-back vocabulary (`DecisionRequestWriteOutcome`), its delays, the repair's grace and the request row's id\n * (`humanDecisionRequestedAuditEventId`) moved to `pending-human-decision.backend.utils`, shared with the actor,\n * operation-approval and representative-admission planes, which have the same commit-then-throw write, together with the\n * repair's result shape (`UnrecordedDecisionRequestRepairResult`).\n */\n\n/** An actor system a conversation can run on, or why the ref names none (the error the turn ends with). */\ntype ConversationalActorSystemResolution =\n | { readonly actorSystem: ActorSystem; readonly refusal?: undefined }\n | { readonly actorSystem?: undefined; readonly refusal: { readonly errorCode: FlowsActors_ExecutionErrorCode; readonly errorMessage: string } };\n\n/** A read of a decision's row that failed: nothing may be decided from it (`HumanDecisionNoticeStayLiveness.UNREADABLE`). */\nconst UNREADABLE_DECISION_ROW = Symbol('unreadable-decision-row');\n\n/** What {@link ConversationalExecutionBackendService} resumes a paused turn with. */\n/**\n * How a resumed turn ended, filled by its own end sites (#2821) for {@link ConversationalExecutionBackendService} to\n * append to the work's `workEvents` once the resume is over. `status` is the turn's own ending, set BEFORE the row write\n * that records it, since an overlapping turn may refuse that write while the work has ended all the same. Left unset when\n * the work did not end here: the resume paused again (or may have), or an inline resume of the same work recorded it.\n */\ninterface ResumedTurnEnding {\n status?: FlowsActors_Status;\n /** The error a FAILED ending reported to its owner, and recorded on the row (#2827). Every FAILED end site sets it. */\n errorCode?: FlowsActors_ExecutionErrorCode;\n /** #3313: the accepted call's `execute` was reached, whatever it answered: a tool that failed once it ran was not left unrun. */\n acceptedCallReached?: boolean;\n}\n\n/**\n * #2827: the work-log entry a resumed turn's ending records. A FAILED end site always sets its code; one that did not\n * would be a defect, recorded as the generic failure it reported rather than as no reason at all.\n */\nfunction resumedWorkTransitionOf(ending: ResumedTurnEnding & { status: FlowsActors_Status }): FlowsActors_StatusTransition {\n return ending.status === FlowsActors_Status.FAILED\n ? { status: FlowsActors_Status.FAILED, failureCode: ending.errorCode ?? FlowsActors_ExecutionErrorCode.AGENT_FAILED }\n : { status: ending.status };\n}\n\n/**\n * What one append to a thread's per-work log did (`recordWorkEvent`, #2829). The interrupted-turn sweep tells the three\n * apart: an entry that matched no row was refused by its guard (the row moved on), which is a race, while one that could\n * not be written taught it nothing.\n */\nenum WorkEventRecording {\n /** The entry is on the row. */\n LANDED = 'landed',\n /** The filter matched no row: the row is gone, or a guard in the filter (the sweep's `workContinuationOpenedAt`) moved. */\n NO_ROW = 'no-row',\n /** Not written: no repository is bound here, or the write threw (logged where it happened). */\n NOT_RECORDED = 'not-recorded',\n}\n\n/**\n * Why the abandoned-work pass left a work alone or failed it (#2829). Each value names the {@link AbandonedWorkSweepResult}\n * count it adds to, so the tally cannot count a work under a reason it did not have.\n */\nenum OpenWorkContinuationSweepOutcome {\n FAILED = 'failed',\n STILL_ALIVE = 'stillAlive',\n WAITING = 'waiting',\n RACED = 'raced',\n AWAITING_CORROBORATION = 'awaitingCorroboration',\n UNDETERMINED = 'undetermined',\n}\n\n/**\n * The outcomes after which a thread may still hold a continuation that runs, or whose death is not yet established, so its\n * `workContinuationOpenedAt` stays. A work that failed, ended, restarted or waits on its decision needs no further look:\n * a restart wrote a newer instant, and an answer to the decision will.\n */\nconst OPEN_WORK_CONTINUATION_OUTCOMES_KEEPING_THE_MARKER: ReadonlySet<OpenWorkContinuationSweepOutcome> = new Set([\n OpenWorkContinuationSweepOutcome.STILL_ALIVE,\n OpenWorkContinuationSweepOutcome.AWAITING_CORROBORATION,\n OpenWorkContinuationSweepOutcome.UNDETERMINED,\n]);\n\n\n/**\n * What the agent is told when a person refuses a call it asked to run. A question's decline had words of its own and this\n * had none, so the model received a bare denial, read it beside instructions that mention approval, and asked the person\n * who had just refused to approve the call.\n */\nconst CALL_REFUSED_BY_A_PERSON_REASON =\n 'The person reviewed this call and refused it, so it did not run. Do not ask them to approve it again. Say it was not done, and ask what they would like instead.';\n\n/** What a gated call's presentation binds beyond its arguments (#2904 file deliverable, #2914 record values). */\ntype DecisionPresentationBindings = ResolvedDecisionDeliverables & { readonly subjectRecord?: HumanDecision_PresentedRecord };\n\n/**\n * What one attempt to pause a turn on a human decision DID (#2821), as `persistApprovalSuspension` itself knows it, so a\n * resume that paused again writes its work's log from the attempt's own outcome and never infers it from a later read of\n * the row (which an answer to the new decision, an automated approver's, can have moved on in between). A closed\n * vocabulary with one named source, per the repository's semantic-literal rule.\n */\nenum PauseAttemptOutcome {\n /** The pause landed: the work waits on the decision it raised. Nothing of the work ended. */\n RAISED = 'raised',\n /**\n * The pause write threw and could not be read back, so whether the decision was raised is unknown. The work's log\n * records nothing: if the decision waits, the work reads WAITING and its answer or its ending continues the log; if it\n * does not, the row stays PROCESSING and the interrupted-turn sweep fails the turn, which ends the work in its log.\n * Recording an ending here would be a guess that is wrong exactly when the decision waits, and an approver can answer.\n */\n UNCONFIRMED = 'unconfirmed',\n /** No pause: the turn ended through its own exits (the person's stop → CANCELLED, otherwise FAILED). */\n ENDED_WITHOUT_PAUSE = 'ended_without_pause',\n /** Nobody could answer, so the call was denied and the turn resumed inline; that resume records its own ending. */\n RESUMED_INLINE = 'resumed_inline',\n}\n\ninterface ResumeAfterApprovalParams {\n systemRef: string;\n executionId: string;\n owner: ResolvedOwnerVariant;\n paused: FlowActorExecution_PausedApproval;\n approved: boolean;\n reason?: string;\n auth?: SocketAuthResult;\n resourceServerInstanceRef?: string;\n emitter?: FlowsActorsExecutionEmitter;\n /**\n * What the turn being resumed wrote into the thread that the row does NOT hold yet; the resumed turn's own work follows\n * it, and both are written onto the row as it stands (#2743). {@link TRANSCRIPT_AS_IT_STANDS} for a decision that was\n * answered (the pause recorded everything before it); the paused turn's own transcript for an automatic denial, which\n * resumes inline with no pause written.\n *\n * REQUIRED, and no longer a transcript: every write below used to REPLACE the row's `messages` with what it was given,\n * so an omitted transcript was written as `[]` and erased the conversation the moment a resumed model call threw\n * (#2521), and a message sent while the resumed turn ran was erased by its end (#2743).\n */\n transcript: ConversationalTurnTranscript;\n /**\n * The SDK array REWRITTEN so the pending tool call carries the approver's own arguments, with\n * the approval signature re-bound to them (#566).\n *\n * Absent on every ordinary decision, which is why the fallback is the untouched\n * `paused.sdkModelMessages` rather than a merge: the contract above — \"we do not reconstruct the\n * conversation\" — still holds. A modification replaces exactly two values inside the array the\n * SDK itself produced, and nothing else about it is authored here.\n */\n modifiedSdkModelMessages?: Record<string, unknown>[];\n /**\n * #2292: the paused turn's personal-data view, when the caller holds it (an automatic denial, or an answer whose\n * modification it tokenized). Otherwise the resume opens one from `storedPersonalDataState`.\n */\n personalData?: TurnPersonalDataView;\n /** #2292: the row's `personalDataModelState`, as read with the decision. */\n storedPersonalDataState?: string | null;\n /** The decision this resume answers; stamped on every tool call it makes so each row names it (#1594). */\n decisionRef?: string;\n /**\n * #2904: the approval seal the answer's release wrote, handed to every tool call of the resume beside `decisionRef`\n * (`FunctionToolExecutionContext.decisionSealId`), so a consumer that records the decision stores its seal. Absent\n * when nothing was sealed (an automatic denial, a host without the seal services).\n */\n decisionSealId?: string;\n /**\n * The WORK this resume continues, named by its first decision (#2821): the answered decision's\n * `pendingDecisionWorkRef`, or the turn's own work for an inline resume. A pause it makes belongs to that work, and an\n * answered resume is registered under it, so a stop of the work reaches every continuation in its chain.\n */\n workRef?: string;\n /** The original requester, carried into a second pause so it is theirs, never the answerer's (D11, I10). */\n requester?: HumanDecision_Requester;\n /** The door that opened the turn, carried unchanged into a second pause. */\n initiationKind?: FlowsActors_InitiationKind | null;\n /** AUTONOMOUS turns: what started the turn, from its row (#1611). */\n autonomousTrigger?: AutonomousTurnTrigger | null;\n /** Automatic denials this turn has already had — see `persistApprovalSuspension`. */\n automaticDenials?: number;\n /**\n * The abort of the turn this resume CONTINUES, when it is resumed inline (an automatic denial): the caller's cancel\n * (A2A `tasks/cancel`, an SSE hang-up) reaches the resumed model call through it (#2721 gate-4 F4). The owner's Stop\n * does not need it: every resume registers with the running-turn registry, which it reaches. Absent on a resume an\n * answer released, which no caller is waiting on: the request that opened that work reaches it by the decision it\n * continues instead, on whichever replica runs it ({@link ConversationalExecutionBackendService.stopResumedTurns}, #2550,\n * #2821).\n */\n abortSignal?: AbortSignal;\n /**\n * When the answer that released this resume DECIDED it (its `decidedAt`, epoch ms), #2550. A stop of its decision that\n * reached this process after that instant and before the resume registered (while the release was written and the\n * decision recorded) found no turn to stop; it is honoured at registration instead. Absent on an inline resume, which\n * hears its own turn's abort — and its absence is what registers such a resume as part of that turn rather than as a\n * decision resume (`runResumeAfterApproval`).\n */\n releasedAt?: number;\n /**\n * #3313: how the decision this resume carries out was accepted, on a release that accepted one. A denial runs nothing and\n * an inline resume is an automatic denial, so neither carries it; a turn ending before an accepted call ran owes a record.\n */\n acceptedAs?: HumanDecision_Outcome;\n /** #3313: the organization the accepted decision was routed in, as its RESOLVED row names it. The release clears it from the row. */\n acceptedDecisionOrganizationId?: string;\n /**\n * The case the thread was opened on (#1598), from its row. Absent: read from the row here, so a resume is\n * attributed to its case whatever door released it — the resume is a different request, with no frame.\n */\n caseRef?: WorkUnitRef | null;\n}\n\n@injectable()\nexport class ConversationalExecutionBackendService implements HumanDecisionNoticeSource {\n constructor(\n @inject(SAAS_SERVICE_TYPES.Logger) private readonly logger: LoggerService,\n @inject(SAAS_SERVICE_TYPES.FlowsActorsRegistryService) private readonly flowsActorsRegistry: FlowsActorsRegistryService,\n @inject(SAAS_SERVICE_TYPES.AgentsBackendService) private readonly agentsBackend: AgentsBackendService,\n @inject(SAAS_SERVICE_TYPES.ResourceRegistryService) private readonly resourcesRegistry: ResourcesRegistryBackendService,\n @inject(SAAS_SERVICE_TYPES.ServicesRegistryHandlerService) private readonly servicesRegistryHandler: ServicesRegistryHandlerBackendService,\n @inject(SAAS_SERVICE_TYPES.ExecutionContextCreatorBackendService) private readonly executionContextCreator: ExecutionContextCreatorBackendService,\n @inject(SAAS_SERVICE_TYPES.SystemAccessService) private readonly systemAccess: SystemAccessBackendService,\n @inject(SAAS_SERVICE_TYPES.RateLimitBackendService) private readonly rateLimitService: RateLimitBackendService,\n // Appended LAST deliberately: a constructor parameter inserted mid-list silently re-binds every\n // positional construction site (the DI container resolves by decorator, hand-built test doubles\n // do not).\n @inject(SAAS_SERVICE_TYPES.AuthorizationsService) private readonly authorizer: AuthorizationsBackendService,\n /**\n * The trail an approve-with-modifications decision leaves. `@optional` and feature-detected at\n * every use, for the reason the MCP emitter already records: an absent or failing audit sink\n * must never fail the act it was going to observe, and this service is constructed positionally\n * by hand in several test doubles.\n */\n @inject(SAAS_SERVICE_TYPES.AuditLogsService) @optional() private readonly auditLogs?: AuditLogsBackendService,\n /**\n * Where a newly routed decision is announced to the people it was routed to (#1594 D6). `@optional()`:\n * a process with no socket server (a worker, a minion) routes decisions just the same, and those people\n * find them in their inbox. Appended last, like every optional injection here.\n */\n @inject(SAAS_SERVICE_TYPES.WebSocketService) @optional() private readonly webSocket?: WebSocketService,\n /**\n * Where a running turn's liveness lease is written (#1780). `@optional()`: a process with no Redis\n * bound runs turns exactly the same and leases none, and the interrupted-turn sweep abstains there\n * because the lease cannot be written. Appended last, like every optional injection here.\n */\n @inject(SAAS_SERVICE_TYPES.RedisService) @optional() redisService?: RedisService,\n /**\n * #1628: the application's `reviewCalendar` (CALENDAR-basis deadlines) and its identity, for a deadline\n * email. `@optional()` and appended last: absent, every clock counts elapsed time — which startup has\n * already guaranteed is what every gate asks for — and no email carries a link.\n */\n @inject(SAAS_SERVICE_TYPES.AppConfigService) @optional() private readonly appConfig?: AppConfigurationService,\n /** #1628: deadline reminders by email. `@optional()`: absent, reminders go in-app only. */\n @inject(SAAS_SERVICE_TYPES.EmailService) @optional() private readonly emailService?: EmailBackendService,\n // Writes a person's own emails in their language (#1799 review M3).\n @inject(SAAS_SERVICE_TYPES.RecipientLanguageService) @optional() private readonly recipientLanguage?: RecipientLanguageBackendService,\n /**\n * The HOSTS of decision planes beside this one (#1612, #2539): a granting organization's per-representative\n * approvals (a representing organization's assignment) and an application's actor-system questions (its own actor\n * plane). Their cards join this inbox and their acts this act route, so a person has one list and one door whatever\n * plane a decision is on. `@optional()`: absent, only the conversational plane is served.\n *\n * A list since #2539. The note that stood here said a SECOND host \"would turn this into a registry; one does not\n * justify one\" — the actor plane is that second host, so it is now a list bound in one place (the container), and\n * each host answers for its own decisions (`holdsDecision`) by id alone.\n */\n @inject(SAAS_SERVICE_TYPES.HumanDecisionHosts) @optional() private readonly humanDecisionHosts?: readonly HumanDecisionHost[],\n /**\n * #1599: where a settled decision on an agent's proposal is recorded. `@optional()` and appended last: absent, a\n * decision still settles and its marker stays on the row for a process that has the recorder to repair.\n */\n @inject(SAAS_SERVICE_TYPES.AgentWorkDecisionsService) @optional() private readonly agentWorkDecisions?: AgentWorkDecisionsBackendService,\n /**\n * #2664: what the walk over a decision's holders reads, by keyset (`collectHumanDecisionAnswerers`). `@optional()` and\n * appended last: absent, a ROLE decision's notices reach nobody (with a warning) and the decision is in the inbox.\n */\n @inject(SAAS_SERVICE_TYPES.RepositoriesRegistryHandlerService) @optional() private readonly repositoriesRegistry?: RepositoriesRegistryHandlerBackendService,\n /**\n * #2664 S5b gate L3: where a resolved decision's outcome reaches its chat cards, so their withdraw says it was\n * answered or lapsed. `@optional()` and appended last: absent, a withdrawn card says it can no longer be acted on.\n */\n @inject(SAAS_SERVICE_TYPES.HumanDecisionNoticeStayStore) @optional() private readonly decisionNoticeStays?: Pick<HumanDecisionNoticeStayStoreBackendService, 'recordDecisionOutcome'>,\n /**\n * #2665 S6 B7: the chat-conversation ledger. A conversation with a row there lives in a chat: its turns run confined\n * to that row's organization, and its resume owes the chat a reply. `@optional()` and appended last: bound in every\n * application container; a hand-built service without it has no chat conversation to confine.\n */\n @inject(SAAS_SERVICE_TYPES.ChatConversationStore) @optional() private readonly chatConversations?: Pick<ChatConversationStoreBackendService, 'readByExecutionId' | 'oweReply'>,\n /**\n * #2300: what the engine's retrieval tool searches with, on the caller's authority. `@optional()` and appended last:\n * bound in every application container; a hand-built service without it offers no retrieval, and the tool says so.\n */\n @inject(SAAS_SERVICE_TYPES.RagRetrievalService) @optional() private readonly ragRetrieval?: Pick<RagRetrievalBackendService, 'retrieve'>,\n /**\n * #2903: the transaction an answered decision's release and its approval seal commit in. `@optional()` and appended\n * last: bound in every application container; a hand-built service without it releases and seals nothing.\n */\n @inject(SAAS_SERVICE_TYPES.ResourcePersistenceUnitOfWorkService) @optional() private readonly unitOfWork?: Pick<ResourcePersistenceUnitOfWorkBackendService, 'executeTransaction'>,\n /** #2903: the application RECORD a seal belongs to (never the platform's id for the process). `@optional()`, appended last. */\n @inject(SAAS_SERVICE_TYPES.ApplicationIdentityService) @optional() private readonly applicationIdentity?: Pick<ApplicationIdentityBackendService, 'getCanonicalApplicationId'>,\n /** #2903: signs a seal right after its decision commits; the relay batch signs what this did not. `@optional()`, last. */\n @inject(SAAS_SERVICE_TYPES.ApprovalSealRelayService) @optional() private readonly approvalSealRelay?: Pick<ApprovalSealRelayBackendService, 'sealSoon'>,\n /**\n * #2904: where a tool approval's file deliverable is read and hashed (`ensureContentHash`) before its card and its seal\n * bind it. `@optional()`, appended last: bound in every application container; a hand-built service without it shows\n * and seals every declared deliverable as NOT bound.\n */\n @inject(SAAS_SERVICE_TYPES.FilesBackendService) @optional() private readonly files?: Pick<FilesBackendService, 'getFile' | 'ensureContentHash'>,\n /**\n * #2923: where a decision's step-up proof is read and consumed, for a gated tool that declares\n * `humanApproval.requiresStepUpAuthentication`. `@optional()`, appended last: bound in every application container; a\n * hand-built service without it refuses every answer to such a decision (fail closed), and requires nothing else.\n */\n @inject(SAAS_SERVICE_TYPES.ConsumableTokenService) @optional() private readonly consumableTokens?: Pick<ConsumableTokenBackendService, 'validateToken' | 'consumeToken'>,\n ) {\n this.turnLease = redisService\n ? new TurnLivenessLease({ keyNamespace: CONVERSATIONAL_TURN_LEASE_NAMESPACE, logTag: '[ConversationalExecution]', subjectNoun: 'Execution', logger, redisService })\n : undefined;\n this.workLease = redisService\n ? new TurnLivenessLease({ keyNamespace: CONVERSATIONAL_WORK_LEASE_NAMESPACE, logTag: '[ConversationalExecution]', subjectNoun: 'Work', logger, redisService })\n : undefined;\n this.resumedTurnStops = redisService\n ? new ResumedTurnStopBroadcast({ redisService, logger, onStop: (executionId, workRef) => { this.stopResumedTurnsHere(executionId, workRef); } })\n : undefined;\n // Subscribed from the start (Redis is connected before a backend constructs this), so a replica is stoppable before\n // its first turn. Not the guarantee — the answer awaits its own arm before it releases (`answerPendingDecision`).\n void this.resumedTurnStops?.arm();\n }\n\n /**\n * The fleet channel a stop of a RESUMED turn travels on (#2550), or `undefined` when no Redis is bound: a process\n * with no Redis is the only replica there is, and {@link stopResumedTurns} stops its own turns directly.\n */\n private readonly resumedTurnStops: ResumedTurnStopBroadcast | undefined;\n\n /**\n * The liveness lease of every conversational turn this process is running (#1780), or `undefined` when\n * no Redis is bound. A turn holds it for exactly as long as its row says PROCESSING, so a row that says\n * PROCESSING with no lease behind it was left by a process that is gone.\n */\n private readonly turnLease: TurnLivenessLease | undefined;\n\n /**\n * Hold the turn's lease, and return what lets it go. Taken BEFORE the row is written PROCESSING and let\n * go only AFTER the row leaves it, so a live process never shows a sweep a PROCESSING row without a lease.\n * Never throws: a lease that cannot be written leaves the turn running and merely unobservable.\n */\n private async holdTurnLease(executionId: string): Promise<() => Promise<void>> {\n const lease = this.turnLease;\n if (!lease) return async () => {};\n await lease.hold(executionId);\n return () => lease.release(executionId);\n }\n\n /**\n * The liveness lease of every WORK whose continuation this process is running (#2829), or `undefined` when no Redis is\n * bound. Held for exactly as long as the work's newest `workEvents` entry may say PROCESSING because of this process,\n * so a work whose entry says PROCESSING with no lease behind it was left by a process that is gone, whichever turn holds\n * the thread meanwhile.\n */\n private readonly workLease: TurnLivenessLease | undefined;\n\n /**\n * Hold a work's lease, and return what lets it go. Taken BEFORE the work's PROCESSING entry is appended and let go only\n * AFTER its ending entry (`recordResumedWorkEnding`) was attempted, mirroring {@link holdTurnLease}: a live continuation\n * never shows the sweep a PROCESSING entry without a lease. Never throws.\n */\n private async holdWorkLease(executionId: string, workRef: string): Promise<() => Promise<void>> {\n const lease = this.workLease;\n if (!lease) return async () => {};\n const id = conversationalWorkLeaseId(executionId, workRef);\n await lease.hold(id);\n return () => lease.release(id);\n }\n\n /**\n * Tell the people a decision is now routed to that it exists — the id and nothing else (#1594 D6). Who they are is\n * `humanDecisionHoldersOf`, the one answer the withdrawal uses too (#2569).\n */\n private announceDecisionRouted(route: HumanDecision_Route, decisionRef: string, except?: string, requester?: HumanDecision_Requester): void {\n announceHumanDecisionRouted({\n channel: this.webSocket, logger: this.logger, route, decisionRef, ...(except ? { except } : {}), ...(requester ? { requester } : {}),\n });\n }\n\n /**\n * Tell the people a decision has LEFT that it is no longer theirs (#2569) — see `announceHumanDecisionWithdrawn`.\n * Called by every site that takes a decision away from its holders: a move (`movePendingDecision`, the deadline\n * sweep's reassignment) with the version the route moved to, and an ending (`endPendingDecision`,\n * `answerPendingDecision`) with none.\n */\n private announceDecisionWithdrawn(params: {\n route: HumanDecision_Route;\n requester: HumanDecision_Requester | undefined;\n decisionRef: string;\n routeVersion?: number;\n except?: string;\n }): void {\n announceHumanDecisionWithdrawn({\n channel: this.webSocket, logger: this.logger, route: params.route, decisionRef: params.decisionRef,\n ...(params.requester ? { requester: params.requester } : {}),\n ...(params.routeVersion === undefined ? {} : { routeVersion: params.routeVersion }),\n ...(params.except ? { except: params.except } : {}),\n });\n }\n\n /**\n * A conversational turn's work attribution (#1598 §4, I3): the tenant from the OWNER fields of the persisted\n * execution (never from the caller or the model), the thread's case, and the execution itself. The recorder\n * then derives the tenant from the case row when there is one, overruling this one if they ever disagree.\n *\n * And the representing organization the turn is done through (#2618): from the role entries of the principal the turn\n * runs as (`auth`, the requester's on a resume), when they work in that tenant only through one representing\n * organization's relationships. Accounting only.\n */\n private workAttributionOf(owner: ResolvedOwnerVariant, executionId: string, caseRef: WorkUnitRef | undefined, auth: SocketAuthResult | undefined): ModelCallAttributionInput {\n const viaOrganization = resolveRelationshipWorkAttribution(auth?.initiatorRoles, owner.ownerFields.organizationId);\n return {\n ...(owner.ownerFields.organizationId ? { organizationId: owner.ownerFields.organizationId } : {}),\n ...(caseRef ? { caseRef: { resourceType: caseRef.resourceType, resourceId: caseRef.resourceId } } : {}),\n executionRef: { kind: ExecutionRefKind.CONVERSATIONAL_EXECUTION, id: executionId },\n ...(viaOrganization ? { viaOrganization } : {}),\n };\n }\n\n /** The case a persisted thread was opened on, read owner-scoped; `undefined` when none or unreadable. */\n private async readTurnCaseRef(\n owner: ResolvedOwnerVariant,\n executionId: string,\n auth: SocketAuthResult | undefined,\n resourceServerInstanceRef: string | undefined,\n ): Promise<WorkUnitRef | undefined> {\n try {\n const row = await this.systemAccess.readAsSystem<FlowActorExecution>(\n owner.resourceType,\n { executionId, ...owner.ownerFields, machineCredentialId: machineCredentialIdOf(auth), resourceServerInstanceRef: agentInstanceOf(resourceServerInstanceRef) },\n { scopeContext: owner.scopeContext, suppressSystemAudit: true },\n );\n return row?.caseRef ?? undefined;\n } catch (error) {\n this.logger.warn('[ConversationalExecution] The thread\\'s case could not be read for a resume; its calls are attributed to the execution only', {\n executionId, ...projectCaughtErrorLogFields(error),\n });\n return undefined;\n }\n }\n\n /**\n * Resolve the owner scope to its persisted polymorphic variant: the concrete\n * `CoreResourceType`, the single owner FK to write on create, and the `*AsSystem`\n * scope-context map (which seeds the contextual filter so reads/writes are scoped\n * to that owner). Fails closed if no owner is present. Priority userId → org → app\n * (a conversation has exactly one owner; priority only disambiguates a\n * mis-populated caller).\n */\n private resolveOwnerVariant(scope: ConversationalOwnerScope): ResolvedOwnerVariant {\n const s = scope as { userId?: string; organizationId?: string; applicationId?: string };\n if (s.userId) {\n return { resourceType: CoreResourceType.USER_FLOW_ACTOR_EXECUTIONS, ownerFields: { userId: s.userId }, scopeContext: { userId: s.userId } };\n }\n if (s.organizationId) {\n return { resourceType: CoreResourceType.ORGANIZATION_FLOW_ACTOR_EXECUTIONS, ownerFields: { organizationId: s.organizationId }, scopeContext: { organizationId: s.organizationId } };\n }\n if (s.applicationId) {\n return { resourceType: CoreResourceType.APPLICATION_FLOW_ACTOR_EXECUTIONS, ownerFields: { applicationId: s.applicationId }, scopeContext: { applicationId: s.applicationId } };\n }\n throw new Error('[ConversationalExecution] scopeContext carries no owner (userId | organizationId | applicationId).');\n }\n\n /**\n * Start (and, for v1, fully run) one conversational execution. Never throws to\n * the caller — every failure path is reported through the emitter as a\n * `FLOWS_ACTORS_ERROR`, so the WebSocket handler stays a thin dispatcher.\n *\n * The turn is the work of the principal it runs as (#2722): its execution row and every other record its system\n * writes create are stamped with the relationship that principal stands in the organization through, as the records\n * it creates itself are (`runAsRelationshipProvenanceOf`, the rule `doOperation` applies). A turn opens no operation,\n * so without this its row would be the organization's own even when a representing organization's admitted agent\n * (#2615) or a representative ran it.\n */\n public async startConversationalExecution(params: StartConversationalExecutionParams): Promise<void> {\n return runAsRelationshipProvenanceOf(\n params.auth,\n // The organization the turn works in: its owner's, else (a person's own thread) the one its principal acts in.\n // Never throws: a missing owner is reported by the turn itself (NO_OWNER).\n (params.scopeContext && 'organizationId' in params.scopeContext ? params.scopeContext.organizationId : undefined) ?? params.auth?.initiatorIds?.organizationId ?? undefined,\n () => this.runConversationalExecution(params),\n );\n }\n\n private async runConversationalExecution(params: StartConversationalExecutionParams): Promise<void> {\n const { systemRef, initialInput, initiator, scopeContext, emitter } = params;\n const executionId = params.executionId ?? randomUUID();\n const startedAt = Date.now();\n\n // Resolve the owner scope → its persisted variant (userFlowActorExecutions /\n // organizationFlowActorExecutions / applicationFlowActorExecutions) + owner FK.\n // Never throws to the caller — a missing owner is reported through the emitter.\n let owner: ResolvedOwnerVariant;\n try {\n owner = this.resolveOwnerVariant(scopeContext);\n } catch {\n this.emitError(emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.NO_OWNER, 'The conversation has no resolvable owner scope.');\n return;\n }\n\n // ── #2665 B7: a conversation that lives in a chat runs confined to that chat's organization ─────\n // Decided here, whichever door started this turn (the chat door, the application, a user-delegated A2A client), so a\n // member of several organizations cannot have the agent bring another organization's records into a transcript\n // posted into this one's chat. Only a person's conversation can live in a chat, and a create-only start continues no\n // conversation. A ledger that cannot be read refuses the turn, recoverably: never run it unconfined.\n let auth = params.auth;\n if (!params.createOnly && owner.resourceType === CoreResourceType.USER_FLOW_ACTOR_EXECUTIONS) {\n let chatConversation: ChatConversation | null;\n try {\n chatConversation = await this.chatConversationOf(executionId);\n } catch (error) {\n this.logger.error('[ConversationalExecution] A conversation\\'s chat record could not be read; the turn does not run unconfined', { systemRef, executionId, ...projectCaughtErrorLogFields(error) });\n this.emitError(emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.PERSIST_FAILED, 'The conversation could not be opened. Send the message again.', true);\n return;\n }\n auth = this.confineToChatConversation(auth, chatConversation);\n }\n\n // ── The application's declared consent requirement ──────────────────────\n if (!(await this.admitsUnderServiceConsentRequirement({ auth, owner, systemRef, executionId, emitter }))) return;\n\n // ── Resolve the system (ACTOR-only in v1; FLOW fails closed) ──────────────\n const actorSystem = this.resolveConversationalActorSystem(systemRef, executionId, emitter);\n if (!actorSystem) return;\n\n // ── The system's launch gate (`config.accessControl[].roles`), whichever door this turn came through ──\n // Asked of the authority the turn will hold (confined to a chat's organization above), in the organization it works\n // in. Every turn is a start: a person whose role was taken away cannot send the next message.\n const turnOrganizationId = (scopeContext && 'organizationId' in scopeContext ? scopeContext.organizationId : undefined) ?? auth?.initiatorIds?.organizationId ?? undefined;\n if (!(await this.admitsSystemStart({ auth, owner, actorSystem, organizationId: turnOrganizationId, refusedSurface: `flows-actors:turn:${params.initiationKind}` }))) {\n this.emitError(emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.SYSTEM_ROLE_NOT_HELD, SYSTEM_ROLE_NOT_HELD_MESSAGE);\n return;\n }\n\n // ── Find the chat actor's agent ──────────────────────────────────────────\n const agentRef = this.resolveChatAgentRef(actorSystem);\n if (!agentRef) {\n this.emitError(emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.NO_CHAT_ACTOR, `System '${systemRef}' has no AGENTIC actor bound to an agent to converse with.`);\n return;\n }\n\n // ── Extract the user's turn ──────────────────────────────────────────────\n const userText = this.extractUserText(initialInput);\n if (!userText) {\n this.emitError(emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.EMPTY_INPUT, 'No user message was provided to start the conversation.');\n return;\n }\n\n // ── #2750: what the conversation may send its model ───────────────────────\n // A message too large to send even with every earlier turn left out is refused here, before anything is written,\n // rather than cut: the replay below never splits a message. The earlier turns are bounded where they are built.\n const replayBudget = this.conversationReplayBudgetOf(agentRef);\n const replayCurrentTurn = { role: FlowsActors_ConversationRole.USER as string, content: userText };\n const currentTurnFit = boundReplayedTranscript([], replayCurrentTurn, replayBudget.budgetTokens);\n if (currentTurnFit.outcome === ReplayBoundOutcome.CURRENT_TURN_EXCEEDS_BUDGET) {\n this.logger.info('[ConversationalExecution] The message is larger than the agent\\'s model can be sent; the turn is refused, nothing is cut', {\n systemRef, executionId, agentRef, currentTurnTokens: currentTurnFit.currentTurnTokens, ...replayBudget,\n });\n this.emitError(emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.MESSAGE_EXCEEDS_CONTEXT_WINDOW, 'The message is too long for the assistant to read. Shorten it and send it again.');\n return;\n }\n\n // ── Load the persisted thread (server-authoritative history) ─────────────\n // One execution row per discussion accumulates every turn's message log. On a\n // CONTINUED thread the client reuses the `executionId`, so the row already\n // exists; reading it here yields BOTH the durable transcript to append to AND\n // the multi-turn context for the LLM — no client-supplied history is trusted.\n //\n // The read is owner-scoped through `scopeContext`: `readAsSystem` seeds the\n // USER_SELF filter from the scope context-map (`userId`), NOT from the absent\n // system-context initiator identity (an internal EC rejects identity fields on\n // `initiatorIds`). So a user only ever reads their own thread.\n const now = new Date();\n let priorMessages: FlowActorExecution_Message[] = [];\n let rowExists = false;\n /** A continued thread's case, as its row recorded it when it was opened (#1598). */\n let persistedCaseRef: WorkUnitRef | undefined;\n /** The decision a continued thread is waiting for, when it is (#2721). */\n let waitingDecisionRef: string | undefined;\n /** Whether a turn already running in the thread admits no second one beside it (#2665 A6). */\n let busy = false;\n /** #2292: the thread's stored placeholder table and model-side texts, as read. */\n let storedPersonalDataState: string | null | undefined;\n /** #2750: the thread's stored summary of the turns its replay leaves out, as read. */\n let storedDroppedTurnsSummary: string | null | undefined;\n // A create-only turn never reads a thread to continue (see `createOnly`): the insert decides.\n if (!params.createOnly) try {\n // Scope the lookup by the owner FK, NOT `executionId` alone: `executionId` is\n // CALLER-SUPPLIED (the A2A `contextId`), and the APPLICATION variant's `*AsSystem`\n // scope-context map does NOT carry `applicationId` (system-access forwards it to\n // `initiatorIds`, which the contextual filter never reads). Without the owner FK\n // in the filter, an app-machine that supplies ANOTHER app's `executionId` would\n // read/continue that app's conversation. The FK makes every variant fail-closed\n // (redundant-but-harmless for USER/ORG, load-bearing for APP).\n const existing = await this.systemAccess.readAsSystem<FlowActorExecution>(\n owner.resourceType,\n // The CREDENTIAL axis rides alongside the owner FK (finding H-5). The scope FK does not\n // identify the principal on the machine variants — `applicationId` is a deployment\n // singleton and `organizationId` is shared by every machine client of one tenant — so\n // without it a separately-credentialed client could continue another's conversation and\n // read its whole message log.\n { executionId, ...owner.ownerFields, machineCredentialId: machineCredentialIdOf(auth), resourceServerInstanceRef: agentInstanceOf(params.resourceServerInstanceRef) },\n { scopeContext: owner.scopeContext },\n );\n if (existing) {\n rowExists = true;\n priorMessages = existing.messages ?? [];\n storedPersonalDataState = existing.personalDataModelState;\n storedDroppedTurnsSummary = existing.droppedTurnsSummary;\n persistedCaseRef = existing.caseRef ?? undefined;\n if (existing.status === FlowsActors_Status.AWAITING_APPROVAL) waitingDecisionRef = existing.pendingDecisionRef ?? '';\n busy = conversationRefusesArrivingTurn(existing, params.initiationKind);\n }\n } catch (error) {\n // Non-fatal: treat as a fresh thread. A create below surfaces any hard\n // persistence failure loudly; a transient read blip must not drop the turn.\n this.logger.error('[ConversationalExecution] Failed to read existing execution', { systemRef, executionId, error });\n }\n\n /*\n * #2721: a thread waiting for a human decision takes no new message. Advancing it would move the row out of\n * AWAITING_APPROVAL by a write that does not end the decision: every inbox would lose it, any later answer would\n * fail, and the trail would hold a request with no resolution. Refused, naming the decision, rather than ending it\n * implicitly: the decision may be routed to someone else, whose say a new message cannot take away. The ways on are\n * the decision's own: an answer, its lapse, or on the A2A door `tasks/cancel`, which ends it WITHDRAWN with its\n * record. The in-app door offers the requester no withdrawal, which is why the sentence names none (#2721 review\n * F-5). An A2A client sees the task as `input-required` meanwhile; the input it waits for is that person's answer.\n * Recoverable: once the decision settles, the same message is admitted.\n */\n if (waitingDecisionRef !== undefined) {\n this.emitDecisionPending(emitter, systemRef, executionId, waitingDecisionRef);\n return;\n }\n // #2665 A6: a chat conversation runs one turn at a time. Refused before anything is written, recoverably.\n if (busy) {\n this.emitError(emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.CONVERSATION_BUSY, CONVERSATION_BUSY_MESSAGE, true);\n return;\n }\n // #2665 A10: a chat message is identified by the vendor's own message id, so a thread holding it already took it. It\n // is answered as such, never re-identified into a second copy (an in-app id is re-minted below; a chat one is not).\n // The chat door asks first (`previewChatTurn`) and its deliveries run one at a time per sender and conversation, so\n // this is the guard behind that check.\n if (params.initiationKind === FlowsActors_InitiationKind.CHAT_MESSAGE && params.userMessageId\n && priorMessages.some((message) => message.id === params.userMessageId)) {\n this.emitError(emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.MESSAGE_ALREADY_RECEIVED, 'This message is already in the conversation.');\n return;\n }\n\n const userMessage: FlowActorExecution_Message = {\n id: params.userMessageId && !priorMessages.some((message) => message.id === params.userMessageId) ? params.userMessageId : randomUUID(),\n role: FlowsActors_ConversationRole.USER,\n contentType: FlowsActors_MessageContentType.TEXT,\n content: userText,\n createdAt: now,\n ...(params.arrivedThrough ? { arrivedThrough: params.arrivedThrough } : {}),\n };\n /*\n * What this turn writes into the thread, applied to the row as it stands at each write (#2743): the person's message,\n * then whatever each end adds after it. `priorMessages` is what the turn READ, for the model's context only; a\n * sibling turn may have written to the row since, and no write of this turn may take that away.\n */\n const turnTranscript: ConversationalTurnTranscript = (current) => transcriptWithTurnMessage(current, userMessage);\n\n /*\n * The turn's work attribution (#1598 §4): the tenant from the OWNER fields, the case the thread was opened on,\n * and this execution. A continued thread keeps the case its row recorded; a case named on a later turn of the\n * same thread is not adopted (the column is never updated, so the thread IS its case).\n */\n const openingCaseRef = params.autonomous?.caseRef ?? params.caseRef;\n const turnCaseRef = rowExists ? persistedCaseRef : openingCaseRef;\n const workAttribution = this.workAttributionOf(owner, executionId, turnCaseRef, auth);\n\n // The lease covers the whole PROCESSING window: taken before the row is opened or advanced to\n // PROCESSING, let go after every exit below — completed, failed, cancelled, suspended, or a write that\n // never landed. A process that dies inside it leaves a PROCESSING row whose lease lapses (#1780).\n //\n // Except a create-only start (#1611), which takes it only once ITS insert landed: two processes starting\n // the same occurrence share one execution id, and the loser — whose insert fails — must neither hold nor,\n // unwinding, DROP the winner's lease. The gap before the first write is safe: a turn whose lease was never\n // established is one the interrupted-turn sweep abstains on.\n let releaseTurnLease: () => Promise<void> = params.createOnly ? async () => {} : await this.holdTurnLease(executionId);\n // The turn's ONE abort (#2524): the caller's signal (A2A `tasks/cancel`, an SSE hang-up) and the owner's Stop\n // both end it, through the same arms.\n const turnAbort = this.registerRunningTurn(executionId, owner, params.abortSignal, undefined);\n try {\n // ── Open (new) or advance (continued) the row to PROCESSING ──────────────\n // A new thread INSERTs; a continued thread UPDATEs by `executionId` (the row's\n // `isUnique({ scope: 'global' })` id) so a reused id never collides on insert —\n // the prior bug was an unconditional create that E11000'd on continuation.\n try {\n if (!rowExists) {\n await this.systemAccess.createAsSystem(owner.resourceType, {\n executionId,\n ...owner.ownerFields,\n systemRef,\n kind: FlowActorSystem_Kind.ACTOR,\n status: FlowsActors_Status.PROCESSING,\n statusChanges: [{ status: FlowsActors_Status.PROCESSING, timestamp: now }],\n messages: [userMessage],\n machineCredentialId: machineCredentialIdOf(auth),\n resourceServerInstanceRef: agentInstanceOf(params.resourceServerInstanceRef),\n contextRef: params.contextRef ?? '',\n initiationKind: params.initiationKind,\n // The case the thread is opened on, whichever door opened it (#1598): a resume reopens it from here.\n ...(openingCaseRef ? { caseRef: openingCaseRef } : {}),\n ...(params.autonomous ? {\n autonomousAgentRef: params.autonomous.autonomousAgentRef,\n autonomousTrigger: params.autonomous.trigger,\n autonomousPrincipalSource: params.autonomous.principalSource,\n ...(params.autonomous.activeSlotKey ? { autonomousActiveSlotKey: params.autonomous.activeSlotKey } : {}),\n } : {}),\n }, { scopeContext: owner.scopeContext });\n } else {\n const advanced = await this.writeTurnTranscript(owner, {\n executionId, ...owner.ownerFields, machineCredentialId: machineCredentialIdOf(auth), resourceServerInstanceRef: agentInstanceOf(params.resourceServerInstanceRef),\n // #2721: never out of AWAITING_APPROVAL by this write. A pause landing between the read above and here\n // would otherwise be overwritten with its decision left on the row, unended. #2665 A6: nor onto a row a\n // turn runs in when that turn, or this one, came from chat.\n ...conversationalAdvanceGuard(params.initiationKind),\n }, turnTranscript, {\n status: FlowsActors_Status.PROCESSING,\n // Each turn records its own door: the turn that raises a decision is the one routed by it.\n initiationKind: params.initiationKind,\n });\n // The row existed on read, so a write matching nothing means it began waiting for a decision meanwhile, went\n // away, or a real scope inconsistency. Either way this turn must not run on a row it did not advance. Only a\n // row read back as waiting is reported as a waiting decision (#2721 review F-4): telling a client to answer a\n // decision that does not exist would send it to an inbox with nothing in it.\n if (!advanced) {\n const waitingFor = await this.waitingDecisionOf(owner, {\n executionId, ...owner.ownerFields, machineCredentialId: machineCredentialIdOf(auth), resourceServerInstanceRef: agentInstanceOf(params.resourceServerInstanceRef),\n });\n if (waitingFor !== undefined) {\n this.logger.info('[ConversationalExecution] The thread began waiting for a decision before this turn advanced it; the turn does not run', { systemRef, executionId });\n this.emitDecisionPending(emitter, systemRef, executionId, waitingFor);\n } else if (await this.threadRefusesArrivingTurn(owner, {\n executionId, ...owner.ownerFields, machineCredentialId: machineCredentialIdOf(auth), resourceServerInstanceRef: agentInstanceOf(params.resourceServerInstanceRef),\n }, params.initiationKind)) {\n this.logger.info('[ConversationalExecution] A turn began in the thread before this one advanced it, and the thread runs one at a time; the turn does not run', { systemRef, executionId });\n this.emitError(emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.CONVERSATION_BUSY, CONVERSATION_BUSY_MESSAGE, true);\n } else {\n this.logger.error('[ConversationalExecution] Continued-thread PROCESSING update matched no row; the turn does not run', { systemRef, executionId, owner: owner.scopeContext });\n this.emitError(emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.PERSIST_FAILED, 'The conversation could not be continued.');\n }\n return;\n }\n }\n } catch (error) {\n // An insert that collided with another turn's insert of the same thread (#2665 D5): the thread now runs that\n // turn, and a thread that admits one turn at a time refuses this one recoverably rather than as a fault. Never for\n // a create-only start: it continues no thread, so an id that exists is a failed open, read nowhere (#1611 I5).\n if (!rowExists && !params.createOnly && await this.threadRefusesArrivingTurn(owner, {\n executionId, ...owner.ownerFields, machineCredentialId: machineCredentialIdOf(auth), resourceServerInstanceRef: agentInstanceOf(params.resourceServerInstanceRef),\n }, params.initiationKind)) {\n this.logger.info('[ConversationalExecution] Another turn opened the thread first, and the thread runs one at a time; the turn does not run', { systemRef, executionId });\n this.emitError(emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.CONVERSATION_BUSY, CONVERSATION_BUSY_MESSAGE, true);\n return;\n }\n this.logger.error('[ConversationalExecution] Failed to persist execution', { systemRef, executionId, error });\n this.emitError(emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.PERSIST_FAILED, 'Failed to open the execution record.');\n return;\n }\n if (params.createOnly) releaseTurnLease = await this.holdTurnLease(executionId);\n\n emitter(CoreWebSocketEvent.FLOWS_ACTORS_STARTED, { systemRef, executionId });\n\n // ── Invoke the agent, streaming token deltas back over the channel ───────\n // One id ties every streamed delta to a single assistant message on the\n // client (the payload's `messageId`); the terminal event carries the full\n // assembled markdown (`isFinal: true`).\n const assistantMessageId = randomUUID();\n // What the turn does on its way to the reply — tool calls, shown reasoning, sources — live and on every exit (#2524).\n const trace = this.openTurnTrace(systemRef, executionId, agentRef, emitter, auth?.initiatorIds?.organizationId);\n // Generics are Zod *schema* types (fields are `z.infer<...>`); the runtime\n // invocation is untyped input, matching `invokeAgent`'s own `<any,any,any>`.\n // Multi-turn context from the DURABLE transcript (server-authoritative): the\n // thread's prior user/assistant turns from the DB, then the new user message.\n // The tool trace, reasoning, PROGRESS and SYSTEM entries are what a turn DID, not what was said, so they are\n // dropped (`isReplayedTurn`) — a reasoning message is an assistant message too (#2524).\n // #2292: the agent's personal-data treatment for this turn. Earlier replies are sent as the MODEL saw them, so a value\n // it was never shown in clear is never sent in clear now; a person on their own turn reads the values back.\n // #2292 R8: under the agent policy of every organization the turn acts for, read once for the turn and carried\n // to the agent service in a frame, so the view and the guards read the same answer.\n const turnPolicies = await this.turnAgentPolicies(auth);\n const personalData = TurnPersonalDataView.open(\n this.turnGuardrailsOf(agentRef, turnPolicies),\n params.initiationKind,\n storedPersonalDataState,\n );\n const invocation: FlowsActors_Agent_Invocation<any, any, any> = {\n agentRef,\n initiator,\n invocationContext: [],\n // Set below, once the replay is decided (#2750): deciding it may make a call that the turn's trace context names.\n input: { messages: [] },\n output: {},\n executionContext: {},\n artifactBindings: [],\n };\n\n // Tool-execution context: lets the agent's grounding tools read the user's\n // own data (scoped by the caller's verified auth), never LLM-supplied identity.\n const toolContext: FunctionToolExecutionContext = this.buildToolExecutionContext(auth, executionId, systemRef, undefined, {\n initiationKind: params.initiationKind,\n autonomousTrigger: params.autonomous?.trigger,\n });\n if (personalData.table) toolContext.personalDataPlaceholders = personalData.table;\n\n // Traceability: correlate every agent call of this conversation (`sessionRef` =\n // executionId) and carry the EXTERNAL PRINCIPAL as filterable dimensions, so\n // run-time observability can attribute LLM spend + behaviour to the caller — a\n // user, or an org/app machine agent (A2A). The engine emits a per-call trace to\n // the configured sink only when traceability is enabled (NONE ⇒ skipped).\n const traceContext: AgentTraceContext = {\n sessionRef: executionId,\n label: `flows-actors:${systemRef}`,\n attributes: {\n systemRef,\n executionType: auth.executionType,\n ...owner.ownerFields,\n ...(auth.initiatorIds?.machineCredential ? { machineCredential: auth.initiatorIds.machineCredential } : {}),\n },\n // #1598: the turn's model calls are attributed EXPLICITLY; the frame opened around the call carries\n // the same attribution to the calls its tools make.\n attribution: workAttribution,\n };\n\n // #2750: bounded to what the agent's model holds: the newest whole turns that fit `replayBudget` beside the current\n // one, which was checked to fit before anything was written. The oldest turns go first, and what they said is\n // carried ahead of the rest as a summary, written by the agent's own model when the window has to move\n // (`carryDroppedTurns`). A stored summary a treated turn may not send as it is (#2292 R8) is written again.\n const storedSummary = parseDroppedTurnsSummary(storedDroppedTurnsSummary);\n const replay = await carryDroppedTurns({\n agents: this.agentsBackend,\n logger: this.logger,\n agentRef,\n prior: priorMessages.filter(isReplayedTurn).map((m) => ({ id: m.id, role: m.role, content: personalData.modelTextOf(m) })),\n current: replayCurrentTurn,\n budgetTokens: replayBudget.budgetTokens,\n stored: storedSummary && personalData.mayResendModelTextWrittenAt(storedSummary.producedAt) ? storedSummary : undefined,\n traceContext,\n abortSignal: turnAbort.signal,\n inTurnFrames: (call) => this.inTurnSpendFrame(params.initiationKind, auth, () => runWithWorkAttributionFrame(workAttribution, () => this.inTurnPolicyFrame(turnPolicies, call))),\n });\n invocation.input = { messages: [...replay.messages] };\n if (replay.kind !== DroppedTurnsReplayKind.WHOLE) {\n this.logger.info('[ConversationalExecution] The conversation is longer than the agent\\'s model holds; its oldest turns are not sent in full this turn', {\n systemRef, executionId, agentRef, replay: replay.kind, droppedMessageCount: replay.droppedMessageCount,\n unsummarizedDroppedMessageCount: replay.unsummarizedDroppedMessageCount, summaryCalls: replay.summaryCalls,\n keptMessageCount: replay.messages.length, keptTokens: replay.keptTokens, ...replayBudget,\n });\n }\n if (replay.summaryToStore) {\n // Stored as soon as it is written, so a turn that then fails or pauses does not pay for it again. Best-effort: a\n // summary that is not stored is written again by the next turn that needs it.\n try {\n await this.systemAccess.updateAsSystem<FlowActorExecution>(owner.resourceType, {\n executionId, ...owner.ownerFields, machineCredentialId: machineCredentialIdOf(auth), resourceServerInstanceRef: agentInstanceOf(params.resourceServerInstanceRef),\n }, { droppedTurnsSummary: serializeDroppedTurnsSummary(replay.summaryToStore) }, { scopeContext: owner.scopeContext });\n } catch (error) {\n this.logger.warn('[ConversationalExecution] The summary of the turns a conversation leaves out could not be stored; the next turn that needs it writes it again', {\n systemRef, executionId, ...projectCaughtErrorLogFields(error),\n });\n }\n }\n\n let assistantText: string;\n /** The agent's result, kept for the usage a COMPLETED event may carry (#2524). */\n let turnResult: unknown;\n /** Set when the turn stopped at a human-in-the-loop boundary instead of finishing. */\n let approvalSuspension: AgentApprovalSuspension | undefined;\n try {\n try {\n let streamedText = '';\n const result = await this.inTurnSpendFrame(params.initiationKind, auth, () => runWithWorkAttributionFrame(workAttribution, () => this.inTurnPolicyFrame(turnPolicies, () => this.agentsBackend.invokeAgentStreaming(invocation, {\n abortSignal: turnAbort.signal,\n onDelta: (delta) => {\n streamedText += delta;\n // #2292: released to the reader with placeholders put back; a placeholder split across deltas waits whole.\n const released = personalData.streamDelta(delta);\n if (released.length === 0) return;\n emitter(CoreWebSocketEvent.FLOWS_ACTORS_MESSAGE, {\n systemRef,\n executionId,\n messageId: assistantMessageId,\n // MARKDOWN throughout: LLM chat output is markdown, and the client's\n // streaming renderer (Streamdown) handles partial markdown, so the\n // reply renders formatted as it streams — not plain text then a swap.\n messageType: FlowsActors_MessageContentType.MARKDOWN,\n content: released,\n isFinal: false,\n timestamp: new Date(),\n });\n },\n // Every phase of every tool call, the reasoning the agent shows, the sources it cites (#2524). FACTS only:\n // the browser words them from its label tree, and a tool is named by its name verbatim (#1283).\n // #2292: what the model wrote (a call's arguments, its reasoning) names values by placeholders; the reader sees\n // them back when entitled to (the turn's personal-data view decides).\n onToolEvent: (event) => trace.recordToolEvent(personalData.toolEventForReader(this.toolEventWithCredentialsWithheld(systemRef, event))),\n onReasoningDelta: (delta) => trace.recordReasoningDelta(personalData.reasoningDelta(delta)),\n onSource: trace.recordSource,\n }, toolContext, traceContext))));\n trace.recordReasoningDelta(personalData.flushReasoning());\n assistantText = this.extractAssistantText(result.output) || streamedText;\n turnResult = result;\n approvalSuspension = (result as { approvalSuspension?: AgentApprovalSuspension }).approvalSuspension;\n } catch (streamError) {\n if (streamError instanceof AgentStreamingUnsupportedError) {\n // Graceful degradation (e.g. a CLI-transport agent): deliver the full\n // reply in one buffered turn — not streamed, but honest and complete.\n //\n // ⚠️ CANCELLATION LIMIT (review finding F-6) — a deliberate SCOPE CHOICE, and it\n // matters that it is recorded as one rather than as a technical impossibility.\n //\n // It WOULD be wireable: AI-SDK's `generateText` accepts an `abortSignal`, and Node's\n // `spawn` accepts one too, so both the buffered provider call and the CLI child\n // process could honour cancellation. What stops it today is that no seam exists and\n // adding one widens `invokeAgent` — an `@wildo_source`-ANCHORED public contract that\n // ships into app-facing skills — for a capability nothing yet exercises.\n //\n // An earlier version of this comment claimed a signal \"cannot reach\" these\n // transports. That was false, and stating a choice as an impossibility is exactly\n // what stops a future maintainer revisiting it. Revisit it when a buffered-transport\n // agent actually needs interruption.\n //\n // What IS honoured: a cancellation that arrived before this fallback begins. That\n // bounds the exposure to one already-started buffered turn instead of letting a\n // cancelled conversation start a whole new one.\n if (turnAbort.signal.aborted) {\n this.logger.info('[ConversationalExecution] Turn was cancelled before the buffered fallback began; recording CANCELLED', { systemRef, executionId });\n // FINALIZE, do not just return (review finding G4-2). Returning bare left the row wedged\n // at PROCESSING while the task plane had already written CANCELLED — the same two-plane\n // disagreement G3-1 was raised to fix, surviving on the one transport G3-1's fix does not\n // reach. It also contradicted this file's own completion path, which exists so a reload\n // never shows \"a row wedged at PROCESSING\".\n const ended = await this.finalizeTerminal(systemRef, executionId, owner, (current) => trace.appendTo(turnTranscript(current)), { status: FlowsActors_Status.CANCELLED }, machineCredentialIdOf(auth), agentInstanceOf(params.resourceServerInstanceRef));\n this.reportTurnEnd(emitter, systemRef, executionId, ended, () => this.emitTurnCancelled(emitter, systemRef, executionId, startedAt));\n return;\n }\n this.logger.info('[ConversationalExecution] Streaming unsupported; falling back to buffered invocation', { systemRef, executionId, reason: streamError.reason });\n const result = await this.inTurnSpendFrame(params.initiationKind, auth, () => runWithWorkAttributionFrame(workAttribution, () => this.agentsBackend.invokeAgent(invocation, traceContext)));\n assistantText = this.extractAssistantText(result.output);\n turnResult = result;\n } else {\n throw streamError;\n }\n }\n } catch (error) {\n // A CANCELLED turn is not a failed one: `tasks/cancel` and an SSE disconnect both abort the\n // model call deliberately, so without this branch an ordinary user action is recorded as\n // `FAILED`, emits `AGENT_FAILED` to the client, and logs at ERROR twice per cancellation —\n // contradicting the task plane (which writes `CANCELLED` for the same event) and training\n // operators to ignore the error channel.\n //\n // ⚠️ THIS IS THE SECONDARY ARM, not the primary one. An earlier revision claimed \"the abort\n // surfaces here as a thrown provider/SDK error\" and relied on that; it is NOT reliably true\n // (AI-SDK v7 ends an aborted stream cleanly with an `abort` part), and the claim quietly\n // became false when the metering fix removed the one read that threw. See the post-invocation\n // check after this block — that is what actually catches a cancelled streaming turn. This arm\n // survives for the transports and providers that DO throw on abort (a future buffered call\n // wired to a signal, an SDK layer that rejects), so cancellation is classified correctly\n // whether it arrives as a throw or as a clean return. Do not delete it; do not rely on it alone.\n //\n // Detected from OUR OWN signal rather than the error's shape: abort errors are named\n // inconsistently across providers and SDK layers, whereas `abortSignal.aborted` is the fact\n // we control and is true only because something deliberately cancelled this turn.\n if (turnAbort.signal.aborted) {\n this.logger.info('[ConversationalExecution] Turn cancelled by the caller; recording CANCELLED', { systemRef, executionId, agentRef });\n const ended = await this.finalizeTerminal(systemRef, executionId, owner, (current) => trace.appendTo(turnTranscript(current)), { status: FlowsActors_Status.CANCELLED }, machineCredentialIdOf(auth), agentInstanceOf(params.resourceServerInstanceRef));\n this.reportTurnEnd(emitter, systemRef, executionId, ended, () => this.emitTurnCancelled(emitter, systemRef, executionId, startedAt));\n return;\n }\n if (error instanceof AgentOutputWithheldError) {\n // #2292 Phase 3: the agent's output moderation withheld what its model wrote. Not a fault: the turn ends FAILED\n // under the withholding's own code, so the person is told the reply was withheld rather than that it broke.\n // Nothing after the withheld chunk was sent, and a failed turn stores no reply.\n this.logger.warn('[ConversationalExecution] The agent\\'s output was withheld by its output moderation; recording the turn FAILED', {\n systemRef, executionId, agentRef, code: error.code, outputKind: error.withholding.outputKind,\n });\n const withheldEnd = await this.finalizeTerminal(systemRef, executionId, owner, (current) => trace.appendTo(turnTranscript(current)), { status: FlowsActors_Status.FAILED, failureCode: error.code }, machineCredentialIdOf(auth), agentInstanceOf(params.resourceServerInstanceRef));\n this.reportTurnEnd(emitter, systemRef, executionId, withheldEnd, () => this.emitError(emitter, systemRef, executionId, error.code, error.message));\n return;\n }\n if (agentSuspensionRefusalOf(error)?.reason === AgentSuspensionRefusalReason.SUSPENDED) {\n // #2843: an administrator suspended the agent; its model was not called (the refusal is already recorded by the\n // agent service). Not a fault: the turn ends FAILED under its own code, so the person is told the assistant is\n // suspended rather than that it broke, and is not invited to send the message again.\n this.logger.warn('[ConversationalExecution] The agent is suspended; recording the turn FAILED', { systemRef, executionId, agentRef });\n const suspendedEnd = await this.finalizeTerminal(systemRef, executionId, owner, (current) => trace.appendTo(turnTranscript(current)), { status: FlowsActors_Status.FAILED, failureCode: FlowsActors_ExecutionErrorCode.AGENT_SUSPENDED }, machineCredentialIdOf(auth), agentInstanceOf(params.resourceServerInstanceRef));\n this.reportTurnEnd(emitter, systemRef, executionId, suspendedEnd, () => this.emitError(emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.AGENT_SUSPENDED, 'This assistant has been suspended by an administrator.'));\n return;\n }\n if (error instanceof AgentModelCallFailedError) {\n // Named apart from a generic failure (#2191). A refusal (an HTTP status) points the operator at\n // the provider ACCOUNT — exhausted, revoked, misconfigured — not at the prompt or the code. A\n // failure without one is the SDK's own (an invalid prompt, a forged approval signature) and is\n // worded as such, so it never sends anyone to a billing page.\n this.logger.error(error.statusCode !== undefined\n ? '[ConversationalExecution] The model provider refused the call; recording the turn FAILED'\n : '[ConversationalExecution] The model call failed on the stream; recording the turn FAILED', {\n systemRef, executionId, agentRef, statusCode: error.statusCode, reason: error.message,\n });\n } else {\n this.logger.error('[ConversationalExecution] Agent invocation failed', { systemRef, executionId, agentRef, error });\n }\n // Mark the persisted row FAILED (keeping the user turn) so a reload shows the\n // question with a failed status rather than a row wedged at PROCESSING.\n const ended = await this.finalizeTerminal(systemRef, executionId, owner, (current) => trace.appendTo(turnTranscript(current)), { status: FlowsActors_Status.FAILED, failureCode: FlowsActors_ExecutionErrorCode.AGENT_FAILED }, machineCredentialIdOf(auth), agentInstanceOf(params.resourceServerInstanceRef));\n this.reportTurnEnd(emitter, systemRef, executionId, ended, () => this.emitError(emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.AGENT_FAILED, 'The assistant failed to produce a response.'));\n return;\n }\n\n // #2292: the stream releases what it still held back, and every stored and final copy of the reply is the READER's\n // text (placeholders put back for a reader entitled to the values); the model-side text is kept for the next turn.\n const heldBack = personalData.flushStream();\n if (heldBack.length > 0) {\n emitter(CoreWebSocketEvent.FLOWS_ACTORS_MESSAGE, {\n systemRef, executionId, messageId: assistantMessageId, messageType: FlowsActors_MessageContentType.MARKDOWN,\n content: heldBack, isFinal: false, timestamp: new Date(),\n });\n }\n const readerAssistantText = personalData.recordReply(assistantMessageId, assistantText);\n\n // ── A CANCELLED turn is not a COMPLETED one ──────────────────────────────\n //\n // ⚠️ THIS CHECK CANNOT MOVE BACK INTO THE `catch` ABOVE — that is precisely where it used to\n // live, and where it silently died (review findings F-B, then G3-1).\n //\n // F-B detected cancellation in the catch on the premise stated in its own comment: \"the abort\n // surfaces here as a thrown provider/SDK error\". A LATER fix IN THE SAME BATCH (F-A, the\n // unmetered-cancellation hole) removed the only thing that threw — `streamTextToDeltas`'s\n // unguarded `await result.usage`. AI-SDK v7 signals an abort as a stream PART (`type:'abort'`),\n // so `fullStream` ends cleanly, `invokeAgentStreaming` only re-throws what it catches, and\n // nothing below the controller throws at all. F-B's branch therefore became DEAD CODE on the\n // only abortable transport, and every cancelled streaming turn fell through to the COMPLETED\n // write below — reproducing the two-plane disagreement F-B existed to fix, inverted (task plane\n // CANCELLED, conversation plane COMPLETED, on the same user action).\n //\n // The lesson generalises: a handler that detects a condition by CATCHING is coupled to whoever\n // throws, and that coupling is invisible to the type system. Detect from the signal we own.\n if (turnAbort.signal.aborted) {\n this.logger.info('[ConversationalExecution] Turn cancelled by the caller; recording CANCELLED', { systemRef, executionId, agentRef });\n // Retain whatever already streamed: the user SAW that text, so discarding it would leave a\n // reloaded transcript emptier than the live one was. `toPersistableConversationMessages`\n // (inside `finalizeTerminal`) drops a contentless message, so an immediately-cancelled turn\n // persists nothing extra rather than an empty assistant bubble.\n // The trace of what the turn did before it was stopped is kept the same way (#2524).\n const cancelledAt = new Date();\n const cancelledTranscript: ConversationalTurnTranscript = (current) => (assistantText.length > 0\n ? [...trace.appendTo(turnTranscript(current), cancelledAt), {\n id: assistantMessageId,\n role: FlowsActors_ConversationRole.ASSISTANT,\n contentType: FlowsActors_MessageContentType.MARKDOWN,\n content: readerAssistantText,\n createdAt: cancelledAt,\n }]\n : trace.appendTo(turnTranscript(current), cancelledAt));\n const ended = await this.finalizeTerminal(systemRef, executionId, owner, cancelledTranscript, { status: FlowsActors_Status.CANCELLED }, machineCredentialIdOf(auth), agentInstanceOf(params.resourceServerInstanceRef), { personalData });\n this.reportTurnEnd(emitter, systemRef, executionId, ended, () => this.emitTurnCancelled(emitter, systemRef, executionId, startedAt));\n return;\n }\n\n // ── A SUSPENDED turn is not a COMPLETED one either ───────────────────────\n //\n // Falling through to the completion write below would record a terminal status for work the\n // model has not done — the same class of lie as recording COMPLETED for a cancelled turn.\n //\n // Ordered AFTER the stop above, as the resumed turn orders them: a turn stopped in the instant\n // it paused ends CANCELLED, and its decision is never raised. The person asked the turn to stop,\n // and the gated call then never runs; persisting the suspension first used to ignore the stop\n // and hand them a decision for a turn they had stopped. Nothing is lost by skipping it — the\n // decision is routed to nobody until the suspension is persisted (#2524).\n if (approvalSuspension) {\n await this.persistApprovalSuspension({\n systemRef, executionId, owner, auth,\n resourceServerInstanceRef: params.resourceServerInstanceRef,\n // The work the turn did before it paused is part of its transcript too (#2524), and so is what it SAID.\n transcript: (current) => this.pausedTurnMessages(trace.appendTo(turnTranscript(current)), {\n id: assistantMessageId, text: readerAssistantText, data: trace.replyData(),\n }),\n personalData,\n suspension: approvalSuspension,\n emitter,\n initiationKind: params.initiationKind,\n autonomousTrigger: params.autonomous?.trigger,\n workAttribution,\n turnAbortSignal: turnAbort.signal,\n withholdCallInput: trace.withholdInput,\n turnStartedAt: startedAt,\n });\n return;\n }\n\n // ── Persist the assistant turn + complete ────────────────────────────────\n const finishedAt = new Date();\n // The sources the reply cited travel ON the reply, stored and live (#2524).\n const replyData = trace.replyData();\n const assistantMessage: FlowActorExecution_Message = {\n id: assistantMessageId,\n role: FlowsActors_ConversationRole.ASSISTANT,\n contentType: FlowsActors_MessageContentType.MARKDOWN,\n content: readerAssistantText,\n ...(replyData ? { data: replyData } : {}),\n createdAt: finishedAt,\n };\n if (assistantText.length === 0) {\n this.logger.warn('[ConversationalExecution] Assistant produced no text; persisting the turn without an assistant message', { systemRef, executionId, agentRef });\n }\n // Written onto the row as it stands (#2743): a sibling turn's messages written since this turn read it stay.\n const completedTranscript: ConversationalTurnTranscript = (current) => [...trace.appendTo(turnTranscript(current), finishedAt), assistantMessage];\n /** Whether this turn's COMPLETED was recorded, or another turn's decision now holds the row. */\n let ended: TurnEndRecord = TURN_END_RECORDED;\n try {\n const completedRowFilter = { executionId, ...owner.ownerFields, machineCredentialId: params.auth ? machineCredentialIdOf(params.auth) : FLOWS_ACTORS_NO_MACHINE_CREDENTIAL, resourceServerInstanceRef: agentInstanceOf(params.resourceServerInstanceRef) };\n const completed = await this.writeTurnTranscript(owner, {\n ...completedRowFilter,\n // #2721 review F-1: never over a row waiting for a decision. One thread admits overlapping turns, so another\n // turn may have paused it meanwhile, and overwriting would leave that decision on the row, unended.\n status: { $nin: [FlowsActors_Status.AWAITING_APPROVAL] },\n }, completedTranscript, {\n status: FlowsActors_Status.COMPLETED,\n finishedAt,\n statusChanges: [\n { status: FlowsActors_Status.PROCESSING, timestamp: now },\n { status: FlowsActors_Status.COMPLETED, timestamp: finishedAt },\n ],\n }, personalData);\n if (!completed) {\n const waitingFor = await this.waitingDecisionOf(owner, completedRowFilter);\n if (waitingFor !== undefined) {\n // The reply was streamed and is not kept: the row holds another turn's decision now, which is what the\n // client is told instead of COMPLETED (`reportTurnEnd`), so a tab holding THAT decision's card keeps it.\n this.logger.warn('[ConversationalExecution] An overlapping turn paused the thread for a decision; this turn\\'s reply is not persisted', { systemRef, executionId });\n ended = { kind: TurnEndRecordKind.DECISION_WAITING, decisionRef: waitingFor };\n } else {\n this.logger.error('[ConversationalExecution] Completion update matched no row', { systemRef, executionId, owner: owner.scopeContext });\n }\n }\n } catch (error) {\n // The answer was produced and streamed; a persistence failure here is logged\n // but the user still receives the reply (best-effort durable history).\n this.logger.error('[ConversationalExecution] Failed to persist assistant turn', { systemRef, executionId, error });\n }\n\n // Terminal, authoritative message: full assembled markdown. The client\n // replaces the accumulated `text` deltas for this `messageId` with it.\n trace.finishReasoning();\n emitter(CoreWebSocketEvent.FLOWS_ACTORS_MESSAGE, {\n systemRef,\n executionId,\n messageId: assistantMessageId,\n messageType: FlowsActors_MessageContentType.MARKDOWN,\n content: readerAssistantText,\n ...(replyData ? { data: replyData } : {}),\n isFinal: true,\n timestamp: new Date(),\n });\n const usage = this.turnUsageShownTo(auth, turnResult);\n this.reportTurnEnd(emitter, systemRef, executionId, ended, () => emitter(CoreWebSocketEvent.FLOWS_ACTORS_COMPLETED, {\n systemRef,\n executionId,\n status: FlowsActors_Status.COMPLETED,\n duration: Date.now() - startedAt,\n ...(usage ? { usage } : {}),\n }));\n } finally {\n this.unregisterRunningTurn(executionId, turnAbort);\n await releaseTurnLease();\n }\n }\n\n // ── Stopping a running turn (#2524) ────────────────────────────────────────\n\n /**\n * The turns THIS process is running, by execution id — a thread reuses its id, so one id can hold two overlapping\n * turns — each with the conversation's owner, the only person who may stop it, and the WORK it resumes, if any, named\n * by that work's first decision (#2550, #2821): only a turn an ANSWER released can be stopped by its work\n * ({@link stopResumedTurns}), since a fresh turn — and an inline automatic-denial resume, which continues it under its\n * abort — is stopped by whatever opened it. Keyed by the work, not by the thread, because a thread outlives the work and\n * non-chat turns may overlap: a stop meant for one work's continuation must not reach another's in the same thread,\n * and must reach every continuation in its own chain (its decision answered, the continuation paused again, that\n * decision answered).\n */\n private readonly runningTurns = new Map<string, Set<{ readonly controller: AbortController; readonly ownerUserId?: string; readonly resumedWorkRef?: string }>>();\n\n /**\n * Stops that found NO resumed turn of their work on this process: execution id → work (its first decision) → when they\n * arrived (#2550, #2821). The gap they cover: an answer swaps the row to PROCESSING, then records the decision, and only\n * then does its resume register here — a stop arriving in between would otherwise reach nothing. A resume of THAT work\n * released BEFORE such a stop arrived is stopped at registration ({@link registerRunningTurn}); one released after it\n * is newer work and runs, and a resume of another work is never matched. Honoured for\n * {@link UNMATCHED_RESUMED_TURN_STOP_MEMORY_MS}, far longer than that gap: the age is checked where the entry is read,\n * and older entries are pruned on every insert. Not recorded when a resumed turn of the work runs here, stopped or not\n * (a replica hearing its own broadcast after stopping its own turn).\n */\n private readonly unmatchedResumedTurnStops = new Map<string, Map<string, number>>();\n\n /**\n * Open a running turn's abort, chained to the caller's own signal when it has one, so either ends the turn the same\n * way. Unregistered by the caller when the turn ends, whatever the exit.\n */\n private registerRunningTurn(\n executionId: string,\n owner: ResolvedOwnerVariant,\n external: AbortSignal | undefined,\n /** The work an ANSWER released this turn to continue, by its first decision (#2550, #2821); absent for every other turn. */\n resumedWorkRef: string | undefined,\n /** A resume's `releasedAt`: a stop of its work that found no turn after that instant was meant for this one (#2550). */\n releasedAt?: number,\n ): AbortController {\n const controller = new AbortController();\n if (external?.aborted) controller.abort();\n else external?.addEventListener('abort', () => controller.abort(), { once: true });\n const unmatchedStopAt = resumedWorkRef !== undefined && releasedAt !== undefined\n ? this.unmatchedResumedTurnStops.get(executionId)?.get(resumedWorkRef)\n : undefined;\n // Both instants are this process's wall clock: `releasedAt` is the answer's `decidedAt`, taken on the replica that\n // runs the resume, and the stop's arrival is recorded by that same replica when it hears the stop. `>=`, so a stop\n // in the same millisecond as the decision stops it: the cancel is the act both planes must agree on.\n if (unmatchedStopAt !== undefined && Date.now() - unmatchedStopAt <= UNMATCHED_RESUMED_TURN_STOP_MEMORY_MS && unmatchedStopAt >= releasedAt!) {\n this.logger.info('[ConversationalExecution] A stop requested after this resume was released reached it before it ran; it ends stopped', { executionId });\n controller.abort();\n }\n const ownerUserId = (owner.ownerFields as { userId?: string }).userId;\n const turns = this.runningTurns.get(executionId) ?? new Set();\n turns.add({ controller, ...(resumedWorkRef !== undefined ? { resumedWorkRef } : {}), ...(ownerUserId ? { ownerUserId } : {}) });\n this.runningTurns.set(executionId, turns);\n // On EVERY turn too (#2550), so a subscription that dropped is rebuilt by the next turn. Not the guarantee: an answer\n // awaits its own arm before it releases a resume. Idempotent, never awaited here, never rejects.\n void this.resumedTurnStops?.arm();\n return controller;\n }\n\n private unregisterRunningTurn(executionId: string, controller: AbortController): void {\n const turns = this.runningTurns.get(executionId);\n if (!turns) return;\n for (const turn of turns) if (turn.controller === controller) turns.delete(turn);\n if (turns.size === 0) this.runningTurns.delete(executionId);\n }\n\n /**\n * The conversation's OWNER stops their own running turn (`FLOWS_ACTORS_CANCEL`, #2524). The turn ends CANCELLED\n * through the runtime's own arms — keeping what it had produced — and `FLOWS_ACTORS_COMPLETED` reports it.\n *\n * Answers whether a turn was stopped. FALSE for a turn this process is not running (it ended, or another process\n * runs it: a cancel reaches the process that holds the socket, which is the one that started the turn unless the\n * person moved tabs to another instance) and for a caller who does not own the conversation. Both are refused\n * silently: a cancel racing a turn's end is ordinary, and naming whose turn exists would answer a question the\n * caller may not ask.\n *\n * assurance-control: WILDO.ACCESS.LEAST_PRIVILEGE — only the conversation's owner can stop its turn.\n * assurance-control: WILDO.AI.HUMAN_OVERSIGHT — a person can stop a running agent turn; it ends through the runtime's own arms.\n */\n cancelTurn(params: { readonly executionId: string; readonly userId: string }): boolean {\n const turns = this.runningTurns.get(params.executionId);\n if (!turns) return false;\n let stopped = false;\n for (const turn of turns) {\n if (turn.ownerUserId !== params.userId || turn.controller.signal.aborted) continue;\n turn.controller.abort();\n stopped = true;\n }\n if (stopped) this.logger.info('[ConversationalExecution] The owner stopped a running turn', { executionId: params.executionId });\n return stopped;\n }\n\n /**\n * Stop the turn that CONTINUES a human decision of this execution, wherever it runs (#2550). For a transport whose\n * request opened the work and may stop it, but holds no handle on what an answer released: the continuation runs on\n * the replica that received the ANSWER, with no abort of the opener's chained to it. Today that is the A2A\n * `tasks/cancel`. The core knows only that some door asked, by the execution and the decision it addressed: it never\n * learns that A2A exists, the same direction as {@link readDecisionWork} and {@link withdrawPendingDecision}.\n *\n * Only a RESUMED turn of `decisionRef` is stopped (#2821). A fresh turn is stopped by whatever opened it (the owner's\n * socket, an SSE hang-up, an A2A task's own signal), and neither a fresh turn of ANOTHER request in the same thread nor\n * the continuation of ANOTHER decision there is this caller's to stop: a thread outlives the work it held, and keying\n * the stop by the thread let one task's cancel stop a later task's resumed turn.\n *\n * The execution is read first through the same four isolation axes as {@link withdrawPendingDecision} (owner FK,\n * machine credential, agent instance), so a caller reaches only its own conversation: a mismatch, or a store that\n * fails, stops nothing. Then this replica's resumed turns are stopped directly and the stop is broadcast, so the\n * replica that runs the resume, whichever it is, stops it ({@link ResumedTurnStopBroadcast}). A stopped turn ends\n * CANCELLED through the resume's own arms, keeping its trace and what it had said, exactly as the owner's Stop does.\n * A replica that holds no resumed turn of the work remembers the stop briefly, so a resume of it whose answer was\n * decided before the stop, and which registers after it, is stopped too ({@link unmatchedResumedTurnStops}). The replica\n * running that resume hears the broadcast because its answer awaited the subscription before deciding\n * ({@link answerPendingDecision}); only a replica that cannot subscribe at all (Redis down) cannot be reached.\n *\n * Call it AFTER ending the decision the work may still wait on ({@link withdrawPendingDecision}), never before. An\n * answer that beats the withdrawal decided before its release, which landed before the withdrawal missed, so its\n * resume's release instant precedes this stop and is caught running or at registration. A stop sent first can be\n * followed by an answer decided after it, whose resume no remembered stop matches.\n *\n * @returns whether a turn was stopped here or the stop was published — never proof that a turn stopped: the replica\n * running it may be gone, or the turn finished. The conversation's record is the truth, as for {@link cancelTurn}.\n */\n public async stopResumedTurns(params: {\n readonly executionId: string;\n /**\n * The work whose continuations are stopped, named by its FIRST decision — the one the caller's work paused on\n * (#2821). Every continuation in its chain is registered under it.\n */\n readonly workRef: string;\n readonly scopeContext: ConversationalOwnerScope;\n /** Whoever asked — the conversation's own principal on every door that reaches this; its credential is an axis. */\n readonly stoppedBy?: SocketAuthResult;\n /** The agent instance the conversation runs on; with the principal's credential, the full isolation key. */\n readonly resourceServerInstanceRef?: string;\n }): Promise<boolean> {\n let owner: ResolvedOwnerVariant;\n try {\n owner = this.resolveOwnerVariant(params.scopeContext);\n } catch {\n return false;\n }\n const row = await this.systemAccess.readAsSystem<FlowActorExecution>(owner.resourceType, {\n executionId: params.executionId,\n ...owner.ownerFields,\n machineCredentialId: machineCredentialIdOf(params.stoppedBy),\n resourceServerInstanceRef: agentInstanceOf(params.resourceServerInstanceRef),\n }, { suppressSystemAudit: true }).catch((error: unknown) => {\n // A store that failed is not a conversation that is absent; nothing is stopped and this line says why.\n this.logger.warn('[ConversationalExecution] The execution of stopped work could not be read; a turn resumed on it runs to its end', {\n executionId: params.executionId, ...projectCaughtErrorLogFields(error),\n });\n return null;\n });\n if (!row) return false;\n const stoppedHere = this.stopResumedTurnsHere(row.executionId, params.workRef);\n const published = (await this.resumedTurnStops?.publish(row.executionId, params.workRef)) ?? false;\n return stoppedHere || published;\n }\n\n /**\n * Stop the turns THIS process runs that resume `workRef`'s work in this execution. Answers whether one was stopped;\n * never throws.\n */\n private stopResumedTurnsHere(executionId: string, workRef: string): boolean {\n let stopped = false;\n /** Whether a resumed turn of the work runs here at all, stopped by this call or already stopped. */\n let found = false;\n for (const turn of this.runningTurns.get(executionId) ?? []) {\n if (turn.resumedWorkRef !== workRef) continue;\n found = true;\n if (turn.controller.signal.aborted) continue;\n turn.controller.abort();\n stopped = true;\n }\n if (stopped) this.logger.info('[ConversationalExecution] Stopped a turn resumed after a decision, at the request of the work it continues', { executionId, workRef });\n // Remembered only when NO resumed turn of the work runs here: the replica that stopped its own turn and then hears\n // its own broadcast found that turn already stopped, which is not a stop waiting for a resume to register.\n if (!found) this.rememberUnmatchedResumedTurnStop(executionId, workRef);\n return stopped;\n }\n\n private rememberUnmatchedResumedTurnStop(executionId: string, workRef: string): void {\n const now = Date.now();\n for (const [id, stops] of this.unmatchedResumedTurnStops) {\n for (const [ref, at] of stops) if (now - at > UNMATCHED_RESUMED_TURN_STOP_MEMORY_MS) stops.delete(ref);\n if (stops.size === 0) this.unmatchedResumedTurnStops.delete(id);\n }\n const stops = this.unmatchedResumedTurnStops.get(executionId) ?? new Map<string, number>();\n stops.set(workRef, now);\n this.unmatchedResumedTurnStops.set(executionId, stops);\n }\n\n /**\n * Every end of a turn before its pause write, which ends the turn exactly once (#2721 re-reviews). Five call sites: its\n * routing failed; nobody can approve the call and the agent already had its one automatic denial (or there is nobody to\n * resume as); the person pressed Stop while the route was decided; the person pressed Stop while the question was\n * composed; the pause write threw without landing. CANCELLED when the person stopped the turn meanwhile, since that is\n * what they asked for, otherwise FAILED with `failureMessage`. The end is written only onto a row still PROCESSING (#2721 gate-4 F2): when another turn's\n * decision holds the thread that decision is reported, and when another turn already ENDED the row its end stands and\n * this turn's is reported without being written, as the pause write's own miss is (`finalizeTerminal`, `reportTurnEnd`).\n */\n private async endTurnWithoutPause(\n params: {\n readonly systemRef: string;\n readonly executionId: string;\n readonly owner: ResolvedOwnerVariant;\n readonly transcript: ConversationalTurnTranscript;\n readonly auth: SocketAuthResult | undefined;\n readonly resourceServerInstanceRef?: string;\n readonly emitter: FlowsActorsExecutionEmitter;\n readonly turnAbortSignal?: AbortSignal;\n readonly turnStartedAt: number;\n },\n failureMessage: string,\n options: {\n /**\n * #2749: the decision this turn's own pause write tried to raise, when that write threw. Its end write then finding\n * the row waiting for THIS decision means the pause committed after all: nothing is reported, and the caller goes\n * on to record and announce it. Any other waiting decision is reported as before.\n */\n readonly ownDecisionRef?: string;\n } = {},\n ): Promise<TurnEndRecord> {\n const stopped = params.turnAbortSignal?.aborted === true;\n const ended = await this.finalizeTerminal(params.systemRef, params.executionId, params.owner, params.transcript,\n // #2827: the code the client is told below, recorded with the end.\n stopped ? { status: FlowsActors_Status.CANCELLED } : { status: FlowsActors_Status.FAILED, failureCode: TURN_ENDED_WITHOUT_PAUSE_CODE },\n machineCredentialIdOf(params.auth), agentInstanceOf(params.resourceServerInstanceRef), { onlyWhileProcessing: true });\n if (options.ownDecisionRef !== undefined && ended.kind === TurnEndRecordKind.DECISION_WAITING && ended.decisionRef === options.ownDecisionRef) return ended;\n this.reportTurnEnd(params.emitter, params.systemRef, params.executionId, ended, () => (stopped\n ? this.emitTurnCancelled(params.emitter, params.systemRef, params.executionId, params.turnStartedAt)\n : this.emitError(params.emitter, params.systemRef, params.executionId, TURN_ENDED_WITHOUT_PAUSE_CODE, failureMessage)));\n return ended;\n }\n\n /**\n * Record a TERMINAL outcome for the turn, keeping the messages accumulated so far (the user's turn among them, so a\n * reloaded transcript still shows the question). Best-effort: a persistence failure is logged, never thrown.\n *\n * The turn's messages are written onto the row as it stands, never in place of it (#2743): `transcript` is what the\n * turn adds, and a sibling turn's messages written since this one read the thread stay (`writeTurnTranscript`).\n *\n * The status is a parameter because a cancelled turn is NOT a failed one. A caller who invokes\n * `tasks/cancel`, or an SSE client that disconnects, ABORTS the model call deliberately — writing\n * `FAILED` there would contradict the task plane (the A2A controller records `CANCELLED` for the\n * very same event) and would leave the two planes disagreeing about one user action.\n *\n * Answers what it found (#2721 review F-1, N-1): RECORDED, or DECISION_WAITING when the write was refused because the\n * row waits for a decision another turn on the thread raised meanwhile. The decision, not this turn, is the thread's\n * state then, and its card must not be cleared. Every caller reports the answer through {@link reportTurnEnd}.\n */\n private async finalizeTerminal(\n systemRef: string,\n executionId: string,\n owner: ResolvedOwnerVariant,\n transcript: ConversationalTurnTranscript,\n /**\n * How the turn ended: CANCELLED, or FAILED with the code its client is told (#2827). The pairing is the type, so a\n * failure cannot be recorded without saying why: the code rides the `failed` entry of `statusChanges`.\n */\n ending: ConversationalTurnTerminalEnding,\n // Carried explicitly: this write is owner-scoped, and the owner FK alone does not identify the\n // principal on the machine variants — a terminal write that omits the axis matches nothing.\n machineCredentialId: string = FLOWS_ACTORS_NO_MACHINE_CREDENTIAL,\n resourceServerInstanceRef: string = FLOWS_ACTORS_DEFAULT_AGENT_INSTANCE,\n /**\n * Write only onto a row still PROCESSING (#2721 gate-4 F2): for every end before the pause write (`endTurnWithoutPause`\n * and its five callers), decided while the turn could not know who else had written, so a row another turn already\n * ended keeps its end.\n */\n options: {\n readonly onlyWhileProcessing?: boolean;\n /** #2292: the turn's personal-data view, when the end keeps a reply it streamed. */\n readonly personalData?: TurnPersonalDataView;\n } = {},\n ): Promise<TurnEndRecord> {\n const rowFilter = { executionId, ...owner.ownerFields, machineCredentialId, resourceServerInstanceRef };\n const { status } = ending;\n const finishedAt = new Date();\n try {\n const ended = await this.writeTurnTranscript(owner, {\n ...rowFilter,\n // #2721 review F-1: never over a row waiting for a decision, as the completion write.\n status: options.onlyWhileProcessing ? FlowsActors_Status.PROCESSING : { $nin: [FlowsActors_Status.AWAITING_APPROVAL] },\n }, transcript, (row) => ({\n status,\n finishedAt,\n // The row's history gains the end it records, as the interrupted-turn sweep's FAILED does. Without it a refused or\n // cancelled turn read `statusChanges: [processing]` beside `status: failed`, and a continued thread kept the previous\n // turn's `completed` as its last entry (#2035 item 100, from #2191).\n // #2827: a FAILED entry carries why, so a reload, a chat reply and an A2A task can say it.\n statusChanges: [...(row.statusChanges ?? []), flowsActorsStatusChange(ending, finishedAt)],\n }), options.personalData);\n if (!ended) {\n const waitingFor = await this.waitingDecisionOf(owner, rowFilter);\n if (waitingFor !== undefined) {\n this.logger.warn('[ConversationalExecution] An overlapping turn paused the thread for a decision; this turn ends unrecorded', { systemRef, executionId, status });\n return { kind: TurnEndRecordKind.DECISION_WAITING, decisionRef: waitingFor };\n }\n }\n } catch (error) {\n this.logger.error('[ConversationalExecution] Failed to finalize execution', { systemRef, executionId, status, error });\n }\n return TURN_END_RECORDED;\n }\n\n /**\n * Tell the turn's client how it ended (#2721 review N-1): its own end when that was recorded, and otherwise the\n * decision that now holds the thread, as a RECOVERABLE `DECISION_PENDING`. Never silence. A turn's emitter is not\n * always the owner's browser room: an A2A call has a private one per request, and reads a turn that says nothing\n * as one that succeeded with no reply, so silence turned a failed turn into a successful empty one. A tab holding\n * the decision's card keeps it (the code is recoverable), a tab that does not refreshes its history and finds it,\n * and an A2A client is answered -32015.\n */\n private reportTurnEnd(\n emitter: FlowsActorsExecutionEmitter | undefined,\n systemRef: string,\n executionId: string,\n ended: TurnEndRecord,\n reportOwnEnd: () => void,\n ): void {\n if (ended.kind === TurnEndRecordKind.RECORDED) {\n reportOwnEnd();\n return;\n }\n if (emitter) this.emitDecisionPending(emitter, systemRef, executionId, ended.decisionRef);\n }\n\n /**\n * The decision a conversation waits for, read as the turn's own continuation read finds the thread (#2721 review\n * F-3): `undefined` when there is no such thread, it does not wait, or it could not be read. For a door that must\n * answer BEFORE it runs a turn (A2A's non-blocking send, which creates a task first). The turn still refuses on its\n * own, so a decision raised after this answer is refused there.\n */\n public async waitingDecisionOfThread(params: {\n readonly scopeContext: ConversationalOwnerScope;\n readonly auth: SocketAuthResult;\n readonly executionId: string;\n readonly resourceServerInstanceRef?: string;\n }): Promise<string | undefined> {\n let owner: ResolvedOwnerVariant;\n try {\n owner = this.resolveOwnerVariant(params.scopeContext);\n } catch {\n return undefined;\n }\n return this.waitingDecisionOf(owner, {\n executionId: params.executionId, ...owner.ownerFields,\n machineCredentialId: machineCredentialIdOf(params.auth), resourceServerInstanceRef: agentInstanceOf(params.resourceServerInstanceRef),\n });\n }\n\n /**\n * Whether a thread admits no turn from `arrivingKind` beside the one running in it (#2665 A6), read as the turn's\n * own continuation read finds the thread: `false` when there is no such thread, nothing runs, or it could not be\n * read. For a door that must answer BEFORE it runs a turn (A2A's non-blocking send, which creates a task first); the\n * turn still refuses on its own, so a turn begun after this answer is refused there.\n */\n public async threadAdmitsNoSecondTurn(params: {\n readonly scopeContext: ConversationalOwnerScope;\n readonly auth: SocketAuthResult;\n readonly executionId: string;\n readonly resourceServerInstanceRef?: string;\n readonly initiationKind: FlowsActors_InitiationKind;\n }): Promise<boolean> {\n let owner: ResolvedOwnerVariant;\n try {\n owner = this.resolveOwnerVariant(params.scopeContext);\n } catch {\n return false;\n }\n return this.threadRefusesArrivingTurn(owner, {\n executionId: params.executionId, ...owner.ownerFields,\n machineCredentialId: machineCredentialIdOf(params.auth), resourceServerInstanceRef: agentInstanceOf(params.resourceServerInstanceRef),\n }, params.initiationKind);\n }\n\n /** {@link conversationRefusesArrivingTurn} on the thread read back now; `false` when it is absent or unreadable. */\n private async threadRefusesArrivingTurn(owner: ResolvedOwnerVariant, rowFilter: Record<string, unknown>, arrivingKind: FlowsActors_InitiationKind | undefined): Promise<boolean> {\n try {\n const row = await this.systemAccess.readAsSystem<FlowActorExecution>(owner.resourceType, rowFilter, { scopeContext: owner.scopeContext });\n return row ? conversationRefusesArrivingTurn(row, arrivingKind) : false;\n } catch (error) {\n this.logger.warn('[ConversationalExecution] A thread could not be read back to tell whether a turn runs in it', {\n executionId: rowFilter.executionId, ...projectCaughtErrorLogFields(error),\n });\n return false;\n }\n }\n\n /**\n * Whether a pause write that THREW raised `decisionRef` (#2749), read back with the write's own filter. Unlike\n * {@link waitingDecisionOf}, a read that fails is never an answer: it is retried after each of\n * {@link DECISION_REQUEST_WRITE_OUTCOME_READ_DELAYS_MS}, and when every read fails the outcome is UNKNOWN. LANDED only when the\n * row waits for this very decision; any row read that does not, or no row, is NOT_LANDED.\n */\n private async readThrownPauseWrite(owner: ResolvedOwnerVariant, rowFilter: Record<string, unknown>, decisionRef: string): Promise<DecisionRequestWriteOutcome> {\n return readBackThrownDecisionRequestWrite({\n read: async () => {\n const row = await this.systemAccess.readAsSystem<FlowActorExecution>(owner.resourceType, rowFilter, { scopeContext: owner.scopeContext });\n return row?.status === FlowsActors_Status.AWAITING_APPROVAL && row.pendingDecisionRef === decisionRef;\n },\n wait: (delayMs) => this.waitBeforePauseOutcomeRead(delayMs),\n onReadFailure: ({ attempt, retrying, error }) => this.logger.warn('[ConversationalExecution] A thrown approval-pause write could not be read back', {\n executionId: rowFilter.executionId, decisionRef, attempt, retrying, ...projectCaughtErrorLogFields(error),\n }),\n });\n }\n\n /** The wait before the next read-back of a thrown pause write; its own method so a test can make it immediate. */\n private waitBeforePauseOutcomeRead(delayMs: number): Promise<void> {\n return waitBeforeDecisionRequestRead(delayMs);\n }\n\n /**\n * The decision a thread's row waits for, read back after a turn's write on it matched nothing (#2721 review F-1,\n * F-4): its `pendingDecisionRef` ('' when the row names none) while the row is AWAITING_APPROVAL, else `undefined`\n * (the row left waiting, went away, or could not be read). Writes are guarded off a waiting row, and one thread\n * admits overlapping turns, so a miss usually means another turn raised a decision meanwhile.\n *\n * A read that fails answers `undefined` here, which is right after a write that MATCHED NOTHING (nothing this turn\n * wrote can be waiting). After a pause write that THREW it is not: that write may have committed, so a failed read is\n * no answer at all, and {@link readThrownPauseWrite} asks instead (#2749).\n */\n private async waitingDecisionOf(owner: ResolvedOwnerVariant, rowFilter: Record<string, unknown>): Promise<string | undefined> {\n try {\n const row = await this.systemAccess.readAsSystem<FlowActorExecution>(owner.resourceType, rowFilter, { scopeContext: owner.scopeContext });\n return row?.status === FlowsActors_Status.AWAITING_APPROVAL ? (row.pendingDecisionRef ?? '') : undefined;\n } catch (error) {\n this.logger.warn('[ConversationalExecution] A thread could not be read back after a write missed it', {\n executionId: rowFilter.executionId, ...projectCaughtErrorLogFields(error),\n });\n return undefined;\n }\n }\n\n /**\n * Write `fields` and the turn's messages onto the ONE row `rowFilter` selects, merging the turn into the row as it is\n * now rather than replacing the row's transcript (#2743). Answers the written row, or `null` when `rowFilter` matches\n * no row (its status guard refused, or the row is gone): the same answer a filtered `updateAsSystem` gives, so every\n * caller reads a miss back as it did before.\n *\n * Every write that advances, pauses or ends a turn goes through here: the advance, the fresh completion,\n * `finalizeTerminal` (every FAILED / CANCELLED end, `endTurnWithoutPause` included), the pause and the resumed\n * completion. Each used to write `messages` as the turn had computed it from the transcript it READ, so two\n * overlapping turns on one thread erased each other's messages, whichever wrote last.\n *\n * A compare-and-swap on the row's `_version`, through the same system door: read the row with the write's own filter,\n * apply `transcript` to its messages, and write with `ifMatchVersion`. A write that lost to another write on the row\n * (MongoDB answers VERSION_CONFLICT; PostgreSQL does too while the guard still matches) reads the row again and\n * merges again, so nothing a sibling wrote in between is lost; a guard that stopped matching ends the loop on the\n * next read with `null`. Nothing waits between attempts: each miss is another write's success.\n *\n * Why not an atomic array append: a resumed turn's trace UPDATES the tool row its pause stored (one row per call,\n * merged by `toolCallId`), which neither store can do inside an append. See {@link ConversationalTurnTranscript}.\n *\n * The read is the write's own read-before-write, so it does not record a privileged-read audit row of its own: the\n * write it serves records one (`updateAsSystem`), and the turn's opening read already recorded the access.\n */\n private async writeTurnTranscript(\n owner: ResolvedOwnerVariant,\n rowFilter: Record<string, unknown>,\n transcript: ConversationalTurnTranscript,\n /** The fields the write sets; a function of the row as read when a field extends what the row holds (`statusChanges`). */\n fields: Record<string, unknown> | ((row: FlowActorExecution) => Record<string, unknown>),\n /**\n * #2292: the turn's personal-data view, when its reply was written. Its placeholder table and model-side texts are\n * merged with what the row holds NOW, inside the same version-guarded write, so an overlapping turn's are kept.\n */\n personalData?: TurnPersonalDataView,\n ): Promise<FlowActorExecution | null> {\n for (let attempt = 1; ; attempt += 1) {\n const row = await this.systemAccess.readAsSystem<FlowActorExecution & { readonly _version?: unknown }>(\n owner.resourceType, rowFilter, { scopeContext: owner.scopeContext, suppressSystemAudit: true },\n );\n if (!row) return null;\n const version = row._version;\n // Without the version the write could only REPLACE the transcript, which is the defect; refuse rather than do it.\n // Not reachable today: both adapters stamp a version on insert (MongoDB's version key, PostgreSQL's\n // `_version_db_doc = 1`) and bump it on every write. Should it ever be, every caller already ends a write that throws.\n if (typeof version !== 'number' || !Number.isSafeInteger(version) || version < 0) {\n throw new Error(`The conversation ${String(rowFilter.executionId)} was read without its version, so this turn's messages cannot be merged into it`);\n }\n const personalDataToStore = personalData?.stateToStore(row.personalDataModelState);\n const renames = personalDataToStore?.renames ?? new Map<string, string>();\n try {\n const written = await this.systemAccess.updateAsSystem<FlowActorExecution>(owner.resourceType, rowFilter, {\n ...renamedPlaceholdersInTurnFields(typeof fields === 'function' ? fields(row) : fields, renames),\n ...(personalDataToStore !== undefined ? { personalDataModelState: personalDataToStore.state } : {}),\n // One contentless message would fail the whole update and lose what the write records (see the helper).\n messages: toPersistableConversationMessages(renamedPlaceholdersInTurnMessages(row.messages ?? [], transcript(row.messages ?? []), renames)),\n }, { scopeContext: owner.scopeContext, ifMatchVersion: version });\n if (written) {\n personalData?.acceptRenames(renames);\n return written;\n }\n } catch (error) {\n if (!(isWildoBackendError(error) && error.type === ErrorType.CONFLICT && error.customMessageReference === ErrorCustomMessageReference.VERSION_CONFLICT)) throw error;\n }\n if (attempt >= TURN_TRANSCRIPT_WRITE_ATTEMPTS) {\n throw new Error(`The conversation ${String(rowFilter.executionId)} changed under ${attempt} consecutive writes of this turn; its messages were not written`);\n }\n }\n }\n\n\n /**\n * #3325: the schemas declaring what a tool's arguments are, or `undefined` for a tool this agent does not declare (an MCP\n * tool, which has no declarations). The tool's own schema still speaks when its resource cannot be read, with `unreadable`\n * set, since what that resource declares is then unknown.\n */\n private credentialDeclarationsOf(systemRef: string, toolName: string): { readonly schemas: readonly unknown[]; readonly unreadable: boolean } | undefined {\n const resolved = this.resolveApprovalGatedFunctionTool(systemRef, toolName);\n if (resolved.kind !== GatedFunctionToolResolutionKind.FOUND) return undefined;\n const resource = this.argumentResourceSchemasOf(resolved.functionTool);\n return { schemas: [resolved.functionTool.inputSchema, ...(resource ?? [])], unreadable: resource === undefined };\n }\n\n /**\n * #3325: a tool event as the turn's trace keeps and sends it, any declared credential withheld. Here, where the event is\n * recorded, because every ending of a turn writes the trace: a stop, a failure and a pause alike, and a tool that was not\n * gated too. Arguments that cannot be vouched for are withheld whole (`heldCallInput`).\n */\n private toolEventWithCredentialsWithheld(systemRef: string, event: FunctionToolStreamEvent): FunctionToolStreamEvent {\n if (event.input === undefined) return event;\n const declarations = this.credentialDeclarationsOf(systemRef, event.toolName);\n if (!declarations) return event;\n return { ...event, input: heldCallInput(event.input, declarations).withheld };\n }\n\n /**\n * #3325: the messages of a pausing turn as they may be stored, and whether its pending calls may be held at all. Calls that\n * already ran or were refused are rewritten silently: no signature covers them, and a later pause would store them. A\n * pending call holding a credential is refused: `denies` when the kept call can be denied with its copies withheld, and\n * not when another call of the step holds it, a schema renamed the value out of reach, or its declarations cannot be read,\n * which end the turn. Never throws: the routing beside it is guarded for the same reason, and a failure here refuses.\n */\n private heldToolCallsOf(systemRef: string, suspension: AgentApprovalSuspension, personalData: TurnPersonalDataView | undefined): {\n readonly sdkModelMessages: Record<string, unknown>[];\n readonly refusal?: { readonly denies: boolean; readonly argumentPaths: readonly string[]; readonly input: Record<string, unknown>; readonly withheldCalls: readonly { readonly toolCallId: string; readonly input: unknown }[] };\n } {\n const isPlaceholder = (value: string) => personalData?.table?.entryOf(value) !== undefined;\n const input = suspension.toolArgs as Record<string, unknown>;\n try {\n const messages = withSettledToolCallsHeld(suspension.sdkModelMessages, (toolName, callInput) => {\n const declarations = this.credentialDeclarationsOf(systemRef, toolName);\n return declarations ? heldCallInput(callInput, declarations, isPlaceholder).withheld : undefined;\n });\n const pending = pendingToolApprovalCallsOf(messages);\n const kept = pending.find((call) => call.approvalId === suspension.approvalId) ?? { approvalId: suspension.approvalId, toolName: suspension.toolName, input, rawInput: input };\n const findingsIn = (call: Pick<typeof kept, 'toolName' | 'rawInput' | 'input'>) => {\n const declarations = this.credentialDeclarationsOf(systemRef, call.toolName);\n if (!declarations) return { paths: [], unvouched: false, withheld: call.input };\n const raw = heldCallInput(call.rawInput, declarations, isPlaceholder);\n const parsed = heldCallInput(call.input, declarations, isPlaceholder);\n // Raw paths the parse did not keep are dropped keys, unless the schema moved the value somewhere no declaration names.\n const dropped = raw.paths.reduce((remaining, path) => withoutArgumentAt(remaining, path), call.rawInput);\n const renamed = raw.paths.length > 0 && parsed.paths.length === 0 && !isDeepEqualData(dropped, call.input);\n return { paths: [...new Set([...raw.paths, ...parsed.paths])], unvouched: renamed || (parsed.tainted && parsed.paths.length === 0), withheld: parsed.withheld };\n };\n const others = pending.filter((call) => call.approvalId !== kept.approvalId).map((call) => ({ toolCallId: call.toolCallId, ...findingsIn(call) }));\n const own = findingsIn(kept);\n const argumentPaths = [...own.paths, ...others.flatMap((other) => other.paths)];\n const refused = argumentPaths.length > 0 || own.unvouched || others.some((other) => other.unvouched);\n if (!refused) return { sdkModelMessages: messages };\n const withheldInput = own.unvouched ? { withheld: WITHHELD_CREDENTIAL_ARGUMENT } : own.withheld;\n const signingKey = this.agentsBackend.resolveToolApprovalSigningKey();\n const applied = signingKey && others.every((other) => other.paths.length === 0 && !other.unvouched) && !own.unvouched\n ? applyModifiedToolApprovalInput({ sdkModelMessages: messages, approvalId: suspension.approvalId, modifiedInput: withheldInput, signingKey })\n : undefined;\n const denies = applied?.kind === ToolApprovalModificationOutcomeKind.MODIFIED;\n const withheldCalls = [{ toolCallId: suspension.toolCallId, input: withheldInput }, ...others.filter((other) => other.paths.length > 0 || other.unvouched).map((other) => ({ toolCallId: other.toolCallId, input: other.unvouched ? { withheld: WITHHELD_CREDENTIAL_ARGUMENT } : other.withheld }))];\n return { sdkModelMessages: denies ? applied.sdkModelMessages : [], refusal: { denies, argumentPaths, input: withheldInput, withheldCalls } };\n } catch (error) {\n this.logger.error('[ConversationalExecution] The calls of a pausing turn could not be read for credentials; ending the turn', { ...projectCaughtErrorLogFields(error) });\n return { sdkModelMessages: [], refusal: { denies: false, argumentPaths: [], input: {}, withheldCalls: [{ toolCallId: suspension.toolCallId, input: { withheld: WITHHELD_CREDENTIAL_ARGUMENT } }] } };\n }\n }\n\n /** A gated call denied without asking anyone, and the same turn resumed at once so the agent can answer (#1594 D3). */\n private async resumeOnAutomaticDenial(params: Parameters<ConversationalExecutionBackendService['persistApprovalSuspension']>[0], suspension: AgentApprovalSuspension, reason: string, requestedAt: string): Promise<void> {\n const { systemRef, executionId, owner, emitter } = params;\n await this.resumeAfterApproval({\n systemRef, executionId, owner,\n paused: {\n approvalId: suspension.approvalId, sdkModelMessages: suspension.sdkModelMessages,\n pendingToolName: suspension.toolName, pendingToolArgs: suspension.toolArgs, requestedAt,\n ...(suspension.outputModerationAtPause ? { outputModerationAtPause: moderationEntriesOf(suspension.outputModerationAtPause) } : {}),\n // #2292 R8: the same turn resumes at once, under the treatment it paused with.\n ...(params.personalData ? params.personalData.pausedPosture() : UNGUARDED_PAUSED_POSTURE),\n },\n approved: false,\n reason,\n // #2821: an inline resume is the same turn, so a pause it makes belongs to the same work.\n ...(params.continuesWorkRef ? { workRef: params.continuesWorkRef } : {}),\n ...(params.personalData ? { personalData: params.personalData } : {}),\n auth: params.auth,\n resourceServerInstanceRef: params.resourceServerInstanceRef,\n emitter,\n // The work this turn did before it paused, which no write has recorded: the resume writes it with its own.\n transcript: params.transcript,\n requester: params.requester,\n initiationKind: params.initiationKind,\n autonomousTrigger: params.autonomousTrigger,\n automaticDenials: (params.automaticDenials ?? 0) + 1,\n // The SAME turn, resumed inline: its caller's cancel (A2A `tasks/cancel`, an SSE hang-up) still reaches the resumed\n // model call (#2721 gate-4 F4). The owner's Stop reaches every resume, this one included, through the running-turn\n // registry; a resume an answer released later has no caller to hear.\n ...(params.turnAbortSignal ? { abortSignal: params.turnAbortSignal } : {}),\n });\n }\n\n /**\n * Persist a turn that SUSPENDED at a human-in-the-loop approval boundary.\n *\n * Writes `AWAITING_APPROVAL` plus the serialized run state, then tells the client what decision is\n * being asked for. Three properties matter and each is deliberate:\n *\n * - **It is not terminal.** `AWAITING_APPROVAL` projects to A2A `input-required`, which is\n * explicitly exempt from the liveness sweep and from derive-on-read (finding A3-3) — a paused\n * turn holds no lease BY DESIGN, and treating \"no lease\" as \"abandoned\" here would fail every\n * approval one grace window after it was requested.\n * - **The user's turn is persisted with it.** A reload during the wait must still show the\n * question that is pending a decision, not an empty thread.\n * - **A failed write is loud.** If the row does not record the pause, the resume has nothing to\n * load and the turn is unrecoverable — silence here would strand a human decision forever.\n */\n private async persistApprovalSuspension(params: {\n systemRef: string;\n executionId: string;\n owner: ResolvedOwnerVariant;\n auth: SocketAuthResult | undefined;\n resourceServerInstanceRef?: string;\n /** What the turn wrote into the thread before it paused, applied to the row as it stands at the pause write (#2743). */\n transcript: ConversationalTurnTranscript;\n /** #2292: the turn's personal-data view: its table and the paused reply's model-side text are stored with the pause. */\n personalData?: TurnPersonalDataView;\n suspension: AgentApprovalSuspension;\n emitter: FlowsActorsExecutionEmitter;\n /** The door that opened the turn; carried unchanged into a second pause of a resumed turn (#1594 D11). */\n initiationKind?: FlowsActors_InitiationKind | null;\n /** AUTONOMOUS turns: what started the turn, from its row; decides which tools a resume may offer (#1611). */\n autonomousTrigger?: AutonomousTurnTrigger | null;\n /**\n * The requester of a SECOND pause in a resumed turn: the original requester, read from the row —\n * never the person whose answer resumed it (#1594 D11, I10). Absent on a first pause, where the\n * requester is derived from the turn's own verified auth.\n */\n requester?: HumanDecision_Requester;\n /**\n * How many gated calls this turn has already had DENIED because nobody could answer them. An\n * unroutable pause denies the call and resumes the turn so the agent can answer; a model that then asks\n * for a gated tool again would otherwise loop — deny, resume, ask, deny — without end. One automatic\n * denial per turn is what the agent gets; a second ends the turn.\n */\n automaticDenials?: number;\n /**\n * The turn's attribution (#1598), re-opened for the model call this pause makes for itself — composing an agent's\n * question as a form (#2720). The pause runs after the turn's own frame has closed, so without it that call\n * would be recorded with no tenant, case or turn.\n */\n workAttribution: ModelCallAttributionInput;\n /** The turn's stop. Pressed while a question is being composed, the turn ends CANCELLED and asks nothing. */\n turnAbortSignal?: AbortSignal;\n /** #3325: replace what the turn's trace keeps of a call's arguments, before any write reads it. */\n withholdCallInput: ConversationalTurnTrace['withholdInput'];\n /** When the turn (or its resume) started, for the duration its CANCELLED event reports. */\n turnStartedAt: number;\n /**\n * The work this turn continues, named by its first decision (#2821): set when the pausing turn is the continuation of\n * an answered decision (or an inline resume inside one). Absent for a fresh turn, whose pause opens its own work.\n */\n continuesWorkRef?: string;\n }): Promise<PauseAttemptOutcome> {\n const { systemRef, executionId, owner, emitter } = params;\n /*\n * #2292: the call's arguments as PEOPLE and application code read them — the decision card, the routing resolvers,\n * the review record, a question's text — with the values the model only saw as placeholders put back. The SDK\n * messages the turn resumes from keep the placeholders the model wrote; the resumed tool re-identifies them itself.\n */\n const heldCalls = this.heldToolCallsOf(systemRef, params.suspension, params.personalData);\n const heldSuspension = { ...params.suspension, sdkModelMessages: heldCalls.sdkModelMessages };\n const suspension: AgentApprovalSuspension = params.personalData?.table\n ? { ...heldSuspension, toolArgs: params.personalData.table.reidentifyDeep(params.suspension.toolArgs) as AgentApprovalSuspension['toolArgs'] }\n : heldSuspension;\n const requestedAtDate = new Date();\n const requestedAt = requestedAtDate.toISOString();\n\n /*\n * #3325: a credential the model wrote into a gated call is denied here, instead of paused, so no decision is raised on it\n * and no card or record shows it. Startup refuses a tool whose own schema declares one, so this is what is left: an argument its resource\n * declares, on an open schema or as a stray key the schema dropped, which the raw input still holds. Refused like a call\n * nobody can approve, with one chance to answer without it. The call's copies carry the marker from here on, re-signed,\n * so the resumed turn and any later pause of it hold no secret either.\n *\n * assurance-control: WILDO.SECURITY.FAIL_CLOSED — a credential a model proposes is denied, and stored with no call.\n */\n if (heldCalls.refusal) {\n this.logger.warn('[ConversationalExecution] The model wrote a credential into a gated call; denying it instead of pausing', {\n systemRef, executionId, toolName: suspension.toolName, argumentPaths: heldCalls.refusal.argumentPaths,\n });\n // What the event could not see: a value a schema renamed out of reach is in the trace under a name nothing declares.\n for (const call of heldCalls.refusal.withheldCalls) params.withholdCallInput(call.toolCallId, call.input);\n if (!heldCalls.refusal.denies || !params.auth || (params.automaticDenials ?? 0) >= 1 || params.turnAbortSignal?.aborted) {\n await this.endTurnWithoutPause(params, 'The assistant tried to use a credential in an action, which is not allowed, so nothing was run.');\n return PauseAttemptOutcome.ENDED_WITHOUT_PAUSE;\n }\n await this.resumeOnAutomaticDenial(params, { ...suspension, toolArgs: heldCalls.refusal.input }, 'A credential cannot be a tool argument, so this call was not run. Do it without one, or tell the person how to do it themselves.', requestedAt);\n return PauseAttemptOutcome.RESUMED_INLINE;\n }\n\n /*\n * WHO may answer, decided BEFORE anything is written (#1594 D3). A route nobody could answer — a\n * machine-raised decision on an OWNER route, a ROLE route with no organization, an assignee the\n * gate's resolver could not name or who does not hold the role — is REFUSED here, and the tool call\n * is denied: the turn resumes with a denial so the agent can answer it. \"A decision nobody may\n * answer\" therefore never exists to be stranded.\n */\n let routing: Awaited<ReturnType<ConversationalExecutionBackendService['routePendingDecision']>>;\n try {\n routing = await this.routePendingDecision({\n systemRef, executionId, owner, auth: params.auth,\n toolName: suspension.toolName, toolArgs: suspension.toolArgs, requester: params.requester,\n });\n } catch (error) {\n /*\n * Deciding who may answer FAILED (a role fact or a unit could not be read, a gate's code threw): that is not \"nobody\n * can answer\", which would deny the call and tell the agent so, but an error. The turn ends once, like a pause\n * write that throws without landing (`endTurnWithoutPause`, #2721 re-review F-5). Uncaught, it escaped\n * `startConversationalExecution`, which promises never to throw, and the turn ended after STARTED with no event.\n */\n this.logger.error('[ConversationalExecution] Routing an approval-gated call failed; ending the turn', {\n systemRef, executionId, toolName: suspension.toolName, ...projectCaughtErrorLogFields(error),\n });\n await this.endTurnWithoutPause(params, 'The assistant\\'s request for approval could not be routed, so nothing was run.');\n return PauseAttemptOutcome.ENDED_WITHOUT_PAUSE;\n }\n if (routing.kind === HumanDecision_VerdictKind.REFUSED) {\n this.logger.warn('[ConversationalExecution] An approval-gated call has no route anyone could answer; denying it instead of pausing', {\n systemRef, executionId, toolName: suspension.toolName, reason: routing.reason,\n });\n if (!params.auth || (params.automaticDenials ?? 0) >= 1) {\n // Nothing to resume AS, so the denial cannot be handed back to the agent — or the agent already had\n // its one automatic denial this turn and asked again. End the turn rather than leave it PROCESSING\n // with nobody to finish it, or resume it into the same refusal forever.\n if (params.auth) {\n this.logger.warn('[ConversationalExecution] The agent asked again for a call nobody can approve; ending the turn', {\n systemRef, executionId, toolName: suspension.toolName,\n });\n }\n // Recorded and reported once, through the one helper that honours a Stop pressed meanwhile (#2721 gate-4 F3): a turn\n // that ends in silence reads as a success to an A2A caller and leaves a tab RUNNING (#2721 review, refused route).\n await this.endTurnWithoutPause(params, 'The assistant asked to take an action nobody here can approve, so the turn ended.');\n return PauseAttemptOutcome.ENDED_WITHOUT_PAUSE;\n }\n // Stopped while the route was being decided: the person asked the turn to stop, so it ends CANCELLED rather than\n // resuming into another model call (#2721 gate-4 F3).\n if (params.turnAbortSignal?.aborted) {\n await this.endTurnWithoutPause(params, 'The assistant asked to take an action nobody here can approve, so the turn ended.');\n return PauseAttemptOutcome.ENDED_WITHOUT_PAUSE;\n }\n await this.resumeOnAutomaticDenial(params, suspension, 'No one is able to approve this action, so it was not run.', requestedAt);\n return PauseAttemptOutcome.RESUMED_INLINE;\n }\n const { route, requester, agentRef } = routing;\n // #1628: the three clocks, armed from the gate that routed it. The lapse (the hard stop) is the gate's\n // `lapseAfter`, 24 hours by default, and is computed ONCE here and shared by the row, the blob, the audit\n // row and the announcement — two computations would let them disagree about when the decision lapses.\n const armed = this.armDecisionDeadlines(requestedAtDate, routing.gate, suspension.toolName);\n const expiresAtDate = armed.lapseAt;\n const pausedApprovalExpiresAt = expiresAtDate.toISOString();\n // The ONE decision id (#1594 D1): minted here, named by every answer, move and audit row. The SDK's\n // `approvalId` stays inside the blob as the SDK's own correlation id and is never a key outside it.\n const decisionRef = randomUUID();\n // #2720: an agent's QUESTION is asked through a form, composed once, here, on the model of the agent that asked —\n // inside the turn's attribution frame, so its spend lands on the turn it serves (#1598), and inside its spend frame,\n // so its tokens are charged to the allowance the turn draws on (#2935). Not refused: it serves a turn already admitted.\n // #2292: composed from the question AS THE MODEL WROTE IT (a model composes it, so it is never sent a value its agent\n // saw only as a placeholder), then shown to the person with the values back.\n const composedForm = await this.inTurnSpendFrame(params.initiationKind, params.auth, () => runWithWorkAttributionFrame(params.workAttribution, () => this.composePausedQuestionForm({\n systemRef, toolName: suspension.toolName, toolArgs: params.suspension.toolArgs, agentRef, requestedAt,\n traceContext: { sessionRef: executionId, label: `flows-actors:${systemRef}`, attribution: params.workAttribution },\n ...(params.turnAbortSignal ? { abortSignal: params.turnAbortSignal } : {}),\n })));\n // STOPPED while the question was composed: the person asked the turn to stop, so it ends CANCELLED and the\n // question is never raised — the order the turn's own stop check keeps before a pause (#2524).\n if (params.turnAbortSignal?.aborted) {\n this.logger.info('[ConversationalExecution] Turn stopped while its question was being composed; recording CANCELLED', {\n systemRef, executionId, toolName: suspension.toolName,\n });\n // Through the one helper every end before the pause write takes, so it lands only on the row this turn still holds\n // PROCESSING, like its siblings above (#2721 gate-5 L4). The person stopped it, so it records CANCELLED.\n await this.endTurnWithoutPause(params, 'The turn was stopped before its question was asked.');\n return PauseAttemptOutcome.ENDED_WITHOUT_PAUSE;\n }\n const questionForm = composedForm && params.personalData?.table\n ? params.personalData.table.reidentifyDeep(composedForm) as typeof composedForm\n : composedForm;\n\n // #2768: the relationships the requester stands through where the decision is routed, kept with the pause so the\n // answer resumes only through them. A resumed turn pausing again carries the record its first pause made (the\n // requester it resumed as); a first pause reads it from the turn's own auth, in the route's organization.\n const requesterThroughRelationshipIds = params.requester\n ? params.requester.throughRelationshipIds\n : route.organizationId && params.auth ? relationshipStandingOf(params.auth.initiatorRoles, route.organizationId) : undefined;\n // #2923: what answering it will require, as the gate declares it now; the answer reads this copy, never the gate later.\n const pausedStepUp = this.pausedCallStepUpRequirementOf(systemRef, suspension.toolName);\n const pausedAnswerChannels = this.pausedCallAnswerChannelsOf(systemRef, suspension.toolName);\n const pausedApproval = serializeFlowActorPausedApproval({\n approvalId: suspension.approvalId,\n sdkModelMessages: suspension.sdkModelMessages,\n // #3364 step 3: what the replies were judged under, owners' tightenings included; the resume is held to it.\n ...(suspension.outputModerationAtPause ? { outputModerationAtPause: moderationEntriesOf(suspension.outputModerationAtPause) } : {}),\n pendingToolName: suspension.toolName,\n pendingToolArgs: suspension.toolArgs,\n ...(questionForm ? { questionForm } : {}),\n requestedAt,\n // #465: the suspension carries its own expiry. The field was declared, sent to the browser and\n // read there, and never written — so a pending approval never expired.\n //\n // Computed ONCE, above, and shared with the announcement below: two `Date.now()` calls would\n // let the row and the message a client is shown disagree about when the pause lapses.\n expiresAt: pausedApprovalExpiresAt,\n ...(requesterThroughRelationshipIds ? { requesterThroughRelationshipIds } : {}),\n ...(pausedStepUp ? { stepUp: pausedStepUp } : {}),\n ...(pausedAnswerChannels ? { answerChannels: [...pausedAnswerChannels] } : {}),\n // #2292 R8: what a resume compares the policy in force then against (an untreated turn records null).\n ...(params.personalData ? params.personalData.pausedPosture() : UNGUARDED_PAUSED_POSTURE),\n });\n\n const pauseRowFilter = {\n executionId,\n ...owner.ownerFields,\n machineCredentialId: machineCredentialIdOf(params.auth),\n resourceServerInstanceRef: agentInstanceOf(params.resourceServerInstanceRef),\n };\n try {\n const paused = await this.writeTurnTranscript(\n owner,\n {\n ...pauseRowFilter,\n // #2721: a decision is raised only by the turn that is running. A row that left PROCESSING meanwhile (stopped,\n // cancelled, or waiting on another decision) is not paused again, so no earlier decision is overwritten unended.\n status: FlowsActors_Status.PROCESSING,\n },\n // Onto the row as it stands (#2743): a sibling turn that ended while this one ran keeps its messages.\n params.transcript,\n {\n status: FlowsActors_Status.AWAITING_APPROVAL,\n pausedApproval,\n // The route, on the row that holds the resume compare-and-swap (#1594 D2).\n pendingDecisionRef: decisionRef,\n // #2821: the work this decision belongs to — this decision itself for a fresh turn's pause, the work's first\n // decision when the turn continuing an answered decision pauses again.\n pendingDecisionWorkRef: params.continuesWorkRef ?? decisionRef,\n pendingDecisionRouteKind: route.kind,\n pendingDecisionEligibleRole: route.eligibleRole ?? null,\n pendingDecisionOrganizationId: route.organizationId ?? null,\n pendingDecisionOrganizationUnitId: route.organizationUnitId ?? null,\n pendingDecisionRequiredQualificationKinds: route.requiredQualificationKinds?.length ? [...route.requiredQualificationKinds] : null,\n pendingDecisionAssigneeUserId: route.assigneeUserId ?? null,\n pendingDecisionClaimedAt: null,\n pendingDecisionRequesterKind: requester.kind,\n pendingDecisionRequesterRef: requester.ref,\n pendingDecisionRequesterClientId: requester.clientId ?? null,\n pendingDecisionRequestedAt: requestedAtDate,\n pendingDecisionExpiresAt: expiresAtDate,\n pendingDecisionRouteVersion: 0,\n // #1628: the CLAIM and DECISION clocks, with every stage's due instant and no marker fired.\n ...armedDeadlineColumns(armed),\n ...(params.initiationKind ? { initiationKind: params.initiationKind } : {}),\n },\n params.personalData,\n );\n if (!paused) {\n this.logger.error('[ConversationalExecution] Approval-pause write matched no running row; no decision is raised', {\n systemRef, executionId, approvalId: suspension.approvalId,\n consequence: 'the turn left PROCESSING before it could pause (stopped, cancelled, or already waiting), so nothing is pending',\n });\n // The turn still ends where its client can see it (#2721 review N-3): this gated call is not pending anywhere.\n // If the row waits for another turn's decision, that is what the thread holds; otherwise the call is lost, and\n // when the person had stopped the turn meanwhile that is what they are told: they asked for it to stop, and it\n // did (#2721 re-review I-2). Nothing is written either way: the row is no longer this turn's.\n const waitingFor = await this.waitingDecisionOf(owner, pauseRowFilter);\n const stopped = params.turnAbortSignal?.aborted === true;\n this.reportTurnEnd(emitter, systemRef, executionId,\n waitingFor !== undefined ? { kind: TurnEndRecordKind.DECISION_WAITING, decisionRef: waitingFor } : TURN_END_RECORDED,\n () => (stopped\n ? this.emitTurnCancelled(emitter, systemRef, executionId, params.turnStartedAt)\n : this.emitError(emitter, systemRef, executionId, TURN_ENDED_WITHOUT_PAUSE_CODE, 'The conversation moved on before the assistant could ask for approval, so nothing was run.')));\n return PauseAttemptOutcome.ENDED_WITHOUT_PAUSE;\n }\n } catch (error) {\n /*\n * The write may have LANDED before its error reached here (a timeout after the store committed), as the answer path\n * also allows for. Read the row back (#2721 re-review I-2): waiting for THIS decision means the pause stands, and the\n * turn goes on to record and announce it rather than telling the tab it failed while an inbox shows the decision.\n *\n * #2749: a read-back that FAILS is not an answer. It used to be read as \"not waiting\", so a pause that committed and\n * then threw, with its read-back failing too, ended the turn (the guarded end missing the AWAITING row) and reported\n * AGENT_FAILED, while the decision sat in an inbox with no `HUMAN_DECISION_REQUESTED` row and nobody told of it. The\n * read is retried (`readThrownPauseWrite`) and its three answers are kept apart:\n * - LANDED: the pause stands; the request is recorded and announced below, once.\n * - NOT_LANDED: the row was read and holds no such decision; the turn ends as before. Its end may still find THIS\n * decision waiting (the pause committed after the read-back), and then it stands after all.\n * - UNKNOWN: nobody can say whether it was raised. The turn records and announces nothing, and is not told it\n * failed: the decision may be in an inbox, answerable. The request facts are the repair's\n * (`repairUnrecordedDecisionRequests`), which records and announces it once the row can be read, if it waits.\n *\n * Rejected (#2749): recording the request row BEFORE the pause write, keyed by the decision, and marking it withdrawn\n * when the write is known not to have landed. The trail would then say an agent asked for a decision that never\n * existed, a WITHDRAWN resolution would describe a decision taken away from people it never reached, and with every\n * read failing the turn could never decide which to write. The repair derives the row from the one place that says\n * whether the decision exists: the row it waits on.\n */\n const outcome = await this.readThrownPauseWrite(owner, pauseRowFilter, decisionRef);\n if (outcome === DecisionRequestWriteOutcome.UNKNOWN) {\n this.logger.error('[ConversationalExecution] An approval-pause write threw and the row could not be read back; whether the decision was raised is unknown', {\n systemRef, executionId, decisionRef, approvalId: suspension.approvalId, ...projectCaughtErrorLogFields(error),\n consequence: 'nothing is recorded or announced now; if the decision waits, the repair records and announces it once the row can be read, '\n + 'and if it does not, the interrupted-turn sweep fails the turn',\n });\n /*\n * Told the decision may wait (DECISION_PENDING, recoverable, naming it), never that the turn failed. The two errors\n * are not symmetric: a requester told \"pending\" for a pause that did not land waits until the thread's history\n * shows the turn failed (the interrupted-turn sweep writes it); a requester told \"failed\" for a pause that DID land\n * asks again while an approver can still approve the first call, which then runs. A tab reloads its history over\n * this error and shows the decision if it waits; an A2A caller is answered -32015. A dedicated \"unconfirmed\" code\n * was rejected: a new member of the client vocabulary on every surface (the thread's wording, the chat door's\n * treatment, the A2A mapping, the history merge) for a state that needs two independent store faults.\n */\n this.emitDecisionPending(emitter, systemRef, executionId, decisionRef);\n return PauseAttemptOutcome.UNCONFIRMED;\n }\n if (outcome === DecisionRequestWriteOutcome.NOT_LANDED) {\n this.logger.error('[ConversationalExecution] Failed to persist an approval pause; ending the turn', {\n systemRef, executionId, approvalId: suspension.approvalId, ...projectCaughtErrorLogFields(error),\n });\n // Recorded, not left PROCESSING for the interrupted-turn sweep: the end write keeps its own guard, so a row another\n // turn's decision holds is not written and that decision is what the client is told.\n const ended = await this.endTurnWithoutPause(params, 'The assistant\\'s request for approval could not be recorded, so nothing was run.', {\n ownDecisionRef: decisionRef,\n });\n if (!(ended.kind === TurnEndRecordKind.DECISION_WAITING && ended.decisionRef === decisionRef)) return PauseAttemptOutcome.ENDED_WITHOUT_PAUSE;\n this.logger.warn('[ConversationalExecution] An approval pause read back as not landed was found waiting by the end write; the decision stands', {\n systemRef, executionId, decisionRef,\n });\n } else {\n this.logger.warn('[ConversationalExecution] The approval-pause write reported an error but the pause is on the row; the decision stands', {\n systemRef, executionId, decisionRef, ...projectCaughtErrorLogFields(error),\n });\n }\n }\n\n // Recorded once the pause EXISTS, under the requester's own principal, inside the frame of the agent\n // whose gate raised it — so the trail reads \"this agent, working for this person, asked\".\n if (this.auditLogs) {\n const agentFrame = { agentRef: agentRef ?? systemRef, agentExecutionId: executionId, systemRef, toolName: suspension.toolName, decisionRef };\n const requestContext = params.auth\n ? runWithAgentActorFrame(agentFrame, () => this.auditContextFor(params.auth as SocketAuthResult, owner))\n : undefined;\n // Inside the agent's frame as well (#2749 review F6): a pause with no auth to build a context from (a resumed turn\n // pausing again) still names the agent that asked, as the repair's row does; with a context, the context's agent wins.\n void runWithAgentActorFrame(agentFrame, () => this.recordDecisionRequested({\n decisionRef, executionId, systemRef, toolName: suspension.toolName, route, requester,\n ...(agentRef ? { agentRef } : {}),\n expiresAt: pausedApprovalExpiresAt,\n claimDeadlineAt: armed.claimDeadlineAt.toISOString(),\n claimClockBasis: armed.claimBasis,\n decisionDeadlineAt: armed.decisionDeadlineAt.toISOString(),\n decisionClockBasis: armed.decisionBasis,\n }, requestContext)).catch((error: unknown) => {\n // The repair records it (`repairUnrecordedDecisionRequests`). The announcement below still goes out now, so when\n // the repair later records this request it announces it a second time: an announcement carries only the\n // decision's id and makes an inbox re-read, and a request the trail is missing is the worse loss.\n this.logger.warn('[ConversationalExecution] Could not record a raised decision on the audit trail; the pause stands and the repair records it', {\n systemRef, executionId, decisionRef, ...projectCaughtErrorLogFields(error),\n });\n });\n }\n\n // Only announce a pause that was actually RECORDED. Emitting first would invite a client to\n // answer a decision no row can accept.\n /*\n * Built through the NAMED schema rather than as an anonymous `data` bag. The bag is\n * `Record<string, unknown>` on the wire, so nothing typed this announcement and the browser\n * ended up listening on `flows-actors:approval-request` — an event no code ever emitted, removed\n * with #2524 — which meant no shipped screen could observe a paused turn at all (#528). Typing the\n * producer is what lets the consumer parse it instead of guessing at keys.\n *\n * `expiresAt` travels here and nowhere else: since #465 the suspension genuinely carries an\n * expiry, and this block is the only path by which a client can learn it.\n */\n // #2904: the call's file deliverable, bound by its hash as every card of this decision binds it.\n // #2914: and the record it acts on, with the fields its approval covers.\n const { deliverables, subjectRecord } = await this.decisionPresentationBindingsOf(systemRef, {\n decisionRef, toolName: suspension.toolName, toolArgs: suspension.toolArgs as Record<string, unknown> | undefined,\n ...(route.organizationId ? { organizationId: route.organizationId } : {}),\n });\n const announcement = this.buildApprovalAnnouncement(systemRef, {\n approvalId: suspension.approvalId,\n decisionRef,\n routeKind: route.kind,\n toolName: suspension.toolName,\n toolArgs: suspension.toolArgs,\n requestedAt,\n expiresAt: pausedApprovalExpiresAt,\n ...(questionForm ? { questionForm } : {}),\n ...(deliverables ? { deliverables } : {}),\n ...(subjectRecord ? { subjectRecord } : {}),\n });\n\n emitter(CoreWebSocketEvent.FLOWS_ACTORS_MESSAGE, {\n systemRef,\n executionId,\n messageType: FlowsActors_MessageContentType.PROGRESS,\n // The tool's NAME, as every PROGRESS message carries its call (`conversational-turn-trace`), and never a sentence:\n // the pause is the typed announcement in `data`, which a page words in its reader's language (#3201). The English\n // `Waiting for approval to run \"<tool>\".` this carried was rendered as written, naming the identifier.\n content: suspension.toolName,\n data: announcement,\n timestamp: new Date(),\n });\n // The requester too: an OWNER route is held by the person who raised it, whose inbox holds it since #2527.\n this.announceDecisionRouted(route, decisionRef, undefined, requester);\n return PauseAttemptOutcome.RAISED;\n }\n\n /**\n * The application's business calendar (#1628), or `undefined` when it declares none or the configuration\n * is not loaded in this process.\n */\n private reviewCalendar(): ReviewCalendar | undefined {\n try {\n return this.appConfig?.isInitialized() ? this.appConfig.config.reviewCalendar : undefined;\n } catch {\n return undefined;\n }\n }\n\n /** The gate's deadline declaration with every default applied; the defaults when the gate declares none. */\n private deadlinePolicyOf(gate: FunctionTool_HumanApprovalGate | undefined): ReviewDeadlinePolicy {\n const deadlines = gate?.deadlines;\n return resolveReviewDeadlinePolicy(deadlines ? { ...deadlines, rules: deadlines.rules?.map(({ stage, action }) => ({ stage, action })) } : undefined);\n }\n\n /**\n * Arm a decision's clocks at the moment it pauses (#1628).\n *\n * A CALENDAR clock needs the application's calendar, and startup refuses a gate asking for one in an\n * application that declares none (I6). Reaching the catch below therefore means the calendar could not\n * be read in THIS process at all; the clocks are then armed on elapsed time and the fact is logged as an\n * error, because stranding a person's turn on a missing reminder would be the worse failure.\n */\n private armDecisionDeadlines(requestedAt: Date, gate: FunctionTool_HumanApprovalGate | undefined, toolName: string): ArmedReviewDeadlines {\n const policy = this.deadlinePolicyOf(gate);\n try {\n return armReviewDeadlines({ requestedAt, policy, calendar: this.reviewCalendar() });\n } catch (error) {\n this.logger.error('[ConversationalExecution] A decision\\'s CALENDAR clock could not be armed; counting it in elapsed time', {\n toolName, ...projectCaughtErrorLogFields(error),\n });\n const elapsed = (target: ReviewDeadlinePolicy['claim']) => ({ ...target, basis: ReviewClockBasis.ELAPSED });\n return armReviewDeadlines({ requestedAt, policy: { ...policy, claim: elapsed(policy.claim), decision: elapsed(policy.decision) }, calendar: undefined });\n }\n }\n\n /**\n * WHO may answer a decision the turn is about to raise, and on whose authority (#1594 D3).\n *\n * - The GATE comes from the tool's declaration (`resolveFunctionToolApprovalGate`); an OWNER route when\n * the tool cannot be resolved, because the requester alone answering is the narrowest route.\n * - The REQUESTER is the turn's own verified principal on a first pause, and the original requester,\n * carried from the row, on a second one.\n * - The ORGANIZATION is the owner row's when the conversation is org-owned, else the requester's\n * active organization. A route that needs one and has none is refused.\n * - The UNIT is stamped only when the requester's authority in that organization is confined to\n * exactly one unit; otherwise only org-wide holders match, the stricter reading.\n */\n private async routePendingDecision(params: {\n systemRef: string;\n executionId: string;\n owner: ResolvedOwnerVariant;\n auth: SocketAuthResult | undefined;\n toolName: string;\n toolArgs?: Record<string, unknown>;\n requester?: HumanDecision_Requester;\n }): Promise<\n | { readonly kind: HumanDecision_VerdictKind.ALLOWED; readonly route: HumanDecision_Route; readonly requester: HumanDecision_Requester; readonly agentRef?: string; readonly gate?: FunctionTool_HumanApprovalGate }\n | { readonly kind: HumanDecision_VerdictKind.REFUSED; readonly reason: HumanDecision_RefusalReason }\n > {\n const requester = params.requester ?? humanDecisionRequesterOfAuth(params.auth);\n if (!requester) return { kind: HumanDecision_VerdictKind.REFUSED, reason: HumanDecision_RefusalReason.NOBODY_CAN_ANSWER };\n\n // A registry that cannot resolve the tool is the \"cannot be resolved\" case, never a lost pause: the turn\n // still pauses, on the OWNER route, the narrowest one.\n let resolved: GatedFunctionToolResolution;\n try {\n resolved = this.resolveApprovalGatedFunctionTool(params.systemRef, params.toolName);\n } catch (error) {\n this.logger.warn('[ConversationalExecution] The gated tool could not be resolved for routing; the requester answers', {\n systemRef: params.systemRef, toolName: params.toolName, ...projectCaughtErrorLogFields(error),\n });\n resolved = { kind: GatedFunctionToolResolutionKind.AGENT_MISSING };\n }\n const functionTool = resolved.kind === GatedFunctionToolResolutionKind.FOUND ? resolved.functionTool : undefined;\n const agentRef = resolved.kind === GatedFunctionToolResolutionKind.FOUND ? resolved.agentRef : undefined;\n const gate = (functionTool ? resolveFunctionToolApprovalGate(functionTool) : undefined) ?? { route: HumanDecision_RouteKind.OWNER };\n // #2734: what the decision about to be raised will expose; its answerers are vetted against it.\n const raisedSubject = humanDecisionSubjectOfToolCall(functionTool, params.toolArgs);\n\n const organizationId = params.owner.ownerFields.organizationId ?? params.auth?.initiatorIds?.organizationId;\n const unitEntries = (params.auth?.initiatorRoles ?? []).filter((entry) =>\n entry.relatedPrimaryScope === ResourcePrimaryScope.ORGANIZATIONS && entry.relatedResourceId === organizationId);\n const confinedUnitIds = [...new Set(unitEntries.map((entry) => entry.organizationUnitId))];\n const organizationUnitId = confinedUnitIds.length === 1 && confinedUnitIds[0] ? confinedUnitIds[0] : undefined;\n\n if (gate.route === HumanDecision_RouteKind.OWNER) {\n // A machine answers nothing: an OWNER decision it raised could never be settled.\n if (requester.kind === HumanDecision_RequesterKind.MACHINE) return { kind: HumanDecision_VerdictKind.REFUSED, reason: HumanDecision_RefusalReason.NOBODY_CAN_ANSWER };\n return { kind: HumanDecision_VerdictKind.ALLOWED, requester, agentRef, gate, route: { kind: HumanDecision_RouteKind.OWNER, ...(organizationId ? { organizationId } : {}) } };\n }\n if (!organizationId) return { kind: HumanDecision_VerdictKind.REFUSED, reason: HumanDecision_RefusalReason.ROUTE_HAS_NO_ORGANIZATION };\n\n const base: HumanDecision_Route = {\n kind: gate.route,\n eligibleRole: gate.eligibleRole,\n organizationId,\n ...(organizationUnitId ? { organizationUnitId } : {}),\n // #2967: the qualifications every answerer must also hold, the same floor for a later claim, move or escalation.\n ...(gate.requiredQualificationKinds?.length ? { requiredQualificationKinds: [...gate.requiredQualificationKinds] } : {}),\n };\n if (gate.route === HumanDecision_RouteKind.ROLE) {\n // #1611 (d): a MACHINE requester has nobody to fall back on — no owner, no one watching the turn — so a\n // ROLE nobody in the organization can answer under is refused NOW rather than left to lapse a day later\n // while SKIP_IF_ACTIVE turns away every run in between. A person's request keeps #1594's behaviour.\n if (requester.kind === HumanDecision_RequesterKind.MACHINE && !(await this.roleRouteHasAnAnswerer(base, requester, raisedSubject))) {\n return { kind: HumanDecision_VerdictKind.REFUSED, reason: HumanDecision_RefusalReason.NOBODY_CAN_ANSWER };\n }\n return { kind: HumanDecision_VerdictKind.ALLOWED, requester, agentRef, gate, route: base };\n }\n\n // ASSIGNEE: the declared resolver names one person, who is vetted exactly as any later assignee is (I8).\n const toolContext = params.auth ? this.buildToolExecutionContext(params.auth, params.executionId, params.systemRef) : undefined;\n const assigneeUserId = toolContext && gate.assignee\n ? await gate.assignee(params.toolArgs ?? {}, toolContext).catch((error: unknown) => {\n this.logger.warn('[ConversationalExecution] A gate\\'s assignee resolver failed; refusing the pause', {\n toolName: params.toolName, ...projectCaughtErrorLogFields(error),\n });\n return undefined;\n })\n : undefined;\n if (!assigneeUserId) return { kind: HumanDecision_VerdictKind.REFUSED, reason: HumanDecision_RefusalReason.NOBODY_CAN_ANSWER };\n const route: HumanDecision_Route = { ...base, assigneeUserId };\n const vetted = await this.authorizeDecisionAct({ userId: assigneeUserId, route, requester, act: HumanDecision_Act.ANSWER, subject: raisedSubject });\n if (vetted.kind === HumanDecision_VerdictKind.REFUSED) return { kind: HumanDecision_VerdictKind.REFUSED, reason: vetted.reason };\n return { kind: HumanDecision_VerdictKind.ALLOWED, requester, agentRef, gate, route };\n }\n\n /**\n * Ask the ONE predicate whether this person may act on this decision, with their role facts resolved\n * NOW in the decision's organization. `userId` is a person: a reassignment target or claimant is\n * vetted the same way as someone answering.\n */\n private async authorizeDecisionAct(params: {\n userId: string | undefined;\n /** The acting principal's kind. A move TARGET is always a person, so it defaults to a signed-in user. */\n executionType?: ExecutionContext_ExecutionType;\n route: HumanDecision_Route;\n requester: HumanDecision_Requester;\n act: HumanDecision_Act;\n /** What the decision's card exposes (#2734): `decisionSubjectOfRow` for a waiting decision, the gated call at raise. */\n subject: HumanDecisionSubject;\n }) {\n const roleFacts = params.userId && isReviewerRoute(params.route)\n ? await resolveHumanDecisionRoleFacts(this.humanDecisionRoleFactsPorts(), {\n userId: params.userId, route: params.route, requester: params.requester, subject: params.subject,\n })\n : NO_HUMAN_DECISION_ROLE_FACTS;\n return authorizeHumanDecisionActor({\n actor: { executionType: params.executionType ?? ExecutionContext_ExecutionType.USER_REQUEST, userId: params.userId },\n roleFacts, route: params.route, requester: params.requester, act: params.act,\n });\n }\n\n /** #2797: the act's person held to the decision organization's granting policy, with what the door can prove. */\n private holdToGrantingOrganization(input: Parameters<typeof holdHumanDecisionActorToGrantingOrganization>[1]) {\n return holdHumanDecisionActorToGrantingOrganization({ executionContextCreator: this.executionContextCreator, logger: this.logger }, input);\n }\n\n /** How role facts are resolved against the running application: current roles, the role table, the unit tree. */\n private humanDecisionRoleFactsPorts(): HumanDecisionRoleFactsPorts {\n return createHumanDecisionRoleFactsPorts({\n executionContextCreator: this.executionContextCreator,\n roleHierarchy: (roleKey, scope) => this.authorizer.getRoleHierarchy(roleKey as Roles, scope),\n systemAccess: this.systemAccess,\n resourcesRegistry: this.resourcesRegistry,\n repositoriesRegistry: this.repositoriesRegistry,\n });\n }\n\n /**\n * What a waiting row's decision card exposes (#2734): the record its gated call addresses, when the tool declares the\n * row it acts on. Derived from the paused call and the live tool declaration each time it is asked; a pause that cannot\n * be read, or a tool that can no longer be resolved, names no record, which hides the card from a representative\n * unless the requester acts through the same relationship.\n */\n private decisionSubjectOfRow(row: Pick<FlowActorExecution, 'systemRef' | 'pausedApproval'>): HumanDecisionSubject {\n if (!row.pausedApproval) return HUMAN_DECISION_NAMES_NO_RECORD;\n try {\n const paused = parseFlowActorPausedApproval(row.pausedApproval);\n return this.decisionSubjectOfCall(row.systemRef, paused.pendingToolName, paused.pendingToolArgs as Record<string, unknown> | undefined);\n } catch {\n return HUMAN_DECISION_NAMES_NO_RECORD;\n }\n }\n\n /**\n * The arguments naming another record that an approval's edit changed (#2734), read against the gated tool's\n * declarations: its argument schema and every schema of the resource its arguments describe (main and inheritance\n * variants, as the evaluation export reads them). `changedArgumentKeys` is the modification's own list of changed\n * argument names. `undefined` when the edit cannot be judged (the tool or its resource can no longer be read), which the\n * edit check treats as an edit it may not admit from someone answering only through a relationship.\n */\n private foreignKeyArgumentsEditedIn(systemRef: string, toolName: string, changedArgumentKeys: readonly string[]): string[] | undefined {\n try {\n const resolved = this.resolveApprovalGatedFunctionTool(systemRef, toolName);\n if (resolved.kind !== GatedFunctionToolResolutionKind.FOUND) return undefined;\n const resourceType = resolved.functionTool.argumentsResource?.resourceType;\n const configuration = resourceType ? this.resourcesRegistry.tryGetResourceConfiguration(resourceType) : undefined;\n const resourceSchemas = configuration?.mainSchema\n ? [configuration.mainSchema, ...resourceInheritanceVariantSchemas(configuration.inheritenceSchemaDefinition as never)]\n : undefined;\n return humanDecisionForeignKeyArgumentsEdited({ tool: resolved.functionTool, resourceSchemas, changedArgumentKeys });\n } catch {\n return undefined;\n }\n }\n\n /** Whether a gated tool declares that its approval of a row replaces its earlier approval of that row (#2914). */\n private approvalReplacesEarlierApprovalOfRow(systemRef: string, toolName: string): boolean {\n try {\n const resolved = this.resolveApprovalGatedFunctionTool(systemRef, toolName);\n return resolved.kind === GatedFunctionToolResolutionKind.FOUND && resolved.functionTool.approvalReplacesEarlierApprovalOfRow === true;\n } catch {\n return false;\n }\n }\n\n /** The argument a gated tool declares names its file deliverable (#2904), when it declares one. */\n private deliverableFileArgumentOf(systemRef: string, toolName: string): string | undefined {\n try {\n const resolved = this.resolveApprovalGatedFunctionTool(systemRef, toolName);\n return resolved.kind === GatedFunctionToolResolutionKind.FOUND ? resolved.functionTool.deliverableFileArgument : undefined;\n } catch {\n return undefined;\n }\n }\n\n /**\n * What a gated call's presentation binds beyond its arguments: its file deliverable, bound by its content hash (#2904),\n * and the record it acts on with the fields its approval covers (#2914). The ONE resolution the announcement, the\n * history, the inbox and the act read, so they agree on the presentation and its id. Nothing for a tool that declares\n * neither.\n */\n private async decisionPresentationBindingsOf(systemRef: string, call: {\n readonly decisionRef: string;\n readonly toolName: string;\n readonly toolArgs: Readonly<Record<string, unknown>> | undefined;\n readonly organizationId?: string;\n }): Promise<DecisionPresentationBindings> {\n const [deliverables, subjectRecord] = await Promise.all([this.decisionDeliverablesOf(systemRef, call), this.decisionSubjectRecordOf(systemRef, call)]);\n return { ...deliverables, ...(subjectRecord ? { subjectRecord } : {}) };\n }\n\n /**\n * The record a gated call acts on, with the fields its tool declares the approval covers (#2914,\n * `FunctionTool.sealedRecordFields`), read as the system. Undefined for a tool that declares none.\n */\n private async decisionSubjectRecordOf(systemRef: string, call: {\n readonly decisionRef: string;\n readonly toolName: string;\n readonly toolArgs: Readonly<Record<string, unknown>> | undefined;\n readonly organizationId?: string;\n }): Promise<HumanDecision_PresentedRecord | undefined> {\n let tool: FunctionTool | undefined;\n try {\n const resolved = this.resolveApprovalGatedFunctionTool(systemRef, call.toolName);\n tool = resolved.kind === GatedFunctionToolResolutionKind.FOUND ? resolved.functionTool : undefined;\n } catch {\n return undefined;\n }\n if (!tool?.sealedRecordFields) return undefined;\n return resolveDecisionSubjectRecord({\n sealedFields: tool.sealedRecordFields,\n resourceType: tool.argumentsResource?.resourceType,\n rowIdArgument: tool.argumentsResource?.rowIdArgument,\n toolArgs: call.toolArgs,\n ...(call.organizationId ? { organizationId: call.organizationId } : {}),\n readRow: (resourceType, rowId) => this.systemAccess.readAsSystem<Record<string, unknown>>(resourceType as never, { _id: rowId }, { suppressSystemAudit: true }),\n onReadFailure: (error) => this.logger.warn('[ConversationalExecution] The record a decision is about could not be read; it is shown and sealed with no record values', {\n systemRef, decisionRef: call.decisionRef, toolName: call.toolName, ...projectCaughtErrorLogFields(error),\n }),\n });\n }\n\n /**\n * A gated call's file deliverable, bound by its content hash (#2904). Nothing for a tool that declares none. Read through\n * {@link decisionPresentationBindingsOf}, never alone.\n */\n private async decisionDeliverablesOf(systemRef: string, call: {\n readonly decisionRef: string;\n readonly toolName: string;\n readonly toolArgs: Readonly<Record<string, unknown>> | undefined;\n readonly organizationId?: string;\n }): Promise<ResolvedDecisionDeliverables> {\n const deliverableArgument = this.deliverableFileArgumentOf(systemRef, call.toolName);\n if (!deliverableArgument) return {};\n return resolveDecisionDeliverables({\n decisionRef: call.decisionRef,\n deliverableArgument,\n toolArgs: call.toolArgs,\n ...(call.organizationId ? { organizationId: call.organizationId } : {}),\n files: this.decisionDeliverableFiles(),\n key: decisionPresentationKeyOfRuntime(this.appConfig),\n onReadFailure: (error) => this.logger.warn('[ConversationalExecution] A decision\\'s file deliverable could not be read; it is shown and sealed as not bound', {\n systemRef, decisionRef: call.decisionRef, toolName: call.toolName, ...projectCaughtErrorLogFields(error),\n }),\n });\n }\n\n /** The file reads a deliverable is bound through, as the system (#2904); undefined when no file service is bound. */\n private decisionDeliverableFiles(): DecisionDeliverableFiles | undefined {\n const files = this.files;\n if (!files) return undefined;\n const context = () => this.executionContextCreator.createForInternalSystemOperation();\n return {\n readFile: async (fileId) => files.getFile(fileId, await context()),\n ensureContentHash: async (fileId) => files.ensureContentHash(fileId, await context()),\n };\n }\n\n /** The argument a gated tool declares as the row it acts on (#2734), when it declares one. */\n private decisionRowIdArgumentOf(systemRef: string, toolName: string): string | undefined {\n try {\n const resolved = this.resolveApprovalGatedFunctionTool(systemRef, toolName);\n return resolved.kind === GatedFunctionToolResolutionKind.FOUND ? resolved.functionTool.argumentsResource?.rowIdArgument : undefined;\n } catch {\n return undefined;\n }\n }\n\n /** What a gated call exposes (#2734): the record its tool declares it acts on, read from `toolArgs`. */\n private decisionSubjectOfCall(systemRef: string, toolName: string, toolArgs: Record<string, unknown> | undefined): HumanDecisionSubject {\n try {\n const resolved = this.resolveApprovalGatedFunctionTool(systemRef, toolName);\n return resolved.kind === GatedFunctionToolResolutionKind.FOUND ? humanDecisionSubjectOfToolCall(resolved.functionTool, toolArgs) : HUMAN_DECISION_NAMES_NO_RECORD;\n } catch {\n return HUMAN_DECISION_NAMES_NO_RECORD;\n }\n }\n\n /**\n * A bare execution context for an audit row written on behalf of a verified principal, with no route to\n * hang it on. Adopts the ambient agent frame, so a caller that opened one gets the agent on the row.\n */\n private auditContextFor(auth: SocketAuthResult, owner: ResolvedOwnerVariant) {\n const operation = this.resourcesRegistry.getResourceConfiguration(owner.resourceType)?.operations.find(\n (candidate: ResourceConfiguration_Operation<any, any, any>) => candidate.operationIdentifier === CoreResourceOperation.UPDATE && candidate.isOperationDefault === true,\n ) as ResourceConfiguration_Operation<any, any, any>;\n return createBareExecutionContextFromVerifiedAuth(operation, auth);\n }\n\n /**\n * The announcement of one pending approval — the ONE derivation both the live pause and the\n * conversation history use (#1601), so a page that loads a paused thread is shown exactly what a page\n * that watched it pause was shown.\n *\n * Typed state only, never a sentence (#3201): what a page SAYS about the pause is worded from this — the presentation's\n * title, the tool's title in `flows_actors_tools` — in the reader's language. The English sentence that accompanied it\n * was rendered as written, naming the tool by its identifier.\n */\n private buildApprovalAnnouncement(systemRef: string, pause: {\n readonly approvalId: string;\n readonly decisionRef?: string;\n readonly routeKind?: HumanDecision_RouteKind;\n readonly toolName: string;\n readonly toolArgs?: Record<string, unknown>;\n readonly requestedAt: string;\n readonly expiresAt?: string;\n /** #2720: the form a question is asked through, when one was composed. */\n readonly questionForm?: HumanInputForm;\n /** #2904: the call's file deliverable, resolved by the caller (`decisionDeliverablesOf`), which the presentation binds. */\n readonly deliverables?: ResolvedDecisionDeliverables['deliverables'];\n /** #2914: the record the call acts on, with the fields its approval covers, resolved by the caller. */\n readonly subjectRecord?: HumanDecision_PresentedRecord;\n }): WS_FlowsActorsApprovalAnnouncementData {\n const toolInputSchema = this.describeGatedToolInputSchema(systemRef, pause.toolName);\n // #2720: an agent's question is shown as the question, rebuilt from the call by the one function every reader uses.\n const question = pause.decisionRef ? this.pausedQuestionOf(systemRef, {\n decisionRef: pause.decisionRef, toolName: pause.toolName, toolArgs: pause.toolArgs, questionForm: pause.questionForm,\n requestedAt: pause.requestedAt, ...(pause.expiresAt ? { expiresAt: pause.expiresAt } : {}),\n }) : undefined;\n const reasonCodes = this.agentWorkDecisions?.declaredReasonCodes() ?? [];\n const riskLevel = this.gatedCallRiskLevel(systemRef, pause.toolName);\n return {\n approvalRequested: true,\n approvalId: pause.approvalId,\n ...(pause.decisionRef ? { decisionRef: pause.decisionRef } : {}),\n ...(pause.routeKind ? { routeKind: pause.routeKind } : {}),\n toolName: pause.toolName,\n toolArgs: pause.toolArgs,\n // The tool's own fields, so an approver who edits the call is not handed a JSON blob (#587).\n // Omitted — never guessed — when the paused tool cannot be resolved.\n ...(toolInputSchema ? { toolInputSchema } : {}),\n requestedAt: pause.requestedAt,\n ...(pause.expiresAt ? { expiresAt: pause.expiresAt } : {}),\n // #1921: the vocabulary the approver may give a reason from when changing or rejecting the call — the same\n // list the answer door checks, so an offered code is never refused. Omitted when nothing is declared.\n ...(reasonCodes.length > 0 ? { reasonCodes: [...reasonCodes] } : {}),\n // #2526: the risk the call's GATE declares, as the decision's inbox card carries it. Omitted, never guessed, when none.\n ...(riskLevel ? { riskLevel } : {}),\n ...(question ? { question } : {}),\n // #2903: what the page shows, built as the inbox card builds it, and the id its answer echoes.\n ...(pause.decisionRef ? (() => {\n const presented = withDecisionPresentation({\n decisionRef: pause.decisionRef, plane: HumanDecision_Plane.CONVERSATIONAL, toolName: pause.toolName,\n toolArgs: pause.toolArgs ?? {}, ...(question ? { request: question } : {}),\n }, decisionPresentationKeyOfRuntime(this.appConfig), pause.deliverables, pause.subjectRecord);\n return { presentation: presented.presentation, presentationId: presented.presentationId };\n })() : {}),\n };\n }\n\n /**\n * The approval a stored turn is waiting on, for a page that was not watching when it paused (#1601).\n *\n * The pause is announced once, over the socket that started the turn. A page loaded afterwards —\n * a reload, a second tab, a companion restart — had no way to learn it: the thread showed the\n * person's message and nothing else, while the engine held a decision it was waiting for. Measured\n * 2026-09-25 on the creation workbench: a thread `awaiting_approval` with a proposed build task,\n * rendered as an unanswered message.\n *\n * Reads the backend-only pause AS SYSTEM because a LIST projects it out; the CALLER must already\n * have established that the execution is the principal's own (the history route lists through the\n * owner-filtered variant before asking). Exposes the announcement only, never the stored model\n * messages. `undefined` for a row that is not paused or whose pause cannot be read.\n */\n public async describePendingApproval(\n resourceType: CoreResourceType,\n execution: { readonly executionId: string; readonly systemRef: string; readonly resourceServerInstanceRef?: string },\n ): Promise<WS_FlowsActorsApprovalAnnouncementData | undefined> {\n try {\n const row = await this.systemAccess.readAsSystem<FlowActorExecution>(\n resourceType, { executionId: execution.executionId }, { suppressSystemAudit: true },\n );\n if (!row || row.status !== FlowsActors_Status.AWAITING_APPROVAL || !row.pausedApproval) return undefined;\n const paused = parseFlowActorPausedApproval(row.pausedApproval);\n const { deliverables, subjectRecord } = row.pendingDecisionRef ? await this.decisionPresentationBindingsOf(execution.systemRef, {\n decisionRef: row.pendingDecisionRef, toolName: paused.pendingToolName, toolArgs: paused.pendingToolArgs as Record<string, unknown> | undefined,\n ...(row.pendingDecisionOrganizationId ? { organizationId: row.pendingDecisionOrganizationId } : {}),\n }) : {};\n return this.buildApprovalAnnouncement(execution.systemRef, {\n approvalId: paused.approvalId,\n ...(row.pendingDecisionRef ? { decisionRef: row.pendingDecisionRef } : {}),\n ...(row.pendingDecisionRouteKind ? { routeKind: row.pendingDecisionRouteKind } : {}),\n toolName: paused.pendingToolName,\n toolArgs: paused.pendingToolArgs as Record<string, unknown> | undefined,\n requestedAt: paused.requestedAt,\n ...(paused.expiresAt ? { expiresAt: paused.expiresAt } : {}),\n ...(paused.questionForm ? { questionForm: paused.questionForm } : {}),\n ...(deliverables ? { deliverables } : {}),\n ...(subjectRecord ? { subjectRecord } : {}),\n });\n } catch (error) {\n this.logger.warn('[ConversationalExecution] A paused turn\\'s approval could not be described for history', {\n resourceType, executionId: execution.executionId, ...projectCaughtErrorLogFields(error),\n });\n return undefined;\n }\n }\n\n /**\n * Record a human's approval decision and RESUME the suspended turn.\n *\n * ## The three things this must get right\n *\n * 1. **The decision is scoped like every other read of this family.** The filter carries the owner\n * FK, the machine credential and the agent instance, so one principal cannot answer another's\n * pending approval — a decision is an ACTION on someone else's work, which makes it exactly the\n * kind of thing an isolation axis exists for.\n * 2. **`approvalId` must match.** It is the idempotency key AND the anti-replay check: the model\n * SDK binds it to the specific tool call with an HMAC signature, so answering a stale id must\n * refuse rather than approve whatever happens to be pending now.\n * 3. **A DENIAL resumes too.** Denying is not cancelling: the SDK is told the call was refused and\n * the model gets to respond (\"I can't do that without approval\"). Treating denial as a terminal\n * failure would leave the user with a dead thread instead of an answer.\n */\n /**\n * The tool-execution context a turn's grounding tools run under.\n *\n * Extracted so the RESUME cannot drift from the original turn. It was inlined at the start-turn\n * site only, and the resume passed no context at all — `resolveAgentTools` returns `undefined`\n * without one, so a resumed turn ran with NO TOOLS. The approved call could not be executed, and\n * the unresolved `tool_use` reached the provider as\n * \"tool_use ids were found without tool_result blocks\". The approval succeeded and the work never\n * happened.\n *\n * The auth is the APPROVER's, carried from the socket that answered. That is the point rather than\n * an implementation detail: the gated tool runs with a verified identity, so approving cannot\n * escalate anything the approver could not already do. Ambient authority here would make the\n * approval itself a privilege-escalation primitive.\n */\n private buildToolExecutionContext(\n auth: SocketAuthResult,\n executionId: string,\n systemRef: string,\n decisionRef?: string,\n /**\n * Facts of the TURN, read from its row by the caller (at start, from what it is about to write; at a\n * resume, from what the row holds) — never from the model or a client. They decide whether a gated call\n * may pause and which tools are offered (#1611).\n */\n turn?: { initiationKind?: FlowsActors_InitiationKind | null; autonomousTrigger?: AutonomousTurnTrigger | null },\n ): FunctionToolExecutionContext {\n return {\n auth,\n executionId,\n ...(turn?.initiationKind ? { initiationKind: turn.initiationKind } : {}),\n ...(turn?.autonomousTrigger ? { autonomousTrigger: turn.autonomousTrigger } : {}),\n // The decision a resumed turn runs under, so the approved write's row carries `agentActor.decisionRef` (#1594).\n ...(decisionRef ? { decisionRef } : {}),\n // Named on the agent frame each tool call runs in, so an audit row says which system the agent's\n // execution belonged to (#1595).\n systemRef,\n // The org the tools scope reads to = the CALLER's own org from their verified auth (a user's\n // active org, or an org-machine's org), NOT the conversation owner scope. An app-machine\n // caller has no org → undefined (app-scope reads).\n organizationId: auth.initiatorIds?.organizationId,\n services: {\n resourcesRegistry: this.resourcesRegistry,\n servicesRegistryHandler: this.servicesRegistryHandler,\n executionContextCreator: this.executionContextCreator,\n // A tool dispatches a resource operation while bypassing Express, so the operation's own\n // authored `rateLimit?` — whose other consumers are the HTTP route's per-caller and\n // per-address counts, the MCP tool plane and the chat-command door — has no enforcer on this\n // plane unless one is supplied here.\n rateLimitService: this.rateLimitService,\n // Same reason, for the operation's `roles` ACL: bypassing Express also bypasses the\n // CONTROLLER tier, which is the only place that ACL is read. Supplying the authorizer here\n // is what lets the tool factories apply it themselves.\n authorizer: this.authorizer,\n // #2300: the engine's retrieval tool searches the index as the caller, through this.\n ...(this.ragRetrieval ? { ragRetrieval: this.ragRetrieval } : {}),\n // #3008: a tool call refused by the operation's declared rate limit records its window's first refusal.\n ...(this.auditLogs ? { auditLogs: this.auditLogs } : {}),\n },\n };\n }\n\n /**\n * The ONE write that ends a pending decision without resuming its turn — a lapse (the sweep, or an\n * answer that arrived too late), a withdrawal (the work was cancelled), or a requester whose authority\n * no longer holds. Shared, so the terminal row cannot differ by which path noticed first.\n *\n * A compare-and-swap on `status` AND the exact serialized blob the caller read (and the decision id,\n * when there is one). The store decides, not the caller's snapshot: a decision that landed, or a\n * re-pause that replaced the blob, makes this match nothing, and a turn someone just resumed is never\n * ended. Filtered `updateAsSystem` is atomic on both adapters (Mongo `findOneAndUpdate`; PostgreSQL\n * re-asserts the caller's predicates in the UPDATE's own WHERE).\n *\n * The RESOLUTION is written inside the same write (#1594 I4): a crash after it still leaves who\n * decided what, and only the caller that won may record the RESOLVED event.\n *\n * @returns the row as it stood when this call ended the decision, or `null` when the row had already moved on. Record\n * the RESOLVED event and the agent-work settlement from THIS row, never from the one passed in: when a move landed in\n * between, the decision ended on the route it moved to, and the passed row still describes the route it left (its\n * kind, eligible role, claim and missed deadlines; #2528 review F5).\n */\n private async endPendingDecision(params: {\n resourceType: CoreResourceType;\n executionId: string;\n rawPausedApproval: string;\n decisionRef?: string | null;\n /**\n * What ended it, which decides the status the row ends in and, for a failure, its code (#2827,\n * `DECISION_ENDING_TRANSITION`), except for an `erasure`'s ending, which CANCELS the work whatever its outcome (#2865).\n */\n outcome: DecisionEndingOutcome;\n decidedByUserId?: string;\n toolName?: string;\n scopeContext?: { userId?: string; organizationId?: string; applicationId?: string };\n /**\n * The row as read: its claim/request instants are the decision's `presentedAt` (#1599 I8), its route organization\n * is kept on the marker, and a previous decision it still owes a record for is repaid before this write\n * overwrites the resolution columns that record needs (review F3).\n */\n row: FlowActorExecution;\n /** The instant the decision ends; the agent-work record carries the same one. */\n decidedAt?: Date;\n /**\n * The person who already knows the decision ended, so is not told (#2569): whoever ended it from the app. Defaults\n * to `decidedByUserId`. A caller whose decider acted from OUTSIDE the app (a delegated client cancelling the work)\n * passes `null`, because that person's inbox has not seen it end.\n */\n announceExcept?: string | null;\n /**\n * The row is being TORN DOWN (#2582): deleted by a cascade, or scrubbed and kept retained. The write joins the\n * teardown's transaction, so an answer that lands after the teardown's read makes it miss rather than end the decision\n * twice. No decision record is owed: none is repaid first and no marker is written, because the scope goes with its\n * records and an erasure must not write new data about its subject. The holders are told only once that transaction\n * commits, so a teardown that rolls back announces nothing.\n */\n teardown?: { readonly transaction?: TransactionContext };\n /**\n * The decision is ended because a person's ERASURE leaves nobody it could continue for (#2865). The row STAYS, so,\n * unlike a teardown, the decision record is still owed (its marker is written) and the work's ending is still\n * logged; but the write joins the erasure's transaction, and the holders are told and the work logged only once\n * that transaction commits. A previous decision's owed record is repaid inside that transaction too, without the\n * erased person as its decider (review F1): written outside it, the record would outlive a rolled-back erasure and\n * keep their id after the agent-work severer had already run.\n */\n erasure?: { readonly transaction?: TransactionContext; readonly erasedUserId: string };\n /**\n * The decision is ended because its row is about to be DELETED by an operation that runs in a transaction (#2297):\n * the write, a previous decision's owed record and the agent-work record join it, so a deletion that rolls back ended\n * nothing; the holders are told once it commits. Unlike a teardown the record is still owed (the marker is written\n * and the record written beside it). The work's ending is NOT logged on the row: the row is deleted in the same\n * transaction, so a log entry on it would outlive nothing.\n */\n deletion?: { readonly transaction: TransactionContext };\n }): Promise<FlowActorExecution | null> {\n const now = params.decidedAt ?? new Date();\n // #2865: an erasure's ending CANCELS the work whatever its outcome (see DECISION_ENDED_BY_ERASURE); every other\n // ending ends it as its outcome says.\n const transition = params.erasure ? DECISION_ENDED_BY_ERASURE : DECISION_ENDING_TRANSITION[params.outcome];\n if (params.decisionRef && !params.teardown) {\n await this.repayOwedCorrectionBeforeOverwrite(params.resourceType, params.row, params.decisionRef, params.erasure, params.deletion?.transaction);\n }\n const transaction = params.teardown?.transaction ?? params.erasure?.transaction ?? params.deletion?.transaction;\n const writeOptions = {\n ...(params.scopeContext ? { scopeContext: params.scopeContext } : {}),\n ...(transaction ? { transaction } : {}),\n };\n /*\n * #2569 review A-5: the write also matches the ROUTE VERSION it read, so the holders told below are the ones the\n * decision was actually taken from. A move landing in between changes who holds the decision, not whether it ends:\n * the row is re-read and the decision ended on the route it now has. Bounded, since each extra pass needs another\n * move to land in the window, and the sweep that runs next picks up anything left.\n */\n let row = params.row;\n for (let attempt = 0; attempt < END_PENDING_DECISION_ROUTE_ATTEMPTS; attempt += 1) {\n const ended = await this.systemAccess.updateAsSystem(\n params.resourceType,\n {\n executionId: params.executionId,\n status: FlowsActors_Status.AWAITING_APPROVAL,\n pausedApproval: params.rawPausedApproval,\n ...(params.decisionRef ? { pendingDecisionRef: params.decisionRef, pendingDecisionRouteVersion: row.pendingDecisionRouteVersion ?? 0 } : {}),\n },\n {\n status: transition.status,\n // #2827: the row's history gains the end, with its code for a failure, as every other end's does.\n statusChanges: [...(row.statusChanges ?? []), flowsActorsStatusChange(transition, now)],\n pausedApproval: null,\n finishedAt: now,\n ...PENDING_DECISION_CLEARED,\n ...(params.decisionRef ? {\n lastResolvedDecisionRef: params.decisionRef,\n // #2821: the work this ending ends, carried over from the pause.\n lastResolvedDecisionWorkRef: row.pendingDecisionWorkRef ?? params.decisionRef,\n decidedByUserId: params.decidedByUserId ?? null,\n decidedAt: now,\n decisionOutcome: params.outcome,\n decisionToolName: params.toolName ?? null,\n decisionModifiedArgumentNames: [],\n // #1599 I3: a tool approval is always a proposal, so its ending owes a decision record; the marker is\n // written by the same compare-and-swap, so a crash before the record leaves it for the repair sweep. A\n // teardown owes none (see `teardown`), and neither does an agent's QUESTION, which proposed nothing (#2720).\n ...(params.teardown || this.pausedCallAsksThePerson(row.systemRef, params.toolName ?? '') ? {} : correctionMarkerOf(params.decisionRef, row, now)),\n } : {}),\n },\n Object.keys(writeOptions).length > 0 ? writeOptions : undefined,\n );\n // A write that matched nothing answers null; anything else is the updated row.\n if (ended !== null && ended !== undefined) {\n // #2821: ending the decision ends its work, as the status this write set. Not for a teardown: the row is being\n // deleted or scrubbed, and an erasure must not write new data about its subject.\n if (params.decisionRef && !params.teardown && !params.deletion) {\n const workRef = row.pendingDecisionWorkRef ?? params.decisionRef;\n if (params.erasure) {\n // After the erasure commits: the log is a write of its own, and a rolled-back erasure ended nothing.\n this.afterTeardownCommits(transaction, ['human-decision-erasure-work-event', params.resourceType, params.decisionRef].join(':'), () => {\n void this.recordWorkEvent(params.resourceType, { executionId: params.executionId }, workRef, transition).catch((error: unknown) => this.logger.warn(\n '[ConversationalExecution] The work an erasure ended could not be logged on its thread', { executionId: params.executionId, ...projectCaughtErrorLogFields(error) },\n ));\n });\n } else {\n await this.recordWorkEvent(params.resourceType, { executionId: params.executionId }, workRef, transition);\n }\n }\n // #2569: only the write that ended it tells the holders it left them, and never the person who already knows.\n const route = params.decisionRef ? humanDecisionRouteOfRow(row) : undefined;\n const except = params.announceExcept === undefined ? params.decidedByUserId : params.announceExcept ?? undefined;\n if (route && params.decisionRef) {\n const decisionRef = params.decisionRef;\n const requester = humanDecisionRequesterOfRow(row);\n const key = ['human-decision-withdrawn', params.resourceType, decisionRef].join(':');\n const announce = (): void => this.announceDecisionWithdrawn({ route, requester, decisionRef, ...(except ? { except } : {}) });\n if (!transaction) {\n announce();\n } else {\n // #2886 review MED-3: capturable, so a purge the organization-purge sweep captures keeps this withdrawal's\n // announcement with its commit, and the purge's next run sends it once when this effect never runs.\n registerTransactionPostCommitEffect(transaction, capturablePostCommitEffect({\n key,\n execute: async () => announce(),\n capture: decisionEndingCapture({\n effect: 'human-decision-withdrawn',\n auditLogs: () => this.auditLogs,\n announcement: {\n announcement: CapturedHumanDecisionAnnouncement.WITHDRAWN,\n route, decisionRef, ...(requester ? { requester } : {}), ...(except ? { except } : {}),\n },\n tellAnnouncement: (payload) => announceCapturedHumanDecision(this.webSocket, this.logger, payload),\n subjectId: params.executionId,\n onFailure: (error) => this.logger.warn('[ConversationalExecution] A withdrawn decision could not be announced; the purge\\'s next run sends it', {\n executionId: params.executionId, decisionRef, ...projectCaughtErrorLogFields(error),\n }),\n }),\n }));\n }\n }\n return row;\n }\n if (!params.decisionRef) return null;\n const fresh = await this.systemAccess.readAsSystem<FlowActorExecution>(\n params.resourceType, { executionId: params.executionId }, { suppressSystemAudit: true, ...(transaction ? { transaction } : {}) },\n ).catch((error: unknown) => {\n // A teardown cannot read an unreadable row as \"nothing waits\": it is about to delete or scrub that row, so the\n // decision would stay requested forever. It fails the teardown instead, as the settler contract asks (#2582\n // review F6). Every other ending treats the row as gone, as before.\n if (params.teardown || params.erasure || params.deletion) throw error;\n return null;\n });\n const onlyTheRouteMoved = !!fresh\n && fresh.status === FlowsActors_Status.AWAITING_APPROVAL\n && fresh.pausedApproval === params.rawPausedApproval\n && fresh.pendingDecisionRef === params.decisionRef\n && (fresh.pendingDecisionRouteVersion ?? 0) !== (row.pendingDecisionRouteVersion ?? 0);\n if (!onlyTheRouteMoved) return null;\n row = fresh;\n }\n return null;\n }\n\n /**\n * #2903: an answered decision's release and its seal, in ONE transaction: the release lands with its seal or neither\n * lands. The release is a guarded write that answers null when another writer moved the row first; then no seal is\n * written. A service built without the unit of work, the repositories or the application's configuration (a hand-built\n * test service) releases as before and seals nothing: every application container binds all three.\n */\n private async releaseWithSeal<T>(\n executionResourceType: string,\n sealFacts: DecisionSealFacts | undefined,\n release: (serviceOptions: ServiceOptions) => Promise<T | null>,\n ): Promise<{ readonly released: T | null; readonly sealDigest?: string; readonly sealId?: string }> {\n const sealServices = this.repositoriesRegistry && this.applicationIdentity\n ? {\n repositoriesRegistry: this.repositoriesRegistry, systemAccess: this.systemAccess, applicationIdentity: this.applicationIdentity,\n afterCommit: { ...(this.auditLogs ? { auditLogs: this.auditLogs } : {}), ...(this.approvalSealRelay ? { relay: this.approvalSealRelay } : {}) },\n }\n : undefined;\n if (!sealFacts || !sealServices || !this.unitOfWork) return { released: await release({}) };\n return this.unitOfWork.executeTransaction(\n { boundary: 'conversational-decision-release', participants: { execution: executionResourceType, approvalSeals: CoreResourceType.APPROVAL_SEALS } },\n async (serviceOptions) => {\n const released = await release(serviceOptions);\n if (released === null) return { released };\n const sealed = await sealDecisionInTransaction(sealServices, sealFacts, { transaction: serviceOptions.transaction });\n return { released, sealDigest: sealed.decisionPayloadDigest, sealId: sealed.row._id };\n },\n );\n }\n\n /**\n * Record that a decision ended, on the audit trail — called ONLY by the caller that won the write that\n * ended or released it, so there is exactly one RESOLVED row per decision (#1594 I9). Fire-and-forget:\n * the trail must never fail the decision it observes.\n */\n private recordDecisionResolved(params: {\n /** The row as it stood BEFORE the write that ended the decision — the deadline columns are cleared by that write. */\n row: Pick<FlowActorExecution, 'executionId' | 'systemRef' | 'pendingDecisionRef' | 'pendingDecisionRouteKind' | 'pendingDecisionEligibleRole' | 'pendingDecisionRequiredQualificationKinds' | 'pendingDecisionOrganizationId'\n | 'pendingDecisionClaimDeadlineAt' | 'pendingDecisionDecisionDeadlineAt' | 'pendingDecisionClaimMissedFiredAt' | 'pendingDecisionDecisionMissedFiredAt' | 'pendingDecisionClaimedAt'\n | 'pendingDecisionClockPausedAt' | 'pendingDecisionClaimWarningAt' | 'pendingDecisionClaimClockBasis' | 'pendingDecisionDecisionWarningAt' | 'pendingDecisionDecisionClockBasis'>;\n outcome: HumanDecision_Outcome;\n toolName?: string;\n agentRef?: string;\n decidedByUserId?: string;\n deciderRoles?: readonly string[];\n modifiedArgumentNames?: readonly string[];\n reasonGiven?: boolean;\n lateDecisionUserId?: string;\n /** #2664: the chat delivery the answer arrived through; recorded only beside the person who decided. */\n answeredThrough?: HumanDecision_AnsweredThrough;\n /** #2905: how the decider was authenticated; recorded only beside the person who decided. */\n decider?: HumanDecision_DeciderRecord;\n /** #2905: who asked, recorded beside who answered. */\n requester?: HumanDecision_Requester;\n /** #2903: the payload digest of the answer's seal, written with the release. */\n decisionPayloadDigest?: string;\n requestContext?: ReturnType<ConversationalExecutionBackendService['auditContextFor']>;\n principal?: Parameters<AuditLogsBackendService['logHumanDecisionResolved']>[2];\n /**\n * #2886: a captured teardown PREPARES the row through the audit service's capture view: the view replaces the service,\n * the chat cards' note is not written here (the teardown keeps it as a row of its own, #2930), and a failure surfaces\n * so the capture can decline instead of keeping a notice beside a missing record.\n */\n capture?: { readonly auditLogs: AuditLogsBackendService };\n }): Promise<unknown> | undefined {\n const { row } = params;\n const auditLogs = params.capture?.auditLogs ?? this.auditLogs;\n // The decision's chat cards are told how it ended, whatever the audit sink (#2664 S5b gate L3). A stay of this\n // plane is the decision itself: its ref names both the stay and the occurrence.\n const noticeOutcome = this.decisionNoticeOutcomeOf(row, params.outcome);\n if (noticeOutcome && !params.capture) noteHumanDecisionNoticeOutcome(this.decisionNoticeStays, this.logger, noticeOutcome);\n if (!auditLogs || !row.pendingDecisionRef || !row.pendingDecisionRouteKind) return undefined;\n const isReviewer = row.pendingDecisionRouteKind !== HumanDecision_RouteKind.OWNER;\n // #1628: whether each armed service target was met. Computed off the row read before the ending write.\n const deadlineOutcomes = deadlineOutcomesOfRow(row, params.outcome, new Date(), this.reviewCalendar());\n const recorded = auditLogs.logHumanDecisionResolved({\n decisionRef: row.pendingDecisionRef,\n executionId: row.executionId,\n plane: HumanDecision_Plane.CONVERSATIONAL,\n systemRef: row.systemRef,\n ...(params.agentRef ? { agentRef: params.agentRef } : {}),\n ...(params.toolName ? { toolName: params.toolName } : {}),\n routeKind: row.pendingDecisionRouteKind,\n ...(row.pendingDecisionEligibleRole ? { routeEligibleRole: row.pendingDecisionEligibleRole } : {}),\n ...(row.pendingDecisionRequiredQualificationKinds?.length ? { routeRequiredQualificationKinds: [...row.pendingDecisionRequiredQualificationKinds] } : {}),\n ...(row.pendingDecisionOrganizationId ? { organizationId: row.pendingDecisionOrganizationId } : {}),\n outcome: params.outcome,\n ...(params.decidedByUserId ? { decidedByUserId: params.decidedByUserId } : {}),\n ...(params.deciderRoles ? { deciderRoles: [...params.deciderRoles] } : {}),\n ...(isReviewer && params.decidedByUserId && row.pendingDecisionEligibleRole ? { admittedByRouteRole: row.pendingDecisionEligibleRole } : {}),\n modifiedArgumentNames: params.modifiedArgumentNames ?? [],\n reasonGiven: params.reasonGiven ?? false,\n ...(params.lateDecisionUserId ? { lateDecisionUserId: params.lateDecisionUserId } : {}),\n ...(deadlineOutcomes ? { deadlineOutcomes } : {}),\n ...(params.decidedByUserId && params.answeredThrough ? {\n answeredThroughInboundSource: params.answeredThrough.inboundSourceKey,\n answeredThroughInboundDeliveryId: params.answeredThrough.inboundDeliveryId,\n } : {}),\n ...(params.decidedByUserId ? humanDecisionDeciderEventFields(params.decider) : {}),\n ...humanDecisionRequesterEventFields(params.requester),\n ...(params.decidedByUserId && params.decisionPayloadDigest ? { decisionPayloadDigest: params.decisionPayloadDigest } : {}),\n }, params.requestContext, params.principal);\n if (params.capture) return recorded;\n return recorded.catch((error: unknown) => {\n this.logger.warn('[ConversationalExecution] Could not record a resolved decision on the audit trail; the decision stands', {\n executionId: row.executionId, decisionRef: row.pendingDecisionRef, ...projectCaughtErrorLogFields(error),\n });\n });\n }\n\n /**\n * The chat cards' note of how a decision ended (#2664 S5b gate L3), as the ledger takes it: this plane's stay is the\n * decision itself, its ref naming both the stay and the occurrence. A captured teardown keeps it (#2930); `undefined` for a\n * row that names no decision.\n */\n private decisionNoticeOutcomeOf(row: Pick<FlowActorExecution, 'pendingDecisionRef'>, outcome: HumanDecision_Outcome): CapturedDecisionNoticeOutcomePayload | undefined {\n if (!row.pendingDecisionRef) return undefined;\n return { plane: HumanDecision_Plane.CONVERSATIONAL, stayRef: row.pendingDecisionRef, occurrenceRef: row.pendingDecisionRef, outcome };\n }\n\n /**\n * Repay a record this row still OWES for an EARLIER decision before a settle overwrites the resolution columns it\n * would be repaired from (#1599 review F3). The marker is one slot: a record whose write failed, followed by a new\n * pause answered before the repair sweep ran, would otherwise lose the first decision for good. Never throws — if the\n * repayment fails too, the loss is logged at ERROR with the decision it cost, and the settle goes on (refusing the\n * new decision over an old record's bookkeeping would put a store outage in front of every answer).\n */\n private async repayOwedCorrectionBeforeOverwrite(\n resourceType: CoreResourceType,\n row: FlowActorExecution,\n decisionRef: string,\n /** An erasure's repay: inside its transaction, without the erased person, and a failure fails the erasure. */\n erasure?: { readonly transaction?: TransactionContext; readonly erasedUserId: string },\n /** A deletion's transaction (#2297): the repay joins it, and a failure fails the deletion (it has aborted the transaction). */\n deletionTransaction?: TransactionContext,\n ): Promise<void> {\n const owed = row.pendingCorrectionRecordRef;\n if (!owed || owed === decisionRef || !this.agentWorkDecisions) return;\n if (erasure) {\n await this.agentWorkDecisions.repairOwedRecordOfExecution(resourceType, row as unknown as ExecutionResolutionRow, erasure);\n return;\n }\n if (deletionTransaction) {\n await this.agentWorkDecisions.repairOwedRecordOfExecution(resourceType, row as unknown as ExecutionResolutionRow, undefined, { transaction: deletionTransaction });\n return;\n }\n const repaid = await this.agentWorkDecisions.repairOwedRecordOfExecution(resourceType, row as unknown as ExecutionResolutionRow).catch(() => undefined);\n if (!repaid) {\n this.logger.error('[ConversationalExecution] A previous decision\\'s agent-work record is still owed and could not be written; this settle overwrites what it would be repaired from', {\n executionId: row.executionId, owedDecisionRef: owed, settlingDecisionRef: decisionRef,\n });\n }\n }\n\n /**\n * Record a settled decision on the agent's proposal (#1599), for the caller that WON the settling write (I2), and\n * clear the row's marker once the record exists. Never throws: a record that cannot be written leaves the marker,\n * and the repair sweep writes it from the row's resolution columns (I3) — as long as the row is still there, which is\n * why it answers whether the record exists: a deletion may not remove the row the repair would need (#2582).\n *\n * @returns `true` once the record exists (or none is kept: no recorder is bound); `false` when it is still owed.\n */\n private async recordAgentWorkSettlement(params: {\n resourceType: CoreResourceType;\n row: FlowActorExecution;\n decisionRef: string;\n outcome: HumanDecision_Outcome;\n decidedAt: Date;\n /** The pause as parsed; or its raw blob, when the caller did not parse it. The proposal is its tool arguments. */\n paused?: FlowActorExecution_PausedApproval;\n rawPausedApproval?: string;\n toolName?: string;\n modifiedToolArgs?: Record<string, unknown>;\n modifiedArgumentNames?: readonly string[];\n reasonCode?: string;\n reasonText?: string;\n deciderUserId?: string;\n admittedByRole?: string;\n /**\n * The transaction the record joins (#2297): a deletion's. A write that fails inside it has aborted it, so the failure\n * PROPAGATES and fails the deletion, rather than answering `false` and writing on inside an aborted transaction.\n */\n transaction?: TransactionContext;\n }): Promise<boolean> {\n if (!this.agentWorkDecisions) return true;\n const { row } = params;\n // #2720: an agent's QUESTION asked its person for information and proposed nothing, so it is not agent-work review:\n // counting it would put questions in the override rate's denominator. Nothing is owed (no marker was written for it).\n if (params.toolName && this.pausedCallAsksThePerson(row.systemRef, params.toolName)) return true;\n const owner = agentWorkOwnerOfExecution(params.resourceType, row as unknown as Record<string, unknown>);\n if (!owner) {\n this.logger.warn('[ConversationalExecution] A settled decision\\'s execution names no owner scope; its record is left to the repair sweep', {\n executionId: row.executionId, decisionRef: params.decisionRef,\n });\n return false;\n }\n let paused = params.paused;\n if (!paused && params.rawPausedApproval) {\n try { paused = parseFlowActorPausedApproval(params.rawPausedApproval); } catch { paused = undefined; }\n }\n try {\n await this.agentWorkDecisions.recordDecision({\n owner,\n decisionRef: params.decisionRef,\n surface: AgentWorkDecisionSurface.TOOL_CALL_APPROVAL,\n outcome: params.outcome,\n agentRef: row.systemRef,\n ...(params.toolName ? { toolName: params.toolName } : {}),\n ...(row.caseRef ? { caseRef: row.caseRef } : {}),\n executionRef: { kind: ExecutionRefKind.CONVERSATIONAL_EXECUTION, id: row.executionId },\n ...(paused?.pendingToolArgs !== undefined ? { proposal: paused.pendingToolArgs } : {}),\n ...(params.modifiedToolArgs ? { final: params.modifiedToolArgs } : {}),\n ...(params.modifiedArgumentNames ? { fallbackPaths: params.modifiedArgumentNames } : {}),\n ...(params.reasonCode ? { reasonCode: params.reasonCode } : {}),\n ...(params.reasonText ? { reasonText: params.reasonText } : {}),\n ...(params.deciderUserId ? { deciderUserId: params.deciderUserId } : {}),\n ...(params.admittedByRole ? { admittedByRole: params.admittedByRole } : {}),\n presentedAt: decisionPresentedAtOfRow(row, params.decidedAt),\n decidedAt: params.decidedAt,\n recordSource: AgentWorkDecisionRecordSource.SETTLEMENT,\n ...(row.pendingDecisionOrganizationId ? { routeOrganizationId: row.pendingDecisionOrganizationId } : {}),\n }, { executionResourceType: params.resourceType, executionId: row.executionId }, params.transaction ? { transaction: params.transaction } : undefined);\n return true;\n } catch (error) {\n if (params.transaction) throw error;\n this.logger.warn('[ConversationalExecution] A settled decision could not be recorded yet; the repair sweep will write it from the row', {\n executionId: row.executionId, decisionRef: params.decisionRef, ...projectCaughtErrorLogFields(error),\n });\n return false;\n }\n }\n\n /**\n * End every decision whose window has closed with nobody answering (#484, #1594 D9).\n *\n * `pendingDecisionExpiresAt` names the instant after which the waiting turn must not resume, and the\n * status vocabulary says such a pause ends FAILED. The sweep SELECTS on that indexed column — it used\n * to list every paused turn and parse every blob to find the lapsed ones — and each candidate is then\n * READ, because the blob the compare-and-swap keys on is backend-only and a listing projects it out.\n *\n * Each lapse writes `decisionOutcome = LAPSED` with no decider inside the ending write, and records one\n * RESOLVED row whose actor is the application. A lapse is its own outcome, never counted as a refusal.\n *\n * A turn paused before decisions were routed carries no expiry column and is not selected; it is\n * answered or left, which this greenfield change accepts rather than carrying a second sweep.\n */\n public async sweepLapsedApprovalPauses(now: Date = new Date()): Promise<LapsedApprovalPauseSweepResult> {\n const result: LapsedApprovalPauseSweepResult = { scanned: 0, lapsed: 0, stillOpen: 0, raced: 0, unreadable: 0 };\n\n for (const resourceType of FLOW_ACTOR_EXECUTION_OWNER_VARIANTS) {\n let candidates: FlowActorExecution[] = [];\n try {\n const listed = await this.systemAccess.listAsSystem<FlowActorExecution>(\n resourceType,\n { status: FlowsActors_Status.AWAITING_APPROVAL, pendingDecisionExpiresAt: { $lte: now } },\n undefined,\n { suppressSystemAudit: true },\n );\n candidates = Array.isArray(listed) ? listed : (listed?.data ?? []);\n } catch (error) {\n // One variant failing must not abort the others: a per-scope outage degrades coverage.\n this.logger.error('[ConversationalExecution] Lapsed-approval sweep could not list paused turns for a scope', {\n resourceType, ...projectCaughtErrorLogFields(error),\n });\n continue;\n }\n\n for (const candidate of candidates) {\n result.scanned += 1;\n const executionId = candidate.executionId;\n let row: FlowActorExecution | null;\n try {\n row = await this.systemAccess.readAsSystem<FlowActorExecution>(resourceType, { executionId }, { suppressSystemAudit: true });\n } catch (error) {\n result.unreadable += 1;\n this.logger.warn('[ConversationalExecution] Lapsed-approval sweep could not read a paused turn', {\n resourceType, executionId, ...projectCaughtErrorLogFields(error),\n });\n continue;\n }\n if (!row || row.status !== FlowsActors_Status.AWAITING_APPROVAL || !row.pendingDecisionRef) {\n // Moved on between the listing and the read — decided, or already ended.\n result.raced += 1;\n continue;\n }\n if (!row.pausedApproval) {\n result.unreadable += 1;\n this.logger.warn('[ConversationalExecution] A turn reads AWAITING_APPROVAL with no pause state; left as it stands', { resourceType, executionId });\n continue;\n }\n if (!row.pendingDecisionExpiresAt || new Date(row.pendingDecisionExpiresAt).getTime() > now.getTime()) {\n result.stillOpen += 1;\n continue;\n }\n const toolName = this.pendingToolNameOf(row.pausedApproval);\n try {\n const decidedAt = new Date();\n const endedOn = await this.endPendingDecision({\n resourceType, executionId, rawPausedApproval: row.pausedApproval, decisionRef: row.pendingDecisionRef,\n outcome: HumanDecision_Outcome.LAPSED, toolName, row, decidedAt,\n });\n if (!endedOn) { result.raced += 1; continue; }\n result.lapsed += 1;\n this.recordDecisionResolved({ row: endedOn, requester: humanDecisionRequesterOfRow(endedOn), outcome: HumanDecision_Outcome.LAPSED, toolName });\n await this.recordAgentWorkSettlement({\n resourceType, row: endedOn, decisionRef: row.pendingDecisionRef, outcome: HumanDecision_Outcome.LAPSED, decidedAt,\n rawPausedApproval: row.pausedApproval, ...(toolName ? { toolName } : {}),\n });\n this.logger.info('[ConversationalExecution] Ended a decision nobody answered in its window', {\n resourceType, executionId, decisionRef: row.pendingDecisionRef, expiresAt: row.pendingDecisionExpiresAt, toolName,\n });\n } catch (error) {\n this.logger.error('[ConversationalExecution] Lapsed-approval sweep could not end an expired decision', {\n resourceType, executionId, ...projectCaughtErrorLogFields(error),\n });\n }\n }\n }\n\n // Logged unconditionally, including the zero case: a sweep that silently finds nothing is\n // indistinguishable from a sweep that silently stopped running.\n this.logger.info('[ConversationalExecution] Lapsed-approval sweep complete', { ...result });\n return result;\n }\n\n /**\n * Record a raised decision's `HUMAN_DECISION_REQUESTED` row under its deterministic id\n * ({@link humanDecisionRequestedAuditEventId}), the one shape both the turn that raised it and the repair write, so\n * their two recordings of one request are one row. Rejects when the row could not be written: each caller decides what\n * that costs (the turn logs it and leaves the request to the repair; the repair tries again next run).\n */\n private recordDecisionRequested(request: {\n readonly decisionRef: string;\n readonly executionId: string;\n readonly systemRef: string;\n readonly agentRef?: string;\n readonly toolName?: string;\n readonly route: HumanDecision_Route;\n readonly requester: HumanDecision_Requester;\n readonly expiresAt?: string;\n readonly claimDeadlineAt?: string;\n readonly claimClockBasis?: ReviewClockBasis;\n readonly decisionDeadlineAt?: string;\n readonly decisionClockBasis?: ReviewClockBasis;\n }, requestContext: ReturnType<ConversationalExecutionBackendService['auditContextFor']> | undefined): Promise<void> {\n if (!this.auditLogs) return Promise.resolve();\n const { route, requester } = request;\n return this.auditLogs.logHumanDecisionRequested({\n decisionRef: request.decisionRef, executionId: request.executionId, plane: HumanDecision_Plane.CONVERSATIONAL, systemRef: request.systemRef,\n ...(request.agentRef ? { agentRef: request.agentRef } : {}),\n ...(request.toolName ? { toolName: request.toolName } : {}),\n routeKind: route.kind,\n ...(route.eligibleRole ? { routeEligibleRole: route.eligibleRole } : {}),\n ...(route.requiredQualificationKinds?.length ? { routeRequiredQualificationKinds: [...route.requiredQualificationKinds] } : {}),\n ...(route.organizationId ? { organizationId: route.organizationId } : {}),\n requesterKind: requester.kind,\n ...(route.assigneeUserId ? { assigneeUserId: route.assigneeUserId } : {}),\n ...(request.expiresAt ? { expiresAt: request.expiresAt } : {}),\n ...(request.claimDeadlineAt ? { claimDeadlineAt: request.claimDeadlineAt } : {}),\n ...(request.claimClockBasis ? { claimClockBasis: request.claimClockBasis } : {}),\n ...(request.decisionDeadlineAt ? { decisionDeadlineAt: request.decisionDeadlineAt } : {}),\n ...(request.decisionClockBasis ? { decisionClockBasis: request.decisionClockBasis } : {}),\n }, requestContext, requester.kind !== HumanDecision_RequesterKind.MACHINE ? requester.ref : undefined, undefined, {\n eventId: humanDecisionRequestedAuditEventId(request.decisionRef),\n });\n }\n\n /**\n * The waiting rows {@link repairUnrecordedDecisionRequests} has found recorded, keyed by row and by when the row last\n * changed: a row that has not changed since still waits on the same decision, so it is not read again. A cache only:\n * emptied, the next run asks again and records nothing twice (the audit row's id is derived from the decision).\n */\n private recordedDecisionRequestKeys = new Set<string>();\n\n /**\n * Record the request of every waiting decision that has no `HUMAN_DECISION_REQUESTED` row, and announce it to its holders\n * (#2749). Derived from the row, the one place that says whether a decision exists, so nothing marks a request as owed.\n *\n * Its population is what the turn could not record: a pause write that threw while its read-back failed too, which the\n * turn reports as possibly waiting and leaves here; a turn whose process died between its pause and its record; and a\n * request row the audit store refused. Only decisions raised more than {@link DECISION_REQUEST_REPAIR_GRACE_MS} ago are\n * asked about (by the listing, and again on the row as read), so the turn that raised one has long finished recording\n * and announcing it. The request is recorded once, whoever records it: under its deterministic id, and only when no row\n * exists for the decision under that id or, for a request recorded before the id was derived, under any id\n * (`hasRecordedHumanDecisionRequest`). The announcement is not always single: when the audit store refused the TURN's\n * row, the turn had already announced the decision, and the repair that records it announces it again. That second\n * announcement carries only the decision's id and makes an inbox re-read; a request missing from the trail is the\n * worse loss.\n *\n * What the repaired row can say is what the waiting row holds: its route, requester, lapse and deadlines as they stand\n * now (a clock act moves the deadlines), and the agent whose gate raised it, read from the agent's declaration. The\n * requester's own request context is gone, so the row names the requester and the agent frame, without the client or\n * relationship the turn's context would have attributed. The holders are announced to only while the route never\n * moved: a move (route version above 0) announced the decision to the holders it moved to.\n *\n * Rides the approval-pause expiry sweep's schedule: the same waiting rows, every minute.\n *\n * assurance-control: WILDO.AUDIT.SECURITY_EVENT — every raised decision has its request row: derived from the waiting row\n * and recorded once, even when the turn that raised it could not learn that it had.\n */\n public async repairUnrecordedDecisionRequests(now: Date = new Date()): Promise<UnrecordedDecisionRequestRepairResult> {\n const result: UnrecordedDecisionRequestRepairResult = { scanned: 0, alreadyRecorded: 0, repaired: 0, raced: 0, failed: 0 };\n const auditLogs = this.auditLogs;\n if (!auditLogs) return result;\n const cutoff = new Date(now.getTime() - DECISION_REQUEST_REPAIR_GRACE_MS);\n const seen = new Set<string>();\n let everyScopeListed = true;\n for (const resourceType of FLOW_ACTOR_EXECUTION_OWNER_VARIANTS) {\n let candidates: FlowActorExecution[] = [];\n try {\n const listed = await this.systemAccess.listAsSystem<FlowActorExecution>(\n resourceType,\n { status: FlowsActors_Status.AWAITING_APPROVAL, pendingDecisionRequestedAt: { $lte: cutoff } },\n undefined,\n { suppressSystemAudit: true },\n );\n candidates = Array.isArray(listed) ? listed : (listed?.data ?? []);\n } catch (error) {\n everyScopeListed = false;\n this.logger.error('[ConversationalExecution] Decision-request repair could not list waiting turns for a scope', {\n resourceType, ...projectCaughtErrorLogFields(error),\n });\n continue;\n }\n for (const candidate of candidates) {\n const changedAt = candidate.updatedAt ? new Date(candidate.updatedAt).getTime() : Number.NaN;\n // A row that names no change instant cannot be told apart from its next decision, so it is asked about every run.\n const key = Number.isNaN(changedAt) ? undefined : `${resourceType}:${candidate.executionId}:${changedAt}`;\n if (key) seen.add(key);\n if (key && this.recordedDecisionRequestKeys.has(key)) continue;\n result.scanned += 1;\n let row: FlowActorExecution | null;\n try {\n row = await this.systemAccess.readAsSystem<FlowActorExecution>(resourceType, { executionId: candidate.executionId }, { suppressSystemAudit: true });\n } catch (error) {\n result.failed += 1;\n this.logger.warn('[ConversationalExecution] Decision-request repair could not read a waiting turn', {\n resourceType, executionId: candidate.executionId, ...projectCaughtErrorLogFields(error),\n });\n continue;\n }\n const decisionRef = row?.status === FlowsActors_Status.AWAITING_APPROVAL ? row.pendingDecisionRef : undefined;\n const route = row && decisionRef ? humanDecisionRouteOfRow(row) : undefined;\n const requester = row && decisionRef ? humanDecisionRequesterOfRow(row) : undefined;\n // The grace again, on the row as read (#2749 review F4): the listing's row may have been answered and paused again\n // since, on a decision its turn is still recording.\n const requestedAt = row?.pendingDecisionRequestedAt ? new Date(row.pendingDecisionRequestedAt).getTime() : Number.NaN;\n if (!row || !decisionRef || !(requestedAt <= cutoff.getTime())) {\n result.raced += 1;\n continue;\n }\n if (!route || !requester) {\n // A pause from before decisions were routed (#1594): no request can be described, and none is owed.\n if (key) this.recordedDecisionRequestKeys.add(key);\n continue;\n }\n try {\n // The derived id first (one indexed read); a miss is asked again by decision, so a request recorded before the id\n // was derived from the decision is not recorded twice.\n if (await auditLogs.hasRecordedAuditEvent(humanDecisionRequestedAuditEventId(decisionRef))\n || await auditLogs.hasRecordedHumanDecisionRequest(HumanDecision_Plane.CONVERSATIONAL, decisionRef)) {\n result.alreadyRecorded += 1;\n if (key) this.recordedDecisionRequestKeys.add(key);\n continue;\n }\n const toolName = row.pausedApproval ? this.pendingToolNameOf(row.pausedApproval) : undefined;\n let agentRef: string | undefined;\n if (toolName) {\n try {\n const resolved = this.resolveApprovalGatedFunctionTool(row.systemRef, toolName);\n agentRef = resolved.kind === GatedFunctionToolResolutionKind.FOUND ? resolved.agentRef : undefined;\n } catch {\n agentRef = undefined;\n }\n }\n const isoOf = (value: Date | string | null | undefined) => (value ? new Date(value).toISOString() : undefined);\n await runWithAgentActorFrame(\n { agentRef: agentRef ?? row.systemRef, agentExecutionId: row.executionId, systemRef: row.systemRef, ...(toolName ? { toolName } : {}), decisionRef },\n () => this.recordDecisionRequested({\n decisionRef, executionId: row.executionId, systemRef: row.systemRef, route, requester,\n ...(agentRef ? { agentRef } : {}),\n ...(toolName ? { toolName } : {}),\n ...(isoOf(row.pendingDecisionExpiresAt) ? { expiresAt: isoOf(row.pendingDecisionExpiresAt) } : {}),\n ...(isoOf(row.pendingDecisionClaimDeadlineAt) ? { claimDeadlineAt: isoOf(row.pendingDecisionClaimDeadlineAt) } : {}),\n ...(row.pendingDecisionClaimClockBasis ? { claimClockBasis: row.pendingDecisionClaimClockBasis } : {}),\n ...(isoOf(row.pendingDecisionDecisionDeadlineAt) ? { decisionDeadlineAt: isoOf(row.pendingDecisionDecisionDeadlineAt) } : {}),\n ...(row.pendingDecisionDecisionClockBasis ? { decisionClockBasis: row.pendingDecisionDecisionClockBasis } : {}),\n }, undefined),\n );\n result.repaired += 1;\n if (key) this.recordedDecisionRequestKeys.add(key);\n if ((row.pendingDecisionRouteVersion ?? 0) === 0) this.announceDecisionRouted(route, decisionRef, undefined, requester);\n this.logger.warn('[ConversationalExecution] Recorded and announced a waiting decision whose request had not been recorded', {\n resourceType, executionId: row.executionId, decisionRef,\n });\n } catch (error) {\n result.failed += 1;\n this.logger.warn('[ConversationalExecution] Decision-request repair could not record a waiting decision\\'s request; the next run tries again', {\n resourceType, executionId: row.executionId, decisionRef, ...projectCaughtErrorLogFields(error),\n });\n }\n }\n }\n // Only rows still waiting are kept; a scope that could not be listed keeps what it had, since nothing was learned.\n if (everyScopeListed) this.recordedDecisionRequestKeys = new Set([...this.recordedDecisionRequestKeys].filter((key) => seen.has(key)));\n // Logged unconditionally, zero included, like every sweep here.\n this.logger.info('[ConversationalExecution] Decision-request repair complete', { ...result });\n return result;\n }\n\n /**\n * End every pending decision raised through a relationship that has ENDED for good (#2573): terminated, withdrawn,\n * expired, or ended because a party was removed.\n *\n * A decision raised through a relationship resumes only through it (#2768), so once it ends none of them can ever run:\n * answering one is refused `REQUESTER_AUTHORITY_LAPSED` at the act. Left alone, each would sit in its reviewer's inbox\n * until its window lapses (ten days for Wonder Ledger's sign-off), asking a person to decide work that cannot happen,\n * and the work it waits on (a close awaiting its sign-off) would read as waiting on a reviewer rather than as over. So\n * the relationship's ending ends them, with the outcome an answer would have met: `REQUESTER_AUTHORITY_LAPSED`, the turn\n * FAILED, one RESOLVED audit row and the agent-work record each, and every holder told (`endPendingDecision`).\n *\n * Called once the ending transaction COMMITS (`endRelationshipReach` registers it), so a rolled-back ending ends\n * nothing. A SUSPENDED relationship is not ended here: its decisions may still be answered once it resumes, and their\n * window decides otherwise.\n *\n * Which decisions: those whose pause recorded the relationship among the ones its requester stood through\n * (`requesterThroughRelationshipIds`). A pause from before that record (#2768) names none; it is still refused at the\n * act and still lapses in its window, and is left to those.\n */\n public async endDecisionsRaisedThroughEndedRelationship(params: {\n relationshipId: string;\n /** The granting organization: where the relationship's decisions are routed. Narrows the organization's executions. */\n organizationId: string;\n }): Promise<EndedRelationshipDecisionsResult> {\n const result: EndedRelationshipDecisionsResult = { scanned: 0, ended: 0, raced: 0, unreadable: 0 };\n for (const resourceType of FLOW_ACTOR_EXECUTION_OWNER_VARIANTS) {\n let candidates: FlowActorExecution[] = [];\n try {\n const listed = await this.systemAccess.listAsSystem<FlowActorExecution>(\n resourceType,\n {\n status: FlowsActors_Status.AWAITING_APPROVAL,\n ...(resourceType === CoreResourceType.ORGANIZATION_FLOW_ACTOR_EXECUTIONS ? { organizationId: params.organizationId } : {}),\n },\n undefined,\n { suppressSystemAudit: true },\n );\n candidates = Array.isArray(listed) ? listed : (listed?.data ?? []);\n } catch (error) {\n this.logger.error('[ConversationalExecution] Could not list paused turns to end the decisions of an ended relationship', {\n resourceType, relationshipId: params.relationshipId, ...projectCaughtErrorLogFields(error),\n });\n continue;\n }\n for (const candidate of candidates) {\n result.scanned += 1;\n const executionId = candidate.executionId;\n let row: FlowActorExecution | null;\n try {\n row = await this.systemAccess.readAsSystem<FlowActorExecution>(resourceType, { executionId }, { suppressSystemAudit: true });\n } catch (error) {\n result.unreadable += 1;\n this.logger.warn('[ConversationalExecution] Could not read a paused turn while ending an ended relationship\\'s decisions', {\n resourceType, executionId, ...projectCaughtErrorLogFields(error),\n });\n continue;\n }\n if (!row || row.status !== FlowsActors_Status.AWAITING_APPROVAL || !row.pendingDecisionRef) { result.raced += 1; continue; }\n if (!row.pausedApproval) { result.unreadable += 1; continue; }\n let raisedThrough: readonly string[] | undefined;\n try {\n raisedThrough = parseFlowActorPausedApproval(row.pausedApproval).requesterThroughRelationshipIds;\n } catch {\n result.unreadable += 1;\n continue;\n }\n if (!raisedThrough?.includes(params.relationshipId)) continue;\n const toolName = this.pendingToolNameOf(row.pausedApproval);\n try {\n const decidedAt = new Date();\n const endedOn = await this.endPendingDecision({\n resourceType, executionId, rawPausedApproval: row.pausedApproval, decisionRef: row.pendingDecisionRef,\n outcome: HumanDecision_Outcome.REQUESTER_AUTHORITY_LAPSED, toolName, row, decidedAt,\n });\n if (!endedOn) { result.raced += 1; continue; }\n result.ended += 1;\n this.recordDecisionResolved({ row: endedOn, requester: humanDecisionRequesterOfRow(endedOn), outcome: HumanDecision_Outcome.REQUESTER_AUTHORITY_LAPSED, toolName });\n await this.recordAgentWorkSettlement({\n resourceType, row: endedOn, decisionRef: row.pendingDecisionRef, outcome: HumanDecision_Outcome.REQUESTER_AUTHORITY_LAPSED, decidedAt,\n rawPausedApproval: row.pausedApproval, ...(toolName ? { toolName } : {}),\n });\n } catch (error) {\n this.logger.error('[ConversationalExecution] Could not end a decision raised through an ended relationship', {\n resourceType, executionId, relationshipId: params.relationshipId, ...projectCaughtErrorLogFields(error),\n });\n }\n }\n }\n // Logged unconditionally, the zero case included: an ending that found nothing reads differently from one that never ran.\n this.logger.info('[ConversationalExecution] Ended the decisions raised through an ended relationship', {\n relationshipId: params.relationshipId, organizationId: params.organizationId, ...result,\n });\n return result;\n }\n\n /** The tool a stored pause gates, for an audit row; `undefined` when the blob cannot be read. */\n private pendingToolNameOf(rawPausedApproval: string): string | undefined {\n try {\n return parseFlowActorPausedApproval(rawPausedApproval).pendingToolName;\n } catch {\n return undefined;\n }\n }\n\n /**\n * Settle the turns a previous process of THIS host left running, as FAILED (#1601).\n *\n * A turn is `PROCESSING` from its first write until it settles, and only the process running it\n * settles it. When that process dies mid-turn (a companion restarted by a rebuild, which in framework\n * development happens every few minutes) the row stays `PROCESSING` for ever and the person's message\n * reads as unanswered with nothing saying why. Measured 2026-09-25 on scratch-journey: three messages\n * in one creation thread, zero replies, and no error anywhere.\n *\n * ## Only for a SOLE host\n *\n * Called at startup, so it assumes no other process is running turns of `systemRefs` against the\n * same store: every `PROCESSING` turn of those systems then belongs to a process that no longer\n * exists. That holds for the development companion, the one process hosting the creation\n * conversation. It does NOT hold for a replicated application backend, where one replica starting\n * would fail another's live turns; there the liveness lease decides instead, through\n * {@link sweepInterruptedTurns} (#1780).\n *\n * The write is guarded on `PROCESSING`, so a turn that settled in the meantime is left alone. Each settle the write\n * WON is audited (`CONVERSATIONAL_TURN_FAILED_BY_SYSTEM`, cause `ORPHANED_AT_STARTUP`, the application as actor, #2800).\n */\n public async settleInterruptedTurns(\n systemRefs: readonly string[],\n now: Date = new Date(),\n ): Promise<{ readonly settled: number; readonly unreadScopes: number }> {\n let settled = 0;\n /*\n * Scopes whose running turns could not be LISTED. Reported beside the count because `settled: 0`\n * alone reads as \"nothing was interrupted\" — which is exactly how a settlement run before its\n * services existed stayed inert on every boot (measured 2026-09-25, #1601).\n */\n let unreadScopes = 0;\n for (const resourceType of FLOW_ACTOR_EXECUTION_OWNER_VARIANTS) {\n for (const systemRef of systemRefs) {\n let candidates: FlowActorExecution[] = [];\n try {\n const listed = await this.systemAccess.listAsSystem<FlowActorExecution>(\n resourceType,\n { status: FlowsActors_Status.PROCESSING, systemRef },\n undefined,\n { suppressSystemAudit: true },\n );\n candidates = Array.isArray(listed) ? listed : (listed?.data ?? []);\n } catch (error) {\n this.logger.error('[ConversationalExecution] Interrupted-turn settlement could not list running turns for a scope', {\n resourceType, systemRef, ...projectCaughtErrorLogFields(error),\n });\n unreadScopes += 1;\n continue;\n }\n for (const candidate of candidates) {\n if (candidate.status !== FlowsActors_Status.PROCESSING || candidate.systemRef !== systemRef) continue;\n try {\n const updated = await this.systemAccess.updateAsSystem(\n resourceType,\n { executionId: candidate.executionId, status: FlowsActors_Status.PROCESSING },\n {\n status: FlowsActors_Status.FAILED,\n // #2827: the turn's process went away, which is what the stored end says.\n statusChanges: [...(candidate.statusChanges ?? []), flowsActorsStatusChange(TURN_INTERRUPTED_END, now)],\n finishedAt: now,\n },\n );\n if (updated !== null) {\n settled += 1;\n // Recorded only by the write that won (#2800): a turn that settled meanwhile records nothing.\n await this.recordTurnFailedBySystem(resourceType, candidate, ActorExecutionInterruptionCause.ORPHANED_AT_STARTUP, updated);\n }\n } catch (error) {\n this.logger.error('[ConversationalExecution] Could not settle an interrupted turn', {\n resourceType, executionId: candidate.executionId, ...projectCaughtErrorLogFields(error),\n });\n }\n }\n }\n }\n if (unreadScopes > 0) {\n this.logger.warn('[ConversationalExecution] Interrupted-turn settlement could not read every scope; turns there were not settled', {\n systemRefs: [...systemRefs], settled, unreadScopes,\n });\n } else {\n this.logger.info('[ConversationalExecution] Interrupted-turn settlement complete', { systemRefs: [...systemRefs], settled });\n }\n return { settled, unreadScopes };\n }\n\n /**\n * Fail the turns whose process died mid-turn, on ANY host, from their liveness lease (#1780).\n *\n * A turn holds its lease for exactly as long as its row says PROCESSING (`holdTurnLease`). So a row\n * that says PROCESSING, has not moved for {@link INTERRUPTED_TURN_GRACE_MS}, and has no lease behind it\n * was left by a process that is gone — unless the lease never could be written, which is what the\n * evidence below tells apart. Unlike {@link settleInterruptedTurns}, which may only run on a sole host,\n * this asks the lease and never assumes, so it is safe on a replicated backend.\n *\n * Every rule is the A2A abandoned-task sweep's, because the reasoning is the lease's, not the plane's:\n * - **abstain** when the lease cannot be written here, or no Redis is bound at all: then every live\n * turn's lease is missing too, and acting would fail the whole fleet;\n * - **the lease decides, never the timestamp**: an old `updatedAt` is a pre-filter only, since a long\n * tool loop keeps an old `updatedAt` and a live lease;\n * - **an absence must explain itself** before it is acted on — only `LEASE_LAPSED` and\n * `CORROBORATED_ABSENCE` are verdicts;\n * - **the write is a compare-and-swap on PROCESSING**, so a turn that ended between the listing and\n * the repair is left as it stands and counted as `raced`, not as a repair.\n *\n * Nothing is announced: the socket the turn was streaming to belonged to the process that died. A\n * reloaded conversation reads FAILED from the row. Each repair the write WON is audited\n * (`CONVERSATIONAL_TURN_FAILED_BY_SYSTEM`, cause `LEASE_LAPSED`, the application as actor, #2800); a RACED row records\n * nothing.\n */\n public async sweepInterruptedTurns(now: Date = new Date()): Promise<InterruptedTurnSweepResult> {\n const result = { scanned: 0, failed: 0, stillAlive: 0, raced: 0, awaitingCorroboration: 0, undetermined: 0, unreadScopes: 0 };\n const lease = this.turnLease;\n if (!lease || !(await lease.isMechanismWritable())) {\n this.logger.warn('[ConversationalExecution] Skipping the interrupted-turn sweep: the turn lease cannot be written here, so liveness cannot be trusted', {\n consequence: 'interrupted turns stay PROCESSING until a run where the lease can be trusted',\n });\n return { ...result, works: NO_ABANDONED_WORK_SWEEP, abstained: true };\n }\n const cutoff = new Date(now.getTime() - INTERRUPTED_TURN_GRACE_MS);\n for (const resourceType of FLOW_ACTOR_EXECUTION_OWNER_VARIANTS) {\n let candidates: FlowActorExecution[] = [];\n try {\n const listed = await this.systemAccess.listAsSystem<FlowActorExecution>(\n resourceType,\n { status: FlowsActors_Status.PROCESSING, updatedAt: { $lt: cutoff } },\n undefined,\n { suppressSystemAudit: true },\n );\n candidates = Array.isArray(listed) ? listed : (listed?.data ?? []);\n } catch (error) {\n this.logger.error('[ConversationalExecution] The interrupted-turn sweep could not list running turns for a scope', {\n resourceType, ...projectCaughtErrorLogFields(error),\n });\n result.unreadScopes += 1;\n continue;\n }\n for (const candidate of candidates) {\n // Re-asserted per row: the listing is a snapshot, and only a PROCESSING row is this sweep's.\n if (candidate.status !== FlowsActors_Status.PROCESSING) continue;\n result.scanned += 1;\n const executionId = candidate.executionId;\n if (await lease.isAlive(executionId)) {\n result.stillAlive += 1;\n continue;\n }\n const evidence = await lease.corroborateAbandonment(executionId);\n if (!abandonmentEvidenceIsAVerdict(evidence)) {\n if (evidence === TurnLeaseAbandonmentEvidence.FIRST_ABSENCE) {\n result.awaitingCorroboration += 1;\n this.logger.info('[ConversationalExecution] A running turn has no lease and no record of ever having had one; left alone pending corroboration', {\n executionId,\n consequence: 'if the absence is still there next run it is failed; if its process merely could not write, its next heartbeat clears this',\n });\n } else {\n result.undetermined += 1;\n this.logger.warn('[ConversationalExecution] Could not establish why a running turn has no lease; nothing was learned and nothing was recorded', {\n executionId, evidence,\n });\n }\n continue;\n }\n try {\n const updated = await this.systemAccess.updateAsSystem(\n resourceType,\n { executionId, status: FlowsActors_Status.PROCESSING },\n {\n status: FlowsActors_Status.FAILED,\n // #2827: the turn's process went away, which is what the stored end says.\n statusChanges: [...(candidate.statusChanges ?? []), flowsActorsStatusChange(TURN_INTERRUPTED_END, now)],\n finishedAt: now,\n },\n );\n if (updated !== null) {\n result.failed += 1;\n // The evidence rides the record of the repair: a run whose repairs are all\n // `corroborated-absence` says a process somewhere cannot write its leases.\n this.logger.info('[ConversationalExecution] Failed a turn its process abandoned', { executionId, systemRef: candidate.systemRef, evidence });\n // Recorded only by the write that won (#2800); `evidence` stays on the log line above.\n await this.recordTurnFailedBySystem(resourceType, candidate, ActorExecutionInterruptionCause.LEASE_LAPSED, updated);\n } else {\n result.raced += 1;\n this.logger.info('[ConversationalExecution] A turn ended between the listing and the repair; left as it stands', { executionId });\n }\n } catch (error) {\n this.logger.error('[ConversationalExecution] Could not fail an abandoned turn', { executionId, ...projectCaughtErrorLogFields(error) });\n }\n }\n }\n // After the turns: a turn this run failed has already ended its work in the log (`recordTurnFailedBySystem` is\n // awaited), so the work pass does not record that work a second time.\n const works = await this.sweepAbandonedWorkContinuations(now);\n // Logged unconditionally, zero included: a sweep that silently finds nothing is indistinguishable from\n // a sweep that silently stopped running.\n this.logger.info('[ConversationalExecution] Interrupted-turn sweep complete', { ...result, works });\n return { ...result, works, abstained: false };\n }\n\n /**\n * Fail the WORKS whose continuation's process died, whichever turn holds their thread (#2829). The second pass of\n * {@link sweepInterruptedTurns}, run after its trust gate, so it abstains exactly when that sweep does.\n *\n * The first pass cannot see these. A continuation whose process dies while ANOTHER turn of the thread holds the row\n * (that turn completed, or paused) leaves a row that is not PROCESSING, and the execution's lease, held by whichever\n * turn runs, cannot say which of two overlapping turns died. The work's own log can: its newest entry stays\n * `PROCESSING`, and an A2A task holding that work read `working` and accepted a cancel that stopped nothing.\n *\n * - **Selection is bounded**: threads whose `workContinuationOpenedAt` (stamped by every `PROCESSING` entry, removed by\n * this pass once nothing on the thread can still be running) is older than {@link INTERRUPTED_TURN_GRACE_MS}. Never\n * every thread whose log ends in `PROCESSING`, which would scan every finished conversation on each run.\n * - **Per work, the lease decides**, under the first pass's rules: a work whose continuation paused again waits on its\n * own decision and is left alone; a held work lease is alive; an absent one must explain itself\n * (`corroborateAbandonment`) before it is a verdict.\n * - **Re-read before acting**: the listing is a snapshot, and a continuation lets its lease go only after its ending\n * entry, so a lease found gone means the ending, if any, is on the row now. The work is failed only if its newest\n * entry is still the one the listing showed.\n * - **The append is guarded** on the `workContinuationOpenedAt` the re-read showed, so a new continuation of the work\n * released in between (a newer instant) makes it land nowhere: counted `raced`, never a repair.\n * - **The column is removed** only when no work on the thread may still be running, with a compare-and-swap on the\n * instant the listing read: a continuation released meanwhile wrote a newer one and keeps the thread selected.\n *\n * A work that is failed here may have ended in fact, its ending lost to a store error: FAILED says only that no process\n * runs it any more, which is all the sweep knows. Each repair the append WON is audited like a failed turn\n * (`CONVERSATIONAL_TURN_FAILED_BY_SYSTEM`, cause `LEASE_LAPSED`).\n */\n private async sweepAbandonedWorkContinuations(now: Date): Promise<AbandonedWorkSweepResult> {\n const lease = this.workLease;\n if (!lease || !this.repositoriesRegistry) return NO_ABANDONED_WORK_SWEEP;\n const result: { -readonly [K in keyof AbandonedWorkSweepResult]: number } = { ...NO_ABANDONED_WORK_SWEEP };\n const cutoff = new Date(now.getTime() - INTERRUPTED_TURN_GRACE_MS);\n for (const resourceType of FLOW_ACTOR_EXECUTION_OWNER_VARIANTS) {\n let threads: FlowActorExecution[] = [];\n try {\n const listed = await this.systemAccess.listAsSystem<FlowActorExecution>(\n resourceType,\n { workContinuationOpenedAt: { $lt: cutoff } },\n undefined,\n { suppressSystemAudit: true },\n );\n threads = Array.isArray(listed) ? listed : (listed?.data ?? []);\n } catch (error) {\n this.logger.error('[ConversationalExecution] The abandoned-work sweep could not list threads with a released continuation for a scope', {\n resourceType, ...projectCaughtErrorLogFields(error),\n });\n result.unreadScopes += 1;\n continue;\n }\n for (const thread of threads) {\n // Re-asserted per row: only a thread whose continuation instant is past the grace is this pass's.\n const openedAt = thread.workContinuationOpenedAt ? new Date(thread.workContinuationOpenedAt) : undefined;\n if (!openedAt || !(openedAt.getTime() < cutoff.getTime())) continue;\n result.scanned += 1;\n let mayStillRun = false;\n for (const entry of worksWithOpenContinuation(thread)) {\n const outcome = await this.sweepOpenWorkContinuation(resourceType, thread, entry, lease);\n result[outcome] += 1;\n if (OPEN_WORK_CONTINUATION_OUTCOMES_KEEPING_THE_MARKER.has(outcome)) mayStillRun = true;\n }\n if (!mayStillRun && await this.settleWorkContinuationMarker(resourceType, thread.executionId, openedAt)) result.settled += 1;\n }\n }\n return result;\n }\n\n /** One work of {@link sweepAbandonedWorkContinuations}: `entry` is its newest `workEvents` entry as LISTED, `PROCESSING`. */\n private async sweepOpenWorkContinuation(\n resourceType: CoreResourceType,\n thread: FlowActorExecution,\n entry: NonNullable<FlowActorExecution['workEvents']>[number],\n lease: TurnLivenessLease,\n ): Promise<OpenWorkContinuationSweepOutcome> {\n const { executionId } = thread;\n const workRef = entry.workRef;\n // A continuation that paused again ended its run by design: the work waits on its own decision, and an answer to it\n // releases a new continuation (a new lease, a newer instant), a withdrawal or a lapse ends it in the log.\n if (decisionWorkOfRow(thread, workRef).standing === ConversationalDecisionWorkStanding.WAITING) return OpenWorkContinuationSweepOutcome.WAITING;\n const leaseId = conversationalWorkLeaseId(executionId, workRef);\n if (await lease.isAlive(leaseId)) return OpenWorkContinuationSweepOutcome.STILL_ALIVE;\n const evidence = await lease.corroborateAbandonment(leaseId);\n if (!abandonmentEvidenceIsAVerdict(evidence)) {\n if (evidence === TurnLeaseAbandonmentEvidence.FIRST_ABSENCE) {\n this.logger.info('[ConversationalExecution] A running work has no lease and no record of ever having had one; left alone pending corroboration', {\n executionId, workRef,\n consequence: 'if the absence is still there next run the work is failed; if its process merely could not write, its next heartbeat clears this',\n });\n return OpenWorkContinuationSweepOutcome.AWAITING_CORROBORATION;\n }\n this.logger.warn('[ConversationalExecution] Could not establish why a running work has no lease; nothing was learned and nothing was recorded', {\n executionId, workRef, evidence,\n });\n return OpenWorkContinuationSweepOutcome.UNDETERMINED;\n }\n // The lease is gone, and a continuation lets it go only after its ending entry: whatever ended the work is on the row\n // NOW, so the decision is taken on a fresh read, never on the listing.\n let current: FlowActorExecution | null;\n try {\n current = await this.systemAccess.readAsSystem<FlowActorExecution>(resourceType, { executionId }, { suppressSystemAudit: true });\n } catch (error) {\n this.logger.warn('[ConversationalExecution] Could not re-read a thread before failing its abandoned work; left as it stands', {\n executionId, workRef, ...projectCaughtErrorLogFields(error),\n });\n return OpenWorkContinuationSweepOutcome.UNDETERMINED;\n }\n const newest = current ? latestWorkEventOf(current, workRef) : undefined;\n const currentOpenedAt = current?.workContinuationOpenedAt;\n if (!current || !newest || newest.status !== FlowsActors_Status.PROCESSING || new Date(newest.at).getTime() !== new Date(entry.at).getTime()\n || !currentOpenedAt) {\n this.logger.info('[ConversationalExecution] A work ended or started again between the listing and the repair; left as it stands', { executionId, workRef });\n return OpenWorkContinuationSweepOutcome.RACED;\n }\n if (decisionWorkOfRow(current, workRef).standing === ConversationalDecisionWorkStanding.WAITING) return OpenWorkContinuationSweepOutcome.WAITING;\n const recorded = await this.recordWorkEvent(resourceType, { executionId, workContinuationOpenedAt: currentOpenedAt }, workRef, TURN_INTERRUPTED_END);\n if (recorded === WorkEventRecording.NO_ROW) {\n this.logger.info('[ConversationalExecution] A continuation was released on the thread before an abandoned work could be failed; left as it stands', { executionId, workRef });\n return OpenWorkContinuationSweepOutcome.RACED;\n }\n if (recorded !== WorkEventRecording.LANDED) return OpenWorkContinuationSweepOutcome.UNDETERMINED;\n // The evidence rides the record of the repair, as for a turn: a run whose repairs are all `corroborated-absence` says\n // a process somewhere cannot write its leases.\n this.logger.info('[ConversationalExecution] Failed a work its continuation\\'s process abandoned', { executionId, workRef, systemRef: thread.systemRef, evidence });\n // The decision whose continuation died, when the row still says so exactly: its last resolved decision is this work's.\n // Another work's answer since then overwrote it, and then no decision is named rather than a wrong one.\n const decisionRef = current.lastResolvedDecisionWorkRef === workRef ? current.lastResolvedDecisionRef ?? undefined : undefined;\n this.auditTurnFailedBySystem(resourceType, current, ActorExecutionInterruptionCause.LEASE_LAPSED, decisionRef, workRef);\n return OpenWorkContinuationSweepOutcome.FAILED;\n }\n\n /**\n * Remove a thread's `workContinuationOpenedAt` once nothing on it may still be running (#2829), with a compare-and-swap on\n * the instant the listing read: a continuation released since wrote a newer one, and the thread stays selected. Answers\n * whether it was removed. Never throws: a removal that fails leaves the thread selected, which costs one more look.\n */\n private async settleWorkContinuationMarker(resourceType: CoreResourceType, executionId: string, openedAt: Date): Promise<boolean> {\n try {\n const settled = await this.repositoriesRegistry?.atomicGuardedMutation(resourceType, { executionId, workContinuationOpenedAt: openedAt }, {\n clear: ['workContinuationOpenedAt'],\n });\n return settled !== null && settled !== undefined;\n } catch (error) {\n this.logger.warn('[ConversationalExecution] Could not settle a thread\\'s released-continuation instant; it is looked at again next run', {\n executionId, ...projectCaughtErrorLogFields(error),\n });\n return false;\n }\n }\n\n /**\n * The audit row of a turn the ENGINE failed because no process runs it any more (#2800): the interrupted-turn sweep's\n * repair and a sole host's startup settle. The conversational sibling of the actor plane's\n * `ACTOR_EXECUTION_ABORTED_BY_SYSTEM`. Called only by the write that won the compare-and-swap on PROCESSING, so a turn\n * that ended between the listing and the write records nothing. The actor is the application. `row` is the row as\n * LISTED: the decision whose continuation the turn was ({@link continuingDecisionOfInterruptedTurn}), and, for an\n * organization's conversation, its tenant (the owner FK of that variant; a user's or the application's names none).\n *\n * The settle never puts a question back (it writes FAILED, and the decision stays answered), so it writes no\n * `HUMAN_DECISION_RESTORED`: the decision's RESOLVED row stands, and this row names it as the answer whose work did not\n * finish.\n *\n * Fire-and-forget like every audit row of this plane: the settle has landed, and a trail that could not be written\n * must not undo it or fail the sweep, so a failure is logged and the settle stands.\n */\n private async recordTurnFailedBySystem(\n resourceType: CoreResourceType,\n row: FlowActorExecution,\n cause: ActorExecutionAbandonmentCause,\n settledRow?: unknown,\n ): Promise<void> {\n const decisionRef = continuingDecisionOfInterruptedTurn(row);\n const workRef = decisionRef ? row.lastResolvedDecisionWorkRef ?? decisionRef : undefined;\n /*\n * #2829 review F1: the row's instants say this turn was the continuation of `decisionRef`'s work, but the WORK's own\n * log may already say it ended. The abandoned-work pass selects on the work's instant and this pass on the row's\n * `updatedAt`, so the work pass can act first: a continuation that died while an overlapping turn's write kept the\n * row PROCESSING (one crash killing both, or a re-pause whose write was never confirmed) is failed there, audited\n * there, and the row is left PROCESSING for this pass on a later run. Read off the row the write RETURNED, which is\n * the newest, else the listed one:\n * - newest entry FAILED: that death is on record already (its entry and its audit row), so nothing more is written.\n * Residual: when an overlapping fresh turn died in the same crash, its own death leaves no separate row; the\n * thread's failure is on the trail once.\n * - newest entry another ending (the work completed, was cancelled, …): the work ended by itself, so the turn that\n * died was not its continuation. Its failure is recorded without naming the work, and the work's ending stands.\n * - PROCESSING, or no entry: the work ran in this turn; it is ended here and audited as its continuation.\n */\n const ended = workRef ? latestWorkEventOf(isFlowActorExecutionRow(settledRow) ? settledRow : row, workRef) : undefined;\n if (workRef && ended && ended.status !== FlowsActors_Status.PROCESSING) {\n if (ended.status === FlowsActors_Status.FAILED) {\n this.logger.info('[ConversationalExecution] A failed turn\\'s work was already recorded failed by the abandoned-work pass; nothing more is recorded', {\n executionId: row.executionId, workRef, cause,\n });\n return;\n }\n this.auditTurnFailedBySystem(resourceType, row, cause, undefined, undefined);\n return;\n }\n this.auditTurnFailedBySystem(resourceType, row, cause, decisionRef, workRef);\n // #2821: a failed continuation ends its WORK, which is what a door holding that work reads (`workEvents`). Both\n // system settles reach here, and only by the write that won. Awaited by both (#2829), so the abandoned-work pass of\n // the same sweep reads the work ended rather than recording it a second time. Never throws.\n if (workRef) {\n await this.recordWorkEvent(resourceType, { executionId: row.executionId }, workRef, TURN_INTERRUPTED_END);\n }\n }\n\n /**\n * The `CONVERSATIONAL_TURN_FAILED_BY_SYSTEM` row of {@link recordTurnFailedBySystem}, and of a work the abandoned-work\n * pass failed (#2829), whose continuation was the turn. `decisionRef` is the decision the turn was continuing, when\n * known; `workRef` the work it continued (review F5), so the row names the work even once another work's answer has\n * moved the thread's last resolved decision. Fire-and-forget: never throws, and a failure is logged.\n */\n private auditTurnFailedBySystem(\n resourceType: CoreResourceType,\n row: FlowActorExecution,\n cause: ActorExecutionAbandonmentCause,\n decisionRef: string | undefined,\n workRef: string | undefined,\n ): void {\n if (!this.auditLogs) return;\n // The owner FK, read directly rather than through `ownerOfRow`: that resolves through `resolveOwnerVariant`, which\n // throws on a row missing its FK, and a fire-and-forget audit side effect must never throw into the settle.\n const organizationId = resourceType === CoreResourceType.ORGANIZATION_FLOW_ACTOR_EXECUTIONS\n ? (row as FlowActorExecution & { organizationId?: string }).organizationId\n : undefined;\n void this.auditLogs.logConversationalTurnFailedBySystem({\n executionId: row.executionId, systemRef: row.systemRef, cause,\n ...(decisionRef ? { decisionRef } : {}),\n ...(workRef ? { workRef } : {}),\n ...(organizationId ? { organizationId } : {}),\n }).catch((error: unknown) => this.logger.warn('[ConversationalExecution] A turn the engine failed could not be recorded; the failure stands', {\n executionId: row.executionId, cause, ...projectCaughtErrorLogFields(error),\n }));\n }\n\n /**\n * Where the work a human decision paused stands now ({@link decisionWorkOfRow}), or `undefined` when the caller's\n * filter matches no row or the row cannot be read.\n *\n * Exists for the A2A task plane, which projects a paused task from the conversation it wraps. When a turn suspends for\n * approval the task is materialised at `input-required`, and NOTHING advances that task when the decision arrives: the\n * resume happens over whichever door took the answer, which knows the execution and not the task. Without this seam the\n * task reports `input-required` forever, for work that finished — and, worse, stays cancellable, because the cancel\n * path compare-and-swaps on the STORED status.\n *\n * Asked by WORK — named by its first decision — not by thread (#2821). It used to answer the execution's status, which is whichever turn of the\n * thread ran last: a task that paused, was approved and finished read as the PROCESSING of a later task's turn in the\n * same thread, so a late cancel of it was recorded and stopped that other task's work.\n *\n * Read through the SAME isolation axes as every other read of this family (owner FK, machine credential, agent\n * instance). The caller has already proved it owns the TASK; that does not license an unfiltered read of the\n * execution, and answering `undefined` on a mismatch keeps not-found and not-yours indistinguishable exactly as the\n * rest of this plane does. The credential is the one the caller's work was opened under (the task row records it), so\n * a machine client's task reads its own conversation rather than the user-delegated sentinel's.\n *\n * Deliberately answers a STANDING, never the row: a richer projection would tempt the transport into reading the\n * transcript, which is the prompt text this plane's isolation rules exist to protect.\n */\n public async readDecisionWork(params: {\n readonly executionId: string;\n /** The caller's work, named by the first decision it paused on. */\n readonly workRef: string;\n readonly scopeContext: ConversationalOwnerScope;\n /** The machine credential the work was opened under; absent for a user-delegated turn. */\n readonly machineCredentialId?: string;\n readonly resourceServerInstanceRef?: string;\n }): Promise<ConversationalDecisionWork | undefined> {\n let owner: ResolvedOwnerVariant;\n try {\n owner = this.resolveOwnerVariant(params.scopeContext);\n } catch {\n return undefined;\n }\n\n try {\n const row = await this.systemAccess.readAsSystem<FlowActorExecution>(\n owner.resourceType,\n {\n executionId: params.executionId,\n ...owner.ownerFields,\n machineCredentialId: params.machineCredentialId ?? FLOWS_ACTORS_NO_MACHINE_CREDENTIAL,\n resourceServerInstanceRef: agentInstanceOf(params.resourceServerInstanceRef),\n },\n { scopeContext: owner.scopeContext },\n );\n return row ? decisionWorkOfRow(row, params.workRef) : undefined;\n } catch (error) {\n // A read that throws must not take down the task read that asked. The caller falls back to\n // the stored task status, which is the pre-existing behaviour — degraded, never broken.\n this.logger.warn('[ConversationalExecution] Could not read where a decision\\'s work stands for a task projection', {\n executionId: params.executionId, workRef: params.workRef, ...projectCaughtErrorLogFields(error),\n });\n return undefined;\n }\n }\n\n /**\n * The WebSocket answer door (#1594): resolves the decision the answer names and hands it to\n * `answerPendingDecision`, the one method every door reaches.\n *\n * `decisionRef` is the key when the client echoes it. A client that does not yet send it is resolved\n * from `executionId` + `approvalId`, read AS THE SYSTEM across the three owner variants: who may answer\n * is the predicate's decision, never the result of filtering by the answerer's own scope — that filter\n * is what made a reviewer's answer on someone else's conversation match nothing and vanish (I2).\n */\n public async respondToApproval(params: {\n systemRef: string;\n executionId: string;\n approvalId: string;\n decisionRef?: string;\n approved: boolean;\n auth?: SocketAuthResult;\n reason?: string;\n /** #1599: a reason code of the application's declared vocabulary. */\n reasonCode?: string;\n /** Back to the person answering: refusals, and the acknowledgement. */\n emitter?: FlowsActorsExecutionEmitter;\n /** The resumed turn's stream goes to the conversation OWNER's room, which may not be the answerer's. */\n ownerEmitterFor?: (owner: ConversationalOwnerScope) => FlowsActorsExecutionEmitter | undefined;\n /**\n * APPROVE-WITH-MODIFICATIONS (#566): arguments the approver authored, replacing the model's.\n *\n * Honoured only on an APPROVAL. On a denial there is no call to run, so arguments attached to\n * one are meaningless rather than dangerous — they are ignored, silently, because refusing a\n * denial over a field that cannot affect anything would block the one decision that must always\n * be available.\n */\n modifiedToolArgs?: Record<string, unknown>;\n /** #2720: the answer to a paused QUESTION, which is settled by this and not by `approved`. */\n answer?: HumanDecision_Answer;\n /** #2903: the presentation the page answered on, from the announcement. */\n presentationId?: string;\n /**\n * #2903: set by the socket door, which carries answers from a page the engine rendered: an answer that echoes no\n * presentation is then refused before anything is read. An in-process caller leaves it unset, and its answer is\n * bound to what the engine built and sent.\n */\n presentationEchoRequired?: boolean;\n }): Promise<void> {\n if (params.presentationEchoRequired === true && params.presentationId === undefined) {\n this.logger.info('[ConversationalExecution] An answer through the conversation did not echo the presentation it was given on; refusing', {\n systemRef: params.systemRef, executionId: params.executionId,\n });\n if (params.emitter) {\n this.emitError(params.emitter, params.systemRef, params.executionId, FlowsActors_ExecutionErrorCode.DECISION_PRESENTATION_STALE, 'This answer did not name what it was given on; open the conversation again to answer the decision as it is now.', true);\n }\n return;\n }\n const decisionRef = params.decisionRef ?? await this.decisionRefOfPause(params.executionId, params.approvalId);\n if (!decisionRef) {\n this.logger.info('[ConversationalExecution] No routed decision matches this response', { systemRef: params.systemRef, executionId: params.executionId, approvalId: params.approvalId });\n this.refuseDecisionAttempt(params.emitter, params.systemRef, params.executionId);\n return;\n }\n await this.answerPendingDecision({\n decisionRef,\n actorAuth: params.auth,\n approved: params.approved,\n reason: params.reason,\n ...(params.reasonCode !== undefined ? { reasonCode: params.reasonCode } : {}),\n modifiedToolArgs: params.modifiedToolArgs,\n ...(params.answer ? { answer: params.answer } : {}),\n expectedApprovalId: params.approvalId,\n ...(params.presentationId !== undefined ? { presentationId: params.presentationId } : {}),\n emitter: params.emitter,\n ownerEmitterFor: params.ownerEmitterFor,\n // #2797: a socket proves only what its session already satisfied; it has no step-up channel.\n actingSession: actingSessionOfConnection(params.auth),\n });\n }\n\n /** The routed decision a paused turn carries, found by its execution and the SDK's approval id. */\n private async decisionRefOfPause(executionId: string, approvalId: string): Promise<string | undefined> {\n for (const resourceType of FLOW_ACTOR_EXECUTION_OWNER_VARIANTS) {\n const row = await this.systemAccess.readAsSystem<FlowActorExecution>(resourceType, { executionId }, { suppressSystemAudit: true }).catch(() => null);\n if (!row?.pendingDecisionRef || !row.pausedApproval) continue;\n try {\n if (parseFlowActorPausedApproval(row.pausedApproval).approvalId === approvalId) return row.pendingDecisionRef;\n } catch {\n return undefined;\n }\n }\n return undefined;\n }\n\n /** The row holding a decision, read by its id ALONE — never filtered by who is asking (#1594 I2). */\n private async findPendingDecision(decisionRef: string): Promise<{ resourceType: CoreResourceType; row: FlowActorExecution } | undefined> {\n for (const resourceType of FLOW_ACTOR_EXECUTION_OWNER_VARIANTS) {\n const row = await this.systemAccess.readAsSystem<FlowActorExecution>(resourceType, { pendingDecisionRef: decisionRef }, { suppressSystemAudit: true }).catch(() => null);\n if (row) return { resourceType, row };\n }\n return undefined;\n }\n\n /** The conversation's owner, read from the ROW — the owner filter for every write that follows comes from here. */\n private ownerOfRow(resourceType: CoreResourceType, row: FlowActorExecution): ResolvedOwnerVariant {\n const fields = row as unknown as { userId?: string; organizationId?: string; applicationId?: string };\n switch (resourceType) {\n case CoreResourceType.USER_FLOW_ACTOR_EXECUTIONS: return this.resolveOwnerVariant({ userId: fields.userId } as ConversationalOwnerScope);\n case CoreResourceType.ORGANIZATION_FLOW_ACTOR_EXECUTIONS: return this.resolveOwnerVariant({ organizationId: fields.organizationId } as ConversationalOwnerScope);\n default: return this.resolveOwnerVariant({ applicationId: fields.applicationId } as ConversationalOwnerScope);\n }\n }\n\n /**\n * \"You cannot answer this decision\" — ONE answer for a decision that does not exist, that was already\n * settled, or whose route does not admit the person: saying which would disclose that a decision exists.\n */\n private refuseDecisionAttempt(emitter: FlowsActorsExecutionEmitter | undefined, systemRef: string, executionId: string): void {\n if (!emitter) return;\n this.emitError(emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.DECISION_NOT_ANSWERABLE, 'This decision cannot be answered by you, or it has already been settled.');\n }\n\n /**\n * Answer a pending decision, and resume its turn under the REQUESTER's current authority (#1594).\n *\n * The one method every answer door reaches. In order, and the order is the design:\n *\n * 1. **Read by `decisionRef` alone.** The owner fields, the machine credential and the agent instance\n * every later write filters on come from the ROW (I2); the answerer only supplies who they are.\n * 2. **Authorize with the one predicate**, role facts resolved now in the decision's organization. A\n * refusal leaves the decision exactly as it was and records HUMAN_DECISION_ANSWER_REFUSED.\n * 3. **A lapsed decision is refused** and ended LAPSED, naming the late answerer.\n * 4. **An edited call is validated** while the pause still stands, so a refused edit costs a message.\n * 5. **Rebuild the requester's authority.** If it no longer holds, the decision ends\n * REQUESTER_AUTHORITY_LAPSED: no tool runs and no model turn starts (I6).\n * 6. **Service consent is checked for the REQUESTER**, whose transcript the resumed turn writes.\n * **An approved call must be able to run** (#3313): what would end the resume is asked here, so nothing is recorded as\n * accepted that was bound not to run.\n * 7. **Release** with a compare-and-swap on status, blob, decision id and `routeVersion` (I5), writing\n * the resolution in the same write (I4). A reassignment that landed first makes this match nothing.\n * A THROWN write fails closed (I7): the row is re-read, and only a recorded release by this person\n * resumes.\n * 8. **The winner records RESOLVED** (I9), then the turn resumes under the rebuilt requester authority;\n * the reviewer's authority never reaches the agent.\n */\n public async answerPendingDecision(params: {\n decisionRef: string;\n actorAuth: SocketAuthResult | undefined;\n /** The verdict on a tool approval. Absent when the door carried an answer naming options of its own (#2720). */\n approved?: boolean;\n /** #2720: the answer to a paused QUESTION: what settles one, and the only thing that does. */\n answer?: HumanDecision_Answer;\n reason?: string;\n /** #1599: a reason code of the application's declared vocabulary; an undeclared one is refused before anything moves. */\n reasonCode?: string;\n modifiedToolArgs?: Record<string, unknown>;\n /** The SDK approval id a legacy door echoed; a mismatch is refused. */\n expectedApprovalId?: string;\n /**\n * #2903: the presentation the answer was given on, echoed by a door that renders the decision. Checked against the\n * row once the route admitted the person: a mismatch is refused as stale. Absent, the door sent the decision where it\n * cannot watch it render (a chat card), and the seal records what was sent.\n */\n presentationId?: string;\n /** #2903 review F2: what the chat card the answer came from carried, set only by the engine's inbound door. */\n sentCardContent?: HumanDecision_SentCardContent;\n emitter?: FlowsActorsExecutionEmitter;\n ownerEmitterFor?: (owner: ConversationalOwnerScope) => FlowsActorsExecutionEmitter | undefined;\n /**\n * Return as soon as the decision is released, and let the resumed turn run on. A request/response door\n * (REST) answers the person who acted; the turn's own stream goes to the owner's room. The socket door\n * leaves it unset and awaits, which is what its tests observe.\n */\n detachResume?: boolean;\n /** #2664: the chat delivery the answer arrived through, set only by the engine's inbound door. */\n answeredThrough?: HumanDecision_AnsweredThrough;\n /**\n * #2664: the one organization the answering door is scoped to (a chat delivery's). A decision routed in any other\n * organization, or in none, is refused before the predicate runs. Set only by the engine's inbound door.\n */\n confinedToOrganizationId?: string;\n /**\n * #2797: what the answering door can prove to a granting organization's authentication policy. A door that states\n * none is held as having no session, the strictest reading.\n */\n actingSession?: ActingSession;\n }): Promise<HumanDecision_ActOutcome> {\n const { decisionRef } = params;\n const found = await this.findPendingDecision(decisionRef);\n if (!found || found.row.status !== FlowsActors_Status.AWAITING_APPROVAL || !found.row.pausedApproval) {\n this.logger.info('[ConversationalExecution] No pending decision matches this answer', { decisionRef });\n this.refuseDecisionAttempt(params.emitter, found?.row.systemRef ?? '', found?.row.executionId ?? '');\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE };\n }\n const { resourceType, row } = found;\n const systemRef = row.systemRef;\n const executionId = row.executionId;\n const rawPausedApproval = row.pausedApproval as string;\n const route = humanDecisionRouteOfRow(row);\n const requester = humanDecisionRequesterOfRow(row);\n if (!route || !requester) {\n this.logger.warn('[ConversationalExecution] A paused turn carries a decision id but no route; refusing the answer', { systemRef, executionId, decisionRef });\n this.refuseDecisionAttempt(params.emitter, systemRef, executionId);\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE };\n }\n\n let paused: FlowActorExecution_PausedApproval;\n try {\n paused = parseFlowActorPausedApproval(rawPausedApproval);\n } catch (parseError) {\n // A corrupted blob fails LOUDLY rather than resuming from garbage — the parse helper's own\n // contract. Resuming from a partial message array would replay a different conversation.\n this.logger.error('[ConversationalExecution] Paused-approval state is unreadable; refusing to resume', {\n systemRef, executionId, decisionRef, ...projectCaughtErrorLogFields(parseError),\n });\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE };\n }\n if (params.expectedApprovalId && paused.approvalId !== params.expectedApprovalId) {\n this.logger.warn('[ConversationalExecution] Answer does not match the pending request; refusing', {\n systemRef, executionId, pendingApprovalId: paused.approvalId, respondedApprovalId: params.expectedApprovalId,\n });\n this.refuseDecisionAttempt(params.emitter, systemRef, executionId);\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE };\n }\n\n const owner = this.ownerOfRow(resourceType, row);\n const answererUserId = params.actorAuth?.initiatorIds?.userId;\n const refusalBase = {\n decisionRef, executionId, plane: HumanDecision_Plane.CONVERSATIONAL, systemRef, toolName: paused.pendingToolName,\n routeKind: route.kind,\n ...(route.eligibleRole ? { routeEligibleRole: route.eligibleRole } : {}),\n ...(route.requiredQualificationKinds?.length ? { routeRequiredQualificationKinds: [...route.requiredQualificationKinds] } : {}),\n ...(route.organizationId ? { organizationId: route.organizationId } : {}),\n // #2811: an answer refused from a chat names the delivery it came through, as the RESOLVED row does, beside the person.\n ...(answererUserId && params.answeredThrough ? answeredThroughRefusalFields(params.answeredThrough) : {}),\n };\n\n // ── 1b. A door scoped to one organization reaches only that organization's decisions (#2664) ──\n //\n // A chat delivery acts as the member its account is linked to in the delivery's organization. That member may also\n // answer decisions elsewhere, and the predicate below would admit them there, by the user alone. The chat proves\n // nothing about the other organization, so its decisions are not reachable from it.\n // assurance-control: WILDO.DATA.TENANT_ISOLATION — an answer through an organization-scoped door reaches only that organization's decisions; any other is refused and recorded.\n if (params.confinedToOrganizationId !== undefined && route.organizationId !== params.confinedToOrganizationId) {\n this.logger.warn('[ConversationalExecution] An answer through an organization-scoped door named a decision outside that organization; refused', {\n systemRef, executionId, decisionRef,\n });\n if (this.auditLogs) {\n void this.auditLogs.logHumanDecisionAnswerRefused({\n ...refusalBase, act: HumanDecision_Act.ANSWER, reason: HumanDecision_RefusalReason.OUTSIDE_THE_DELIVERY_ORGANIZATION,\n ...(answererUserId ? { attemptedByUserId: answererUserId } : {}),\n }, params.actorAuth ? this.auditContextFor(params.actorAuth, owner) : undefined).catch(() => undefined);\n }\n this.refuseDecisionAttempt(params.emitter, systemRef, executionId);\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE };\n }\n\n // ── 2. The one predicate ────────────────────────────────────────────────\n const roleFacts = answererUserId && isReviewerRoute(route)\n ? await resolveHumanDecisionRoleFacts(this.humanDecisionRoleFactsPorts(), { userId: answererUserId, route, requester, subject: this.decisionSubjectOfRow(row) })\n : NO_HUMAN_DECISION_ROLE_FACTS;\n const verdict = authorizeHumanDecisionActor({\n actor: { executionType: params.actorAuth?.executionType ?? ExecutionContext_ExecutionType.PUBLIC_EXECUTION, userId: answererUserId },\n roleFacts, route, requester, act: HumanDecision_Act.ANSWER,\n });\n if (verdict.kind === HumanDecision_VerdictKind.REFUSED) {\n this.logger.info('[ConversationalExecution] An answer was refused by the decision\\'s route', { systemRef, executionId, decisionRef, reason: verdict.reason });\n if (this.auditLogs) {\n void this.auditLogs.logHumanDecisionAnswerRefused({\n ...refusalBase, act: HumanDecision_Act.ANSWER, reason: verdict.reason,\n ...(answererUserId ? { attemptedByUserId: answererUserId } : {}),\n }, params.actorAuth ? this.auditContextFor(params.actorAuth, owner) : undefined).catch(() => undefined);\n }\n this.refuseDecisionAttempt(params.emitter, systemRef, executionId);\n // No reason to the caller: naming why would tell someone the decision was not routed to that it exists.\n // The reason is on the ANSWER_REFUSED row.\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE };\n }\n\n // ── 2'a. Decided by the person in their own name (#2923) ──────────────\n //\n // A tool approval is a REVIEW of what the agent proposed, which commits the person: it is never answered through a\n // client they delegated to (an MCP or A2A client acting for them). A question asks for information (an ANSWER), which\n // such a client may give. The same rule operation approvals apply, through the same predicate. After the predicate\n // admitted them, so naming the reason discloses nothing.\n // assurance-control: WILDO.AI.HUMAN_OVERSIGHT — an agent's proposed action is approved or refused by the person in their own name, never by a client acting for them\n const answerMeaning = this.pausedCallAsksThePerson(systemRef, paused.pendingToolName) ? ApprovalSealMeaning.ANSWER : ApprovalSealMeaning.REVIEW;\n if (params.actorAuth && !humanDecisionDeciderMayDecideMeaning(answerMeaning, humanDecisionDeciderRecordOfActor(params.actorAuth))) {\n this.logger.info('[ConversationalExecution] A tool approval was answered through a client the person delegated to; refused', { systemRef, executionId, decisionRef });\n if (this.auditLogs) {\n void this.auditLogs.logHumanDecisionAnswerRefused({\n ...refusalBase, act: HumanDecision_Act.ANSWER, reason: HumanDecision_RefusalReason.DECIDER_NOT_IN_PERSON,\n ...(answererUserId ? { attemptedByUserId: answererUserId } : {}),\n }, this.auditContextFor(params.actorAuth, owner)).catch(() => undefined);\n }\n this.refuseDecisionAttempt(params.emitter, systemRef, executionId);\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE, reason: HumanDecision_RefusalReason.DECIDER_NOT_IN_PERSON };\n }\n // #2923: and through a channel the call was paused under, when its gate names them (a chat card for a call answered\n // only in the application is given its address there by the chat door).\n // assurance-control: WILDO.AI.HUMAN_OVERSIGHT — an agent's call is answered only through a channel its gate admits\n if (params.actorAuth && !humanDecisionAnswerChannelAdmitted(paused.answerChannels, humanDecisionDeciderRecordOfActor(params.actorAuth))) {\n if (this.auditLogs) {\n void this.auditLogs.logHumanDecisionAnswerRefused({\n ...refusalBase, act: HumanDecision_Act.ANSWER, reason: HumanDecision_RefusalReason.ANSWER_CHANNEL_NOT_ADMITTED,\n ...(answererUserId ? { attemptedByUserId: answererUserId } : {}),\n }, this.auditContextFor(params.actorAuth, owner)).catch(() => undefined);\n }\n this.refuseDecisionAttempt(params.emitter, systemRef, executionId);\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE, reason: HumanDecision_RefusalReason.ANSWER_CHANNEL_NOT_ADMITTED };\n }\n\n // ── 2'. A decision that requires a step-up is answered with a proof bound to it (#2923) ──\n //\n // Declared on the gated tool (`humanApproval.requiresStepUpAuthentication` / `stepUp`), the same declaration and the same\n // check an operation approval has. Read BEFORE the granting organization's policy, which may consume the same token, and\n // consumed only at a settle (`consumeDecisionStepUp` below), so an answer this door then refuses while the pause stands\n // (an edit, a reason code, the requester's consent) costs the person no proof. After the predicate admitted them, so\n // naming the reason discloses nothing. A socket or chat answer carries no proof and is refused here.\n // assurance-control: WILDO.IDENTITY.STEP_UP_AUTHENTICATION — a gated tool call or an agent's question that requires a step-up is answered only with a fresh, single-use proof bound to it and to the presentation answered, as fresh and as strong as the gate declares\n const decisionStepUp = await checkDecisionStepUp(this.consumableTokens, {\n // #2923: what the call was paused under, kept in its pause, never the gate as it is declared now.\n requirement: paused.stepUp,\n session: params.actingSession, userId: answererUserId, decisionRef, presentationId: params.presentationId,\n });\n const refuseForStepUp = (): HumanDecision_ActOutcome => {\n this.logger.info('[ConversationalExecution] An answer carried no step-up proof this decision accepts; refused', { systemRef, executionId, decisionRef });\n if (this.auditLogs) {\n void this.auditLogs.logHumanDecisionAnswerRefused({\n ...refusalBase, act: HumanDecision_Act.ANSWER, reason: HumanDecision_RefusalReason.DECISION_STEP_UP_REQUIRED,\n ...(answererUserId ? { attemptedByUserId: answererUserId } : {}),\n }, params.actorAuth ? this.auditContextFor(params.actorAuth, owner) : undefined).catch(() => undefined);\n }\n // Its own code, not the generic refusal: the person was admitted, the decision still waits, and the remedy (the inbox,\n // which proves a factor first) is theirs to know.\n if (params.emitter) {\n this.emitError(params.emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.DECISION_STEP_UP_REQUIRED,\n 'This decision asks you to confirm it is you before answering; answer it from your decisions inbox.', true);\n }\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE, reason: HumanDecision_RefusalReason.DECISION_STEP_UP_REQUIRED };\n };\n if (decisionStepUp !== undefined && decisionStepUp.kind !== DecisionStepUpProofKind.VALID) return refuseForStepUp();\n const validStepUp = decisionStepUp?.kind === DecisionStepUpProofKind.VALID ? decisionStepUp : undefined;\n\n // ── 2a. A representative is held to the granting organization's authentication policy (#2797) ──\n //\n // The predicate read their roles through a rebuild that carries no policy, and this door built no context for the\n // decision's organization. After the predicate admitted them, so naming the reason discloses nothing.\n const held = await this.holdToGrantingOrganization({ decisionRef, userId: answererUserId, organizationId: route.organizationId, session: params.actingSession });\n if (held.kind === HumanDecisionGrantorHoldKind.REFUSED) {\n if (this.auditLogs) {\n void this.auditLogs.logHumanDecisionAnswerRefused({\n ...refusalBase, act: HumanDecision_Act.ANSWER, reason: held.reason,\n ...(answererUserId ? { attemptedByUserId: answererUserId } : {}),\n }, params.actorAuth ? this.auditContextFor(params.actorAuth, owner) : undefined).catch(() => undefined);\n }\n // An HTTP act is answered as a request into the organization would be: a step-up its frontend answers and replays.\n if (held.refusal) throw held.refusal;\n this.refuseDecisionAttempt(params.emitter, systemRef, executionId);\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE, reason: held.reason };\n }\n /**\n * #2923: the bound proof is used once, at the settle. The granting organization's policy consumed it when it asked for\n * a factor; otherwise it is consumed here, and a proof another act consumed meanwhile is a replay. `true` when there\n * is nothing to consume.\n */\n const consumeDecisionStepUp = async (): Promise<boolean> => !validStepUp || !!held.stepUpMethod || consumeDecisionStepUpProof(this.consumableTokens!, validStepUp);\n /** #2905, #2923: the factor the act consumed and, for the decision's own proof, when it was proven. */\n const deciderOf = (actorAuth: SocketAuthResult) => humanDecisionDeciderRecordOfActor(actorAuth, deciderStepUpEvidenceOf(held.stepUpMethod, validStepUp));\n\n // ── 2b. A QUESTION is answered, never approved (#2720) ─────────────────\n //\n // An agent's question (`askPersonTool`) is settled by the person's answer: their values, checked by the form they\n // were asked through, become the call's `answers`, or they decline and the agent is told to decide. A bare approve\n // would run the tool on answers the MODEL wrote, so a door that sends one is refused, and so is an answer the form\n // refuses. A tool approval is settled by its verdict, as before.\n const question = this.pausedQuestionOf(systemRef, {\n decisionRef, toolName: paused.pendingToolName, toolArgs: paused.pendingToolArgs as Record<string, unknown> | undefined,\n questionForm: paused.questionForm, requestedAt: paused.requestedAt, ...(paused.expiresAt ? { expiresAt: paused.expiresAt } : {}),\n });\n\n // ── 2c. What the person was shown is what the decision is (#2903) ──────\n //\n // Rebuilt from the row, as the card and the announcement build it, and compared with the presentation the door echoed.\n // After the predicate admitted them, so saying it changed discloses nothing. A file deliverable is bound again here,\n // from the file as it is now (#2904): a card shown before its recorded hash changed carries another id, and is stale.\n // #2914: so is the record the call acts on, from the row as it is now: a card read before one of its sealed values\n // changed carries another id, and is stale.\n const deliverable = await this.decisionPresentationBindingsOf(systemRef, {\n decisionRef, toolName: paused.pendingToolName, toolArgs: paused.pendingToolArgs as Record<string, unknown> | undefined,\n ...(route.organizationId ? { organizationId: route.organizationId } : {}),\n });\n const presentationCheck = acknowledgeDecisionPresentation({\n source: {\n decisionRef, plane: HumanDecision_Plane.CONVERSATIONAL, toolName: paused.pendingToolName,\n toolArgs: (paused.pendingToolArgs ?? {}) as Record<string, unknown>, ...(question ? { request: question } : {}),\n ...(deliverable.deliverables ? { deliverables: deliverable.deliverables } : {}),\n ...(deliverable.subjectRecord ? { subjectRecord: deliverable.subjectRecord } : {}),\n },\n ...(params.presentationId !== undefined ? { echoedPresentationId: params.presentationId } : {}),\n ...(params.sentCardContent !== undefined ? { sentCardContent: params.sentCardContent } : {}),\n key: decisionPresentationKeyOfRuntime(this.appConfig),\n });\n if (presentationCheck.kind === DecisionPresentationCheckKind.STALE) {\n this.logger.info('[ConversationalExecution] An answer echoed a presentation that is not the decision\\'s now; refusing', { systemRef, executionId, decisionRef });\n if (params.emitter) {\n this.emitError(params.emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.DECISION_PRESENTATION_STALE, 'This decision changed since it was shown; open the conversation again to answer it as it is now.', true);\n }\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE, reason: HumanDecision_RefusalReason.PRESENTATION_STALE };\n }\n\n let approved: boolean;\n let modifiedToolArgs = params.modifiedToolArgs;\n let reason = params.reason;\n if (question) {\n const settled = this.settleQuestionAnswer(question, params.answer, paused, params.reason,\n this.pausedQuestionTool(systemRef, paused.pendingToolName)?.questionDeclinedReason ?? ASK_PERSON_DECLINED_REASON);\n if (!settled) {\n this.logger.info('[ConversationalExecution] A paused question was answered without an answer its form accepts; refusing', { systemRef, executionId, decisionRef });\n this.refuseDecisionAttempt(params.emitter, systemRef, executionId);\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE };\n }\n ({ approved, modifiedToolArgs, reason } = settled);\n } else {\n if (params.approved === undefined) {\n this.refuseDecisionAttempt(params.emitter, systemRef, executionId);\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE };\n }\n approved = params.approved;\n if (!approved && !reason) reason = CALL_REFUSED_BY_A_PERSON_REASON;\n }\n\n // ── 3. A lapsed decision is refused, and ended ──────────────────────────\n //\n // #465: honouring a decision on a tool call raised days ago would execute it against a conversation,\n // a world and an intent that have all moved on. The guard at USE; the unattended half is the sweep.\n if (isFlowActorPausedApprovalLapsed(paused, new Date())) {\n this.logger.warn('[ConversationalExecution] A decision was answered after it lapsed; refusing and ending it', {\n systemRef, executionId, decisionRef, expiresAt: paused.expiresAt, toolName: paused.pendingToolName,\n });\n const lapsedAt = new Date();\n const endedOn = await this.endPendingDecision({\n resourceType, executionId, rawPausedApproval, decisionRef,\n outcome: HumanDecision_Outcome.LAPSED, toolName: paused.pendingToolName,\n scopeContext: owner.scopeContext, row, decidedAt: lapsedAt,\n }).catch((error: unknown) => {\n this.logger.error('[ConversationalExecution] Could not end a lapsed decision', { systemRef, executionId, ...projectCaughtErrorLogFields(error) });\n return null;\n });\n if (endedOn) {\n this.recordDecisionResolved({ row: endedOn, requester: humanDecisionRequesterOfRow(endedOn), outcome: HumanDecision_Outcome.LAPSED, toolName: paused.pendingToolName, lateDecisionUserId: answererUserId });\n await this.recordAgentWorkSettlement({\n resourceType, row: endedOn, decisionRef, outcome: HumanDecision_Outcome.LAPSED, decidedAt: lapsedAt, paused, toolName: paused.pendingToolName,\n });\n }\n this.refuseDecisionAttempt(params.emitter, systemRef, executionId);\n return { kind: HumanDecision_ActOutcomeKind.LAPSED };\n }\n\n // #2292: the paused turn's personal-data view, read from the row with the decision: an approver's edit is tokenized\n // through its table, and the resume continues on it.\n const answerPersonalData = this.personalDataViewOfPausedTurn(systemRef, paused.pendingToolName, row, paused);\n\n // ── 4. An edited call is validated while the pause stands ───────────────\n let modifiedResume: PreparedToolCallModification | undefined;\n if (approved && modifiedToolArgs) {\n const prepared = await this.prepareApprovedToolCallModification({\n systemRef, executionId, paused, modifiedToolArgs,\n // #3192: an answer to a question rewrites the call too, but overrules nothing: the agent asked for it.\n reviewerEdited: !question,\n ...(answerPersonalData ? { personalData: answerPersonalData } : {}),\n });\n if (prepared.kind === ToolApprovalModificationOutcomeKind.REFUSED) {\n this.logger.warn('[ConversationalExecution] Refusing an approval whose modified arguments could not be applied; the pause stands', {\n systemRef, executionId, decisionRef, toolName: paused.pendingToolName, reason: prepared.message,\n });\n if (params.emitter) {\n // `recoverable: true` — the decision is still pending and still answerable.\n this.emitError(params.emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.APPROVAL_MODIFICATION_REJECTED, prepared.message, true, prepared.refusal);\n }\n return this.refusedOutcomeOf(prepared);\n }\n modifiedResume = prepared.kind === ToolApprovalModificationOutcomeKind.MODIFIED ? prepared.modification : undefined;\n\n // #2904: the file a person approves is the file they were shown, bound by its bytes. An edit that names another file\n // would approve something nobody was shown, so it is refused, for every approver; approving as proposed stays open.\n const deliverableArgument = question ? undefined : this.deliverableFileArgumentOf(systemRef, paused.pendingToolName);\n if (modifiedResume && deliverableArgument && modifiedResume.modifiedArgumentKeys.includes(deliverableArgument)) {\n const refused = this.callCannotRunRefusal(\n `The file this call to \"${paused.pendingToolName}\" is about cannot be changed in an approval: approve the file you were shown, or deny the call.`,\n { reason: FlowsActors_ApprovalModificationRefusalReason.DELIVERABLE_FILE_NOT_EDITABLE, toolName: paused.pendingToolName, argumentPaths: [deliverableArgument] },\n HumanDecision_RefusalReason.DELIVERABLE_FILE_EDITED,\n );\n this.logger.info('[ConversationalExecution] An approval edited the call\\'s file deliverable; refusing, the pause stands', {\n systemRef, executionId, decisionRef, toolName: paused.pendingToolName, argument: deliverableArgument,\n });\n if (params.emitter) this.emitError(params.emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.APPROVAL_MODIFICATION_REJECTED, refused.message, true, refused.refusal);\n return this.refusedOutcomeOf(refused);\n }\n\n // #2734: an edit can point the call at another record, and the call then runs under the REQUESTER's authority,\n // which may reach a record the answerer's relationship never could. So the edited call is held to the card's rule,\n // for an answerer standing in the organization only through a relationship (the organization's own staff edit as\n // before):\n // - its row is judged like the card's record, and a row edited into something that names no record is refused,\n // since nothing can then say whose record the call reaches (review A3);\n // - an argument that names another record (a declared foreign key, at any depth, on the tool's or the resource's\n // schemas) may not be changed: the engine cannot place it;\n // - an edit it cannot judge (the tool's resource can no longer be read) is refused, naming the arguments changed.\n // An edit that resolved to the proposed arguments (UNCHANGED) runs the call as proposed, which the answerer may\n // answer, so nothing is checked. Refused like any other edit the server will not apply: the pause stands, the\n // approver is told why on every door (the outcome's reason for the REST inbox, the error payload for the socket\n // card), and answering as proposed stays open. Recorded with its own reason.\n if (answererUserId && isReviewerRoute(route) && modifiedResume) {\n const changedArgumentKeys = modifiedResume.modifiedArgumentKeys;\n const rowIdArgument = this.decisionRowIdArgumentOf(systemRef, paused.pendingToolName);\n // Read once, and fail closed (review F1): only roles read now holding an own entry make the answerer the\n // organization's own staff. A read that lapses or finds no entry holds the edit to the relationship rule.\n let standsOnlyThroughRelationship: boolean | undefined;\n const answersOnlyThroughRelationship = async (): Promise<boolean> => {\n if (standsOnlyThroughRelationship === undefined) {\n // A reviewer route naming no organization is refused before this (ROUTE_HAS_NO_ORGANIZATION); read as\n // relationship-only here too, so this check never admits on an absent organization (review N2).\n standsOnlyThroughRelationship = route.organizationId === undefined || !answersAsOrganizationOwnStaff(\n await this.humanDecisionRoleFactsPorts().currentRolesIn(answererUserId, route.organizationId), route.organizationId,\n );\n }\n return standsOnlyThroughRelationship;\n };\n const cardSubject = this.decisionSubjectOfCall(systemRef, paused.pendingToolName, paused.pendingToolArgs as Record<string, unknown> | undefined);\n const editedSubject = this.decisionSubjectOfCall(systemRef, paused.pendingToolName, modifiedToolArgs);\n // The arguments to name when the edit is refused; `undefined` while it is admitted.\n let refusedArguments: readonly string[] | undefined;\n if (editedSubject.kind === HumanDecisionSubjectKind.RECORD) {\n const verdict = authorizeHumanDecisionActor({\n actor: { executionType: params.actorAuth?.executionType ?? ExecutionContext_ExecutionType.PUBLIC_EXECUTION, userId: answererUserId },\n roleFacts: await resolveHumanDecisionRoleFacts(this.humanDecisionRoleFactsPorts(), { userId: answererUserId, route, requester, subject: editedSubject }),\n route, requester, act: HumanDecision_Act.ANSWER,\n });\n if (verdict.kind === HumanDecision_VerdictKind.REFUSED) refusedArguments = rowIdArgument ? [rowIdArgument] : [];\n } else if (cardSubject.kind === HumanDecisionSubjectKind.RECORD && await answersOnlyThroughRelationship()) {\n refusedArguments = rowIdArgument ? [rowIdArgument] : [];\n }\n if (refusedArguments === undefined) {\n const editedForeignKeys = this.foreignKeyArgumentsEditedIn(systemRef, paused.pendingToolName, changedArgumentKeys);\n if ((editedForeignKeys === undefined || editedForeignKeys.length > 0) && await answersOnlyThroughRelationship()) {\n refusedArguments = editedForeignKeys ?? changedArgumentKeys;\n }\n }\n if (refusedArguments !== undefined) {\n this.logger.info('[ConversationalExecution] An approval edited the call onto a record its answerer may not reach; refusing, the pause stands', {\n systemRef, executionId, decisionRef, refusedArguments,\n });\n if (this.auditLogs) {\n void this.auditLogs.logHumanDecisionAnswerRefused({\n ...refusalBase, act: HumanDecision_Act.ANSWER, reason: HumanDecision_RefusalReason.EDITED_CALL_NOT_REACHABLE, attemptedByUserId: answererUserId,\n }, params.actorAuth ? this.auditContextFor(params.actorAuth, owner) : undefined).catch(() => undefined);\n }\n if (params.emitter) {\n this.emitError(params.emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.APPROVAL_MODIFICATION_REJECTED,\n 'That edit points the call at a record you may not reach. Approve the call as proposed, or deny it.', true, {\n reason: FlowsActors_ApprovalModificationRefusalReason.RECORD_NOT_REACHABLE,\n toolName: paused.pendingToolName,\n argumentPaths: [...refusedArguments],\n });\n }\n return { kind: HumanDecision_ActOutcomeKind.MODIFICATION_REJECTED, reason: HumanDecision_RefusalReason.EDITED_CALL_NOT_REACHABLE, argumentNames: [...refusedArguments] };\n }\n }\n }\n\n // ── 4a.i. An edit nothing can vouch for (#3314) ────────────────────────\n //\n // A resource that cannot be read leaves half a shape: the check above read the tool's schema, and cannot say what the\n // resource declares. Refused AFTER the reach check of #2734, so a representative's refused edit keeps its reason and its\n // audit row, and under a reason that is true: this is not known to be a credential.\n if (modifiedResume && !question) {\n const edited = this.resolveApprovalGatedFunctionTool(systemRef, paused.pendingToolName);\n if (edited.kind === GatedFunctionToolResolutionKind.FOUND && this.argumentResourceSchemasOf(edited.functionTool) === undefined) {\n const unjudged = this.callCannotRunRefusal(\n `The arguments of \"${paused.pendingToolName}\" cannot be checked, because the record they describe cannot be read: ${modifiedResume.modifiedArgumentKeys.join(', ')}. The approval is still pending: put them back, or deny it.`,\n { reason: FlowsActors_ApprovalModificationRefusalReason.ARGUMENTS_NOT_RUN_AS_WRITTEN, toolName: paused.pendingToolName, argumentPaths: [...modifiedResume.modifiedArgumentKeys] },\n );\n this.logger.warn('[ConversationalExecution] Refusing an edit whose resource cannot be read; the pause stands', { systemRef, executionId, decisionRef, toolName: paused.pendingToolName });\n if (params.emitter) this.emitError(params.emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.APPROVAL_MODIFICATION_REJECTED, unjudged.message, true, unjudged.refusal);\n return this.refusedOutcomeOf(unjudged);\n }\n }\n\n // ── 4a. A call approved unedited would run (#3295) ─────────────────────\n if (approved && !modifiedResume) {\n const refused = await this.proposedCallRefusal(systemRef, paused, answerPersonalData);\n if (refused) {\n this.logger.warn('[ConversationalExecution] Refusing an approval of a call the tool would refuse; the pause stands', {\n systemRef, executionId, decisionRef, toolName: paused.pendingToolName, argumentNames: refused.refusal.argumentPaths,\n });\n if (params.emitter) {\n this.emitError(params.emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.APPROVAL_MODIFICATION_REJECTED, refused.message, true, refused.refusal);\n }\n return this.refusedOutcomeOf(refused);\n }\n }\n\n // ── 4b. A reason code is one the application declares (#1599) ──────────\n //\n // Refused while the pause stands, like a refused edit: the decision stays answerable, with a declared code or\n // none. A code nobody declared would enter the decision record as an undefined term of its closed vocabulary.\n if (params.reasonCode !== undefined && !this.agentWorkDecisions?.reasonCodeIsDeclared(params.reasonCode)) {\n this.logger.info('[ConversationalExecution] Refusing an answer whose reason code the application does not declare; the pause stands', {\n systemRef, executionId, decisionRef,\n });\n if (params.emitter) {\n this.emitError(params.emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.APPROVAL_REASON_CODE_REJECTED,\n 'That reason is not one this application offers. The approval is still pending: answer it again with an offered reason, or with none.', true);\n }\n return { kind: HumanDecision_ActOutcomeKind.REASON_CODE_REJECTED };\n }\n\n // ── 5. The requester's authority, as it stands NOW ──────────────────────\n const rebuilt = await this.executionContextCreator.rebuildDecisionRequesterAuthority({\n requesterKind: requester.kind,\n requesterRef: requester.ref,\n requesterClientId: requester.clientId,\n organizationId: route.organizationId,\n requestedAt: row.pendingDecisionRequestedAt ? new Date(row.pendingDecisionRequestedAt) : new Date(paused.requestedAt),\n // A MACHINE requester re-resolves its declared principal from the agent the turn ran as (#1611 I4). Every requester\n // resumes only through the relationships it was raised through (#2768).\n ...(row.autonomousAgentRef ? { autonomousAgentRef: row.autonomousAgentRef } : {}),\n ...this.decisionRaisedThroughOf(requester, resourceType, row.executionId, route.organizationId),\n });\n if (rebuilt.standing === DecisionRequesterAuthorityStanding.LAPSED) {\n // #2923: this answer settles the decision, so it spends its proof.\n if (!await consumeDecisionStepUp()) return refuseForStepUp();\n this.logger.info('[ConversationalExecution] A decision was answered but its requester\\'s authority no longer holds; the work will not run', {\n systemRef, executionId, decisionRef, reason: rebuilt.reason,\n });\n const endedAt = new Date();\n const endedOn = await this.endPendingDecision({\n resourceType, executionId, rawPausedApproval, decisionRef,\n outcome: HumanDecision_Outcome.REQUESTER_AUTHORITY_LAPSED, decidedByUserId: answererUserId, toolName: paused.pendingToolName, scopeContext: owner.scopeContext, row, decidedAt: endedAt,\n }).catch(() => null);\n if (endedOn) {\n this.recordDecisionResolved({\n row: endedOn, outcome: HumanDecision_Outcome.REQUESTER_AUTHORITY_LAPSED, toolName: paused.pendingToolName,\n decidedByUserId: answererUserId, reasonGiven: !!params.reason,\n // #2664: the answer that ended it may have come from a chat, like the winner's below.\n ...(params.answeredThrough ? { answeredThrough: params.answeredThrough } : {}),\n ...(params.actorAuth ? { decider: deciderOf(params.actorAuth) } : {}),\n requester,\n requestContext: params.actorAuth ? this.auditContextFor(params.actorAuth, owner) : undefined,\n });\n await this.recordAgentWorkSettlement({\n resourceType, row: endedOn, decisionRef, outcome: HumanDecision_Outcome.REQUESTER_AUTHORITY_LAPSED, decidedAt: endedAt, paused,\n toolName: paused.pendingToolName, ...(answererUserId ? { deciderUserId: answererUserId } : {}),\n });\n }\n if (params.emitter) {\n this.emitError(params.emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.DECISION_REQUESTER_AUTHORITY_LAPSED,\n 'The person this work was done for no longer has the access it needs, so it was not run.');\n }\n return { kind: HumanDecision_ActOutcomeKind.REQUESTER_AUTHORITY_LAPSED };\n }\n // #2665 B7: a chat conversation's resumed turn runs confined like its every turn. A ledger that cannot be read throws\n // here, before anything moved: the decision stays answerable.\n const chatConversation = await this.chatConversationOf(executionId);\n const requesterAuth = this.confineToChatConversation(rebuilt.auth, chatConversation);\n\n // ── 6. Consent, for the REQUESTER ──────────────────────────────────────\n //\n // The resumed turn runs the model and writes the REQUESTER's transcript, so it is held to the\n // requester's consent, not the answerer's (#534 third review M1, #1594 D5). Checked before the\n // release, so a refused decision stays answerable once the requester has consented.\n if (!(await this.admitsUnderServiceConsentRequirement({\n auth: requesterAuth, owner, systemRef, executionId, emitter: params.emitter, recoverable: true,\n }))) {\n return { kind: HumanDecision_ActOutcomeKind.CONSENT_REQUIRED };\n }\n\n // ── 6a. An approved call can run, as things stand (#3313) ──────────────\n //\n // A decision settles before its resume runs, so what would end that resume is asked here, while the pause stands: an\n // acceptance is not recorded for a call that was bound not to run. A denial is not asked: it runs nothing, and it is\n // the remedy these refusals name. The resume keeps its own checks, for what moves between here and there.\n if (approved) {\n const cannotRun = await this.approvedCallCannotRunRefusal(systemRef, paused, requesterAuth, row.initiationKind);\n if (cannotRun) {\n this.logger.warn('[ConversationalExecution] Refusing an approval of a call that cannot run as things stand; the pause stands', {\n systemRef, executionId, decisionRef, toolName: paused.pendingToolName, reason: cannotRun.refusal.reason,\n });\n if (params.emitter) this.emitError(params.emitter, systemRef, executionId, FlowsActors_ExecutionErrorCode.APPROVAL_MODIFICATION_REJECTED, cannotRun.message, true, cannotRun.refusal);\n return this.refusedOutcomeOf(cannotRun);\n }\n }\n\n // ── 7. Release, on the route that was authorized ───────────────────────\n // #2665 B2, V1: a chat conversation is owed the resumed turn's reply BEFORE the release, so whatever ends that turn\n // (its own end, a later pause, a crash and the sweep) is posted into the chat. Owed for the decision: the reply waits\n // until the row has moved past it. If the release then misses (another answer, a lapse), the reply still says how the\n // turn ended.\n // #2923: the release settles the decision, so it spends the answer's proof first: a replayed proof moves nothing.\n if (!await consumeDecisionStepUp()) return refuseForStepUp();\n if (chatConversation) await this.chatConversations!.oweReply(chatConversation._id, { decisionRef });\n const outcome = humanDecisionOutcomeOf(\n toolApprovalDecisionRequest({ decisionRef, toolName: paused.pendingToolName, requestedAt: paused.requestedAt, ...(paused.expiresAt ? { expiresAt: paused.expiresAt } : {}) }),\n { decisionId: decisionRef, optionRef: approved ? HumanDecision_ToolApprovalOption.APPROVE : HumanDecision_ToolApprovalOption.DENY, values: [] },\n // A question's answers ride as `answers` on the call, which is how they reach the tool, not an edit of it (#2720).\n { modified: !!modifiedResume && !question },\n );\n const modifiedArgumentNames = modifiedResume && !question ? [...modifiedResume.modifiedArgumentKeys].sort() : [];\n // #2550: subscribed to resumed-turn stops BEFORE the decision instant and the release. A cancel that misses this\n // decision's withdrawal is published after the release, which is after this, so this replica hears it — whether the\n // resume is running then or registers just after (`unmatchedResumedTurnStops`). Arming at registration alone left a\n // cold replica (first turn since boot, or a subscriber that dropped) deaf in exactly that gap. Never rejects; with\n // no Redis it resolves at once and the replica is the only one there is.\n await this.resumedTurnStops?.arm();\n const decidedAt = new Date();\n const rowOwnerFilter = {\n executionId,\n ...owner.ownerFields,\n machineCredentialId: row.machineCredentialId,\n resourceServerInstanceRef: row.resourceServerInstanceRef,\n };\n this.logger.info('[ConversationalExecution] Resuming a suspended turn on a human decision', {\n systemRef, executionId, decisionRef, outcome, toolName: paused.pendingToolName, modifiedArgumentNames,\n });\n // A previous decision on this row whose record is still owed is repaid first: the release overwrites the\n // resolution columns that record would be repaired from (#1599 review F3).\n await this.repayOwedCorrectionBeforeOverwrite(owner.resourceType, row, decisionRef);\n // The resumed turn's lease, taken BEFORE the release writes PROCESSING (#1780) — see `holdTurnLease`.\n const releaseTurnLease = await this.holdTurnLease(executionId);\n let released: boolean;\n let rereadAfterThrow: FlowActorExecution | null | undefined;\n /** Whether a re-read of the row failed: then nothing is known about whether the decision still waits. */\n let rereadFailed = false;\n // #2903: the answer's seal, written in the release's own transaction: a release that lands has one, one that loses\n // (another answer, a move, an end) or rolls back has none. The decider is the one the RESOLVED row records.\n const decider = params.actorAuth ? deciderOf(params.actorAuth) : undefined;\n /*\n * #2924: what the seal attests, which is what it goes with. A tool approval attests the record its call acts on (the\n * row its tool declares, `argumentsResource.rowIdArgument`, read from the arguments the call runs with), so the seal\n * follows that record's retention, its legal holds and its tenant's purge, exactly as an operation approval's seal\n * follows the record its operation acts on. A Wonder Ledger close's sign-off seal goes with the close, not with the\n * conversation it was answered in. A question, or a call that names no row (a create), attests the conversation.\n */\n const sealedCallSubject = question ? HUMAN_DECISION_NAMES_NO_RECORD : this.decisionSubjectOfCall(\n systemRef, paused.pendingToolName,\n (approved && modifiedResume && modifiedToolArgs ? modifiedToolArgs : paused.pendingToolArgs) as Record<string, unknown> | undefined,\n );\n const sealFacts: DecisionSealFacts | undefined = answererUserId && decider && isApprovalSealOutcome(outcome) ? {\n ...(route.organizationId ? { organizationId: route.organizationId } : {}),\n source: ApprovalSource.CONVERSATIONAL_DECISION,\n decisionRef,\n subject: sealedCallSubject.kind === HumanDecisionSubjectKind.RECORD\n ? { resourceType: sealedCallSubject.resourceType, resourceId: sealedCallSubject.recordId }\n : { resourceType: owner.resourceType, resourceId: String(row._id) },\n outcome,\n meaning: question ? ApprovalSealMeaning.ANSWER : ApprovalSealMeaning.REVIEW,\n decidedAt,\n decider,\n approverUserId: answererUserId,\n requester,\n presentation: presentationCheck.presentation,\n // #2904: the file the presentation binds; the seal attests it only when the presentation it seals binds it.\n ...(deliverable.bound ? { deliverableFile: deliverable.bound } : {}),\n // #2914: an approval of a tool that REPLACES its earlier approval of the record (a month signed off again after a\n // reopen) supersedes the latest seal of that tool on that record, when this answer supersedes none of its own.\n ...(!question && sealedCallSubject.kind === HumanDecisionSubjectKind.RECORD && this.approvalReplacesEarlierApprovalOfRow(systemRef, paused.pendingToolName)\n ? { replacesEarlierApprovalOfSubject: { toolName: paused.pendingToolName } }\n : {}),\n statement: decisionStatementOf({\n optionRef: question ? (params.answer?.optionRef ?? HumanDecision_ToolApprovalOption.DENY) : (approved ? HumanDecision_ToolApprovalOption.APPROVE : HumanDecision_ToolApprovalOption.DENY),\n ...(question && params.answer ? { values: params.answer.values } : {}),\n ...(approved && modifiedResume && !question && modifiedToolArgs ? { modifiedToolArgs } : {}),\n ...(params.reasonCode !== undefined ? { reasonCode: params.reasonCode } : {}),\n }),\n } : undefined;\n let sealDigest: string | undefined;\n /** #2904: the seal's id, handed to the resumed turn's tool calls so a consumer recording the decision stores it. */\n let sealId: string | undefined;\n try {\n const updated = await this.releaseWithSeal(owner.resourceType, sealFacts, (serviceOptions) => this.systemAccess.updateAsSystem(owner.resourceType, {\n ...rowOwnerFilter,\n status: FlowsActors_Status.AWAITING_APPROVAL,\n pausedApproval: rawPausedApproval,\n pendingDecisionRef: decisionRef,\n pendingDecisionRouteVersion: row.pendingDecisionRouteVersion ?? 0,\n }, {\n status: FlowsActors_Status.PROCESSING,\n pausedApproval: null,\n ...PENDING_DECISION_CLEARED,\n lastResolvedDecisionRef: decisionRef,\n // #2821: the work this decision belongs to, carried over so the turn it releases stays attributable to that work.\n lastResolvedDecisionWorkRef: row.pendingDecisionWorkRef ?? decisionRef,\n decidedByUserId: answererUserId ?? null,\n decidedAt,\n decisionOutcome: outcome,\n decisionToolName: paused.pendingToolName,\n decisionModifiedArgumentNames: modifiedArgumentNames,\n // #1599 I3: written by the release itself, so a crash before the record leaves the marker for the repair.\n // #2720: a QUESTION asked for information and proposed nothing, so it owes no agent-work record.\n ...(question ? {} : correctionMarkerOf(decisionRef, row, decidedAt, isReviewerRoute(route) && answererUserId ? route.eligibleRole : undefined)),\n }, { ...serviceOptions, scopeContext: owner.scopeContext }));\n released = updated.released !== null;\n sealDigest = updated.sealDigest;\n sealId = updated.sealId;\n } catch (error) {\n // read-failure-in-caller-transaction: N/A — a guarded write in the release's own transaction, not a read made on a caller's behalf; it fails closed below (#3091).\n /*\n * D10 — a THROWN release fails CLOSED. It used to log and resume, on the reading that \"a thrown write\n * is not proof the release did not land\"; that let the tool run with no recorded decider, and let a\n * second answer resume as well. Now the row decides: only a release RECORDED for this decision, by\n * this person, resumes.\n */\n this.logger.error('[ConversationalExecution] The release write for a decision threw; re-reading the row before resuming', {\n systemRef, executionId, decisionRef, ...projectCaughtErrorLogFields(error),\n });\n rereadAfterThrow = await this.systemAccess.readAsSystem<FlowActorExecution>(owner.resourceType, { executionId }, { suppressSystemAudit: true })\n .catch(() => { rereadFailed = true; return null; });\n released = rereadAfterThrow?.lastResolvedDecisionRef === decisionRef && (rereadAfterThrow?.decidedByUserId ?? undefined) === answererUserId;\n }\n if (!released) {\n this.refuseDecisionAttempt(params.emitter, systemRef, executionId);\n await releaseTurnLease();\n /*\n * S5a review F2: the release lost, and the two ways to lose mean opposite things to whoever shows the decision.\n * Another answer, or an end, means nothing waits any more: SUPERSEDED. A MOVE (a claim, a reassignment, an\n * escalation) changed the route between this answer's read and its write, and the decision still waits for\n * the people it now names: NOT_ACTIONABLE, which a shared chat message reads as \"leave it for the others\".\n * The row says which. A row that is GONE holds no decision, so nothing waits: SUPERSEDED. A row that could not be\n * READ says nothing, and NOT_ACTIONABLE is the answer that takes nothing away from the people who may still hold\n * the decision (#2664 review R-3).\n */\n const now = rereadAfterThrow !== undefined\n ? rereadAfterThrow\n : await this.systemAccess.readAsSystem<FlowActorExecution>(owner.resourceType, { executionId }, { suppressSystemAudit: true })\n .catch(() => { rereadFailed = true; return null; });\n const stillWaits = rereadFailed || (now?.status === FlowsActors_Status.AWAITING_APPROVAL && now.pendingDecisionRef === decisionRef);\n this.logger.info('[ConversationalExecution] The decision was settled or moved before this answer could claim it; not resuming', {\n systemRef, executionId, decisionRef,\n consequence: rereadFailed ? 'the row could not be re-read, so the decision may still wait'\n : stillWaits ? 'the route moved and the decision still waits' : 'another answer won, or the decision ended',\n });\n return { kind: stillWaits ? HumanDecision_ActOutcomeKind.NOT_ACTIONABLE : HumanDecision_ActOutcomeKind.SUPERSEDED };\n }\n // #2569: the decision is answered, so it leaves everyone it was routed to but the person who answered it.\n this.announceDecisionWithdrawn({ route, requester, decisionRef, ...(answererUserId ? { except: answererUserId } : {}) });\n\n // ── 8. The winner records it, then the turn resumes as the requester ───\n let resumed: Promise<void>;\n // #2829: the WORK's lease, beside the execution's: taken before the work's PROCESSING entry, let go after its ending.\n let releaseWorkLease: () => Promise<void> = async () => {};\n try {\n this.recordDecisionResolved({\n row, outcome, toolName: paused.pendingToolName, decidedByUserId: answererUserId,\n deciderRoles: (params.actorAuth?.initiatorRoles ?? [])\n .filter((entry) => entry.relatedResourceId === route.organizationId)\n .flatMap((entry) => entry.roles),\n modifiedArgumentNames, reasonGiven: !!params.reason,\n ...(params.answeredThrough ? { answeredThrough: params.answeredThrough } : {}),\n // #2905: how the person who answered was authenticated, from what the door verified, and who had asked.\n ...(decider ? { decider } : {}),\n requester,\n ...(sealDigest ? { decisionPayloadDigest: sealDigest } : {}),\n requestContext: params.actorAuth ? this.auditContextFor(params.actorAuth, owner) : undefined,\n });\n // #1599: the winner records the decision on the agent's proposal (I2), before the turn resumes.\n // #2720: a question asked information and proposed nothing, so it is not agent-work review (the settlement skips it).\n await this.recordAgentWorkSettlement({\n resourceType: owner.resourceType, row, decisionRef, outcome, decidedAt, paused, toolName: paused.pendingToolName,\n ...(modifiedResume && modifiedToolArgs ? { modifiedToolArgs } : {}),\n modifiedArgumentNames,\n ...(params.reasonCode ? { reasonCode: params.reasonCode } : {}),\n ...(params.reason ? { reasonText: params.reason } : {}),\n ...(answererUserId ? { deciderUserId: answererUserId } : {}),\n ...(isReviewerRoute(route) && route.eligibleRole ? { admittedByRole: route.eligibleRole } : {}),\n });\n // #3015: a person's denial takes effect on the record the call was about, when the gate declares what it does.\n // After the sealed decision committed, before the turn resumes, so the model's next reply sees the record moved.\n // A failed effect is said to the resumed turn, so the person hears the record did not move rather than only a log.\n const denialEffectFailed = !question && outcome === HumanDecision_Outcome.REJECTED\n && !(await this.applyDenialEffect({ systemRef, executionId, owner, paused, requesterAuth, decisionRef, row }));\n if (denialEffectFailed) reason = [reason, DENIAL_EFFECT_FAILED_REASON].filter(Boolean).join(' ');\n\n /*\n * The resumed turn's stream reaches the conversation's OWNER and nobody else. It carries what the turn does —\n * tool results, a shown reasoning, the turn's usage for the owner's roles — so it is the owner's to see (#2524).\n *\n * A door that routes by owner (the socket and the REST door) decides alone: when the owner has no personal room\n * — a conversation owned by an organization or the application, which every autonomous turn is — the stream\n * goes to no one. It used to fall back to the ANSWERER's emitter, so a reviewer approving an autonomous turn\n * received that turn's tool results. A reviewer sees the decision they were shown, and the outcome through the\n * decision list, never the turn. A door with no owner routing (A2A, whose caller owns the task) keeps its own.\n */\n const ownerEmitter = params.ownerEmitterFor ? params.ownerEmitterFor(owner.scopeContext as ConversationalOwnerScope) : params.emitter;\n // #2821: the work this decision belongs to starts running again. Appended BEFORE the resume can end it, so the\n // work's newest entry is never the start of a continuation that has already finished.\n const resumedWorkRef = row.pendingDecisionWorkRef ?? decisionRef;\n // #2829: held for the continuation's whole run, so a process that dies inside it leaves a work whose lease lapses,\n // which the interrupted-turn sweep fails whichever turn holds the thread by then.\n releaseWorkLease = await this.holdWorkLease(executionId, resumedWorkRef);\n await this.recordWorkEvent(owner.resourceType, { executionId, ...owner.ownerFields }, resumedWorkRef, { status: FlowsActors_Status.PROCESSING });\n resumed = this.resumeAfterApproval({\n systemRef, executionId, owner, paused, approved,\n reason,\n // The rewritten, re-signed SDK array when the approver authored the arguments; otherwise the\n // resume reads `paused.sdkModelMessages` exactly as before.\n modifiedSdkModelMessages: modifiedResume?.sdkModelMessages,\n storedPersonalDataState: row.personalDataModelState,\n ...(answerPersonalData ? { personalData: answerPersonalData } : {}),\n auth: requesterAuth,\n resourceServerInstanceRef: row.resourceServerInstanceRef,\n emitter: ownerEmitter,\n // The pause recorded everything the turn did before it, so the resume adds only its own work, onto the row as it\n // stands when each of its writes lands (#2743): a message sent while it runs stays.\n transcript: TRANSCRIPT_AS_IT_STANDS,\n decisionRef,\n ...(sealId ? { decisionSealId: sealId } : {}),\n // #2821: the work the answered decision belongs to; the resume continues it, and a pause in it is that work's too.\n workRef: resumedWorkRef,\n requester,\n initiationKind: row.initiationKind,\n autonomousTrigger: row.autonomousTrigger,\n // #1598: the thread's case, from the row the decision was read with.\n caseRef: row.caseRef ?? null,\n // #2550: a stop of this decision arriving after it was decided and before the resume registers is honoured there.\n releasedAt: decidedAt.getTime(),\n // #3313: an acceptance owes a record if its call does not run.\n ...(approved ? { acceptedAs: outcome, ...(row.pendingDecisionOrganizationId ? { acceptedDecisionOrganizationId: row.pendingDecisionOrganizationId } : {}) } : {}),\n });\n } catch (error) {\n // Nothing resumed, so nothing would let the leases go — do it here, or their heartbeats run for ever.\n await releaseWorkLease();\n await releaseTurnLease();\n throw error;\n }\n // Let go when the resumed turn ends, however it ends, whether this call waits for it or not. The work's lease AFTER\n // the resume settled, which is after its ending entry was attempted (`resumeAfterApproval`'s own `finally`).\n resumed = resumed.finally(async () => {\n await releaseWorkLease();\n await releaseTurnLease();\n });\n if (params.detachResume) {\n // `resumeAfterApproval` records its own failures and ends the turn FAILED; nothing here can add to that.\n void resumed.catch((error: unknown) => {\n this.logger.error('[ConversationalExecution] A detached resume failed outside its own handling', {\n systemRef, executionId, decisionRef, ...projectCaughtErrorLogFields(error),\n });\n });\n } else {\n await resumed;\n }\n return { kind: HumanDecision_ActOutcomeKind.APPLIED };\n }\n\n /**\n * Withdraw the decision a turn is waiting on, because the work itself was cancelled (#1594 D8): the\n * pause is ended WITHDRAWN through the same compare-and-swap every other ending uses, and one RESOLVED\n * row names whoever cancelled. `tasks/cancel` used to cancel the task and leave the pause answerable.\n *\n * The work is named by the first decision it paused on (#2821), and only a decision THAT work waits on is withdrawn:\n * the row's waiting decision when the pause recorded it as this work's (`pendingDecisionWorkRef`), which a chained\n * pause of its continuation is and another turn's pause in the same thread never is ({@link decisionWorkOfRow}). It\n * used to withdraw whatever the thread waited on, and a thread outlives its work and admits overlapping non-chat turns:\n * a cancel of one work withdrew the decision another turn of the same thread was waiting on.\n *\n * @returns `true` when a pending decision was withdrawn; `false` when the work was not waiting on one.\n */\n public async withdrawPendingDecision(params: {\n executionId: string;\n /** The cancelled work, named by the first decision it paused on. */\n workRef: string;\n scopeContext: ConversationalOwnerScope;\n /** Whoever cancelled — the conversation's own principal on every door that reaches this. */\n withdrawnBy?: SocketAuthResult;\n /** The agent instance the conversation runs on; with the principal's credential, the full isolation key. */\n resourceServerInstanceRef?: string;\n }): Promise<boolean> {\n let owner: ResolvedOwnerVariant;\n try {\n owner = this.resolveOwnerVariant(params.scopeContext);\n } catch {\n return false;\n }\n const row = await this.systemAccess.readAsSystem<FlowActorExecution>(owner.resourceType, {\n executionId: params.executionId,\n ...owner.ownerFields,\n machineCredentialId: machineCredentialIdOf(params.withdrawnBy),\n resourceServerInstanceRef: agentInstanceOf(params.resourceServerInstanceRef),\n }, { suppressSystemAudit: true }).catch((error: unknown) => {\n // #2582 review R3: a store that failed is not a row that is absent, any more than on the withdrawal below. The cancel\n // stands and the decision, if one waits, stays answerable until answered or lapsed; this line says the read failed.\n this.logger.warn('[ConversationalExecution] The execution of cancelled work could not be read; a decision it holds stays answerable until answered or lapsed', {\n executionId: params.executionId, ...projectCaughtErrorLogFields(error),\n });\n return null;\n });\n if (!row) return false;\n // The decision the cancelled work waits on, if any; any other decision on the thread is another turn's (#2821). The\n // compare-and-swap below is keyed on the row's waiting decision, so an answer landing in between makes it miss.\n const work = decisionWorkOfRow(row, params.workRef);\n if (work.standing !== ConversationalDecisionWorkStanding.WAITING || row.pendingDecisionRef !== work.waitingDecisionRef) return false;\n try {\n const withdrawal = await this.withdrawHeldDecision({\n owner, row,\n withdrawnByUserId: params.withdrawnBy?.initiatorIds?.userId,\n throughDelegatedClient: !!params.withdrawnBy?.delegatingClientId,\n requestContext: params.withdrawnBy ? this.auditContextFor(params.withdrawnBy, owner) : undefined,\n });\n return withdrawal.ended;\n } catch (error) {\n // #2582 review F1: a store that failed is not a decision that was not waiting. The cancel stands; the decision\n // stays answerable until it is answered or its deadline sweep ends it, and this line names it.\n this.logger.warn('[ConversationalExecution] The decision of cancelled work could not be withdrawn; it stays answerable until answered or lapsed', {\n executionId: row.executionId, decisionRef: row.pendingDecisionRef, ...projectCaughtErrorLogFields(error),\n });\n return false;\n }\n }\n\n /**\n * Settle what an execution row holds before the row is DELETED (#2582): a person deleting a discussion, or an\n * administrator deleting a run. Called by the DELETE's prefix (`flow-actor-executions.custom-impl`), so a decision\n * ends the way every other ending does — WITHDRAWN, one RESOLVED record naming who deleted it, the agent-work\n * settlement, its holders told — instead of going with the row and staying requested on the trail forever.\n *\n * Fail-closed, because the row is the last copy of what it holds (#2582 review F1):\n * - a store that fails propagates, so the deletion is refused and the row stays, instead of being read as \"nothing was\n * waiting\";\n * - a record the row owes — the settlement of the decision just ended, or of one that ended earlier — must exist\n * before the row goes, since the repair sweep writes it FROM the row ({@link DeletedExecutionDecisionSettlement});\n * - a compare-and-swap that misses because the row moved (answered and paused again on a NEW decision, review F5) is\n * re-read and the decision it holds NOW is ended, a bounded number of times.\n *\n * The first read is the row the DELETE already read under the deleter's own authorization.\n */\n public async settleDecisionBeforeDeletion(params: {\n resourceType: CoreResourceType;\n row: FlowActorExecution;\n /** The DELETE's own context: who deleted, and the request the RESOLVED record belongs to. */\n deletedBy: ExecutionContext<any>;\n /**\n * The DELETE's transaction (#2297): every write of the settlement joins it (the ending, the work's records, the\n * re-read), so a deletion that rolls back settled nothing, and its RESOLVED row and announcement follow the commit.\n */\n transaction?: TransactionContext;\n }): Promise<DeletedExecutionDecisionSettlement> {\n // The one owner rule of an execution row (#2582 review F6), the same the agent-work record and its repair read.\n const ownerScope = agentWorkOwnerOfExecution(params.resourceType, params.row as unknown as Record<string, unknown>);\n // No owner scope: no decision on it could be routed, and no record could be repaired from it.\n if (!ownerScope) return DeletedExecutionDecisionSettlement.NOTHING_OWED;\n const owner = this.resolveOwnerVariant(ownerScope);\n let row = params.row;\n for (let attempt = 0; ; attempt += 1) {\n // A record still owed for a decision that ended EARLIER is written first: the withdrawal below overwrites the\n // columns it is repaired from, and the deletion removes them.\n if (!(await this.repayOwedRecordBeforeDeletion(owner.resourceType, row, params.transaction))) return DeletedExecutionDecisionSettlement.RECORD_NOT_WRITTEN;\n if (!holdsPendingDecision(row)) return DeletedExecutionDecisionSettlement.NOTHING_OWED;\n if (attempt >= DELETED_EXECUTION_WITHDRAWAL_ATTEMPTS) return DeletedExecutionDecisionSettlement.STILL_WAITING;\n const withdrawal = await this.withdrawHeldDecision({\n owner, row,\n withdrawnByUserId: params.deletedBy.initiatorIds?.userId,\n throughDelegatedClient: !!params.deletedBy.delegatingClientId,\n requestContext: params.deletedBy,\n ...(params.transaction ? { transaction: params.transaction } : {}),\n });\n if (withdrawal.ended) {\n return withdrawal.recordWritten ? DeletedExecutionDecisionSettlement.SETTLED : DeletedExecutionDecisionSettlement.RECORD_NOT_WRITTEN;\n }\n // Missed: the row moved under the write. Read what it holds now, under the same owner, and settle that.\n const fresh = await this.systemAccess.readAsSystem<FlowActorExecution>(owner.resourceType, {\n executionId: row.executionId, ...owner.ownerFields,\n }, { suppressSystemAudit: true, ...(params.transaction ? { transaction: params.transaction } : {}) });\n if (!fresh) return DeletedExecutionDecisionSettlement.NOTHING_OWED;\n row = fresh;\n }\n }\n\n /**\n * Settle the decisions of execution rows a TEARDOWN is about to delete or scrub (#2582). Two paths reach a row without\n * its own service tier running, so its DELETE settlement ({@link settleDecisionBeforeDeletion}) never runs for them:\n * - an owner scope's `onParentDelete` cascade DELETES the rows: an organization purge, a person's deletion;\n * - the scrub chokepoint RETAINS them scrubbed: a person's ERASURE, since this resource is impersonalize-and-retain. A\n * retained row is hidden from every ordinary read and frozen to every ordinary write, so a decision left on it could\n * be neither answered nor lapsed, and stayed requested forever.\n *\n * Called by the row-teardown settler {@link registerFlowActorExecutionTeardownSettlement}, BEFORE the teardown's write\n * and inside its transaction. Each decision is ended by the compare-and-swap every ending uses\n * ({@link endPendingDecision}): WITHDRAWN, with no decider, because nobody in the app ended it. Only a write that wins\n * records it, so an answer that landed after the teardown's read makes the write miss and is the decision's only\n * ending (#2582 review F7). Once the teardown commits, the RESOLVED row is recorded and every holder is told, including\n * reviewers in ANOTHER organization (a ROLE decision routed across an organization relationship), whose inbox would\n * otherwise keep a card nobody can act on.\n *\n * NO agent-work record is written, and none owed by an earlier decision is repaid: the scope goes with its records, and\n * an erasure must not write new data about its subject. The trail is the record. A record an earlier decision still owed\n * is lost with the row, and the loss is logged, naming it.\n *\n * A store failure propagates and fails the teardown (the settler contract): the row is the only copy of what it holds.\n */\n public async settleDecisionsBeforeTeardown(event: RowTeardownSettlementEvent): Promise<void> {\n const resourceType = event.resourceType as CoreResourceType;\n const transaction = event.options?.transaction;\n for (const snapshot of event.rows) {\n const row = snapshot as unknown as FlowActorExecution;\n if (row.pendingCorrectionRecordRef) {\n this.logger.warn('[ConversationalExecution] A teardown reached an execution that still owed a decision record; the record is lost with it', {\n executionId: row.executionId, decisionRef: row.pendingCorrectionRecordRef, treatment: event.treatment,\n });\n }\n if (!holdsPendingDecision(row) || !row.pausedApproval || !row.pendingDecisionRef) continue;\n // The one owner rule of an execution row (#2582 review F6). A row with no owner scope routed no decision to anyone.\n const ownerScope = agentWorkOwnerOfExecution(resourceType, snapshot);\n if (!ownerScope) continue;\n const toolName = this.pendingToolNameOf(row.pausedApproval);\n const endedOn = await this.endPendingDecision({\n resourceType, executionId: row.executionId, rawPausedApproval: row.pausedApproval, decisionRef: row.pendingDecisionRef,\n outcome: HumanDecision_Outcome.WITHDRAWN, toolName, row,\n scopeContext: this.resolveOwnerVariant(ownerScope).scopeContext,\n teardown: transaction ? { transaction } : {},\n });\n // Missed: the decision moved on after the teardown's read (answered, lapsed, withdrawn), and the move recorded it.\n if (!endedOn) continue;\n const recordEnding = (): void => {\n void this.recordDecisionResolved({ row: endedOn, requester: humanDecisionRequesterOfRow(endedOn), outcome: HumanDecision_Outcome.WITHDRAWN, toolName, requestContext: event.executionContext });\n };\n if (!transaction) {\n recordEnding();\n continue;\n }\n // #2886 review MED-3: capturable. Under a purge the organization-purge sweep captures, the RESOLVED row is kept in the\n // post-commit effect outbox with the purge's commit, and written once by the purge's next run when this effect never\n // runs. This plane announces no withdrawal to holders here. The chat cards' outcome note is kept too (#2930): written\n // by whichever of this effect and that run settles it, once, since the ledger takes an outcome once.\n const noticeOutcome = this.decisionNoticeOutcomeOf(endedOn, HumanDecision_Outcome.WITHDRAWN);\n registerTransactionPostCommitEffect(transaction, capturablePostCommitEffect({\n key: ['human-decision-teardown-resolved', resourceType, row.pendingDecisionRef].join(':'),\n execute: async () => recordEnding(),\n capture: decisionEndingCapture({\n effect: 'human-decision-teardown-resolved',\n auditLogs: () => this.auditLogs,\n record: (view) => this.recordDecisionResolved({\n row: endedOn, requester: humanDecisionRequesterOfRow(endedOn), outcome: HumanDecision_Outcome.WITHDRAWN, toolName, requestContext: event.executionContext, capture: { auditLogs: view },\n }),\n tellAnnouncement: () => undefined,\n ...(noticeOutcome && this.decisionNoticeStays\n ? { noticeOutcome: { payload: noticeOutcome, record: (payload) => this.decisionNoticeStays!.recordDecisionOutcome(payload) } }\n : {}),\n subjectId: row.executionId,\n onFailure: (error) => this.logger.warn('[ConversationalExecution] A decision a teardown ended could not be recorded; the purge\\'s next run writes it', {\n executionId: row.executionId, decisionRef: row.pendingDecisionRef, ...projectCaughtErrorLogFields(error),\n }),\n }),\n }));\n }\n }\n\n /**\n * ONE step of removing an erased person from a conversation that names them without being theirs (#2865): an\n * organization's or an application's conversation, or another person's, where they raised, were assigned or decided a\n * decision. Inside the erasure's transaction; effects outside the store follow the commit. The caller (the plane's\n * subject-reference severer) reads the row fresh, calls this, and calls again on the re-read row until it answers\n * DONE, so each step is a compare-and-swap on the row as read:\n *\n * - a waiting decision the person RAISED is ended `REQUESTER_AUTHORITY_LAPSED` (CANCELLED, nobody deciding): its answer\n * could only continue work under an authority that no longer exists. Its record is still owed, as for any ending;\n * - a waiting decision ASSIGNED to them goes back to the role it was assigned within (an unclaim's move, next route\n * version), recorded as `HUMAN_DECISION_REASSIGNED` with the trigger `SUBJECT_ERASURE`, naming no target and never\n * the person; with no role to go back to, nobody else may answer it, and it is ended WITHDRAWN;\n * - the person as the LAST DECIDER of the conversation (`decidedByUserId`) is removed; the outcome stays.\n *\n * `LOST` means another writer moved the row after the caller read it: read again. The person's id in the paused call\n * itself (`pausedApproval`) is the call's arguments, the conversation's content, and is not touched here.\n *\n * assurance-control: WILDO.PRIVACY.SUBJECT_ERASURE — an erased person's id leaves the conversations that name them.\n */\n public async severErasedPersonStep(\n resourceType: CoreResourceType,\n row: FlowActorExecution,\n userId: string,\n transaction?: TransactionContext,\n ): Promise<ConversationalErasureStep> {\n const owner = agentWorkOwnerOfExecution(resourceType, row as unknown as Record<string, unknown>);\n const scopeContext = owner ? this.resolveOwnerVariant(owner).scopeContext : undefined;\n const writeOptions = { ...(scopeContext ? { scopeContext } : {}), ...(transaction ? { transaction } : {}) };\n const waiting = holdsPendingDecision(row) && !!row.pausedApproval && !!row.pendingDecisionRef;\n const requester = humanDecisionRequesterOfRow(row);\n const raisedByThem = waiting && !!requester && requester.kind !== HumanDecision_RequesterKind.MACHINE && requester.ref === userId;\n const assignedToThem = waiting && row.pendingDecisionRouteKind === HumanDecision_RouteKind.ASSIGNEE && row.pendingDecisionAssigneeUserId === userId;\n const canReturnToRole = !!row.pendingDecisionEligibleRole && !!row.pendingDecisionOrganizationId;\n\n if (raisedByThem || (assignedToThem && !canReturnToRole)) {\n const outcome = raisedByThem ? HumanDecision_Outcome.REQUESTER_AUTHORITY_LAPSED : HumanDecision_Outcome.WITHDRAWN;\n const toolName = this.pendingToolNameOf(row.pausedApproval as string);\n const endedOn = await this.endPendingDecision({\n resourceType, executionId: row.executionId, rawPausedApproval: row.pausedApproval as string, decisionRef: row.pendingDecisionRef,\n outcome, toolName, row, ...(scopeContext ? { scopeContext } : {}),\n erasure: { ...(transaction ? { transaction } : {}), erasedUserId: userId },\n });\n if (!endedOn) return ConversationalErasureStep.LOST;\n this.afterTeardownCommits(transaction, ['human-decision-erasure-resolved', resourceType, String(row.pendingDecisionRef)].join(':'), () => {\n this.recordDecisionResolved({ row: endedOn, requester: humanDecisionRequesterOfRow(endedOn), outcome, toolName });\n });\n return ConversationalErasureStep.DECISION_ENDED;\n }\n\n if (assignedToThem) {\n const version = row.pendingDecisionRouteVersion ?? 0;\n const moved = await this.systemAccess.updateAsSystem(resourceType, {\n executionId: row.executionId,\n status: FlowsActors_Status.AWAITING_APPROVAL,\n pendingDecisionRef: row.pendingDecisionRef,\n pendingDecisionAssigneeUserId: userId,\n pendingDecisionRouteVersion: version,\n // Review F2: the same write as an unclaim (`actOnDecision`'s move): the next-due instant is computed for the pause\n // state read here, so a pause landing in between makes this match nothing rather than re-arm a paused clock.\n pendingDecisionClockPausedAt: row.pendingDecisionClockPausedAt ?? null,\n }, {\n pendingDecisionRouteKind: HumanDecision_RouteKind.ROLE,\n pendingDecisionAssigneeUserId: null,\n pendingDecisionClaimedAt: null,\n pendingDecisionRouteVersion: version + 1,\n // Back with the role, unclaimed: the CLAIM clock re-opens, as on an unclaim. A paused decision keeps none.\n ...(row.pendingDecisionClockPausedAt ? {} : { pendingDecisionNextDueAt: nextDueAtOfRow(row, { claimed: false }) }),\n }, Object.keys(writeOptions).length > 0 ? writeOptions : undefined);\n if (moved === null || moved === undefined) return ConversationalErasureStep.LOST;\n const route = humanDecisionRouteOfRow({ ...row, pendingDecisionRouteKind: HumanDecision_RouteKind.ROLE, pendingDecisionAssigneeUserId: null, pendingDecisionClaimedAt: null });\n const toolName = this.pendingToolNameOf(row.pausedApproval as string);\n this.afterTeardownCommits(transaction, ['human-decision-erasure-rerouted', resourceType, String(row.pendingDecisionRef), String(version + 1)].join(':'), () => {\n if (!route) return;\n // assurance-control: WILDO.ACCESS.AUTHORIZATION_DECISION_AUDIT — an erasure's move of a waiting decision's route is recorded like every other move, naming nobody it was taken from.\n if (this.auditLogs) {\n void this.auditLogs.logHumanDecisionReassigned({\n ...this.decisionEventBase(row, route, toolName), routeVersion: version + 1, reasonGiven: false, trigger: HumanDecision_RouteChangeTrigger.SUBJECT_ERASURE,\n }, undefined).catch((error: unknown) => this.logger.warn('[ConversationalExecution] An erasure\\'s move of a waiting decision could not be recorded; the move stands', {\n executionId: row.executionId, ...projectCaughtErrorLogFields(error),\n }));\n }\n this.announceDecisionRouted(route, String(row.pendingDecisionRef), undefined, requester);\n });\n return ConversationalErasureStep.DECISION_REROUTED;\n }\n\n if (row.decidedByUserId === userId) {\n const cleared = await this.systemAccess.updateAsSystem(resourceType, { executionId: row.executionId, decidedByUserId: userId }, { decidedByUserId: null },\n Object.keys(writeOptions).length > 0 ? writeOptions : undefined);\n return cleared === null || cleared === undefined ? ConversationalErasureStep.LOST : ConversationalErasureStep.ID_REMOVED;\n }\n\n /*\n * Review F5: the row was found because a person column names them, and no step above removed it. On a row that holds\n * no waiting decision those columns are residue (every ending clears them), so they are cleared; on a WAITING row it\n * is a shape this step does not recognise (a requester with no kind): the step says so, and the severer refuses the\n * erasure rather than report the person gone while the row still names them.\n */\n const residual = (['pendingDecisionRequesterRef', 'pendingDecisionAssigneeUserId'] as const).filter((column) => row[column] === userId);\n if (residual.length > 0) {\n if (waiting) return ConversationalErasureStep.UNRECOGNISED_WAITING_DECISION;\n const cleared = await this.systemAccess.updateAsSystem(resourceType, {\n executionId: row.executionId, status: row.status, ...Object.fromEntries(residual.map((column) => [column, userId])),\n }, Object.fromEntries(residual.map((column) => [column, null])), Object.keys(writeOptions).length > 0 ? writeOptions : undefined);\n return cleared === null || cleared === undefined ? ConversationalErasureStep.LOST : ConversationalErasureStep.ID_REMOVED;\n }\n return ConversationalErasureStep.DONE;\n }\n\n /**\n * Run an effect outside the store (a record on the trail, a notification) once a teardown's transaction commits, or at\n * once when the teardown has none (#2582): a teardown that rolls back must have announced nothing.\n */\n private afterTeardownCommits(transaction: TransactionContext | undefined, key: string, effect: () => void): void {\n if (!transaction) {\n effect();\n return;\n }\n registerTransactionPostCommitEffect(transaction, { key, execute: async () => effect() });\n }\n\n /**\n * Write the record an execution row still owes from an earlier decision, before the row is deleted. `true` when\n * nothing is owed, or the record now exists, or the row cannot carry it (a marker without the resolution it names\n * is a record already lost, which keeping the row would not recover — the repair logs it at ERROR).\n */\n private async repayOwedRecordBeforeDeletion(resourceType: CoreResourceType, row: FlowActorExecution, transaction?: TransactionContext): Promise<boolean> {\n if (!row.pendingCorrectionRecordRef || !this.agentWorkDecisions) return true;\n const resolution = row as unknown as ExecutionResolutionRow;\n if (!owedRecordIsRepairableFromRow(resourceType, resolution)) return true;\n // Inside the deletion's transaction (#2297) a failure throws (it has aborted the transaction) and fails the deletion.\n return (await this.agentWorkDecisions.repairOwedRecordOfExecution(resourceType, resolution, undefined, transaction ? { transaction } : undefined)) !== undefined;\n }\n\n /**\n * The part of a withdrawal that follows reading the row: end the pause WITHDRAWN and record it. Shared by the work\n * being cancelled and the row being deleted, so the two cannot record a withdrawal differently.\n *\n * A store that fails PROPAGATES (#2582 review F1): each caller decides what that means — the cancel logs it and\n * stands, the deletion is refused. `ended: false` means only that the row was not waiting, or that another writer\n * won the compare-and-swap; `recordWritten` says whether the agent-work record now exists.\n */\n private async withdrawHeldDecision(params: {\n owner: ResolvedOwnerVariant;\n row: FlowActorExecution;\n withdrawnByUserId?: string;\n /** Withdrawn through a delegated client: the person was not in the app, so their inbox is told too (#2569 A-7). */\n throughDelegatedClient: boolean;\n requestContext?: ExecutionContext<any>;\n /**\n * The transaction of a DELETE that settles the row before it goes (#2297): the ending, the agent-work record and a\n * previous decision's owed record join it; the RESOLVED row and the holders' announcement follow its commit, kept with\n * it (capturable) so a crash between the commit and their delivery loses neither.\n */\n transaction?: TransactionContext;\n }): Promise<{ readonly ended: false } | { readonly ended: true; readonly recordWritten: boolean }> {\n const { owner, row, transaction } = params;\n if (!holdsPendingDecision(row) || !row.pausedApproval || !row.pendingDecisionRef) return { ended: false };\n const toolName = this.pendingToolNameOf(row.pausedApproval);\n const withdrawnAt = new Date();\n const endedOn = await this.endPendingDecision({\n resourceType: owner.resourceType, executionId: row.executionId, rawPausedApproval: row.pausedApproval,\n decisionRef: row.pendingDecisionRef, outcome: HumanDecision_Outcome.WITHDRAWN, decidedByUserId: params.withdrawnByUserId, toolName, scopeContext: owner.scopeContext, row, decidedAt: withdrawnAt,\n ...(params.throughDelegatedClient ? { announceExcept: null } : {}),\n ...(transaction ? { deletion: { transaction } } : {}),\n });\n if (!endedOn) return { ended: false };\n if (transaction) {\n this.recordDecisionResolvedAfterCommit(transaction, owner.resourceType, endedOn, toolName, params.requestContext);\n } else {\n this.recordDecisionResolved({ row: endedOn, requester: humanDecisionRequesterOfRow(endedOn), outcome: HumanDecision_Outcome.WITHDRAWN, toolName, requestContext: params.requestContext });\n }\n const recordWritten = await this.recordAgentWorkSettlement({\n resourceType: owner.resourceType, row: endedOn, decisionRef: row.pendingDecisionRef, outcome: HumanDecision_Outcome.WITHDRAWN,\n decidedAt: withdrawnAt, rawPausedApproval: row.pausedApproval, ...(toolName ? { toolName } : {}),\n ...(params.withdrawnByUserId ? { deciderUserId: params.withdrawnByUserId } : {}),\n ...(transaction ? { transaction } : {}),\n });\n return { ended: true, recordWritten };\n }\n\n /**\n * The RESOLVED row of a decision WITHDRAWN inside a transaction (#2297), recorded once it commits: capturable, so an\n * attempt the framework captures keeps it (and the chat cards' outcome note) with its commit, and the outbox relay\n * writes it once when this effect never runs. A transaction that rolls back recorded nothing. The holders'\n * announcement is the ending write's own (`endPendingDecision`), so this one tells nobody.\n */\n private recordDecisionResolvedAfterCommit(\n transaction: TransactionContext,\n resourceType: CoreResourceType,\n endedOn: FlowActorExecution,\n toolName: string | undefined,\n requestContext: ExecutionContext<any> | undefined,\n ): void {\n const record = (capture?: { readonly auditLogs: AuditLogsBackendService }) => this.recordDecisionResolved({\n row: endedOn, requester: humanDecisionRequesterOfRow(endedOn), outcome: HumanDecision_Outcome.WITHDRAWN, toolName, requestContext, ...(capture ? { capture } : {}),\n });\n const noticeOutcome = this.decisionNoticeOutcomeOf(endedOn, HumanDecision_Outcome.WITHDRAWN);\n registerTransactionPostCommitEffect(transaction, capturablePostCommitEffect({\n key: ['human-decision-deletion-resolved', resourceType, String(endedOn.pendingDecisionRef)].join(':'),\n execute: async () => { void record(); },\n capture: decisionEndingCapture({\n effect: 'human-decision-deletion-resolved',\n auditLogs: () => this.auditLogs,\n record: (view) => record({ auditLogs: view }),\n tellAnnouncement: () => undefined,\n ...(noticeOutcome && this.decisionNoticeStays\n ? { noticeOutcome: { payload: noticeOutcome, record: (payload) => this.decisionNoticeStays!.recordDecisionOutcome(payload) } }\n : {}),\n subjectId: endedOn.executionId,\n onFailure: (error) => this.logger.warn('[ConversationalExecution] A decision a deletion withdrew could not be recorded; the outbox relay writes it', {\n executionId: endedOn.executionId, decisionRef: endedOn.pendingDecisionRef, ...projectCaughtErrorLogFields(error),\n }),\n }),\n }));\n }\n\n /**\n * The one entry every REST verb reaches (#1594 D6): ANSWER goes to `answerPendingDecision`, every move to\n * `movePendingDecision`. The act string comes from a URL, so an unknown one is refused like any refusal.\n *\n * #2811: a door that knows the person but holds no authority for them (a chat account linked to a member who was\n * suspended or removed) passes `lapsedActor` instead of `actorAuth`. Their act is refused on the decision's own plane\n * and recorded, and nothing is authorized or changed ({@link HumanDecisionActingActor}).\n */\n public async actOnPendingDecision(params: HumanDecisionActingActor & {\n decisionRef: string;\n act: HumanDecision_Act;\n request: HumanDecision_ActRequest;\n ownerEmitterFor?: (owner: ConversationalOwnerScope) => FlowsActorsExecutionEmitter | undefined;\n /**\n * #2664: the chat delivery an ANSWER arrived through (a Slack button, a Teams card), set only by the engine's inbound\n * door and never from a request body: every plane records it on the decision's RESOLVED row.\n */\n answeredThrough?: HumanDecision_AnsweredThrough;\n /**\n * #2664: the one organization the acting door is scoped to (a chat delivery's), set only by the engine's inbound\n * door. Every plane refuses a decision routed in another organization or in none\n * (`OUTSIDE_THE_DELIVERY_ORGANIZATION`), and such a door may only ANSWER.\n */\n confinedToOrganizationId?: string;\n /**\n * #2797: what the acting door can prove to a granting organization's authentication policy: the inbox's HTTP request\n * (its session and its step-up proof), or nothing at all (a chat delivery). Absent is held as no session.\n */\n actingSession?: ActingSession;\n /**\n * #2903 review F2: what the chat card an ANSWER came from carried of the decision, set only by the engine's inbound\n * door from the application's notice handler; every plane seals an answer without an echo over exactly this.\n */\n sentCardContent?: HumanDecision_SentCardContent;\n }): Promise<HumanDecision_ActOutcome> {\n // A door scoped to one organization answers and does nothing else: moving or pausing a decision from a chat is no\n // act any chat door offers, so it is refused rather than reached.\n if (params.confinedToOrganizationId !== undefined && params.act !== HumanDecision_Act.ANSWER) {\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE, reason: HumanDecision_RefusalReason.ACT_NOT_OFFERED };\n }\n const confinement = {\n ...(params.confinedToOrganizationId === undefined ? {} : { confinedToOrganizationId: params.confinedToOrganizationId }),\n ...(params.actingSession ? { actingSession: params.actingSession } : {}),\n };\n // #2811: exactly one of the two is set, and which one decides everything below: a lapsed actor is never authorized.\n const actor: HumanDecisionActingActor = params.lapsedActor !== undefined\n ? { lapsedActor: params.lapsedActor }\n : { actorAuth: params.actorAuth };\n // A decision held by another plane's host (#1612, #2539) is acted on there, with the same predicate and outcomes.\n // Read by the id alone, like every door here, so asking says nothing about who may act.\n for (const host of this.humanDecisionHosts ?? []) {\n if (await host.holdsDecision(params.decisionRef)) {\n return host.act({\n ...actor, decisionRef: params.decisionRef, act: params.act, request: params.request,\n ...(params.answeredThrough ? { answeredThrough: params.answeredThrough } : {}),\n ...(params.sentCardContent !== undefined ? { sentCardContent: params.sentCardContent } : {}),\n ...confinement,\n });\n }\n }\n if (actor.lapsedActor !== undefined) {\n return this.refuseLapsedDecisionActor({\n decisionRef: params.decisionRef, lapsedActor: actor.lapsedActor, act: params.act,\n ...(params.answeredThrough ? { answeredThrough: params.answeredThrough } : {}),\n ...(params.confinedToOrganizationId === undefined ? {} : { confinedToOrganizationId: params.confinedToOrganizationId }),\n });\n }\n const actorAuth = actor.actorAuth;\n switch (params.act) {\n case HumanDecision_Act.ANSWER: {\n const approved = params.request.answer\n ? toolApprovalVerdictOf(params.decisionRef, params.request.answer)\n : params.request.approved;\n // #2720: an answer naming options of its own settles a QUESTION; the answer door decides what it means.\n if (typeof approved !== 'boolean' && !params.request.answer) return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE };\n return this.answerPendingDecision({\n decisionRef: params.decisionRef,\n actorAuth,\n ...(typeof approved === 'boolean' ? { approved } : {}),\n ...(params.request.answer ? { answer: params.request.answer } : {}),\n reason: params.request.reason,\n ...(params.request.reasonCode !== undefined ? { reasonCode: params.request.reasonCode } : {}),\n modifiedToolArgs: params.request.modifiedToolArgs,\n // #2903: the presentation the door echoed (the REST route requires one); the plane compares it with the row.\n ...(params.request.presentationId !== undefined ? { presentationId: params.request.presentationId } : {}),\n ...(params.sentCardContent !== undefined ? { sentCardContent: params.sentCardContent } : {}),\n ownerEmitterFor: params.ownerEmitterFor,\n detachResume: true,\n ...(params.answeredThrough ? { answeredThrough: params.answeredThrough } : {}),\n ...confinement,\n });\n }\n case HumanDecision_Act.REASSIGN:\n case HumanDecision_Act.ESCALATE:\n case HumanDecision_Act.CLAIM:\n case HumanDecision_Act.UNCLAIM:\n return this.movePendingDecision({\n decisionRef: params.decisionRef, actorAuth, act: params.act,\n targetUserId: params.request.targetUserId, reasonGiven: !!params.request.reason,\n ...(params.actingSession ? { actingSession: params.actingSession } : {}),\n });\n case HumanDecision_Act.PAUSE_CLOCK:\n case HumanDecision_Act.RESUME_CLOCK:\n return this.setPendingDecisionClock({\n decisionRef: params.decisionRef, actorAuth, act: params.act, pauseStateRef: params.request.pauseStateRef,\n ...(params.actingSession ? { actingSession: params.actingSession } : {}),\n });\n default:\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE };\n }\n }\n\n /**\n * #2811: the act of a person this plane's door knows but holds no authority for (a chat account still linked to a member\n * who was suspended or removed), on a CONVERSATIONAL decision. Refused and recorded `HUMAN_DECISION_ANSWER_REFUSED`, with\n * the reason `lapsedActorRefusalReason` gives, the person, the act and the delivery it came through; the decision is not\n * touched and its predicate is never asked. Not disclosed: the person learns nothing about a decision, as any refusal\n * by the route. A decision that is not pending here answers NOT_ACTIONABLE with no row, as it does for anyone; so does\n * a waiting row `answerPendingDecision` would give up on before deciding (no route, no requester, an unreadable paused\n * state), so a lapsed person is never recorded against a row nobody can be refused on.\n *\n * assurance-control: WILDO.ACCESS.AUTHORIZATION_DECISION_AUDIT — an attempt on a conversational decision by a known person whose authority lapsed is recorded on the decision's plane, and changes nothing\n */\n private async refuseLapsedDecisionActor(params: {\n decisionRef: string;\n lapsedActor: HumanDecisionLapsedActor;\n act: HumanDecision_Act;\n answeredThrough?: HumanDecision_AnsweredThrough;\n confinedToOrganizationId?: string;\n }): Promise<HumanDecision_ActOutcome> {\n const { decisionRef, act } = params;\n const found = await this.findPendingDecision(decisionRef);\n const route = found ? humanDecisionRouteOfRow(found.row) : undefined;\n if (!found || found.row.status !== FlowsActors_Status.AWAITING_APPROVAL || !found.row.pausedApproval || !route || !humanDecisionRequesterOfRow(found.row)) {\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE };\n }\n try {\n parseFlowActorPausedApproval(found.row.pausedApproval as string);\n } catch {\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE };\n }\n const { row } = found;\n const reason = lapsedActorRefusalReason({ decisionOrganizationId: route.organizationId, confinedToOrganizationId: params.confinedToOrganizationId });\n this.logger.info('[ConversationalExecution] An act by a person whose authority lapsed was refused', { decisionRef, executionId: row.executionId, reason });\n if (this.auditLogs) {\n const toolName = this.pendingToolNameOf(row.pausedApproval as string);\n void this.auditLogs.logHumanDecisionAnswerRefused({\n decisionRef, executionId: row.executionId, plane: HumanDecision_Plane.CONVERSATIONAL, systemRef: row.systemRef,\n ...(toolName ? { toolName } : {}),\n routeKind: route.kind,\n ...(route.eligibleRole ? { routeEligibleRole: route.eligibleRole } : {}),\n ...(route.requiredQualificationKinds?.length ? { routeRequiredQualificationKinds: [...route.requiredQualificationKinds] } : {}),\n ...(route.organizationId ? { organizationId: route.organizationId } : {}),\n act, reason, attemptedByUserId: params.lapsedActor.userId,\n ...(params.answeredThrough ? answeredThroughRefusalFields(params.answeredThrough) : {}),\n }).catch(() => undefined);\n }\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE };\n }\n\n /**\n * Move a pending decision to someone else, or between a role and one of its holders (#1594 D7).\n *\n * - The mover is authorized by the one predicate, for this act, with role facts read now (I1).\n * - The person it moves TO must be able to ANSWER it under the new route (I8): a move can never hand a\n * decision to someone who could not settle it. There is no default escalation to an administrator —\n * an escalation goes to the gate's declared `escalateTo`, or to the person the escalator names.\n * - The move is a compare-and-swap on status, decision id AND route version, and bumps the version (I5):\n * an answer read under the old route loses, and so does a concurrent move.\n * - Only the route changes. The deadline does not, the requester does not, and nothing is resumed.\n */\n public async movePendingDecision(params: {\n decisionRef: string;\n actorAuth: SocketAuthResult;\n act: HumanDecision_Act.REASSIGN | HumanDecision_Act.ESCALATE | HumanDecision_Act.CLAIM | HumanDecision_Act.UNCLAIM;\n targetUserId?: string;\n reasonGiven?: boolean;\n /** #2797: what the moving door can prove to a granting organization's authentication policy; absent is no session. */\n actingSession?: ActingSession;\n }): Promise<HumanDecision_ActOutcome> {\n const { decisionRef, act } = params;\n const found = await this.findPendingDecision(decisionRef);\n const route = found ? humanDecisionRouteOfRow(found.row) : undefined;\n const requester = found ? humanDecisionRequesterOfRow(found.row) : undefined;\n if (!found || found.row.status !== FlowsActors_Status.AWAITING_APPROVAL || !found.row.pausedApproval || !route || !requester) {\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE };\n }\n const { resourceType, row } = found;\n const owner = this.ownerOfRow(resourceType, row);\n const moverUserId = params.actorAuth.initiatorIds?.userId;\n const toolName = this.pendingToolNameOf(row.pausedApproval as string);\n const base = {\n decisionRef, executionId: row.executionId, plane: HumanDecision_Plane.CONVERSATIONAL, systemRef: row.systemRef,\n ...(toolName ? { toolName } : {}),\n routeKind: route.kind,\n ...(route.eligibleRole ? { routeEligibleRole: route.eligibleRole } : {}),\n ...(route.requiredQualificationKinds?.length ? { routeRequiredQualificationKinds: [...route.requiredQualificationKinds] } : {}),\n ...(route.organizationId ? { organizationId: route.organizationId } : {}),\n };\n const refuse = (reason: HumanDecision_RefusalReason, outcome = HumanDecision_ActOutcomeKind.NOT_ACTIONABLE): HumanDecision_ActOutcome => {\n if (this.auditLogs) {\n void this.auditLogs.logHumanDecisionAnswerRefused(\n { ...base, act, reason, ...(moverUserId ? { attemptedByUserId: moverUserId } : {}) },\n this.auditContextFor(params.actorAuth, owner),\n ).catch(() => undefined);\n }\n // A refused target is reported as such — the mover was admitted, so the decision's existence is theirs to know.\n return outcome === HumanDecision_ActOutcomeKind.TARGET_REFUSED ? { kind: outcome, reason } : { kind: outcome };\n };\n\n // ── The mover ────────────────────────────────────────────────────────────\n const subject = this.decisionSubjectOfRow(row);\n const verdict = await this.authorizeDecisionAct({ userId: moverUserId, executionType: params.actorAuth.executionType, route, requester, act, subject });\n if (verdict.kind === HumanDecision_VerdictKind.REFUSED) return refuse(verdict.reason);\n // #2797: a move is an act in the decision's organization too, held to its granting organization's policy.\n const held = await this.holdToGrantingOrganization({ decisionRef, userId: moverUserId, organizationId: route.organizationId, session: params.actingSession });\n if (held.kind === HumanDecisionGrantorHoldKind.REFUSED) {\n refuse(held.reason);\n if (held.refusal) throw held.refusal;\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE, reason: held.reason };\n }\n\n // ── Where it goes ────────────────────────────────────────────────────────\n let next: HumanDecision_Route;\n let toDeclaredTarget = false;\n switch (act) {\n case HumanDecision_Act.CLAIM:\n next = { ...route, kind: HumanDecision_RouteKind.ASSIGNEE, assigneeUserId: moverUserId, claimedAt: new Date().toISOString() };\n break;\n case HumanDecision_Act.UNCLAIM: {\n const { assigneeUserId: _dropped, claimedAt: _unclaimed, ...rest } = route;\n void _dropped; void _unclaimed;\n next = { ...rest, kind: HumanDecision_RouteKind.ROLE };\n break;\n }\n case HumanDecision_Act.REASSIGN:\n case HumanDecision_Act.ESCALATE: {\n let targetUserId = params.targetUserId;\n if (!targetUserId && act === HumanDecision_Act.ESCALATE) {\n targetUserId = await this.declaredEscalationTarget(row, params.actorAuth);\n toDeclaredTarget = !!targetUserId;\n }\n if (!targetUserId) return refuse(HumanDecision_RefusalReason.NO_TARGET, HumanDecision_ActOutcomeKind.TARGET_REFUSED);\n const { claimedAt: _claim, ...rest } = route;\n void _claim;\n next = { ...rest, kind: HumanDecision_RouteKind.ASSIGNEE, assigneeUserId: targetUserId };\n break;\n }\n }\n\n // ── I8: whoever holds it next must be able to answer it ─────────────────\n if (next.kind === HumanDecision_RouteKind.ASSIGNEE) {\n const target = await this.authorizeDecisionAct({ userId: next.assigneeUserId, route: next, requester, act: HumanDecision_Act.ANSWER, subject });\n if (target.kind === HumanDecision_VerdictKind.REFUSED) return refuse(target.reason, HumanDecision_ActOutcomeKind.TARGET_REFUSED);\n }\n\n // ── The move, on the version that was read ──────────────────────────────\n const version = row.pendingDecisionRouteVersion ?? 0;\n const moved = await this.systemAccess.updateAsSystem(resourceType, {\n executionId: row.executionId,\n ...owner.ownerFields,\n machineCredentialId: row.machineCredentialId,\n resourceServerInstanceRef: row.resourceServerInstanceRef,\n status: FlowsActors_Status.AWAITING_APPROVAL,\n pendingDecisionRef: decisionRef,\n pendingDecisionRouteVersion: version,\n // #1628: the next-due instant below is computed for the pause state read here; a pause landing in\n // between makes this move match nothing rather than re-arm a paused clock.\n pendingDecisionClockPausedAt: row.pendingDecisionClockPausedAt ?? null,\n }, {\n pendingDecisionRouteKind: next.kind,\n pendingDecisionAssigneeUserId: next.assigneeUserId ?? null,\n pendingDecisionClaimedAt: next.claimedAt ? new Date(next.claimedAt) : null,\n pendingDecisionRouteVersion: version + 1,\n // #1628: a claim meets the CLAIM clock and an unclaim re-opens it, so the next stage due moves with the\n // route. A paused decision keeps no next-due instant until it resumes.\n ...(row.pendingDecisionClockPausedAt ? {} : { pendingDecisionNextDueAt: nextDueAtOfRow(row, { claimed: !!next.claimedAt }) }),\n }, { scopeContext: owner.scopeContext }).catch((error: unknown) => {\n this.logger.error('[ConversationalExecution] A decision move could not be written', {\n executionId: row.executionId, decisionRef, act, ...projectCaughtErrorLogFields(error),\n });\n return null;\n });\n if (moved === null || moved === undefined) return { kind: HumanDecision_ActOutcomeKind.SUPERSEDED };\n\n // ── Recorded, and the new holder told ───────────────────────────────────\n if (this.auditLogs && moverUserId) {\n const requestContext = this.auditContextFor(params.actorAuth, owner);\n const onRecordFailure = (error: unknown) => this.logger.warn('[ConversationalExecution] Could not record a decision move; the move stands', {\n decisionRef, act, ...projectCaughtErrorLogFields(error),\n });\n if (act === HumanDecision_Act.CLAIM || act === HumanDecision_Act.UNCLAIM) {\n void this.auditLogs.logHumanDecisionClaimed({\n ...base, claimed: act === HumanDecision_Act.CLAIM, assigneeUserId: moverUserId, routeVersion: version + 1,\n }, requestContext).catch(onRecordFailure);\n } else {\n const move = {\n ...base,\n ...(route.assigneeUserId ? { fromAssigneeUserId: route.assigneeUserId } : {}),\n toAssigneeUserId: next.assigneeUserId as string,\n routeVersion: version + 1,\n reasonGiven: !!params.reasonGiven,\n };\n void (act === HumanDecision_Act.ESCALATE\n ? this.auditLogs.logHumanDecisionEscalated({ ...move, toDeclaredTarget }, moverUserId, requestContext)\n : this.auditLogs.logHumanDecisionReassigned({ ...move, trigger: HumanDecision_RouteChangeTrigger.PERSON }, moverUserId, requestContext)\n ).catch(onRecordFailure);\n }\n }\n // The new holder hears of it — the assignee, or the role's holders after an UNCLAIM. A claim is announced\n // to nobody: the one person it now names is the one who claimed it.\n this.announceDecisionRouted(next, decisionRef, moverUserId);\n // #2569: and whoever held it before hears it left them — a claimer's colleagues, the person it was moved away from.\n this.announceDecisionWithdrawn({ route, requester, decisionRef, routeVersion: version + 1, ...(moverUserId ? { except: moverUserId } : {}) });\n return { kind: HumanDecision_ActOutcomeKind.APPLIED };\n }\n\n /**\n * Could ANYONE answer a decision on this ROLE route (#1611 (d))? The same listing and the same predicate as\n * {@link listReassignCandidates}, asked of the route itself and stopped at the first person it admits.\n *\n * Two directions, deliberately different:\n * - an organization larger than {@link REASSIGN_CANDIDATE_SCAN_LIMIT} whose first page holds nobody is NOT\n * proven empty, so it answers true (logged): refusing there would deny a real reviewer's work, and a\n * pause nobody takes still ends through #1628's lapse;\n * - a store that cannot be read answers false: the gated call is then denied and nothing is written, which\n * is the fail-closed direction for a turn with no person behind it.\n */\n private async roleRouteHasAnAnswerer(route: HumanDecision_Route, requester: HumanDecision_Requester, subject: HumanDecisionSubject): Promise<boolean> {\n try {\n const listed = await this.systemAccess.listAsSystem<OrganizationMember>(\n CoreResourceType.ORGANIZATION_MEMBERS,\n { organizationId: route.organizationId, status: OrganizationMemberStatus.ACTIVE },\n { page: 1, limit: REASSIGN_CANDIDATE_SCAN_LIMIT },\n { suppressSystemAudit: true },\n );\n const members = Array.isArray(listed) ? listed : (listed?.data ?? []);\n for (const member of members) {\n if (!member.userId || member.userId === requester.ref) continue;\n const verdict = await this.authorizeDecisionAct({ userId: member.userId, route, requester, act: HumanDecision_Act.ANSWER, subject });\n if (verdict.kind === HumanDecision_VerdictKind.ALLOWED) return true;\n }\n if (members.length >= REASSIGN_CANDIDATE_SCAN_LIMIT) {\n this.logger.warn('[ConversationalExecution] A ROLE route\\'s answerers were scanned only up to the cap; pausing without proof', {\n organizationId: route.organizationId, eligibleRole: route.eligibleRole, limit: REASSIGN_CANDIDATE_SCAN_LIMIT,\n });\n return true;\n }\n return false;\n } catch (error) {\n this.logger.warn('[ConversationalExecution] Could not establish who may answer a machine\\'s decision; denying the call', {\n organizationId: route.organizationId, eligibleRole: route.eligibleRole, ...projectCaughtErrorLogFields(error),\n });\n return false;\n }\n }\n\n /**\n * The people a decision may be reassigned or escalated to (#1594 D7, I8): the ACTIVE members of the\n * decision's organization who could answer it under an ASSIGNEE route, checked with the one predicate.\n *\n * Only for a caller who may REASSIGN it; anyone else gets NOT_ACTIONABLE, the answer an unknown decision\n * gets. The requester and the current holder are never offered — the first could not answer it (SoD) and\n * the second already holds it. Bounded: an organization larger than {@link REASSIGN_CANDIDATE_SCAN_LIMIT}\n * members is scanned only that far, and the log says so.\n */\n public async listReassignCandidates(params: {\n decisionRef: string;\n actorAuth: SocketAuthResult;\n }): Promise<HumanDecision_ReassignCandidatesResponse | undefined> {\n const found = await this.findPendingDecision(params.decisionRef);\n const route = found ? humanDecisionRouteOfRow(found.row) : undefined;\n const requester = found ? humanDecisionRequesterOfRow(found.row) : undefined;\n if (!found || found.row.status !== FlowsActors_Status.AWAITING_APPROVAL || !route || !requester || !route.organizationId) return undefined;\n const subject = this.decisionSubjectOfRow(found.row);\n const mover = await this.authorizeDecisionAct({\n userId: params.actorAuth.initiatorIds?.userId, executionType: params.actorAuth.executionType, route, requester, act: HumanDecision_Act.REASSIGN, subject,\n });\n if (mover.kind === HumanDecision_VerdictKind.REFUSED) return undefined;\n\n const listed = await this.systemAccess.listAsSystem<OrganizationMember>(\n CoreResourceType.ORGANIZATION_MEMBERS,\n { organizationId: route.organizationId, status: OrganizationMemberStatus.ACTIVE },\n { page: 1, limit: REASSIGN_CANDIDATE_SCAN_LIMIT },\n { suppressSystemAudit: true },\n );\n const members = Array.isArray(listed) ? listed : (listed?.data ?? []);\n if (members.length >= REASSIGN_CANDIDATE_SCAN_LIMIT) {\n this.logger.warn('[ConversationalExecution] Reassignment candidates were scanned only up to the cap', {\n decisionRef: params.decisionRef, limit: REASSIGN_CANDIDATE_SCAN_LIMIT,\n });\n }\n const moverUserId = params.actorAuth.initiatorIds?.userId;\n // The route each candidate is vetted on: the decision as it would stand once assigned to them. A claim does\n // not travel with a reassignment, so it is dropped rather than carried onto someone who never took it.\n const { claimedAt: _droppedClaim, ...unclaimedRoute } = route;\n const candidates: HumanDecision_ReassignCandidate[] = [];\n for (const member of members) {\n // Not the requester (separation of duties), not whoever holds it now, and not the mover — moving a\n // decision to yourself is a CLAIM, which is its own act with its own record.\n if (!member.userId || member.userId === requester.ref || member.userId === route.assigneeUserId || member.userId === moverUserId) continue;\n const verdict = await this.authorizeDecisionAct({\n userId: member.userId, route: { ...unclaimedRoute, kind: HumanDecision_RouteKind.ASSIGNEE, assigneeUserId: member.userId }, requester, act: HumanDecision_Act.ANSWER, subject,\n });\n if (verdict.kind === HumanDecision_VerdictKind.ALLOWED) {\n candidates.push({ userId: member.userId, ...(member.userEmail ? { email: member.userEmail } : {}) });\n }\n }\n return { candidates };\n }\n\n /**\n * The escalation target the gate DECLARES for this call, or `undefined` when it declares none. Asked under\n * the escalator's authority: it only names a person, who is then vetted like any other target (I8).\n */\n private async declaredEscalationTarget(row: FlowActorExecution, escalatorAuth: SocketAuthResult): Promise<string | undefined> {\n try {\n const paused = parseFlowActorPausedApproval(row.pausedApproval as string);\n const resolved = this.resolveApprovalGatedFunctionTool(row.systemRef, paused.pendingToolName);\n if (resolved.kind !== GatedFunctionToolResolutionKind.FOUND) return undefined;\n const gate = resolveFunctionToolApprovalGate(resolved.functionTool);\n if (!gate?.escalateTo) return undefined;\n return await gate.escalateTo(paused.pendingToolArgs ?? {}, this.buildToolExecutionContext(escalatorAuth, row.executionId, row.systemRef));\n } catch (error) {\n this.logger.warn('[ConversationalExecution] The gate\\'s escalation target could not be resolved', {\n executionId: row.executionId, ...projectCaughtErrorLogFields(error),\n });\n return undefined;\n }\n }\n\n\n // ════════════════════════════════════════════════════════════════════════════\n // Decision deadlines (#1628)\n //\n // Two service-target clocks (CLAIM, DECISION) beside the lapse. A stage firing changes who is ASKED and\n // who is TOLD, never what is decided: nothing below writes an outcome, and only the lapse sweep ends a\n // decision (I1). Each stage fires once across every host, through the compare-and-swap on its own\n // marker column (I3). A pause stops both clocks and never the lapse (I4).\n // ════════════════════════════════════════════════════════════════════════════\n\n /** The approval gate a paused row was raised through, or `undefined` when its tool no longer resolves. */\n private gateOfRow(row: FlowActorExecution, toolName: string | undefined): FunctionTool_HumanApprovalGate | undefined {\n if (!toolName) return undefined;\n try {\n const resolved = this.resolveApprovalGatedFunctionTool(row.systemRef, toolName);\n return resolved.kind === GatedFunctionToolResolutionKind.FOUND ? resolveFunctionToolApprovalGate(resolved.functionTool) : undefined;\n } catch {\n return undefined;\n }\n }\n\n /**\n * Stop or restart a pending decision's CLAIM and DECISION clocks — PAUSE_CLOCK and RESUME_CLOCK.\n *\n * - Admitted by the ONE predicate exactly as an answer is: whoever may answer may pause while they wait on\n * something outside their control. A pause names one of the gate's declared pause states.\n * - A compare-and-swap on the pause state that was read, so a pause and a resume never both land twice.\n * - A pause clears the next-due instant, so the sweep selects nothing while it holds. A resume adds the\n * paused time to each still-running target, counted on that target's own basis (a CALENDAR target counts\n * only the working time the pause covered), and re-arms the next-due instant.\n * - The lapse is never touched (I4): the lapse sweep selects on `pendingDecisionExpiresAt`, which neither\n * write changes, so a paused decision still ends LAPSED when its window closes.\n */\n public async setPendingDecisionClock(params: {\n decisionRef: string;\n actorAuth: SocketAuthResult;\n act: HumanDecision_Act.PAUSE_CLOCK | HumanDecision_Act.RESUME_CLOCK;\n pauseStateRef?: string;\n /** #2797: what the acting door can prove to a granting organization's authentication policy; absent is no session. */\n actingSession?: ActingSession;\n }): Promise<HumanDecision_ActOutcome> {\n const { decisionRef, act } = params;\n const found = await this.findPendingDecision(decisionRef);\n const route = found ? humanDecisionRouteOfRow(found.row) : undefined;\n const requester = found ? humanDecisionRequesterOfRow(found.row) : undefined;\n if (!found || found.row.status !== FlowsActors_Status.AWAITING_APPROVAL || !found.row.pausedApproval || !route || !requester) {\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE };\n }\n const { resourceType, row } = found;\n const owner = this.ownerOfRow(resourceType, row);\n const actorUserId = params.actorAuth.initiatorIds?.userId;\n const toolName = this.pendingToolNameOf(row.pausedApproval as string);\n const base = this.decisionEventBase(row, route, toolName);\n const recordRefusal = (reason: HumanDecision_RefusalReason): void => {\n if (!this.auditLogs) return;\n void this.auditLogs.logHumanDecisionAnswerRefused(\n { ...base, act, reason, ...(actorUserId ? { attemptedByUserId: actorUserId } : {}) },\n this.auditContextFor(params.actorAuth, owner),\n ).catch(() => undefined);\n };\n\n const verdict = await this.authorizeDecisionAct({ userId: actorUserId, executionType: params.actorAuth.executionType, route, requester, act, subject: this.decisionSubjectOfRow(row) });\n if (verdict.kind === HumanDecision_VerdictKind.REFUSED) {\n recordRefusal(verdict.reason);\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE };\n }\n // From here the actor was admitted, so the decision's existence is theirs to know and a refusal names why.\n const refuseAdmitted = (reason: HumanDecision_RefusalReason): HumanDecision_ActOutcome => {\n recordRefusal(reason);\n return { kind: HumanDecision_ActOutcomeKind.NOT_ACTIONABLE, reason };\n };\n // #2797: pausing a decision's clock is an act in its organization, held to its granting organization's policy.\n const held = await this.holdToGrantingOrganization({ decisionRef, userId: actorUserId, organizationId: route.organizationId, session: params.actingSession });\n if (held.kind === HumanDecisionGrantorHoldKind.REFUSED) {\n const refused = refuseAdmitted(held.reason);\n if (held.refusal) throw held.refusal;\n return refused;\n }\n const now = new Date();\n const filter = {\n executionId: row.executionId,\n ...owner.ownerFields,\n machineCredentialId: row.machineCredentialId,\n resourceServerInstanceRef: row.resourceServerInstanceRef,\n status: FlowsActors_Status.AWAITING_APPROVAL,\n pendingDecisionRef: decisionRef,\n pendingDecisionClockPausedAt: row.pendingDecisionClockPausedAt ?? null,\n // The next-due instant a resume writes depends on whether the decision is claimed; a claim landing\n // meanwhile makes this match nothing rather than leave that instant stale (#1628 review L1).\n pendingDecisionRouteVersion: row.pendingDecisionRouteVersion ?? 0,\n };\n const write = (update: Partial<FlowActorExecution>) => this.systemAccess.updateAsSystem(resourceType, filter, update, { scopeContext: owner.scopeContext })\n .catch((error: unknown) => {\n this.logger.error('[ConversationalExecution] A decision clock change could not be written', {\n executionId: row.executionId, decisionRef, act, ...projectCaughtErrorLogFields(error),\n });\n return null;\n });\n\n if (act === HumanDecision_Act.PAUSE_CLOCK) {\n if (row.pendingDecisionClockPausedAt) return refuseAdmitted(HumanDecision_RefusalReason.CLOCK_ALREADY_PAUSED);\n const pauseStates = this.deadlinePolicyOf(this.gateOfRow(row, toolName)).pauseStates;\n if (!params.pauseStateRef || !pauseStates.includes(params.pauseStateRef)) return refuseAdmitted(HumanDecision_RefusalReason.PAUSE_STATE_NOT_DECLARED);\n const paused = await write({\n pendingDecisionClockPausedAt: now,\n pendingDecisionClockPauseStateRef: params.pauseStateRef,\n pendingDecisionNextDueAt: null,\n });\n if (paused === null || paused === undefined) return { kind: HumanDecision_ActOutcomeKind.SUPERSEDED };\n if (this.auditLogs && actorUserId) {\n void this.auditLogs.logHumanDecisionClockPaused(\n { ...base, pauseStateRef: params.pauseStateRef, pausedByUserId: actorUserId },\n this.auditContextFor(params.actorAuth, owner),\n ).catch(() => undefined);\n }\n return { kind: HumanDecision_ActOutcomeKind.APPLIED };\n }\n\n if (!row.pendingDecisionClockPausedAt) return refuseAdmitted(HumanDecision_RefusalReason.CLOCK_NOT_PAUSED);\n const pausedAt = new Date(row.pendingDecisionClockPausedAt);\n const targets = serviceTargetsOfRow(row);\n let resumed = targets;\n try {\n resumed = resumeReviewServiceTargets(targets, pausedAt, now, this.reviewCalendar());\n } catch (error) {\n // Only a CALENDAR target without a readable calendar lands here; count it as elapsed time, loudly.\n this.logger.error('[ConversationalExecution] A paused CALENDAR clock could not be resumed on its calendar; counting elapsed time', {\n decisionRef, ...projectCaughtErrorLogFields(error),\n });\n resumed = resumeReviewServiceTargets({ ...targets, claimBasis: ReviewClockBasis.ELAPSED, decisionBasis: ReviewClockBasis.ELAPSED }, pausedAt, now, undefined);\n }\n const columns = serviceTargetColumns(resumed);\n const pausedMs = Math.max(0, now.getTime() - pausedAt.getTime());\n const pauseStateRef = row.pendingDecisionClockPauseStateRef ?? '';\n const restarted = await write({\n ...columns,\n pendingDecisionClockPausedAt: null,\n pendingDecisionClockPauseStateRef: null,\n pendingDecisionClockPausedMs: (row.pendingDecisionClockPausedMs ?? 0) + pausedMs,\n pendingDecisionNextDueAt: nextDueAtOfRow({ ...row, ...columns } as FlowActorExecution),\n });\n if (restarted === null || restarted === undefined) return { kind: HumanDecision_ActOutcomeKind.SUPERSEDED };\n if (this.auditLogs && actorUserId) {\n void this.auditLogs.logHumanDecisionClockResumed(\n { ...base, pauseStateRef, resumedByUserId: actorUserId, pausedMs },\n this.auditContextFor(params.actorAuth, owner),\n ).catch(() => undefined);\n }\n return { kind: HumanDecision_ActOutcomeKind.APPLIED };\n }\n\n /**\n * What an inbox card shows of a decision's clocks (#1628): while paused, the pause and no deadline; else\n * the CLAIM deadline until it is claimed or missed, then the DECISION deadline until it is missed.\n */\n private deadlineCardFields(row: FlowActorExecution): Pick<HumanDecision_PendingCard, 'nextDeadline' | 'clockPause'> {\n if (row.pendingDecisionClockPausedAt) {\n return {\n clockPause: {\n pausedAt: new Date(row.pendingDecisionClockPausedAt).toISOString(),\n pauseStateRef: row.pendingDecisionClockPauseStateRef ?? '',\n },\n };\n }\n // A deadline at or after the lapse never fires, so the card never shows it: the expiry is the real limit.\n const lapseMs = row.pendingDecisionExpiresAt ? new Date(row.pendingDecisionExpiresAt).getTime() : Number.POSITIVE_INFINITY;\n const beforeLapse = (instant: Date | null | undefined): boolean => !!instant && new Date(instant).getTime() < lapseMs;\n const claimOpen = !row.pendingDecisionClaimedAt && !row.pendingDecisionClaimMissedFiredAt && beforeLapse(row.pendingDecisionClaimDeadlineAt);\n if (claimOpen) return { nextDeadline: { kind: ReviewDeadlineKind.CLAIM, dueAt: new Date(row.pendingDecisionClaimDeadlineAt as Date).toISOString() } };\n if (!row.pendingDecisionDecisionMissedFiredAt && beforeLapse(row.pendingDecisionDecisionDeadlineAt)) {\n return { nextDeadline: { kind: ReviewDeadlineKind.DECISION, dueAt: new Date(row.pendingDecisionDecisionDeadlineAt).toISOString() } };\n }\n return {};\n }\n\n /** The fields every decision audit row carries, read off the row. */\n private decisionEventBase(row: FlowActorExecution, route: HumanDecision_Route, toolName: string | undefined) {\n return {\n decisionRef: row.pendingDecisionRef as string, executionId: row.executionId, plane: HumanDecision_Plane.CONVERSATIONAL, systemRef: row.systemRef,\n ...(toolName ? { toolName } : {}),\n routeKind: route.kind,\n ...(route.eligibleRole ? { routeEligibleRole: route.eligibleRole } : {}),\n ...(route.requiredQualificationKinds?.length ? { routeRequiredQualificationKinds: [...route.requiredQualificationKinds] } : {}),\n ...(route.organizationId ? { organizationId: route.organizationId } : {}),\n };\n }\n\n /**\n * Fire every deadline stage that is due (#1628).\n *\n * SELECTS on the indexed `pendingDecisionNextDueAt` (a paused decision holds none, so it is never\n * selected), READS each candidate because the columns are backend-only, and fires its due stages in order\n * through {@link fireDecisionDeadlineStage}. Safe to run on every host at once: a stage's marker is set\n * by a compare-and-swap that requires it null, so one writer wins and only it acts.\n *\n * A row selected with nothing actually due — its next-due instant went stale behind a concurrent write —\n * has the instant recomputed, so it is not selected again for nothing.\n *\n * A listing is one page; a backlog larger than a page drains over the following runs.\n */\n public async sweepDueDecisionDeadlines(now: Date = new Date()): Promise<DecisionDeadlineSweepResult> {\n const result: DecisionDeadlineSweepResult = { scanned: 0, fired: 0, raced: 0, unreadable: 0, repaired: 0 };\n for (const resourceType of FLOW_ACTOR_EXECUTION_OWNER_VARIANTS) {\n let candidates: FlowActorExecution[] = [];\n try {\n const listed = await this.systemAccess.listAsSystem<FlowActorExecution>(\n resourceType,\n { status: FlowsActors_Status.AWAITING_APPROVAL, pendingDecisionNextDueAt: { $lte: now }, pendingDecisionClockPausedAt: null },\n undefined,\n { suppressSystemAudit: true },\n );\n candidates = Array.isArray(listed) ? listed : (listed?.data ?? []);\n } catch (error) {\n this.logger.error('[ConversationalExecution] Decision-deadline sweep could not list due decisions for a scope', {\n resourceType, ...projectCaughtErrorLogFields(error),\n });\n continue;\n }\n\n for (const candidate of candidates) {\n result.scanned += 1;\n let row = await this.systemAccess.readAsSystem<FlowActorExecution>(resourceType, { executionId: candidate.executionId }, { suppressSystemAudit: true })\n .catch(() => null);\n if (!row) { result.unreadable += 1; continue; }\n if (row.status !== FlowsActors_Status.AWAITING_APPROVAL || !row.pendingDecisionRef || !row.pausedApproval || row.pendingDecisionClockPausedAt) {\n result.raced += 1;\n continue;\n }\n // A decision whose lapse has passed is the lapse sweep's to end; no reminder describes it any more.\n const lapsedAlready = !!row.pendingDecisionExpiresAt && new Date(row.pendingDecisionExpiresAt).getTime() <= now.getTime();\n // A row no stage can ever fire on (its route or requester unreadable) is not re-selected every minute.\n const unfireable = !humanDecisionRouteOfRow(row) || !humanDecisionRequesterOfRow(row);\n const stages = lapsedAlready || unfireable ? [] : dueReviewDeadlineStages(deadlineStageScheduleOfRow(row), now);\n if (stages.length === 0) {\n const repaired = await this.systemAccess.updateAsSystem(resourceType, {\n executionId: row.executionId, status: FlowsActors_Status.AWAITING_APPROVAL, pendingDecisionRef: row.pendingDecisionRef,\n pendingDecisionClockPausedAt: null,\n }, { pendingDecisionNextDueAt: lapsedAlready || unfireable ? null : nextDueAtOfRow(row) }).catch(() => null);\n if (repaired) result.repaired += 1;\n continue;\n }\n for (const stage of stages) {\n const fired = await this.fireDecisionDeadlineStage(resourceType, row, stage, now).catch((error: unknown) => {\n this.logger.error('[ConversationalExecution] A decision deadline stage could not be fired', {\n resourceType, executionId: row?.executionId, stage, ...projectCaughtErrorLogFields(error),\n });\n return false;\n });\n if (!fired) { result.raced += 1; break; }\n result.fired += 1;\n // The next stage is judged on the row as the winning write left it.\n row = await this.systemAccess.readAsSystem<FlowActorExecution>(resourceType, { executionId: candidate.executionId }, { suppressSystemAudit: true })\n .catch(() => null);\n if (!row || row.status !== FlowsActors_Status.AWAITING_APPROVAL) break;\n }\n }\n }\n // Logged unconditionally, including the zero case: a sweep that silently finds nothing is\n // indistinguishable from a sweep that silently stopped running.\n this.logger.info('[ConversationalExecution] Decision-deadline sweep complete', { ...result });\n return result;\n }\n\n /**\n * Fire ONE deadline stage of one decision. Returns `false` when another writer got there first — the\n * stage already fired, the decision ended, was paused, or (for a reassignment) was moved meanwhile.\n *\n * 1. **What the stage does** comes from the gate's rules as they stand now (the defaults when it\n * declares none, or when its tool no longer resolves). A rule is a function of the application's code,\n * so it cannot be stored; WHEN each stage is due was stored at pause and is never re-read from the gate.\n * 2. **A REASSIGN rule** (the first declared at this stage wins) resolves its target under the REQUESTER's\n * authority as it stands now, and the target must be able to ANSWER the decision (I2, #1594 I8). A\n * target that resolves to nobody, or to someone who may not answer, moves nothing: the stage notifies\n * instead, and the refusal is recorded (`targetResolved: false`).\n * 3. **One compare-and-swap** sets the marker (which must be null) and, for a move, the route and its\n * version (which must be the version read). Both land or neither does, so a reassignment is never lost\n * after its stage is marked, and never applied twice.\n * 4. **Only then** are the audit rows written and the people told. A crash between the write and the sends\n * loses at most those sends — accepted: a notice grants nothing and the decision stays in the inbox.\n *\n * Never writes an outcome (I1).\n */\n private async fireDecisionDeadlineStage(resourceType: CoreResourceType, row: FlowActorExecution, stage: ReviewDeadlineStage, now: Date): Promise<boolean> {\n const route = humanDecisionRouteOfRow(row);\n const requester = humanDecisionRequesterOfRow(row);\n const decisionRef = row.pendingDecisionRef;\n if (!route || !requester || !decisionRef || !row.pausedApproval) return false;\n const owner = this.ownerOfRow(resourceType, row);\n const toolName = this.pendingToolNameOf(row.pausedApproval);\n const gate = this.gateOfRow(row, toolName);\n const rulesAtStage = this.deadlinePolicyOf(gate).rules.filter((rule) => rule.stage === stage);\n const reassignRule = (gate?.deadlines?.rules ?? []).find((rule) => rule.stage === stage && rule.action === ReviewEscalationActionKind.REASSIGN);\n const notifyDeclared = rulesAtStage.some((rule) => rule.action === ReviewEscalationActionKind.NOTIFY);\n\n // ── The reassignment, decided before anything is written ───────────────\n let movedTo: HumanDecision_Route | undefined;\n let targetResolved: boolean | undefined;\n let targetRefusalReason: HumanDecision_RefusalReason | undefined;\n if (reassignRule && isReviewerRoute(route)) {\n const targetUserId = await this.resolveEscalationRuleTarget(resourceType, row, route, requester, reassignRule.target, toolName);\n if (!targetUserId) {\n targetResolved = false;\n targetRefusalReason = HumanDecision_RefusalReason.NO_TARGET;\n } else if (targetUserId === route.assigneeUserId) {\n // The target already holds it: there is nowhere to move it, and nobody new to tell.\n targetResolved = true;\n } else {\n const { claimedAt: _claim, ...unclaimed } = route;\n void _claim;\n const next: HumanDecision_Route = { ...unclaimed, kind: HumanDecision_RouteKind.ASSIGNEE, assigneeUserId: targetUserId };\n // assurance-control: WILDO.ACCESS.REQUESTER_REVIEWER_SEPARATION — a deadline rule can only hand a decision to someone the gate would have admitted to answer it, never the requester.\n const vetted = await this.authorizeDecisionAct({ userId: targetUserId, route: next, requester, act: HumanDecision_Act.ANSWER, subject: this.decisionSubjectOfRow(row) });\n if (vetted.kind === HumanDecision_VerdictKind.ALLOWED) {\n movedTo = next;\n targetResolved = true;\n } else {\n targetResolved = false;\n targetRefusalReason = vetted.reason;\n }\n }\n }\n\n // ── The one write: the marker, and the move with it ─────────────────────\n const markerColumn = DEADLINE_STAGE_FIRED_COLUMN[stage];\n const version = row.pendingDecisionRouteVersion ?? 0;\n const written = await this.systemAccess.updateAsSystem(resourceType, {\n executionId: row.executionId,\n ...owner.ownerFields,\n machineCredentialId: row.machineCredentialId,\n resourceServerInstanceRef: row.resourceServerInstanceRef,\n status: FlowsActors_Status.AWAITING_APPROVAL,\n pendingDecisionRef: decisionRef,\n pendingDecisionClockPausedAt: null,\n [markerColumn]: null,\n // Always the version read (#1628 review L1): a claim or a move landing meanwhile changes who should be\n // told — or whether the CLAIM stage applies at all — so this stage is re-judged on the new route.\n pendingDecisionRouteVersion: version,\n }, {\n [markerColumn]: now,\n pendingDecisionNextDueAt: nextDueAtOfRow(row, { firedStage: stage, firedAt: now, claimed: movedTo ? false : !!row.pendingDecisionClaimedAt }),\n ...(movedTo ? {\n pendingDecisionRouteKind: HumanDecision_RouteKind.ASSIGNEE,\n pendingDecisionAssigneeUserId: movedTo.assigneeUserId,\n pendingDecisionClaimedAt: null,\n pendingDecisionRouteVersion: version + 1,\n } : {}),\n }, { scopeContext: owner.scopeContext });\n if (written === null || written === undefined) return false;\n\n // ── Who is told ─────────────────────────────────────────────────────────\n const shouldNotify = notifyDeclared || (!!reassignRule && !movedTo);\n const recipients: DecisionDeadlineNoticeRecipient[] = movedTo\n ? [{ userId: movedTo.assigneeUserId as string, audience: DecisionDeadlineNoticeAudience.REASSIGNEE }]\n : shouldNotify ? await this.decisionNoticeRecipients(resourceType, row, route, requester, stage) : [];\n\n // ── Recorded ────────────────────────────────────────────────────────────\n const base = this.decisionEventBase(row, route, toolName);\n if (this.auditLogs) {\n const onRecordFailure = (error: unknown) => this.logger.warn('[ConversationalExecution] Could not record a decision deadline stage; the stage stands', {\n decisionRef, stage, ...projectCaughtErrorLogFields(error),\n });\n if (!isReviewWarningStage(stage)) {\n const kind = reviewDeadlineKindOfStage(stage);\n const deadlineAt = noticedDeadlineOfStage(row, stage);\n if (deadlineAt) {\n void this.auditLogs.logHumanDecisionDeadlineMissed({\n ...base, kind,\n deadlineAt: deadlineAt.toISOString(),\n basis: (kind === ReviewDeadlineKind.CLAIM ? row.pendingDecisionClaimClockBasis : row.pendingDecisionDecisionClockBasis) ?? ReviewClockBasis.ELAPSED,\n }).catch(onRecordFailure);\n }\n }\n if (reassignRule || notifyDeclared) {\n void this.auditLogs.logHumanDecisionEscalationFired({\n ...base, stage,\n action: movedTo ? ReviewEscalationActionKind.REASSIGN : ReviewEscalationActionKind.NOTIFY,\n reassignAttempted: !!reassignRule && isReviewerRoute(route),\n ...(targetResolved !== undefined ? { targetResolved } : {}),\n ...(targetRefusalReason ? { targetRefusalReason } : {}),\n ...(movedTo ? {\n ...(route.assigneeUserId ? { fromAssigneeUserId: route.assigneeUserId } : {}),\n toAssigneeUserId: movedTo.assigneeUserId,\n routeVersion: version + 1,\n } : {}),\n recipientCount: recipients.length,\n }).catch(onRecordFailure);\n }\n if (movedTo) {\n void this.auditLogs.logHumanDecisionReassigned({\n ...base,\n ...(route.assigneeUserId ? { fromAssigneeUserId: route.assigneeUserId } : {}),\n toAssigneeUserId: movedTo.assigneeUserId as string,\n routeVersion: version + 1,\n reasonGiven: false,\n trigger: HumanDecision_RouteChangeTrigger.ESCALATION_RULE,\n stage,\n }, undefined).catch(onRecordFailure);\n }\n }\n if (movedTo) {\n this.announceDecisionRouted(movedTo, decisionRef);\n // #2569: a missed deadline took it away from whoever held it.\n this.announceDecisionWithdrawn({ route, requester, decisionRef, routeVersion: version + 1, ...(movedTo.assigneeUserId ? { except: movedTo.assigneeUserId } : {}) });\n }\n await this.sendDecisionDeadlineNotices(row, stage, recipients, toolName);\n this.logger.info('[ConversationalExecution] A decision deadline stage fired', {\n resourceType, executionId: row.executionId, decisionRef, stage, reassigned: !!movedTo, recipients: recipients.length,\n });\n return true;\n }\n\n /**\n * Where the requester authority rebuild reads the relationships a decision was raised through (#2768): the record the\n * pause kept with the requester, else, for a turn paused before it was kept, the waiting row's relationship provenance.\n * Only an organization's execution row carries provenance; an older pause on a person's own execution\n * (`userFlowActorExecutions`) records nothing, and its requester is compared with nothing.\n */\n private decisionRaisedThroughOf(\n requester: HumanDecision_Requester,\n resourceType: CoreResourceType,\n executionId: string,\n organizationId: string | undefined,\n ): { raisedThroughRelationshipIds?: readonly string[]; waitingWork?: DecisionWaitingWorkRef } {\n if (requester.throughRelationshipIds) return { raisedThroughRelationshipIds: requester.throughRelationshipIds };\n return resourceType === CoreResourceType.ORGANIZATION_FLOW_ACTOR_EXECUTIONS && organizationId\n ? { waitingWork: { resourceType, key: { executionId, organizationId } } }\n : {};\n }\n\n /**\n * The person a REASSIGN rule names, resolved under the REQUESTER's authority as it stands now — the\n * authority the decision would run under, never a reviewer's. `undefined` when the rule names nobody, the\n * requester's authority no longer holds, or the resolver fails.\n */\n private async resolveEscalationRuleTarget(\n resourceType: CoreResourceType,\n row: FlowActorExecution,\n route: HumanDecision_Route,\n requester: HumanDecision_Requester,\n target: ((args: unknown, context: FunctionToolExecutionContext) => Promise<string | undefined>) | undefined,\n toolName: string | undefined,\n ): Promise<string | undefined> {\n if (!target) return undefined;\n try {\n const rebuilt = await this.executionContextCreator.rebuildDecisionRequesterAuthority({\n requesterKind: requester.kind,\n requesterRef: requester.ref,\n requesterClientId: requester.clientId,\n organizationId: route.organizationId,\n requestedAt: row.pendingDecisionRequestedAt ? new Date(row.pendingDecisionRequestedAt) : new Date(),\n ...(row.autonomousAgentRef ? { autonomousAgentRef: row.autonomousAgentRef } : {}),\n ...this.decisionRaisedThroughOf(requester, resourceType, row.executionId, route.organizationId),\n });\n if (rebuilt.standing !== DecisionRequesterAuthorityStanding.HOLDS) return undefined;\n const paused = parseFlowActorPausedApproval(row.pausedApproval as string);\n // #2665 B7: the authority the decision would run under, confined as its resume would be.\n const requesterAuth = this.confineToChatConversation(rebuilt.auth, await this.chatConversationOf(row.executionId));\n return await target(paused.pendingToolArgs ?? {}, this.buildToolExecutionContext(requesterAuth, row.executionId, row.systemRef, row.pendingDecisionRef ?? undefined));\n } catch (error) {\n this.logger.warn('[ConversationalExecution] A deadline rule\\'s reassignment target could not be resolved; notifying instead', {\n executionId: row.executionId, toolName, ...projectCaughtErrorLogFields(error),\n });\n return undefined;\n }\n }\n\n /**\n * Who a stage tells (I5): exactly the people who may ANSWER the decision at this moment — its requester on\n * an OWNER route, its assignee on an ASSIGNEE route, every eligible holder in its organization (never the\n * requester) on a ROLE route, each re-checked with the one predicate now, so a holder who lost the role is\n * not told. At a DECISION stage the gate's owner — the person whose request is waiting — is told too, in\n * their own words. Never an organization-wide room.\n */\n private async decisionNoticeRecipients(\n resourceType: CoreResourceType,\n row: FlowActorExecution,\n route: HumanDecision_Route,\n requester: HumanDecision_Requester,\n stage: ReviewDeadlineStage,\n ): Promise<DecisionDeadlineNoticeRecipient[]> {\n // The shared walk (#2664 review M3): every active membership, keyset to the end, each re-checked with THIS plane's\n // ANSWER predicate. It read the first 100 members until then, so a holder past them was never told.\n const subject = this.decisionSubjectOfRow(row);\n const answerers = new Set(await collectHumanDecisionAnswerers({\n repositoriesRegistry: this.repositoriesRegistry,\n mayAnswer: async (userId) =>\n (await this.authorizeDecisionAct({ userId, route, requester, act: HumanDecision_Act.ANSWER, subject })).kind === HumanDecision_VerdictKind.ALLOWED,\n logger: this.logger,\n }, { decisionRef: row.pendingDecisionRef ?? '', route, requester }));\n const recipients: DecisionDeadlineNoticeRecipient[] = [...answerers].map((userId) => ({ userId, audience: DecisionDeadlineNoticeAudience.ANSWERER }));\n if (reviewDeadlineKindOfStage(stage) === ReviewDeadlineKind.DECISION) {\n const gateOwner = this.ownerOfRow(resourceType, row).ownerFields.userId\n ?? (requester.kind !== HumanDecision_RequesterKind.MACHINE ? requester.ref : undefined);\n if (gateOwner && !answerers.has(gateOwner)) recipients.push({ userId: gateOwner, audience: DecisionDeadlineNoticeAudience.REQUESTER });\n }\n return recipients;\n }\n\n /**\n * Tell each recipient, in-app (their own room) and by email. Best-effort per recipient and per channel: a\n * notice that cannot be sent is logged, and the decision is still in their inbox. Carries the decision id,\n * the tool name and the instants — never the proposed arguments.\n */\n private async sendDecisionDeadlineNotices(\n row: FlowActorExecution,\n stage: ReviewDeadlineStage,\n recipients: readonly DecisionDeadlineNoticeRecipient[],\n toolName: string | undefined,\n ): Promise<void> {\n if (recipients.length === 0) return;\n const deadlineAt = noticedDeadlineOfStage(row, stage);\n const lapsesAt = row.pendingDecisionExpiresAt ? new Date(row.pendingDecisionExpiresAt) : undefined;\n const organizationId = row.pendingDecisionOrganizationId ?? undefined;\n const config = this.appConfig?.isInitialized() ? this.appConfig.config : undefined;\n const frontendServiceName = this.appConfig?.isInitialized() ? this.appConfig.resolveDefaultFrontendServiceName() : undefined;\n const frontendUrl = config && frontendServiceName ? AuthControllerUtils.lookupFrontendPublicUrl(config, frontendServiceName) ?? undefined : undefined;\n\n for (const recipient of recipients) {\n const identifier = inAppNoticeOfDeadlineStage(stage, recipient.audience);\n // Where the notice leads, in-app AND in the email (#2578): the decision inbox for someone who may act on it, nowhere\n // for the requester, whom the inbox refuses every act on their own decision, so a button would open an empty page.\n // The email's button is the same page under the frontend's public URL, so the two cannot disagree.\n const destination = inAppDestinationOfDeadlineNotice(recipient.audience);\n const appUrl = frontendUrl && destination ? `${frontendUrl.replace(/\\/+$/, '')}${destination}` : undefined;\n void this.webSocket?.notifyUser(recipient.userId, {\n type: isReviewWarningStage(stage) || recipient.audience === DecisionDeadlineNoticeAudience.REQUESTER ? NotificationLevel.INFO : NotificationLevel.WARNING,\n identifier,\n data: { decisionRef: row.pendingDecisionRef, stage, ...(toolName ? { toolName } : {}), ...(deadlineAt ? { deadlineAt: deadlineAt.toISOString() } : {}) },\n destination,\n ...(organizationId ? { organizationId } : {}),\n }).catch((error: unknown) => this.logger.warn('[ConversationalExecution] A deadline notice could not be sent in-app; it is in the inbox', {\n decisionRef: row.pendingDecisionRef, stage, ...projectCaughtErrorLogFields(error),\n }));\n\n if (!this.emailService || !config || !deadlineAt) continue;\n try {\n const user = await this.systemAccess.readAsSystem<User>(CoreResourceType.USERS, { _id: recipient.userId }, { suppressSystemAudit: true });\n const email = (user as { email?: string } | null)?.email;\n if (!email) continue;\n await this.emailService.send({\n templateRef: SystemEmailTemplateRef.HUMAN_DECISION_DEADLINE,\n locale: this.recipientLanguage ? await this.recipientLanguage.forUser(recipient.userId) : getConfiguredPrimaryLanguage(config),\n type: EmailTemplateType.TRANSACTIONAL,\n to: email,\n // The decision's organization: its branding while in effect (#2306), and its sender.\n ...(organizationId ? { organizationId } : {}),\n context: {\n currentObject: { email },\n objectContext: {\n primaryScopeContext: {\n appName: applicationDisplayName(config.appIdentity),\n applicationId: this.appConfig?.applicationId,\n logoUrl: this.appConfig?.resolveBrandLogoAbsoluteUrl({ composition: BrandAssetComposition.LOCKUP, purpose: BrandAssetPurpose.EMAIL }) ?? undefined,\n },\n },\n userContext: { userId: recipient.userId, email },\n additionalContext: {\n stage,\n reassignedToYou: recipient.audience === DecisionDeadlineNoticeAudience.REASSIGNEE,\n forRequester: recipient.audience === DecisionDeadlineNoticeAudience.REQUESTER,\n decisionRef: row.pendingDecisionRef,\n ...(toolName ? { toolName } : {}),\n deadlineAt: deadlineAt.toISOString(),\n ...(lapsesAt ? { lapsesAt: lapsesAt.toISOString() } : {}),\n ...(appUrl ? { appUrl } : {}),\n },\n },\n });\n } catch (error) {\n this.logger.warn('[ConversationalExecution] A deadline notice could not be emailed; it is in the inbox', {\n decisionRef: row.pendingDecisionRef, stage, ...projectCaughtErrorLogFields(error),\n });\n }\n }\n }\n\n /**\n * The pending decisions this person may act on, as decision cards (#1594 D6).\n *\n * Candidates are SELECTED on indexed columns built from the person — decisions assigned to them, OWNER\n * decisions they raised, and ROLE decisions in organizations they hold a role entry in, an organization they reach\n * through a live relationship included (#2792, `resolveHumanDecisionListingOrganizationIds`) — then each is READ (the\n * route columns are backend-only, so a listing projects them out) and re-checked with the same predicate\n * an answer is (I3). A card appears only if the person may answer it now; `permittedActs` says what else.\n * The organizations are resolved once and handed to every other host, so each plane selects from the same set.\n *\n * The card is the decision and never the conversation: tool, proposed arguments, deadline, route.\n */\n public async listPendingDecisions(actorAuth: SocketAuthResult): Promise<HumanDecision_PendingCard[]> {\n const userId = actorAuth.initiatorIds?.userId;\n if (actorAuth.executionType !== ExecutionContext_ExecutionType.USER_REQUEST || !userId) return [];\n const organizationIds = await resolveHumanDecisionListingOrganizationIds(\n { executionContextCreator: this.executionContextCreator, logger: this.logger }, actorAuth,\n );\n const waiting = { status: FlowsActors_Status.AWAITING_APPROVAL };\n const filters: Record<string, unknown>[] = [\n { ...waiting, pendingDecisionAssigneeUserId: userId },\n { ...waiting, pendingDecisionRouteKind: HumanDecision_RouteKind.OWNER, pendingDecisionRequesterRef: userId },\n ...organizationIds.map((organizationId) => ({ ...waiting, pendingDecisionRouteKind: HumanDecision_RouteKind.ROLE, pendingDecisionOrganizationId: organizationId })),\n ];\n\n const candidates = new Map<string, CoreResourceType>();\n for (const resourceType of FLOW_ACTOR_EXECUTION_OWNER_VARIANTS) {\n for (const filter of filters) {\n const listed = await this.systemAccess.listAsSystem<FlowActorExecution>(\n resourceType, filter, { page: 1, limit: PENDING_DECISION_LIST_LIMIT }, { suppressSystemAudit: true },\n ).catch((error: unknown) => {\n this.logger.warn('[ConversationalExecution] Could not list pending decisions for one scope', { resourceType, ...projectCaughtErrorLogFields(error) });\n return [] as FlowActorExecution[];\n });\n const rows = Array.isArray(listed) ? listed : (listed?.data ?? []);\n if (rows.length >= PENDING_DECISION_LIST_LIMIT) {\n this.logger.warn('[ConversationalExecution] A pending-decision selection reached its cap; the list is partial', {\n resourceType, userId, limit: PENDING_DECISION_LIST_LIMIT,\n });\n }\n for (const candidate of rows) candidates.set(candidate.executionId, resourceType);\n }\n }\n\n const cards: HumanDecision_PendingCard[] = [];\n const deliverablesByDecision = new Map<string, NonNullable<ResolvedDecisionDeliverables['deliverables']>>();\n const subjectRecordsByDecision = new Map<string, HumanDecision_PresentedRecord>();\n for (const [executionId, resourceType] of candidates) {\n const row = await this.systemAccess.readAsSystem<FlowActorExecution>(resourceType, { executionId }, { suppressSystemAudit: true }).catch(() => null);\n const described = row ? this.decisionCardOfRow(row, new Date()) : undefined;\n if (!described) continue;\n const { card, route, requester } = described;\n const permittedActs: HumanDecision_Act[] = [];\n // One row whose facts cannot be read (a unit read, a qualification register read, #2967) is left out of this listing\n // with a warning, never the whole inbox emptied: the actor plane isolates its rows the same way.\n let roleFacts: HumanDecision_RoleFacts;\n try {\n roleFacts = isReviewerRoute(route)\n ? await resolveHumanDecisionRoleFacts(this.humanDecisionRoleFactsPorts(), { userId, route, requester, subject: this.decisionSubjectOfRow(row!) })\n : NO_HUMAN_DECISION_ROLE_FACTS;\n } catch (error) {\n this.logger.warn('[ConversationalExecution] A pending decision\\'s role facts could not be read; it is left out of this listing', {\n executionId, userId, ...projectCaughtErrorLogFields(error),\n });\n continue;\n }\n for (const act of Object.values(HumanDecision_Act)) {\n const verdict = authorizeHumanDecisionActor({ actor: { executionType: actorAuth.executionType, userId }, roleFacts, route, requester, act });\n if (verdict.kind === HumanDecision_VerdictKind.ALLOWED) permittedActs.push(act);\n }\n // I3: only what the person could ANSWER. A supervisor who may only take a decision over does not see\n // it listed as theirs; they reach it through the decision id.\n if (!permittedActs.includes(HumanDecision_Act.ANSWER)) continue;\n cards.push({ ...card, permittedActs });\n // #2904: the call's file deliverable, bound by its hash as the act that answers it binds it.\n const resolved = await this.decisionPresentationBindingsOf(card.systemRef, {\n decisionRef: card.decisionRef, toolName: card.toolName, toolArgs: card.toolArgs,\n ...(route.organizationId ? { organizationId: route.organizationId } : {}),\n });\n if (resolved.deliverables) deliverablesByDecision.set(card.decisionRef, resolved.deliverables);\n if (resolved.subjectRecord) subjectRecordsByDecision.set(card.decisionRef, resolved.subjectRecord);\n }\n // Decisions held by another plane's host (#1612, #2539), re-checked by that host with the same predicate.\n for (const host of this.humanDecisionHosts ?? []) cards.push(...await host.listCards(actorAuth, { organizationIds }));\n // #2903: every card carries what it presents and the id an answer echoes, built by the one function each plane's act\n // rebuilds it with.\n const presentationKey = decisionPresentationKeyOfRuntime(this.appConfig);\n // Soonest deadline first: that is the one a person must not miss.\n return cards\n .map((card) => card.plane === HumanDecision_Plane.CONVERSATIONAL\n ? withDecisionPresentation(card, presentationKey, deliverablesByDecision.get(card.decisionRef), subjectRecordsByDecision.get(card.decisionRef))\n : withDecisionPresentation(card, presentationKey))\n .sort((a, b) => (a.expiresAt ?? '\\uffff').localeCompare(b.expiresAt ?? '\\uffff'));\n }\n\n /**\n * A waiting row's decision card WITHOUT `permittedActs`, the one field that depends on who views it (#2664 S5b): the\n * inbox adds the viewer's acts, and a decision's notice is built from the card as everyone who may answer sees it.\n * `undefined` when the row holds no decision anyone could answer: not waiting, no route or requester, or a pause that\n * is unreadable or lapsed. The card is the decision and never the conversation: tool, proposed arguments, deadline,\n * route.\n */\n private decisionCardOfRow(row: FlowActorExecution, now: Date): {\n readonly card: Omit<HumanDecision_PendingCard, 'permittedActs'>;\n readonly route: HumanDecision_Route;\n readonly requester: HumanDecision_Requester;\n } | undefined {\n const route = humanDecisionRouteOfRow(row);\n const requester = humanDecisionRequesterOfRow(row);\n if (row.status !== FlowsActors_Status.AWAITING_APPROVAL || !row.pausedApproval || !row.pendingDecisionRef || !route || !requester) return undefined;\n let paused: FlowActorExecution_PausedApproval;\n try {\n paused = parseFlowActorPausedApproval(row.pausedApproval);\n } catch {\n return undefined;\n }\n if (isFlowActorPausedApprovalLapsed(paused, now)) return undefined;\n const toolInputSchema = this.describeGatedToolInputSchema(row.systemRef, paused.pendingToolName);\n // #2526: the system's own name, read from the registry; absent when it is no longer registered.\n const system = this.registeredActorSystem(row.systemRef);\n // #2526 review F2: the risk of THIS call, as its gate declares it — not the system's, which says how far the\n // assistant is trusted overall and would badge a deletion \"low\" because the assistant is.\n const riskLevel = this.gateOfRow(row, paused.pendingToolName)?.riskLevel;\n return {\n route,\n requester,\n card: {\n decisionRef: row.pendingDecisionRef,\n plane: HumanDecision_Plane.CONVERSATIONAL,\n executionId: row.executionId,\n systemRef: row.systemRef,\n ...(system?.displayName ? { systemDisplayName: system.displayName } : {}),\n ...(riskLevel ? { riskLevel } : {}),\n toolName: paused.pendingToolName,\n toolArgs: (paused.pendingToolArgs ?? {}) as Record<string, unknown>,\n ...(toolInputSchema ? { toolInputSchema } : {}),\n // #2720: an agent's question is answered as a question, through its form, in the inbox as in the chat.\n ...((() => {\n const question = this.pausedQuestionOf(row.systemRef, {\n decisionRef: row.pendingDecisionRef as string, toolName: paused.pendingToolName, toolArgs: paused.pendingToolArgs as Record<string, unknown> | undefined,\n questionForm: paused.questionForm, requestedAt: paused.requestedAt, ...(paused.expiresAt ? { expiresAt: paused.expiresAt } : {}),\n });\n return question ? { request: question } : {};\n })()),\n requestedAt: paused.requestedAt,\n ...(paused.expiresAt ? { expiresAt: paused.expiresAt } : {}),\n route,\n routeVersion: row.pendingDecisionRouteVersion ?? 0,\n requesterKind: requester.kind,\n ...(requester.kind !== HumanDecision_RequesterKind.MACHINE ? { requesterUserId: requester.ref } : {}),\n declaresEscalationTarget: this.gateDeclaresEscalationTarget(row.systemRef, paused.pendingToolName),\n // #1628: the next service target ahead of it, the pause it is in, and the pause states it offers.\n ...this.deadlineCardFields(row),\n pauseStates: this.deadlinePolicyOf(this.gateOfRow(row, paused.pendingToolName)).pauseStates,\n // #1921: a tool approval is always a review of agent work, so its answer may carry a declared reason code.\n reasonCodes: this.agentWorkDecisions?.declaredReasonCodes() ?? [],\n // #2923: the step-up an answer must carry, so the inbox asks for it before answering.\n ...(paused.stepUp ? { stepUp: paused.stepUp } : {}),\n ...(paused.answerChannels ? { answerChannels: paused.answerChannels } : {}),\n },\n };\n }\n\n // ─── #2664 S5b: this plane as a decision-notice source ─────────────────────\n //\n // A stay is keyed by the decision id, unique across the three owner variants (`pendingDecisionRef`), and its route\n // version moves with every claim, reassignment and escalation. Only a decision routed IN an organization has one: that\n // organization is the one a chat answer is confined to (`answerPendingDecision`), and a chat link belongs to it.\n\n public readonly plane = HumanDecision_Plane.CONVERSATIONAL;\n\n /**\n * One page of the waiting decisions, by keyset on `_id` within each owner variant in turn. The cursor names the\n * variant and the last `_id` read; a variant is finished only when it answers an EMPTY page (a short page proves\n * nothing: a repository clamps a page to its ceiling). A page whose rows all hold no stay has no stays and a `next`.\n */\n public async listLiveStays(after: string | undefined, limit: number): Promise<HumanDecisionNoticeLiveStayPage> {\n if (!this.repositoriesRegistry) throw new Error('No repository is bound in this process, so the waiting decisions cannot be listed.');\n const separator = after?.indexOf('|') ?? -1;\n let variantIndex = after === undefined || separator < 0 ? 0 : Number(after.slice(0, separator));\n let afterId = after === undefined || separator < 0 ? undefined : after.slice(separator + 1) || undefined;\n const waiting = { status: FlowsActors_Status.AWAITING_APPROVAL };\n const now = new Date();\n for (; variantIndex < FLOW_ACTOR_EXECUTION_OWNER_VARIANTS.length; variantIndex += 1, afterId = undefined) {\n const rows = await this.repositoriesRegistry.findManyForInfrastructure<FlowActorExecution & { _id: unknown }>(\n FLOW_ACTOR_EXECUTION_OWNER_VARIANTS[variantIndex]!,\n afterId === undefined ? waiting : { $and: [waiting, { _id: { $gt: afterId } }] },\n undefined,\n undefined,\n { sort: [{ field: '_id', order: SortOrder.ASC }], limit },\n );\n if (rows.length === 0) continue;\n return {\n stays: rows.flatMap((row) => { const stay = this.noticeStayOfRow(row, now); return stay ? [stay] : []; }),\n next: `${variantIndex}|${String(rows[rows.length - 1]!._id)}`,\n };\n }\n return { stays: [] };\n }\n\n public async stayStateOf(stayRef: string): Promise<HumanDecisionNoticeStayState> {\n const read = await this.readDecisionRowForNotice(stayRef);\n if (read === UNREADABLE_DECISION_ROW) return { kind: HumanDecisionNoticeStayLiveness.UNREADABLE };\n const stay = read ? this.noticeStayOfRow(read, new Date()) : undefined;\n return stay ? { kind: HumanDecisionNoticeStayLiveness.LIVE, stay } : { kind: HumanDecisionNoticeStayLiveness.NOT_LIVE };\n }\n\n public async describeStay(stayRef: string): Promise<HumanDecisionNoticeStayDescription | undefined> {\n const read = await this.readDecisionRowForNotice(stayRef);\n if (read === UNREADABLE_DECISION_ROW || !read) return undefined;\n const now = new Date();\n const stay = this.noticeStayOfRow(read, now);\n const described = stay ? this.decisionCardOfRow(read, now) : undefined;\n if (!stay || !described) return undefined;\n // What only the in-app inbox uses: the moves, the clock pauses, the edit schema.\n const { declaresEscalationTarget: _moves, pauseStates: _pauses, clockPause: _clock, toolInputSchema: _edit, ...card } = described.card;\n const { route, requester } = described;\n const answererUserIds = await collectHumanDecisionAnswerers({\n repositoriesRegistry: this.repositoriesRegistry,\n mayAnswer: this.noticeAnswerPredicateOf(read, described),\n logger: this.logger,\n }, { decisionRef: stay.decisionRef, route, requester });\n return { stay, card, answererUserIds };\n }\n\n /** #2756: which of `userIds` may answer the decision now, by the predicate `describeStay` walks the organization with. */\n public async answerersAmong(stayRef: string, userIds: readonly string[]): Promise<HumanDecisionNoticeAnswererCheck> {\n const read = await this.readDecisionRowForNotice(stayRef);\n if (read === UNREADABLE_DECISION_ROW) return { kind: HumanDecisionNoticeStayLiveness.UNREADABLE };\n const now = new Date();\n const stay = read ? this.noticeStayOfRow(read, now) : undefined;\n const described = read && stay ? this.decisionCardOfRow(read, now) : undefined;\n if (!read || !stay || !described) return { kind: HumanDecisionNoticeStayLiveness.NOT_LIVE };\n const answererUserIds = await admitHumanDecisionAnswerers({ mayAnswer: this.noticeAnswerPredicateOf(read, described), logger: this.logger }, { decisionRef: stay.decisionRef, userIds });\n return { kind: HumanDecisionNoticeStayLiveness.LIVE, stay, answererUserIds };\n }\n\n /**\n * The CHAT-OFFERABLE answer predicate, person by person: this plane's own ANSWER predicate (as the deadline notices\n * ask it), then the granting organization's authentication policy as a chat answer would meet it, with no session\n * (#2797). The walk and the re-check share it.\n */\n private noticeAnswerPredicateOf(\n read: FlowActorExecution,\n described: { readonly route: HumanDecision_Route; readonly requester: HumanDecision_Requester },\n ): (userId: string) => Promise<boolean> {\n const { route, requester } = described;\n const subject = this.decisionSubjectOfRow(read);\n // #2797: a chat card's reader answers with no session, so one the granting organization's policy would refuse is\n // never offered the card.\n return chatOfferableAnswerPredicate(\n { executionContextCreator: this.executionContextCreator, logger: this.logger },\n { decisionRef: read.pendingDecisionRef ?? '', organizationId: route.organizationId },\n async (userId) =>\n (await this.authorizeDecisionAct({ userId, route, requester, act: HumanDecision_Act.ANSWER, subject })).kind === HumanDecision_VerdictKind.ALLOWED,\n );\n }\n\n /**\n * The row holding a decision, for a notice: `null` when no variant holds it, {@link UNREADABLE_DECISION_ROW} when a\n * variant could not be read. Unlike `findPendingDecision`, a read error is not an absence: a notice must never be\n * withdrawn because a read failed.\n */\n /**\n * The chat-conversation ledger row of a conversation, when it lives in a chat (#2665 B7): `null` when it does not, or\n * when no ledger store is bound. A failed read throws, so no caller runs a turn unconfined on a guess.\n */\n private async chatConversationOf(executionId: string): Promise<ChatConversation | null> {\n return this.chatConversations ? this.chatConversations.readByExecutionId(executionId) : null;\n }\n\n /**\n * `auth` confined to the chat conversation's organization (#2665 B7, B10: that organization's entries and the\n * application's `APP_USER`, read through the LIVE role table), or as it is when the conversation lives in no chat.\n */\n private confineToChatConversation(auth: SocketAuthResult, chatConversation: ChatConversation | null): SocketAuthResult {\n return chatConversation ? this.confineToChatOrganization(auth, chatConversation.organizationId) : auth;\n }\n\n private confineToChatOrganization(auth: SocketAuthResult, organizationId: string): SocketAuthResult {\n return confineAuthorityToChatConversationOrganization(auth, organizationId, (roleKey, scope) => this.authorizer.getRoleHierarchy(roleKey as never, scope));\n }\n\n /**\n * What a chat message would meet, asked BEFORE the chat door owes it a reply (#2665 S6, plan V1): read-only, through the\n * same predicates the start applies, so every refusal is decided before anything is written and the start then runs\n * on the answer. A person's conversation, confined to the chat's organization as the start confines it once the\n * conversation's ledger row exists (B7), so consent is asked of the authority the turn will hold, and the token budget\n * the door checks bills that organization.\n *\n * In order: the message already held (the conversation took it: final, whatever else holds), then the refusals that\n * end the message (consent, a system that cannot converse), then the thread's state (a decision waiting, a turn\n * running). A thread that cannot be read THROWS: whether the message is already held is not something to guess. So does\n * a consent requirement that could not be evaluated: it is not the person's refusal (review M1).\n */\n public async previewChatTurn(params: {\n readonly systemRef: string;\n readonly executionId: string;\n readonly auth: SocketAuthResult;\n readonly organizationId: string;\n readonly userMessageId: string;\n }): Promise<ChatTurnPreview> {\n const { systemRef, executionId, organizationId, userMessageId } = params;\n const userId = params.auth.initiatorIds?.userId;\n if (!userId) return { kind: ChatTurnPreviewKind.REFUSED, errorCode: FlowsActors_ExecutionErrorCode.NO_OWNER };\n const owner = this.resolveOwnerVariant({ userId });\n const auth = this.confineToChatOrganization(params.auth, organizationId);\n\n const existing = await this.readChatConversationRow(owner, auth, executionId);\n if (existing && (existing.messages ?? []).some((message) => message.id === userMessageId)) return { kind: ChatTurnPreviewKind.ALREADY_RECEIVED };\n\n // Three answers, not two (#2665 S6 review M1): a requirement that could not be evaluated is not the person's refusal.\n // Answering it as one would tell them to record a consent they may hold and discard their message, so it throws and\n // the delivery is tried again, like a thread that cannot be read.\n const consent = await this.serviceConsentVerdictForTurn({ auth, owner, systemRef, executionId });\n if (consent === ServiceConsentRequirementVerdict.NOT_EVALUATED) throw new ChatTurnConsentNotEvaluatedError(executionId);\n if (consent === ServiceConsentRequirementVerdict.REFUSED) {\n return { kind: ChatTurnPreviewKind.REFUSED, errorCode: FlowsActors_ExecutionErrorCode.SERVICE_CONSENT_REQUIRED };\n }\n const system = this.conversationalActorSystemOf(systemRef);\n if (system.refusal) return { kind: ChatTurnPreviewKind.REFUSED, errorCode: system.refusal.errorCode };\n if (!this.resolveChatAgentRef(system.actorSystem!)) return { kind: ChatTurnPreviewKind.REFUSED, errorCode: FlowsActors_ExecutionErrorCode.NO_CHAT_ACTOR };\n // The same launch gate the start asks, so a member the system is not open to is told before anything is written.\n if (!(await this.admitsSystemStart({ auth, owner, actorSystem: system.actorSystem!, organizationId, refusedSurface: `flows-actors:turn:${FlowsActors_InitiationKind.CHAT_MESSAGE}` }))) {\n return { kind: ChatTurnPreviewKind.REFUSED, errorCode: FlowsActors_ExecutionErrorCode.SYSTEM_ROLE_NOT_HELD };\n }\n\n if (existing?.status === FlowsActors_Status.AWAITING_APPROVAL) {\n const decisionRef = existing.pendingDecisionRef ?? '';\n const replyAnswer = decisionRef ? this.replyAnswerOfWaitingDecision(existing, decisionRef) : null;\n return { kind: ChatTurnPreviewKind.WAITING_FOR_DECISION, decisionRef, ...(replyAnswer ? { replyAnswer } : {}) };\n }\n if (existing && conversationRefusesArrivingTurn(existing, FlowsActors_InitiationKind.CHAT_MESSAGE)) return { kind: ChatTurnPreviewKind.BUSY };\n return { kind: ChatTurnPreviewKind.ADMITTED, auth };\n }\n\n /**\n * How a person's next message would answer the decision `row` waits on (#2751), or `null`: the question its paused call\n * asks, read through `pausedQuestionOf` (the one reader the card, the inbox and the answer door share), and held to\n * `humanDecisionReplyAnswerOf`. A pause that cannot be read answers nothing: the message is refused as before.\n */\n private replyAnswerOfWaitingDecision(row: FlowActorExecution, decisionRef: string): HumanDecisionReplyAnswer | null {\n if (!row.pausedApproval) return null;\n let paused: FlowActorExecution_PausedApproval;\n try {\n paused = parseFlowActorPausedApproval(row.pausedApproval);\n } catch {\n return null;\n }\n return humanDecisionReplyAnswerOf(this.pausedQuestionOf(row.systemRef, {\n decisionRef, toolName: paused.pendingToolName, toolArgs: paused.pendingToolArgs as Record<string, unknown> | undefined,\n questionForm: paused.questionForm, requestedAt: paused.requestedAt, ...(paused.expiresAt ? { expiresAt: paused.expiresAt } : {}),\n }));\n }\n\n /**\n * Whether the person's conversation `executionId` already holds the chat message `userMessageId` (#2665 S6 review\n * L12): the preview's own read. The chat door asks it of every OTHER epoch a retried message could have joined, so a\n * message whose turn started in one epoch is never started again in a later one that has since widened over it. A\n * thread that cannot be read throws.\n */\n public async chatConversationHoldsMessage(params: {\n readonly executionId: string;\n readonly auth: SocketAuthResult;\n readonly organizationId: string;\n readonly userMessageId: string;\n }): Promise<boolean> {\n const userId = params.auth.initiatorIds?.userId;\n if (!userId) return false;\n const owner = this.resolveOwnerVariant({ userId });\n const existing = await this.readChatConversationRow(owner, this.confineToChatOrganization(params.auth, params.organizationId), params.executionId);\n return (existing?.messages ?? []).some((message) => message.id === params.userMessageId);\n }\n\n /**\n * The application's service consent requirement, asked of a chat turn's authority confined to the chat's organization\n * (#2665 S6 review M1): the start refused a chat message for consent, and the chat door asks again which of the three it\n * was. REFUSED is the person's to remedy; NOT_EVALUATED, and an ADMITTED that came too late, are tried again.\n */\n public async chatTurnConsentVerdict(params: {\n readonly systemRef: string;\n readonly executionId: string;\n readonly auth: SocketAuthResult;\n readonly organizationId: string;\n }): Promise<ServiceConsentRequirementVerdict> {\n const userId = params.auth.initiatorIds?.userId;\n if (!userId) return ServiceConsentRequirementVerdict.NOT_EVALUATED;\n const owner = this.resolveOwnerVariant({ userId });\n const auth = this.confineToChatOrganization(params.auth, params.organizationId);\n return this.serviceConsentVerdictForTurn({ auth, owner, systemRef: params.systemRef, executionId: params.executionId });\n }\n\n /**\n * A person's conversation row as the start reads it: the same owner fields, credential axis and agent instance (a chat\n * turn arrives through no A2A agent). A row that cannot be read throws.\n */\n private async readChatConversationRow(owner: ResolvedOwnerVariant, auth: SocketAuthResult, executionId: string): Promise<FlowActorExecution | null> {\n return this.systemAccess.readAsSystem<FlowActorExecution>(\n owner.resourceType,\n { executionId, ...owner.ownerFields, machineCredentialId: machineCredentialIdOf(auth), resourceServerInstanceRef: agentInstanceOf(undefined) },\n { scopeContext: owner.scopeContext },\n );\n }\n\n private async readDecisionRowForNotice(decisionRef: string): Promise<FlowActorExecution | null | typeof UNREADABLE_DECISION_ROW> {\n if (!decisionRef) return null;\n let unreadable = false;\n for (const resourceType of FLOW_ACTOR_EXECUTION_OWNER_VARIANTS) {\n try {\n const row = await this.systemAccess.readAsSystem<FlowActorExecution>(resourceType, { pendingDecisionRef: decisionRef }, { suppressSystemAudit: true });\n if (row) return row;\n } catch (error) {\n unreadable = true;\n this.logger.warn('[ConversationalExecution] A decision could not be read for its notice', { decisionRef, resourceType, ...projectCaughtErrorLogFields(error) });\n }\n }\n return unreadable ? UNREADABLE_DECISION_ROW : null;\n }\n\n /** The stay a row holds, or `undefined` when it holds none: no answerable decision, or none routed in an organization. */\n private noticeStayOfRow(row: FlowActorExecution, now: Date): HumanDecisionNoticeLiveStay | undefined {\n const described = this.decisionCardOfRow(row, now);\n const organizationId = described?.route.organizationId;\n if (!described || !organizationId) return undefined;\n return {\n plane: this.plane,\n stayRef: described.card.decisionRef,\n occurrenceRef: described.card.decisionRef,\n decisionRef: described.card.decisionRef,\n routeVersion: described.card.routeVersion,\n organizationId,\n ...(described.card.expiresAt ? { expiresAt: new Date(described.card.expiresAt) } : {}),\n };\n }\n\n /**\n * Re-invoke the agent with the human's decision appended, and finish the turn.\n *\n * The resume payload is the SDK's own message array captured at suspension, plus a\n * `tool-approval-response` carrying the decision. We do not reconstruct the conversation: the\n * array is opaque to us by contract, and rebuilding it would silently change what the model sees.\n * An approved response's `reason` reaches no model; a reviewer's edit is told through the mark on the call (#3192,\n * `reviewerEditStatementsOf`).\n *\n * A resumed turn is the work of the principal it resumes as (#2722): the requester, rebuilt, so what its system writes\n * create is that principal's relationship's (see {@link startConversationalExecution}).\n */\n private async resumeAfterApproval(params: ResumeAfterApprovalParams): Promise<void> {\n const ending: ResumedTurnEnding = {};\n try {\n return await runAsRelationshipProvenanceOf(\n params.auth,\n params.owner.ownerFields.organizationId ?? params.auth?.initiatorIds?.organizationId ?? undefined,\n () => this.runResumeAfterApproval(params, ending),\n );\n } finally {\n await this.recordResumedWorkEnding(params, ending);\n await this.recordAcceptedCallNotRun(params, ending);\n }\n }\n\n /**\n * #3313: a turn resumed on an acceptance ended and its tool never ran, so the acceptance did not take effect. The decision's\n * own rows stay as they are, since the person did accept and the trail is append-only: this row is the correction. A\n * COMPLETED ending counts: the SDK can refuse the approved call and tell the model, which then answers normally. Not for a\n * turn its owner stopped (`CANCELLED`), which is its own recorded act, nor one that paused again, which has not ended; and\n * it never throws: a resume that has ended cannot be failed by its bookkeeping.\n */\n private async recordAcceptedCallNotRun(params: ResumeAfterApprovalParams, ending: ResumedTurnEnding): Promise<void> {\n const ended = ending.status === FlowsActors_Status.FAILED || ending.status === FlowsActors_Status.COMPLETED;\n if (!params.acceptedAs || !params.decisionRef || !ended || ending.acceptedCallReached) return;\n const { executionId, systemRef, decisionRef, paused, owner } = { ...params, decisionRef: params.decisionRef };\n // The tenant the decision's RESOLVED row is on, which a user's conversation does not name itself.\n const organizationId = params.acceptedDecisionOrganizationId ?? owner.ownerFields.organizationId;\n this.logger.warn('[ConversationalExecution] A resumed turn ended without the accepted call running', { systemRef, executionId, decisionRef, toolName: paused.pendingToolName, errorCode: ending.errorCode });\n try {\n await this.auditLogs?.logHumanDecisionAcceptedCallNotRun({\n decisionRef, executionId, systemRef, toolName: paused.pendingToolName, outcome: params.acceptedAs,\n ...(ending.errorCode !== undefined ? { errorCode: ending.errorCode } : {}),\n ...(organizationId ? { organizationId } : {}),\n });\n } catch (error) {\n this.logger.warn('[ConversationalExecution] An accepted call that did not run could not be recorded; the turn\\'s end stands', {\n executionId, decisionRef, ...projectCaughtErrorLogFields(error),\n });\n }\n }\n\n /**\n * Append the ending of the WORK a resume continued to `workEvents` (#2821), once the resume is over, however it ended.\n * Only a resume that continues a work (an answered decision's, or an inline resume inside one) has one to record, and\n * only when its own end sites set one ({@link ResumedTurnEnding}): nothing is read back from the row. Never throws.\n */\n private async recordResumedWorkEnding(params: ResumeAfterApprovalParams, ending: ResumedTurnEnding): Promise<void> {\n const workRef = params.workRef ?? params.decisionRef;\n const { status } = ending;\n if (!workRef || status === undefined) return;\n await this.recordWorkEvent(params.owner.resourceType, { executionId: params.executionId, ...params.owner.ownerFields }, workRef, resumedWorkTransitionOf({ ...ending, status }));\n }\n\n /**\n * Append one entry to a conversation's per-work log, `workEvents` (#2821): `{ workRef, status, at }`, the newest\n * {@link CONVERSATION_WORK_EVENTS_RETAINED} kept. An atomic array addition through the repository, filtered on the row's\n * identity alone, so it lands whatever the row's status is: while the row waits on another work's decision, or after\n * an overlapping turn ended it. Best-effort and never throws: a lost entry leaves the work read from an older entry or\n * from the row's own fields, which is logged here rather than failing the turn it describes.\n *\n * A `PROCESSING` entry also stamps `workContinuationOpenedAt` with its own instant, in the same statement (#2829), so a\n * thread holding a running work is always one the interrupted-turn sweep selects, and no entry can exist without it.\n * The sweep's own `FAILED` adds that column to `rowFilter`, so its append lands only if no continuation was released\n * since it read the row. Answers what the append did ({@link WorkEventRecording}).\n */\n private async recordWorkEvent(\n resourceType: ResolvedOwnerVariant['resourceType'],\n rowFilter: { readonly executionId: string } & Record<string, unknown>,\n workRef: string,\n /** The work's new status, with its code for a failure (#2827), so a door holding the work can say why it failed. */\n transition: FlowsActors_StatusTransition,\n ): Promise<WorkEventRecording> {\n const { executionId } = rowFilter;\n const { status } = transition;\n if (!this.repositoriesRegistry) {\n this.logger.warn('[ConversationalExecution] No repository is bound here, so a work\\'s life is not recorded; doors read it from the row\\'s own fields', { executionId, workRef, status });\n return WorkEventRecording.NOT_RECORDED;\n }\n const at = new Date();\n try {\n const landed = await this.repositoriesRegistry.atomicGuardedMutation(resourceType, rowFilter, {\n ...(status === FlowsActors_Status.PROCESSING ? { set: { workContinuationOpenedAt: at } } : {}),\n arrayAdditions: [{\n path: 'workEvents',\n values: [{ workRef, status, at, ...(transition.status === FlowsActors_Status.FAILED ? { failureCode: transition.failureCode } : {}) }],\n placement: RepositoryArrayAdditionPlacement.TAIL,\n distinctOnly: false,\n maxLength: CONVERSATION_WORK_EVENTS_RETAINED,\n }],\n });\n return landed !== null && landed !== undefined ? WorkEventRecording.LANDED : WorkEventRecording.NO_ROW;\n } catch (error) {\n this.logger.warn('[ConversationalExecution] A work\\'s life could not be recorded; a door asking about it reads an older entry or the row\\'s own fields', {\n executionId, workRef, status, ...projectCaughtErrorLogFields(error),\n });\n return WorkEventRecording.NOT_RECORDED;\n }\n }\n\n private async runResumeAfterApproval(params: ResumeAfterApprovalParams, ending: ResumedTurnEnding): Promise<void> {\n const { systemRef, executionId, owner, paused, approved } = params;\n const resumedAt = Date.now();\n\n /*\n * A resumed turn ENDS like a fresh one (#2521): one terminal event to the owner, and a transcript\n * that is the prior one plus whatever this turn added — never less.\n *\n * The browser leaves RUNNING only on `FLOWS_ACTORS_COMPLETED` or `FLOWS_ACTORS_ERROR`\n * (`FlowsActorsContext`), and answering an approval puts it back in RUNNING. A resume that ended\n * on a bare final MESSAGE therefore left the chat's composer locked and the workbench's\n * \"build now\" waiting for a turn that had finished. Every exit below ends through one of these two.\n */\n /** What the resumed turn did before it ended, once its agent is known (#2524); stored on every exit. */\n let resumeTrace: ConversationalTurnTrace | undefined;\n // #2827: every resumed failure names its code, recorded with the end and told to the client.\n const endFailed = async (errorCode: FlowsActors_ExecutionErrorCode, errorMessage: string): Promise<void> => {\n ending.status = FlowsActors_Status.FAILED;\n ending.errorCode = errorCode;\n const ended = await this.finalizeTerminal(systemRef, executionId, owner, (current) => (resumeTrace ? resumeTrace.appendTo(params.transcript(current)) : params.transcript(current)), { status: FlowsActors_Status.FAILED, failureCode: errorCode },\n machineCredentialIdOf(params.auth), agentInstanceOf(params.resourceServerInstanceRef));\n this.reportTurnEnd(params.emitter, systemRef, executionId, ended, () => {\n if (params.emitter) this.emitError(params.emitter, systemRef, executionId, errorCode, errorMessage);\n });\n };\n\n const resumeMessages = [\n ...(params.modifiedSdkModelMessages ?? paused.sdkModelMessages),\n {\n role: 'tool',\n content: [{\n type: 'tool-approval-response',\n approvalId: paused.approvalId,\n approved,\n ...(params.reason ? { reason: params.reason } : {}),\n }],\n },\n ];\n\n // A resumed turn is as stoppable as a fresh one (#2524): its owner's Stop reaches it through the same registry, and an\n // inline resume also hears the turn it continues (`abortSignal`).\n // #2550: TWO sites resume a turn — `answerPendingDecision`'s release (every answer door reaches it, detached or not),\n // and the inline automatic denial in the pause path. Only the first is registered as a decision RESUME, reachable by\n // execution id wherever it runs (`stopResumedTurns`): an A2A `tasks/cancel` lands on any replica and holds no handle\n // on a continuation somebody else's answer released. The inline one continues the turn that paused, on the same\n // replica, under that turn's own abort, so its opener stops it the way it stops the turn — and a stop aimed at a\n // released decision's continuation in the same thread must not reach it. `releasedAt` is what tells them apart.\n // #2821: registered under the WORK it continues (its first decision), so a stop reaches that work's continuations only,\n // a chained one included, and never another turn's in the same thread.\n const releasedByAnswer = params.releasedAt !== undefined;\n const resumedWorkRef = params.workRef ?? params.decisionRef;\n const acceptedToolCallId = params.acceptedAs ? pendingToolCallIdOf(paused.sdkModelMessages, paused.approvalId) : undefined;\n const turnAbort = this.registerRunningTurn(executionId, owner, params.abortSignal, releasedByAnswer ? resumedWorkRef : undefined, params.releasedAt);\n try {\n // The system or its agent can be gone: on a denial, which the door does not ask about, or since the door asked (#3313).\n // The decision is already settled, so nothing can resume it: the turn ends FAILED with its transcript, not wedged at\n // PROCESSING until the liveness sweep finds it. The resolver's refusal is the turn's end, reported once\n // by `endFailed` (#2721 re-review R-1): emitted first, it was followed by DECISION_PENDING whenever the\n // row read back waiting, two terminal events for one turn.\n const resolved = this.conversationalActorSystemOf(systemRef);\n if (resolved.refusal) {\n await endFailed(resolved.refusal.errorCode, resolved.refusal.errorMessage);\n return;\n }\n const actorSystem = resolved.actorSystem;\n const agentRef = this.resolveChatAgentRef(actorSystem);\n if (!agentRef) {\n await endFailed(FlowsActors_ExecutionErrorCode.NO_CHAT_ACTOR, `System '${systemRef}' has no agentic actor bound to an agent.`);\n return;\n }\n\n // The tool context is what makes a resume able to DO anything. Without it the agent resolves\n // no tools, so the approved call cannot execute and the provider rejects the unresolved\n // `tool_use`. A resume that cannot run the tool is not a resume.\n if (!params.auth) {\n this.logger.error('[ConversationalExecution] Cannot resume without the requester\\'s auth; the tool would have no identity to run as', {\n systemRef, executionId, approvalId: paused.approvalId,\n });\n await endFailed(FlowsActors_ExecutionErrorCode.AGENT_FAILED, 'The assistant failed to produce a response.');\n return;\n }\n\n /*\n * ONE id for every delta and the final event, exactly as a fresh turn does (`assistantMessageId`\n * above). The client merges a streamed message BY this id: deltas append, the final event replaces.\n * Without it each delta and the final full text arrived as separate one-shot messages, so the page\n * rendered the reply followed by the reply again — seen on the creation assistant's first approved\n * turn, 2026-09-24 (#1464). The persisted message was always right; only the live view doubled.\n */\n const resumedAssistantMessageId = randomUUID();\n // #2292 R8: the organizations' policies as they are NOW. The paused call carries what the tools returned under the\n // treatment it paused with, so a resume under a stricter one would send the model what that one withholds: refused,\n // and the person asks again under the policy as it is.\n const turnPolicies = await this.turnAgentPolicies(params.auth);\n if (turnPolicies.unreadable !== undefined) {\n this.logger.error('[ConversationalExecution] An organization\\'s agent policy could not be read; the resume is refused rather than run untightened', {\n systemRef, executionId, approvalId: paused.approvalId, reason: turnPolicies.unreadable,\n });\n await endFailed(FlowsActors_ExecutionErrorCode.AGENT_FAILED, 'The assistant failed to produce a response.');\n return;\n }\n const pausedUnder = paused.personalDataTreatment ?? undefined;\n const currentGuardrails = this.turnGuardrailsOf(agentRef, turnPolicies);\n if (this.contentPolicyTightenedSincePause(paused, agentRef, turnPolicies)) {\n this.logger.warn('[ConversationalExecution] The organization tightened its agents\\' content policy since this call paused; the resume is refused', {\n systemRef, executionId, approvalId: paused.approvalId,\n pausedUnder: pausedUnder ?? 'none', currentTreatment: currentGuardrails?.personalData?.treatment,\n });\n await endFailed(FlowsActors_ExecutionErrorCode.CONTENT_POLICY_TIGHTENED, 'The organization tightened its content policy since this action was paused. Ask again.');\n return;\n }\n // #2292: the turn's personal-data view: the same placeholders as the turn that paused, read back from the row.\n // #3295: a resume with no view of its own (the paused tool is gone, on a denial) still holds the paused messages, so\n // it opens from their posture. From the current guardrails, a relaxed treatment would leave a later pause with none.\n const personalData = params.personalData ?? TurnPersonalDataView.open(\n pausedUnder ? this.guardrailsOfPausedPosture(paused) : currentGuardrails,\n params.initiationKind,\n params.storedPersonalDataState,\n );\n // #3295: the paused messages are in the form this treatment wrote, placeholders included, and only a guard under it\n // can read them back. So a treatment relaxed since the pause reaches the NEXT turn, not the one holding them: without\n // this the resume has no guard, and writes a placeholder into the record as if it were the value, or the SDK refuses\n // a typed field holding one. It can only hold the treatment up (the merge is tighten-only), and a treatment\n // tightened since the pause was refused above. Handed to the run on `heldPersonalDataTreatment`.\n const heldGuardrails = pausedUnder ? effectiveAgentContentGuardrails(currentGuardrails, [{ personalDataTreatment: pausedUnder }]) : currentGuardrails;\n // A second pause of this resumed turn records the looser of what its messages were built under: the paused posture\n // (the replayed messages) and the guardrails it resumes with (what it runs now, held as above, or the next resume\n // would run with no guard over the same placeholders).\n personalData.recordMessagesAlsoBuiltUnder(looserPausedPosture(pausedPostureOfGuardrails(heldGuardrails), {\n personalDataTreatment: paused.personalDataTreatment ?? null,\n personalDataReidentifiesForMachineReaders: paused.personalDataReidentifiesForMachineReaders === true,\n promptInjectionScreening: paused.promptInjectionScreening ?? null,\n }));\n const resumeToolContext = this.buildToolExecutionContext(params.auth, executionId, systemRef, params.decisionRef, {\n initiationKind: params.initiationKind,\n autonomousTrigger: params.autonomousTrigger,\n });\n // #2904: the answer's seal, beside the decision it seals, for a tool that records the decision.\n if (params.decisionSealId) resumeToolContext.decisionSealId = params.decisionSealId;\n if (personalData.table) resumeToolContext.personalDataPlaceholders = personalData.table;\n if (pausedUnder) resumeToolContext.heldPersonalDataTreatment = pausedUnder;\n // #3364 step 3: the records its owners tightened moderation for are in the replayed messages.\n if (paused.outputModerationAtPause?.length) {\n resumeToolContext.heldOutputModeration = Object.fromEntries(paused.outputModerationAtPause.map((entry) => [entry.category, entry.blockAtOrAbove]));\n }\n if (acceptedToolCallId) resumeToolContext.onFunctionToolExecuting = (toolCallId) => { if (toolCallId === acceptedToolCallId) ending.acceptedCallReached = true; };\n resumeTrace = this.openTurnTrace(systemRef, executionId, agentRef, params.emitter ?? (() => {}), params.auth?.initiatorIds?.organizationId);\n const trace = resumeTrace;\n // #1598 (I2): the resume is a separate request with no frame of its own, so its spend was uncorrelated.\n // It reopens the turn's attribution from the row: the owner's tenant, the thread's case, this execution.\n const resumeCaseRef = params.caseRef !== undefined ? params.caseRef ?? undefined : await this.readTurnCaseRef(owner, executionId, params.auth, params.resourceServerInstanceRef);\n const resumeAttribution = this.workAttributionOf(owner, executionId, resumeCaseRef, params.auth);\n // #2935: the resumed call is charged as the principal it runs as (the requester re-resolved before release), through\n // the door the turn was opened through: the agent service charges it, as it charges the turn's first call.\n const result = await this.inTurnSpendFrame(params.initiationKind, params.auth, () => runWithWorkAttributionFrame(resumeAttribution, () => this.inTurnPolicyFrame(turnPolicies, () => this.agentsBackend.invokeAgentStreaming(\n { agentRef, input: { messages: resumeMessages } } as any,\n {\n abortSignal: turnAbort.signal,\n onDelta: (delta) => {\n const released = personalData.streamDelta(delta);\n if (released.length === 0) return;\n params.emitter?.(CoreWebSocketEvent.FLOWS_ACTORS_MESSAGE, {\n systemRef, executionId, messageType: FlowsActors_MessageContentType.MARKDOWN,\n messageId: resumedAssistantMessageId,\n content: released, isFinal: false, timestamp: new Date(),\n });\n },\n // A resumed turn runs the approved tool and may call more: its trace is recorded like a fresh turn's (#2524).\n onToolEvent: (event) => trace.recordToolEvent(personalData.toolEventForReader(this.toolEventWithCredentialsWithheld(systemRef, event))),\n onReasoningDelta: (delta) => trace.recordReasoningDelta(personalData.reasoningDelta(delta)),\n onSource: trace.recordSource,\n },\n resumeToolContext,\n { sessionRef: executionId, label: `flows-actors:${systemRef}`, attribution: resumeAttribution },\n ))));\n trace.recordReasoningDelta(personalData.flushReasoning());\n const heldBack = personalData.flushStream();\n if (heldBack.length > 0) {\n params.emitter?.(CoreWebSocketEvent.FLOWS_ACTORS_MESSAGE, {\n systemRef, executionId, messageType: FlowsActors_MessageContentType.MARKDOWN,\n messageId: resumedAssistantMessageId, content: heldBack, isFinal: false, timestamp: new Date(),\n });\n }\n\n // STOPPED by its owner (#2524): CANCELLED, keeping what it did and what it had said — the same arm a fresh\n // turn takes, read from the signal we own (an aborted stream ends cleanly, it does not throw).\n if (turnAbort.signal.aborted) {\n ending.status = FlowsActors_Status.CANCELLED;\n const partial = personalData.recordReply(resumedAssistantMessageId, this.extractAssistantText(result.output));\n const cancelledAt = new Date();\n const ended = await this.finalizeTerminal(systemRef, executionId, owner, (current) => [\n ...trace.appendTo(params.transcript(current), cancelledAt),\n ...(partial.length > 0 ? [{\n id: resumedAssistantMessageId,\n role: FlowsActors_ConversationRole.ASSISTANT,\n contentType: FlowsActors_MessageContentType.MARKDOWN,\n content: partial,\n createdAt: cancelledAt,\n }] : []),\n ], { status: FlowsActors_Status.CANCELLED }, machineCredentialIdOf(params.auth), agentInstanceOf(params.resourceServerInstanceRef), { personalData });\n this.reportTurnEnd(params.emitter, systemRef, executionId, ended, () => params.emitter && this.emitTurnCancelled(params.emitter, systemRef, executionId, resumedAt));\n return;\n }\n\n // A resumed turn can suspend AGAIN — a multi-step agent may hit a second gated tool. That is\n // ordinary, not an error, so it is persisted the same way rather than recorded as completed.\n const nextSuspension = (result as { approvalSuspension?: AgentApprovalSuspension }).approvalSuspension;\n if (nextSuspension) {\n const secondPauseText = personalData.recordReply(resumedAssistantMessageId, this.extractAssistantText(result.output));\n const pauseOutcome = await this.persistApprovalSuspension({\n systemRef, executionId, owner, auth: params.auth,\n resourceServerInstanceRef: params.resourceServerInstanceRef,\n // What the resumed turn did, onto the row as it stands (#2743). This once wrote `[]` as the row's messages,\n // erasing the whole conversation the moment a resumed turn met a second gated tool; the first pause records its\n // work for the same reason: a reload during the wait must still show the thread.\n transcript: (current) => this.pausedTurnMessages(trace.appendTo(params.transcript(current)), {\n id: resumedAssistantMessageId, text: secondPauseText, data: trace.replyData(),\n }),\n personalData,\n suspension: nextSuspension,\n emitter: params.emitter ?? (() => {}),\n // A NEW decision, raised by the same requester as the first (#1594 D11): the person whose answer\n // resumed this turn never becomes its requester, so they cannot answer their own escalation.\n requester: params.requester,\n initiationKind: params.initiationKind,\n autonomousTrigger: params.autonomousTrigger,\n automaticDenials: params.automaticDenials,\n workAttribution: resumeAttribution,\n turnAbortSignal: turnAbort.signal,\n withholdCallInput: trace.withholdInput,\n turnStartedAt: resumedAt,\n // #2821: a pause in the continuation of an answered decision belongs to that decision's work.\n ...((params.workRef ?? params.decisionRef) ? { continuesWorkRef: params.workRef ?? params.decisionRef } : {}),\n });\n // #2821: the work's log follows what the attempt DID, never a later read of the row: once the pause lands, an\n // answer (an automated approver's) can release the new decision before this line, and a read would then take its\n // running continuation for an ending. RAISED and RESUMED_INLINE end nothing here (the work waits, or the inline\n // resume recorded its own ending); UNCONFIRMED records nothing (see the enum); only a pause that never happened\n // ends the work, as its exits ended the turn.\n if (pauseOutcome === PauseAttemptOutcome.ENDED_WITHOUT_PAUSE) {\n if (turnAbort.signal.aborted) {\n ending.status = FlowsActors_Status.CANCELLED;\n } else {\n // #2827: the code `endTurnWithoutPause` recorded on the row and told the client.\n ending.status = FlowsActors_Status.FAILED;\n ending.errorCode = TURN_ENDED_WITHOUT_PAUSE_CODE;\n }\n }\n return;\n }\n\n // PERSIST THE ANSWER, not just the status.\n //\n // This wrote `status` + `finishedAt` only, so the agent's reply was emitted to the live socket\n // and then dropped: a reload after a decision showed the thread with the question and no\n // answer. It matters most for a DENIAL, where the reply (\"I can't do that without approval\")\n // IS the entire outcome of the turn — the same reason the pause path persists the user's turn\n // alongside the suspension.\n const assistantText = personalData.recordReply(resumedAssistantMessageId, this.extractAssistantText(result.output));\n const finishedAt = new Date();\n const replyData = trace.replyData();\n // Onto the row as it stands (#2743): a message sent while this resumed turn ran is a sibling turn's, and stays.\n const resumedTranscript: ConversationalTurnTranscript = (current) => (assistantText.length > 0\n ? [...trace.appendTo(params.transcript(current), finishedAt), {\n id: resumedAssistantMessageId,\n role: FlowsActors_ConversationRole.ASSISTANT,\n contentType: FlowsActors_MessageContentType.MARKDOWN,\n content: assistantText,\n ...(replyData ? { data: replyData } : {}),\n createdAt: finishedAt,\n }]\n : trace.appendTo(params.transcript(current), finishedAt));\n\n const resumedRowFilter = {\n executionId, ...owner.ownerFields,\n machineCredentialId: machineCredentialIdOf(params.auth),\n resourceServerInstanceRef: agentInstanceOf(params.resourceServerInstanceRef),\n };\n // #2821: the work's ending is its own, written to `workEvents` whether or not this row write lands: an overlapping\n // turn that paused the thread refuses the row write below, and the work has finished all the same.\n ending.status = FlowsActors_Status.COMPLETED;\n const resumedCompleted = await this.writeTurnTranscript(owner, {\n ...resumedRowFilter,\n // #2721 review F-1: never over a row waiting for a decision. A message admitted while this resumed turn ran\n // starts an overlapping turn, which may pause the thread on a decision of its own.\n status: { $nin: [FlowsActors_Status.AWAITING_APPROVAL] },\n }, resumedTranscript, {\n status: FlowsActors_Status.COMPLETED,\n finishedAt,\n }, personalData);\n const waitingFor = resumedCompleted ? undefined : await this.waitingDecisionOf(owner, resumedRowFilter);\n const ended: TurnEndRecord = waitingFor === undefined ? TURN_END_RECORDED : { kind: TurnEndRecordKind.DECISION_WAITING, decisionRef: waitingFor };\n if (waitingFor !== undefined) {\n this.logger.warn('[ConversationalExecution] An overlapping turn paused the thread for a decision; the resumed turn\\'s reply is not persisted', { systemRef, executionId });\n }\n\n trace.finishReasoning();\n params.emitter?.(CoreWebSocketEvent.FLOWS_ACTORS_MESSAGE, {\n systemRef, executionId, messageType: FlowsActors_MessageContentType.MARKDOWN,\n messageId: resumedAssistantMessageId,\n content: assistantText, ...(replyData ? { data: replyData } : {}), isFinal: true, timestamp: new Date(),\n });\n // The terminal event a fresh turn emits after its final message (#2521). Without it the client\n // kept the turn RUNNING: the final MESSAGE carries the text, not the end of the turn.\n const usage = this.turnUsageShownTo(params.auth, result);\n this.reportTurnEnd(params.emitter, systemRef, executionId, ended, () => params.emitter?.(CoreWebSocketEvent.FLOWS_ACTORS_COMPLETED, {\n systemRef, executionId, status: FlowsActors_Status.COMPLETED, duration: Date.now() - resumedAt, ...(usage ? { usage } : {}),\n }));\n } catch (error) {\n // A transport that THROWS on abort (most end the stream cleanly) still reports a stop as a stop (#2524).\n if (turnAbort.signal.aborted) {\n ending.status = FlowsActors_Status.CANCELLED;\n const ended = await this.finalizeTerminal(systemRef, executionId, owner, (current) => (resumeTrace ? resumeTrace.appendTo(params.transcript(current)) : params.transcript(current)), { status: FlowsActors_Status.CANCELLED },\n machineCredentialIdOf(params.auth), agentInstanceOf(params.resourceServerInstanceRef));\n this.reportTurnEnd(params.emitter, systemRef, executionId, ended, () => params.emitter && this.emitTurnCancelled(params.emitter, systemRef, executionId, resumedAt));\n return;\n }\n if (error instanceof AgentOutputWithheldError) {\n // #2292 Phase 3: the resumed turn's output was withheld (the approved call ran; what the model wrote after it did not\n // pass). Ended FAILED under the withholding's code, as on a fresh turn.\n this.logger.warn('[ConversationalExecution] The resumed turn\\'s output was withheld by its output moderation', {\n systemRef, executionId, approvalId: paused.approvalId, code: error.code, outputKind: error.withholding.outputKind,\n });\n await endFailed(error.code, error.message);\n return;\n }\n if (agentSuspensionRefusalOf(error)?.reason === AgentSuspensionRefusalReason.SUSPENDED) {\n // #2843: the agent was suspended after the door asked (#3313), or on a denial's continuation. The decision is settled;\n // the continuation is a new model call, and the suspension refuses it before the model runs.\n this.logger.warn('[ConversationalExecution] The agent was suspended while its turn waited; the resume is refused', {\n systemRef, executionId, approvalId: paused.approvalId,\n });\n await endFailed(FlowsActors_ExecutionErrorCode.AGENT_SUSPENDED, 'This assistant has been suspended by an administrator.');\n return;\n }\n this.logger.error('[ConversationalExecution] Resumed turn failed after the approval decision', {\n systemRef, executionId, approvalId: paused.approvalId, ...projectCaughtErrorLogFields(error),\n ...(error instanceof AgentModelCallFailedError ? { statusCode: error.statusCode } : {}),\n });\n // What the turn did, onto the row as it stands: the empty list this once passed was written as the row's messages\n // and erased the whole conversation when a resumed model call threw (#2521).\n await endFailed(FlowsActors_ExecutionErrorCode.AGENT_FAILED, 'The assistant failed to produce a response.');\n } finally {\n this.unregisterRunningTurn(executionId, turnAbort);\n }\n }\n\n // ── Approve-with-modifications (#566) ──────────────────────────────────────\n\n /**\n * A modification that survived every server-side check and is ready to resume.\n *\n * Carries the rewritten array AND what the audit trail needs, because both are produced by the\n * same walk of the SDK's message array — recomputing either afterwards would mean walking it a\n * second time and could disagree with the version that was signed.\n */\n /**\n * #2292: the personal-data view of a paused turn, opened from the row its decision was read with, or `undefined` when\n * the agent that paused it can no longer be resolved (the decision is then refused or resumed without one, as before).\n */\n private personalDataViewOfPausedTurn(\n systemRef: string,\n pendingToolName: string,\n row: Pick<FlowActorExecution, 'personalDataModelState' | 'initiationKind'>,\n /**\n * #2292 R8: the treatment the turn paused under, as the pause recorded it — which an organization's policy may have\n * raised above the declaration. The view is the PAUSED turn's; a resume under a stricter policy is refused before it\n * runs on this view.\n */\n paused: Pick<FlowActorExecution_PausedApproval, 'personalDataTreatment' | 'personalDataReidentifiesForMachineReaders' | 'promptInjectionScreening'>,\n ): TurnPersonalDataView | undefined {\n const resolved = this.resolveApprovalGatedFunctionTool(systemRef, pendingToolName);\n if (resolved.kind !== GatedFunctionToolResolutionKind.FOUND) return undefined;\n return TurnPersonalDataView.open(this.guardrailsOfPausedPosture(paused), row.initiationKind, row.personalDataModelState);\n }\n\n /** The guardrails a turn paused under, as the pause recorded them: what its stored messages were built with. */\n private guardrailsOfPausedPosture(\n paused: Pick<FlowActorExecution_PausedApproval, 'personalDataTreatment' | 'personalDataReidentifiesForMachineReaders' | 'promptInjectionScreening'>,\n ): FlowsActors_AgentContentGuardrails {\n return {\n ...(paused.personalDataTreatment\n ? { personalData: { treatment: paused.personalDataTreatment, reidentifyForMachineReaders: paused.personalDataReidentifiesForMachineReaders === true } }\n : {}),\n ...(paused.promptInjectionScreening ? { promptInjection: { screening: paused.promptInjectionScreening } } : {}),\n };\n }\n\n /**\n * #2292 R8: the agent policies of the organizations this turn acts for — the caller's organization, and each\n * representing organization it stands there through — read once for the turn. When one could not be read the lookup\n * says so (`unreadable`): the turn refuses, and the frame carries the same lookup, so the agent service refuses the\n * call too rather than read again or run it untightened.\n */\n private async turnAgentPolicies(auth: SocketAuthResult | undefined): Promise<AgentPolicyLookup> {\n return readAgentPolicies(this.repositoriesRegistry, this.turnOrganizationIdsOf(auth));\n }\n\n /** The organizations a turn acts for: its own, and each representing organization it stands there through. */\n private turnOrganizationIdsOf(auth: SocketAuthResult | undefined) {\n const organizationId = auth?.initiatorIds?.organizationId ?? undefined;\n return turnPolicyOrganizationIds(organizationId, resolveRepresentingOrganizationIdsInOrganization(auth?.initiatorRoles, organizationId));\n }\n\n /**\n * #2292 R8: whether the policies as they are now are stricter than the ones a call paused under. The paused call carries\n * what its tools returned under that treatment, so a resume under a stricter one would send the model what that one\n * withholds. Asked at the door of an approval (#3313) and again by the resume, which may run later.\n */\n private contentPolicyTightenedSincePause(paused: FlowActorExecution_PausedApproval, agentRef: string, policies: AgentPolicyLookup): boolean {\n const pausedUnder = paused.personalDataTreatment ?? undefined;\n const current = this.turnGuardrailsOf(agentRef, policies);\n // The machine-reader half is asked only while a treatment is still current: a relax to no treatment is no tightening.\n const machineReadersNowKeepPlaceholders = pausedUnder !== undefined && paused.personalDataReidentifiesForMachineReaders === true\n && current?.personalData?.treatment !== undefined && current.personalData.reidentifyForMachineReaders !== true;\n // The paused messages carry its tool results as its model read them; screened then, or they reach the model unscreened.\n const screeningNowOn = current?.promptInjection?.screening !== undefined && !paused.promptInjectionScreening;\n return isStricterPersonalDataTreatment(current?.personalData?.treatment, pausedUnder) || machineReadersNowKeepPlaceholders || screeningNowOn;\n }\n\n /** #2292 R8: an agent's guardrails under the turn's policies: its declaration, tightened by each. */\n private turnGuardrailsOf(agentRef: string, policies: AgentPolicyLookup): FlowsActors_AgentContentGuardrails | undefined {\n const declared = this.flowsActorsRegistry.getAgent(agentRef)?.contentGuardrails;\n return policies.unreadable === undefined && policies.policies.length > 0 ? effectiveAgentContentGuardrails(declared, policies.policies) : declared;\n }\n\n /**\n * #2292 R8: run the agent call inside the turn's policy frame — an unreadable result included, so the agent service\n * refuses the call on THIS reading (before any model call, through the turn's failure path) instead of reading again.\n */\n private inTurnPolicyFrame<T>(policies: AgentPolicyLookup, fn: () => T): T {\n return runWithAgentPolicyFrame(policies, fn);\n }\n\n private async prepareApprovedToolCallModification(params: {\n systemRef: string;\n executionId: string;\n paused: FlowActorExecution_PausedApproval;\n modifiedToolArgs: Record<string, unknown>;\n /** #3192: a person reviewing the call edited it, as opposed to answering a question it asked. */\n reviewerEdited: boolean;\n /**\n * #2292/#2855: the paused turn's view. Under any treatment the rewritten call is marked person-authored, so the model\n * is sent its personal arguments treated; under `TOKENIZE` the executed copy also carries them as placeholders.\n */\n personalData?: TurnPersonalDataView;\n }): Promise<ToolCallModificationPreparation> {\n const { paused, modifiedToolArgs } = params;\n\n /*\n * The agent, and the FunctionTool behind the name the model was shown.\n *\n * A gated tool is always a FunctionTool: `requiresHumanApproval` is declared on that interface\n * and nothing else contributes to the approval-gated set — an MCP tool is discovered from a\n * server at turn start and no author can gate one. So a pending approval whose tool this cannot\n * find is a disagreement between the paused row and the live registry, not an unsupported case.\n */\n const resolved = this.resolveApprovalGatedFunctionTool(params.systemRef, paused.pendingToolName);\n if (resolved.kind !== GatedFunctionToolResolutionKind.FOUND) return this.goneCallRefusal(resolved, paused.pendingToolName);\n const { functionTool } = resolved;\n // The agent the tool was resolved THROUGH — the resumed turn runs on it, so it comes from the same lookup.\n const { agentRef } = resolved;\n if (!resolveFunctionToolApprovalGate(functionTool)) {\n // Not pedantry: it means the registry no longer gates this tool, so the resumed turn would run\n // arguments a human authored under a gate that has since been removed.\n return { kind: ToolApprovalModificationOutcomeKind.REFUSED, message: `The tool \"${paused.pendingToolName}\" no longer requires approval, so this pending decision is stale. Deny it and ask again.`, refusal: { reason: FlowsActors_ApprovalModificationRefusalReason.TOOL_NO_LONGER_GATED, toolName: paused.pendingToolName } };\n }\n\n // #3314: a secret is not a tool argument. Whatever the treatment, a call's arguments are kept on the paused row, in the\n // transcript's tool trace and in the agent-work record, and under `REMOVE` or none the executed copy holds them as\n // typed, so a credential typed here would be stored at rest, three times. Refused for every agent rather than for the\n // treatments that happened to leak, and before the schema reads the value, whose error text could quote it. It reads\n // what the field is DECLARED to be, on the tool's schema and every schema of its resource, at any depth: free text\n // nothing classifies is outside what any check can see (#3325).\n // Rejected: scrubbing the copies afterwards, which leaves a secret to be found in every store a later feature adds.\n const typedCredentials = editedCredentialPaths(modifiedToolArgs, paused.pendingToolArgs, [functionTool.inputSchema, ...(this.argumentResourceSchemasOf(functionTool) ?? [])]).sort();\n if (typedCredentials.length > 0) {\n // #3317: leaving it out cannot help where the tool requires it.\n const requiredCredentials = await this.credentialsNobodyCanSupply(functionTool, (paused.pendingToolArgs ?? {}) as Record<string, unknown>, typedCredentials);\n if (requiredCredentials.length > 0) return this.argumentsFinalRefusal(paused.pendingToolName, requiredCredentials);\n return this.callCannotRunRefusal(\n `A credential cannot be typed into \"${paused.pendingToolName}\": ${typedCredentials.join(', ')}. The approval is still pending: leave it out, or deny it.`,\n { reason: FlowsActors_ApprovalModificationRefusalReason.CREDENTIAL_NOT_ACCEPTED, toolName: paused.pendingToolName, argumentPaths: typedCredentials },\n HumanDecision_RefusalReason.CREDENTIAL_NOT_ACCEPTED,\n );\n }\n\n /*\n * Step 2 of the issue's order: the SERVER validates, against the tool's OWN schema.\n *\n * The browser's validation is a convenience — an approver editing a call is authoring a call the\n * agent never proposed, and the only schema that can judge it is the one the tool declares. The\n * SDK re-validates too (`validate-tool-approvals.ts` throws `InvalidToolInputError`), so this is\n * not what makes it SAFE; it is what makes it USABLE. Its refusal arrives while the pause is\n * still standing and names the offending argument, whereas the SDK's arrives mid-resume as an\n * exception, which reaches a person as a turn that died.\n *\n * The RAW edit is what gets validated, written and signed — never the parse OUTPUT. A schema\n * with a transform would otherwise make the persisted arguments something the approver did not\n * type, and it keeps an approver's input treated exactly like a model's. #3295 holds that to what\n * runs: an edit that is not its own parse is refused below, once it is known to be an edit.\n */\n // An approver's edit arrives as JSON, like a model's call (#3478): validated against the tool schema's JSON form.\n const validation = await jsonParsingSchemaOf(functionTool.inputSchema).safeParseAsync(modifiedToolArgs);\n if (!validation.success) {\n const detail = validation.error.issues\n .map((issue) => `${issue.path.join('.') || '(root)'}: ${issue.message}`)\n .join('; ');\n return { kind: ToolApprovalModificationOutcomeKind.REFUSED, message: `Those arguments are not valid for \"${paused.pendingToolName}\" — ${detail}. The approval is still pending: correct them, or approve the call as proposed.`, refusal: {\n reason: FlowsActors_ApprovalModificationRefusalReason.ARGUMENTS_INVALID,\n toolName: paused.pendingToolName,\n // Paths only: the issue MESSAGES are Zod's English, and the values are what the approver typed.\n argumentPaths: [...new Set(validation.error.issues.map((issue) => issue.path.join('.') || '(root)'))],\n } };\n }\n\n const signingKey = this.agentsBackend.resolveToolApprovalSigningKey();\n if (!signingKey) {\n // Unreachable while the turn is running — a turn with an approval-gated tool is refused\n // outright when the key cannot be derived — but stated rather than assumed, because signing\n // with nothing would silently produce an approval the SDK refuses at resume.\n return { kind: ToolApprovalModificationOutcomeKind.REFUSED, message: 'The approval-signing key is not configured, so a modified call cannot be re-bound to this approval. Approve the call as proposed, or deny it.', refusal: { reason: FlowsActors_ApprovalModificationRefusalReason.SIGNING_KEY_NOT_CONFIGURED } };\n }\n\n // #2292/#2855: what the MODEL is sent of the person's arguments, by the one treatment every record field goes through\n // (`PersonalDataGuard.treatAuthoredArguments`), on the resource the tool's guarded arguments are re-identified into\n // (`personalDataArgumentsResourceOf`, #2848). Two halves, because the SDK EXECUTES the call it finds in the messages:\n // - the rewritten call is MARKED person-authored under any treatment, and every model step of the resume is sent its\n // personal arguments treated (`modelCopyOfPersonAuthoredToolCalls`, at the agent service's model boundary). Under\n // `REMOVE` that is the only treatment: a withheld marker cannot be executed, signed or stored, so the executed copy\n // keeps the approver's values and the model reads `⟦withheld:…⟧`. Before #2855 nothing treated it, and the resumed\n // model call received the value the approver typed in clear;\n // - under `TOKENIZE` the executed copy carries placeholders too, as the model's own proposal did: a value the approver\n // kept is the same placeholder and reads as unchanged, a value they typed is a new one the conversation stores, and\n // the resumed tool puts them back before it runs.\n // The approver read and validated the real values either way.\n const recordsResource = personalDataArgumentsResourceOf(functionTool);\n const treatment = params.personalData?.treatment;\n const table = params.personalData?.table;\n // The guard the resume runs under: the paused treatment, which `runResumeAfterApproval` holds the turn to (#3295).\n const runGuard = this.pausedCallGuard(treatment, table);\n const tokenizer = table ? runGuard : undefined;\n // #3315: what the person kept is the model's, in the model's form, so re-identifying it for the card did not hand it back.\n // Only a reviewer's edit. A question's answers are the person's own, even where the model wrote some of its own in that\n // place, which the tool's description tells it not to and its schema allows; what the question asked is already in the\n // model's form.\n const keptInModelForm = table && params.reviewerEdited\n ? withKeptStringsInModelForm(modifiedToolArgs, pendingToolCallInputOf(paused.sdkModelMessages, paused.approvalId), (value) => table.reidentifyDeep(value) as string)\n : modifiedToolArgs;\n const modifiedInput = tokenizer && recordsResource !== undefined\n ? tokenizer.treatAuthoredArguments(keptInModelForm, tokenizer.personalFieldsOf(recordsResource))\n : keptInModelForm;\n const applied = applyModifiedToolApprovalInput({\n sdkModelMessages: paused.sdkModelMessages,\n approvalId: paused.approvalId,\n modifiedInput,\n signingKey,\n ...(params.reviewerEdited ? { reviewerEdit: { isDeclaredArgument: declaredArgumentPredicateOf(functionTool.inputSchema) } } : {}),\n ...(treatment !== undefined && recordsResource !== undefined ? { personAuthoredArgumentsResourceType: recordsResource } : {}),\n });\n if (applied.kind === ToolApprovalModificationOutcomeKind.REFUSED) {\n this.logger.error('[ConversationalExecution] A paused turn\\'s resume payload does not contain the call its approval names', {\n systemRef: params.systemRef, executionId: params.executionId,\n approvalId: paused.approvalId, refusal: applied.refusal, detail: applied.detail,\n });\n return { kind: ToolApprovalModificationOutcomeKind.REFUSED, message: 'This pending call could not be rewritten with your arguments. Approve it as proposed, or deny it.', refusal: { reason: FlowsActors_ApprovalModificationRefusalReason.CALL_NOT_REWRITABLE } };\n }\n\n /*\n * Nothing changed, so nothing is a modification.\n *\n * An approver who opens the editor, changes their mind and approves has approved the call as\n * proposed — resuming through the rewritten array would still be correct (the signature is over\n * identical bytes), but it would put a row on the audit trail claiming a person authored\n * arguments they did not, which is the one thing this event exists to mean.\n */\n if (applied.modifiedArgumentKeys.length === 0) {\n return { kind: ToolApprovalModificationOutcomeKind.UNCHANGED };\n }\n\n /*\n * #3295: an edit runs exactly as written, or it is refused here, while the pause stands.\n *\n * The decision settles BEFORE the resume, and two things can still stop or change the call after it: the SDK, which runs\n * a value only if its schema parses it to itself, and `execute`, which under a guard puts placeholders back and parses\n * again. So an edit either of them would refuse used to be recorded as accepted and then not run, and one `execute`\n * would rewrite ran as something other than what was sealed. This is the last moment that can be told to the person, so\n * the door REHEARSES both, with their own code, on the copy the SDK will execute, and requires what `execute` would\n * receive to be `modifiedToolArgs`, which is what the seal, the agent-work record and the reach check of #2734 read. It\n * rehearses under the paused treatment, which the resume is held to (`heldPersonalDataTreatment`).\n *\n * Comes after UNCHANGED on purpose: an edit that resolved to the proposal is an approval of the proposal, which\n * `proposedCallRefusal` rehearses on the SDK's own pair, and a kept value need not be a fixed point (a transform the\n * model's raw input went through).\n *\n * Rejected: writing the SDK's pair instead (`inputSchemaInput` = the edit, the call's input = its parse). That runs, but\n * it runs and seals values the approver never wrote, which is the divergence this exists to remove.\n *\n * This covers the ARGUMENTS. A resume can still end before the call runs for other reasons (the exits of\n * `runResumeAfterApproval`, #3313), and a tool can fail once it runs.\n */\n const rehearsal = await rehearsedToolArguments(functionTool, runGuard, modifiedInput);\n const notRunAsWritten = await argumentsNotRunAsWritten(sdkInputSchemaOfFunctionTool(functionTool, runGuard), modifiedInput)\n ?? ('refusedArguments' in rehearsal ? rehearsal.refusedArguments : argumentsRunOtherwiseThanWritten(rehearsal.ran, modifiedToolArgs));\n if (notRunAsWritten) return this.notRunAsWrittenRefusal(paused.pendingToolName, notRunAsWritten, await this.noValueCouldRun(functionTool, (paused.pendingToolArgs ?? {}) as Record<string, unknown>, modifiedToolArgs, notRunAsWritten));\n\n return {\n kind: ToolApprovalModificationOutcomeKind.MODIFIED,\n modification: {\n agentRef,\n sdkModelMessages: applied.sdkModelMessages,\n toolName: applied.toolName,\n modifiedArgumentKeys: applied.modifiedArgumentKeys,\n },\n };\n }\n\n /** #3295: a guard over the paused turn's table, or a fresh one under `REMOVE`, which keeps none. `undefined` under no treatment. */\n private pausedCallGuard(treatment: FlowsActors_PersonalDataModelTreatment | undefined, table: PersonalDataPlaceholderTable | undefined): PersonalDataGuard | undefined {\n if (treatment === undefined) return undefined;\n return new PersonalDataGuard(treatment, table ?? new PersonalDataPlaceholderTable(), (resourceType) => this.resourcesRegistry.tryGetResourceConfiguration(resourceType as never) as never);\n }\n\n /**\n * #3295: the refusal of a call that would not run as the person read it. Names only, so no value reaches a log or a card.\n * #3317: or, when `final`, of one nothing they could enter would let run, which must not ask them to correct it.\n */\n private notRunAsWrittenRefusal(toolName: string, argumentNames: string[], final = false): ToolCallRefusal {\n return final\n ? this.argumentsFinalRefusal(toolName, argumentNames)\n : this.callCannotRunRefusal(\n `\"${toolName}\" would not run these arguments as written: ${argumentNames.join(', ')}. The approval is still pending: correct them, or deny it.`,\n { reason: FlowsActors_ApprovalModificationRefusalReason.ARGUMENTS_NOT_RUN_AS_WRITTEN, toolName, argumentPaths: argumentNames },\n );\n }\n\n private argumentsFinalRefusal(toolName: string, argumentNames: string[]): ToolCallRefusal {\n return this.callCannotRunRefusal(\n `\"${toolName}\" cannot run with these arguments, whatever is entered: ${argumentNames.join(', ')}. Deny it, and ask again.`,\n { reason: FlowsActors_ApprovalModificationRefusalReason.ARGUMENTS_CANNOT_BE_CORRECTED, toolName, argumentPaths: argumentNames },\n HumanDecision_RefusalReason.ARGUMENTS_CANNOT_BE_CORRECTED,\n );\n }\n\n /** #3316: a refusal as the outcome a door with no error payload reads: its reason, and the arguments it is about, by name. */\n private refusedOutcomeOf(refused: ToolCallRefusal): HumanDecision_ActOutcome {\n const argumentNames = refused.refusal.argumentPaths;\n return {\n kind: HumanDecision_ActOutcomeKind.MODIFICATION_REJECTED,\n ...(refused.humanDecisionRefusalReason ? { reason: refused.humanDecisionRefusalReason } : {}),\n ...(argumentNames?.length ? { argumentNames: [...argumentNames] } : {}),\n };\n }\n\n /**\n * #3317: the credentials of `paths` the call cannot do without and the person cannot supply: what they were shown holds none\n * there (nothing, or a marker), and the tool's schema asks for one. A value they were shown can be kept, and an optional\n * parent left out, so neither is final.\n */\n private async credentialsNobodyCanSupply(functionTool: FunctionTool, shown: Record<string, unknown>, paths: readonly string[]): Promise<string[]> {\n const required = await Promise.all(paths.map(async (path) => {\n if (!isWithheldOrAbsentAt(shown, path)) return false;\n const parsed = await jsonParsingSchemaOf(functionTool.inputSchema).safeParseAsync(withoutArgumentAt(shown, path)).catch(() => undefined);\n return parsed !== undefined && !parsed.success && parsed.error.issues.some((issue) => issue.path.join('.') === path);\n }));\n return paths.filter((_path, index) => required[index]);\n }\n\n /**\n * #3317: whether nothing the person could enter would let these refused arguments run, on evidence and not by assumption,\n * because the refusal then stops asking them to correct anything. Two kinds of evidence: the tool REQUIRES a credential the\n * person cannot supply (#3314); or its schema keeps rewriting what the person reads, so no value survives the second parse\n * a guard makes (`schemaKeepsRewriting`). Anything else stays a call they can correct. `read` is the arguments as the\n * person read or wrote them.\n */\n private async noValueCouldRun(functionTool: FunctionTool, shown: Record<string, unknown>, read: Record<string, unknown>, names: readonly string[]): Promise<boolean> {\n const schemas = [functionTool.inputSchema, ...(this.argumentResourceSchemasOf(functionTool) ?? [])];\n const untypeable = names.filter((name) => editedCredentialPaths({ [name]: 'any value' }, undefined, schemas).length > 0);\n if ((await this.credentialsNobodyCanSupply(functionTool, shown, untypeable)).length > 0) return true;\n return schemaKeepsRewriting(functionTool.inputSchema, read);\n }\n\n /** #3313: the refusal of a call whose agent or tool is gone since the pause, edited or not. */\n private goneCallRefusal(resolved: Exclude<GatedFunctionToolResolution, { kind: GatedFunctionToolResolutionKind.FOUND }>, toolName: string): ToolCallRefusal {\n return resolved.kind === GatedFunctionToolResolutionKind.AGENT_MISSING\n ? this.callCannotRunRefusal('The agent that raised this approval is no longer registered, so this call cannot run. Deny it, and ask again.', { reason: FlowsActors_ApprovalModificationRefusalReason.AGENT_NOT_REGISTERED }, HumanDecision_RefusalReason.CALL_CANNOT_RUN)\n : this.callCannotRunRefusal(`The agent no longer declares the tool \"${toolName}\", so this call cannot run. Deny it, and ask again.`, { reason: FlowsActors_ApprovalModificationRefusalReason.TOOL_NOT_DECLARED, toolName }, HumanDecision_RefusalReason.CALL_CANNOT_RUN);\n }\n\n /**\n * #3313: why an approved call could not run as things stand, whatever its arguments, or `undefined` when it can: the\n * questions the resume would ask, asked of the requester whose turn resumes, so the person is told while the decision\n * stands instead of an acceptance being recorded for a turn bound to fail. Each is the resume's own reading (the same\n * resolution, the same policy comparison, the agent service's admission), and a record that cannot be read refuses, as\n * it would refuse the call.\n */\n private async approvedCallCannotRunRefusal(\n systemRef: string,\n paused: FlowActorExecution_PausedApproval,\n requesterAuth: SocketAuthResult | undefined,\n initiationKind: FlowActorExecution['initiationKind'],\n ): Promise<ToolCallRefusal | undefined> {\n const toolName = paused.pendingToolName;\n const resolved = this.resolveApprovalGatedFunctionTool(systemRef, toolName);\n if (resolved.kind !== GatedFunctionToolResolutionKind.FOUND) return this.goneCallRefusal(resolved, toolName);\n // The route a tool declares is read again for the resumed turn, and a route that no longer admits a decision for this\n // requester has the SDK deny the call a person just accepted (`buildToolApprovalConfiguration`).\n const gate = resolveFunctionToolApprovalGate(resolved.functionTool);\n if (gate && !admitsDecisionSuspension({ executionType: requesterAuth?.executionType, initiationKind, routeKind: gate.route })) {\n return this.callCannotRunRefusal(\n `The way \"${toolName}\" is approved has changed since this action was paused, so it cannot run. Deny it, and ask again.`,\n { reason: FlowsActors_ApprovalModificationRefusalReason.APPROVAL_ROUTE_CHANGED, toolName },\n HumanDecision_RefusalReason.CALL_CANNOT_RUN,\n );\n }\n const unreadable = () => this.callCannotRunRefusal(\n 'What this assistant answers to could not be read, so this call cannot run now. The approval is still pending: try again, or deny it.',\n { reason: FlowsActors_ApprovalModificationRefusalReason.AGENT_STANDING_UNREADABLE, toolName },\n HumanDecision_RefusalReason.CALL_CANNOT_RUN,\n );\n const policies = await this.turnAgentPolicies(requesterAuth);\n if (policies.unreadable !== undefined) return unreadable();\n if (this.contentPolicyTightenedSincePause(paused, resolved.agentRef, policies)) {\n return this.callCannotRunRefusal(\n 'The organization tightened its content policy since this action was paused, so it cannot run. Deny it, and ask again.',\n { reason: FlowsActors_ApprovalModificationRefusalReason.CONTENT_POLICY_TIGHTENED, toolName },\n HumanDecision_RefusalReason.CALL_CANNOT_RUN,\n );\n }\n const admission = await this.agentsBackend.readCallAdmission(resolved.agentRef, this.turnOrganizationIdsOf(requesterAuth));\n switch (admission) {\n case AgentCallAdmission.ADMITTED: return undefined;\n case AgentCallAdmission.UNREADABLE: return unreadable();\n case AgentCallAdmission.SUSPENDED: return this.callCannotRunRefusal(\n 'This assistant has been suspended by an administrator, so this call cannot run. Deny it, or answer once it is back.',\n { reason: FlowsActors_ApprovalModificationRefusalReason.AGENT_SUSPENDED, toolName },\n HumanDecision_RefusalReason.CALL_CANNOT_RUN,\n );\n case AgentCallAdmission.AGENT_NOT_ACTIVE: return this.callCannotRunRefusal(\n 'This assistant is no longer active, so this call cannot run. Deny it, and ask again.',\n { reason: FlowsActors_ApprovalModificationRefusalReason.AGENT_NOT_ACTIVE, toolName },\n HumanDecision_RefusalReason.CALL_CANNOT_RUN,\n );\n }\n }\n\n private callCannotRunRefusal(\n message: string,\n refusal: WS_FlowsActorsApprovalModificationRefusal,\n humanDecisionRefusalReason: HumanDecision_RefusalReason = HumanDecision_RefusalReason.CALL_NOT_RUN_AS_READ,\n ): ToolCallRefusal {\n return { kind: ToolApprovalModificationOutcomeKind.REFUSED, message, refusal, humanDecisionRefusalReason };\n }\n\n /** The schemas of the resource a tool's arguments describe; `undefined` when it names one that cannot be read. */\n private argumentResourceSchemasOf(functionTool: FunctionTool): readonly unknown[] | undefined {\n const resourceType = personalDataArgumentsResourceOf(functionTool);\n if (resourceType === undefined) return [];\n try {\n const configuration = this.resourcesRegistry.tryGetResourceConfiguration(resourceType as never);\n return configuration?.mainSchema ? [configuration.mainSchema, ...resourceInheritanceVariantSchemas(configuration.inheritenceSchemaDefinition as never)] : undefined;\n } catch {\n return undefined;\n }\n }\n\n /**\n * #3295: the same rehearsal for a call approved as the model proposed it (or an edit that resolved to that). The SDK is\n * asked its own question of the stored pair, since a parse output that did not survive the pause's JSON no longer equals\n * the call; and `execute` of the proposal, which can refuse a `⟦withheld:…⟧` marker or a placeholder that cannot be put\n * back, and under a guard parses a value already parsed, so a transform would run something other than the card shows.\n * Each would be recorded as accepted and not run, or run differently. Editing the value is a real remedy.\n */\n private async proposedCallRefusal(systemRef: string, paused: FlowActorExecution_PausedApproval, personalData: TurnPersonalDataView | undefined) {\n const resolved = this.resolveApprovalGatedFunctionTool(systemRef, paused.pendingToolName);\n // A tool or agent gone since the pause is not an argument: the door refuses it after the requester's standing (#3313).\n if (resolved.kind !== GatedFunctionToolResolutionKind.FOUND) return undefined;\n const proposal = pendingToolCallInputOf(paused.sdkModelMessages, paused.approvalId);\n if (!proposal) return undefined;\n const runGuard = this.pausedCallGuard(personalData?.treatment, personalData?.table);\n const refused = await argumentsNotRunAsWritten(\n sdkInputSchemaOfFunctionTool(resolved.functionTool, runGuard),\n pendingToolCallSchemaInputOf(paused.sdkModelMessages, paused.approvalId, proposal),\n proposal,\n );\n const rehearsal = await rehearsedToolArguments(resolved.functionTool, runGuard, proposal);\n const named = refused ?? ('refusedArguments' in rehearsal\n ? rehearsal.refusedArguments\n : argumentsRunOtherwiseThanWritten(rehearsal.ran, rehearsal.readAs as Record<string, unknown>));\n return named ? this.notRunAsWrittenRefusal(paused.pendingToolName, named, await this.noValueCouldRun(resolved.functionTool, (paused.pendingToolArgs ?? proposal) as Record<string, unknown>, (paused.pendingToolArgs ?? proposal) as Record<string, unknown>, named)) : undefined;\n }\n\n // ── Internals ──────────────────────────────────────────────────────────────\n\n /**\n * Resolve the target system as an ACTOR system. If it is a FLOW system, fail\n * closed with a typed \"not implemented\" (v1 has no flow conversational\n * runtime); if it does not exist at all, report not-found.\n */\n private resolveConversationalActorSystem(\n systemRef: string,\n executionId: string,\n emitter: FlowsActorsExecutionEmitter,\n ): ActorSystem | undefined {\n const resolved = this.conversationalActorSystemOf(systemRef);\n if (resolved.refusal) {\n this.emitError(emitter, systemRef, executionId, resolved.refusal.errorCode, resolved.refusal.errorMessage);\n return undefined;\n }\n return resolved.actorSystem;\n }\n\n /**\n * The same resolution, answering the refusal instead of emitting it, for a turn that reports its own end: a resumed\n * turn records FAILED first and then reports either this refusal or the decision that now holds the thread, never\n * both (#2721 re-review R-1).\n */\n private conversationalActorSystemOf(systemRef: string): ConversationalActorSystemResolution {\n const actor = this.flowsActorsRegistry.getSystem(systemRef, FlowActorSystem_Kind.ACTOR);\n if (actor) return { actorSystem: actor as ActorSystem };\n\n if (this.flowsActorsRegistry.getSystem(systemRef, FlowActorSystem_Kind.FLOW)) {\n return { refusal: { errorCode: FlowsActors_ExecutionErrorCode.FLOW_CONVERSATION_NOT_IMPLEMENTED, errorMessage: `System '${systemRef}' is a FLOW system; conversational execution of flows is not yet implemented.` } };\n }\n return { refusal: { errorCode: FlowsActors_ExecutionErrorCode.SYSTEM_NOT_FOUND, errorMessage: `No actor system registered for ref '${systemRef}'.` } };\n }\n\n /**\n * The budget a turn of `agentRef`'s conversation replays its transcript within (#2750): from the agent's model's\n * documented limits when it is an LLM-arm agent on a catalog model, otherwise the framework floor; less the agent's own\n * authored prompt material (`promptSpec`), which the system prompt is compiled from and which rides every call.\n */\n private conversationReplayBudgetOf(agentRef: string): ConversationReplayBudget {\n const agent = this.flowsActorsRegistry.getAgent(agentRef);\n // An agent with no config arm (a registry entry being replaced, a test double) is not an LLM-arm agent: the floor applies.\n const llmConfig = agent?.config && isLLMAgentConfiguration(agent.config) ? agent.config : undefined;\n // A registry provider's model states its limits in the provider's declaration, not in the engine's catalog (#2750).\n const declaredLimits = llmConfig?.model && llmConfig.providerRef && !isLLMCatalogModel(llmConfig.model)\n ? this.flowsActorsRegistry.declaredModelContextLimits(agentRef, llmConfig.providerRef, llmConfig.model)\n : undefined;\n return conversationReplayBudget({\n model: llmConfig?.model,\n ...(typeof llmConfig?.maxTokens === 'number' ? { configuredMaxOutputTokens: llmConfig.maxTokens } : {}),\n ...(declaredLimits ? { declaredLimits } : {}),\n promptOverheadText: agent?.promptSpec ? JSON.stringify(agent.promptSpec) : '',\n });\n }\n\n /** Pick the agent-backed actor to converse with (first AGENTIC actor with an agentRef). */\n private resolveChatAgentRef(actorSystem: ActorSystem): string | undefined {\n return chatAgentRefOfActorSystem(actorSystem);\n }\n\n /** Read the user's turn from the free-form start input (`message` or `prompt`). */\n private extractUserText(initialInput?: Record<string, unknown>): string | undefined {\n if (!initialInput) return undefined;\n const candidate = initialInput.message ?? initialInput.prompt;\n if (typeof candidate === 'string' && candidate.trim().length > 0) return candidate;\n return undefined;\n }\n\n /**\n * The resource a tool READS, when it is one of the engine's resource-read function tools — whose\n * name the engine itself mints from `resource.<resourceType>.read` (the provider may rewrite the\n * dots to underscores). Answers the resource TYPE, an identifier the browser resolves to the\n * resource's authored title; `undefined` for every other tool.\n *\n * It used to answer WORDS — \"Looking up your todos…\", humanized from the same match — which no\n * translator could reach (#1283).\n */\n private resourceTypeReadByTool(toolName: string): string | undefined {\n // One reading of the name, shared with the agent operation record (#2841).\n return resourceTypeReadByToolName(toolName);\n }\n\n /**\n * The recorder of one turn's work (#2524), for the agent answering it: its reasoning is shown only when that agent\n * declares it (`FlowsActors_Agent.disclosure.reasoning`), read here rather than passed down so every turn — fresh or\n * resumed — reads the same declaration.\n */\n private openTurnTrace(\n systemRef: string, executionId: string, agentRef: string, emitter: FlowsActorsExecutionEmitter,\n /** The organization the turn's tools read in (`buildToolExecutionContext`): where a show-records call read its records. */\n toolsOrganizationId?: string,\n ): ConversationalTurnTrace {\n return new ConversationalTurnTrace({\n systemRef,\n executionId,\n emitter,\n showsReasoning: this.flowsActorsRegistry.getAgent(agentRef)?.disclosure?.reasoning === true,\n readsResourceTypeOf: (toolName) => this.resourceTypeReadByTool(toolName),\n presentsRecordsOf: (toolName) => this.functionToolOfAgent(agentRef, toolName)?.presentsRecords === true,\n ...(toolsOrganizationId ? { toolsOrganizationId } : {}),\n });\n }\n\n /**\n * The registered function tool an agent's model calls under `toolName`, read from the agent's own grants: the same\n * reverse lookup a paused call resolves through (`resolveApprovalGatedFunctionTool`), for the agent answering now.\n */\n private functionToolOfAgent(agentRef: string, toolName: string): FunctionTool | undefined {\n const functionRef = (this.flowsActorsRegistry.getAgent(agentRef)?.capabilities?.tools?.functionRefs ?? [])\n .find((ref) => modelToolNameForFunctionRef(ref) === toolName);\n return functionRef ? this.flowsActorsRegistry.getFunctionTool(functionRef) : undefined;\n }\n\n /**\n * Tell the watcher a turn ended because it was stopped (#2524): `FLOWS_ACTORS_COMPLETED` with status CANCELLED.\n *\n * Every cancel arm used to record CANCELLED on the row and emit nothing, so the person who stopped a turn kept\n * watching one that would never end — the defect #2521 closed for a resumed turn, on the cancel path.\n */\n private emitTurnCancelled(emitter: FlowsActorsExecutionEmitter, systemRef: string, executionId: string, startedAt: number): void {\n emitter(CoreWebSocketEvent.FLOWS_ACTORS_COMPLETED, {\n systemRef, executionId, status: FlowsActors_Status.CANCELLED, duration: Date.now() - startedAt,\n });\n }\n\n /**\n * The tokens a turn spent, for its COMPLETED event — only when the person may read model cost (#2524).\n *\n * The roles that read it are `MODEL_COST_READ_ROLES`, held at APPLICATION scope (the same test the cost summary route\n * applies, so a role key typed into an organization membership does not count). A run's reader is told its tokens on\n * the run's page (#2574, decided B, `modelUsageDisclosureOf`); this live line reaches whoever is chatting, end users\n * included, which that decision did not cover, so it keeps the narrower audience. `undefined` too when the agent\n * reported no usage.\n */\n private turnUsageShownTo(auth: SocketAuthResult | undefined, result: unknown): WS_FlowsActorsTurnUsage | undefined {\n // The one rule for who reads model usage, shared with the cost summary and an execution's usage (#2528).\n if (!auth || !callerReadsModelCost(auth, this.authorizer)) return undefined;\n const usage = (result as { executionContext?: { usage?: Record<string, unknown> } } | undefined)?.executionContext?.usage;\n if (!usage) return undefined;\n const count = (value: unknown): number | undefined => (typeof value === 'number' && Number.isFinite(value) && value >= 0 ? Math.round(value) : undefined);\n const shown: WS_FlowsActorsTurnUsage = {\n ...(count(usage.promptTokens) !== undefined ? { inputTokens: count(usage.promptTokens) } : {}),\n ...(count(usage.completionTokens) !== undefined ? { outputTokens: count(usage.completionTokens) } : {}),\n ...(count(usage.reasoningTokens) !== undefined ? { reasoningTokens: count(usage.reasoningTokens) } : {}),\n ...(count(usage.totalTokens) !== undefined ? { totalTokens: count(usage.totalTokens) } : {}),\n };\n return Object.keys(shown).length > 0 ? shown : undefined;\n }\n\n /**\n * #2935: run `fn` in the turn's SPEND frame: its door and the principal it runs as. Every model call `fn` makes (the\n * turn's own, a tool's nested agent, the form a paused question is composed through) is charged by the agent service\n * to the allowance that door and principal draw on, the first call and every resume alike (#1855: one mechanism).\n * Before #2935 the runtime reported each invocation's usage itself, which reached only the invocations it made.\n *\n * A row that recorded no door (written before doors were recorded) runs OUTSIDE any spend frame, an outer one\n * included: its calls are charged to the organization its work is attributed to, as a call outside any door is, and\n * never inherit an outer door's per-call refusal.\n */\n private inTurnSpendFrame<T>(initiationKind: FlowsActors_InitiationKind | null | undefined, auth: SocketAuthResult | undefined, fn: () => T): T {\n if (!initiationKind || !auth) return runOutsideModelSpendFrame(fn);\n return runWithModelSpendFrame({ door: modelSpendDoorOfInitiationKind(initiationKind), auth }, fn);\n }\n\n /** Normalize the agent output (chat `{message:{content}}` or text `{text}`) to a string. */\n private extractAssistantText(output: unknown): string {\n if (typeof output === 'string') return output;\n if (output && typeof output === 'object') {\n const record = output as Record<string, unknown>;\n const message = record.message;\n if (message && typeof message === 'object' && typeof (message as Record<string, unknown>).content === 'string') {\n return (message as Record<string, unknown>).content as string;\n }\n if (typeof record.text === 'string') return record.text;\n }\n return typeof output === 'undefined' ? '' : JSON.stringify(output);\n }\n\n /**\n * The transcript a PAUSED turn stores: the work it did, then what it had said before it paused (#2525 review M1).\n *\n * The person read that text as it streamed. It used to be dropped at the pause — only a cancelled turn kept its\n * partial reply — so a reload lost it, and the client, which keeps a live turn's messages across the decision, drew it\n * fused with the resumed reply under one id. Stored under the id it streamed with, a re-read replaces the live copy by\n * identity, and the resumed reply follows it as its own message. Nothing is stored for a turn that said nothing.\n */\n private pausedTurnMessages(\n work: FlowActorExecution_Message[],\n reply: { readonly id: string; readonly text: string; readonly data: ReturnType<ConversationalTurnTrace['replyData']> },\n ): FlowActorExecution_Message[] {\n if (reply.text.length === 0) return work;\n return [...work, {\n id: reply.id,\n role: FlowsActors_ConversationRole.ASSISTANT,\n contentType: FlowsActors_MessageContentType.MARKDOWN,\n content: reply.text,\n ...(reply.data ? { data: reply.data } : {}),\n createdAt: new Date(),\n }];\n }\n\n /**\n * The actor system's registration, for its display name on a decision (#2526). `undefined` for a system no longer\n * registered.\n */\n private registeredActorSystem(systemRef: string): ActorSystem | undefined {\n return this.flowsActorsRegistry.getSystem(systemRef, FlowActorSystem_Kind.ACTOR) as ActorSystem | undefined;\n }\n\n /**\n * The risk of a gated call, as its gate declares it (#2526 review F2): the one read the live announcement makes, as the\n * inbox card makes it through `gateOfRow`, so the two badge a decision alike. `undefined` when the gate declares none or\n * the tool can no longer be resolved — never defaulted, and never the system's own `riskLevel`.\n */\n private gatedCallRiskLevel(systemRef: string, pendingToolName: string): ResourceOperationRiskLevel | undefined {\n try {\n const resolved = this.resolveApprovalGatedFunctionTool(systemRef, pendingToolName);\n return resolved.kind === GatedFunctionToolResolutionKind.FOUND ? resolveFunctionToolApprovalGate(resolved.functionTool)?.riskLevel : undefined;\n } catch {\n return undefined;\n }\n }\n\n /**\n * Run the gate's `onDenied` for a person's REJECTED answer (#3015): what the denial does to the record the call was\n * about. Called once the sealed denial committed, with the context `execute` would have had (the requester's rebuilt\n * authority, the decision's ref, inside the requester's relationship provenance), on the arguments the model\n * proposed, inside the agent's actor frame. Never throws: the decision is sealed and stands whatever the effect does.\n * Answers whether the record was left as the denial requires (`false` only when a declared effect failed): the\n * failure is logged, and the caller tells the resumed turn, so the person learns the record did not move. A gate that\n * declares nothing, or a tool no longer resolvable, answers `true`.\n *\n * Not repaired: a process that dies between the denial's commit and its effect leaves the record as it was, as an\n * approved call whose resume dies leaves its work undone. The decision itself is sealed either way.\n */\n private async applyDenialEffect(params: {\n readonly systemRef: string;\n readonly executionId: string;\n readonly owner: ResolvedOwnerVariant;\n readonly paused: FlowActorExecution_PausedApproval;\n readonly requesterAuth: SocketAuthResult;\n readonly decisionRef: string;\n readonly row: Pick<FlowActorExecution, 'initiationKind' | 'autonomousTrigger'>;\n }): Promise<boolean> {\n try {\n const resolved = this.resolveApprovalGatedFunctionTool(params.systemRef, params.paused.pendingToolName);\n if (resolved.kind !== GatedFunctionToolResolutionKind.FOUND) return true;\n const onDenied = resolveFunctionToolApprovalGate(resolved.functionTool)?.onDenied;\n if (!onDenied) return true;\n const context = this.buildToolExecutionContext(params.requesterAuth, params.executionId, params.systemRef, params.decisionRef, {\n initiationKind: params.row.initiationKind,\n autonomousTrigger: params.row.autonomousTrigger,\n });\n // The frame `execute` runs in (`agentActorForToolCall`): the effect's own audit rows then name the agent, the tool\n // by its functionRef, and the decision, so the trail reads \"the denial of this agent's call\", never the requester\n // acting alone.\n const agentFrame = {\n agentRef: resolved.agentRef, agentExecutionId: params.executionId, systemRef: params.systemRef,\n toolName: resolved.functionTool.functionRef, decisionRef: params.decisionRef,\n };\n await runAsRelationshipProvenanceOf(\n params.requesterAuth,\n params.owner.ownerFields.organizationId ?? params.requesterAuth?.initiatorIds?.organizationId ?? undefined,\n () => runWithAgentActorFrame(agentFrame, () => onDenied(params.paused.pendingToolArgs, context)),\n );\n return true;\n } catch (error) {\n this.logger.error('[ConversationalExecution] A denied call\\'s declared effect failed; the denial stands, sealed, and the record it was about did not move', {\n systemRef: params.systemRef, executionId: params.executionId, decisionRef: params.decisionRef,\n toolName: params.paused.pendingToolName, ...projectCaughtErrorLogFields(error),\n });\n return false;\n }\n }\n\n /**\n * The FunctionTool behind a paused approval's model-facing tool name — the ONE lookup both the\n * approval announcement and the modification check use (#587).\n *\n * A pause keeps only the name the model was shown (`modelToolNameForFunctionRef`), so the tool is\n * found by walking the chat agent's declared function refs back to that name. It lives in one place\n * because the two callers must agree on which tool a name means: an editor offering one tool's\n * fields while the server validated against another would refuse every edit it invited.\n */\n private resolveApprovalGatedFunctionTool(systemRef: string, pendingToolName: string): GatedFunctionToolResolution {\n const actorSystem = this.flowsActorsRegistry.getSystem(systemRef, FlowActorSystem_Kind.ACTOR) as ActorSystem | undefined;\n const agentRef = actorSystem ? this.resolveChatAgentRef(actorSystem) : undefined;\n const agent = agentRef ? this.flowsActorsRegistry.getAgent(agentRef) : undefined;\n if (!agent || !agentRef) return { kind: GatedFunctionToolResolutionKind.AGENT_MISSING };\n\n const functionRef = (agent.capabilities?.tools?.functionRefs ?? [])\n .find((ref) => modelToolNameForFunctionRef(ref) === pendingToolName);\n const functionTool = functionRef ? this.flowsActorsRegistry.getFunctionTool(functionRef) : undefined;\n return functionTool\n ? { kind: GatedFunctionToolResolutionKind.FOUND, agentRef, functionTool }\n : { kind: GatedFunctionToolResolutionKind.TOOL_MISSING };\n }\n\n /**\n * The gated tool's input schema as a serialized descriptor for the approval announcement (#587), or\n * `undefined` when it cannot honestly be described.\n *\n * Only for a tool that STILL requires approval. A pause whose tool is no longer gated is stale and\n * the modification path refuses it, so offering its fields would invite an edit that cannot land.\n *\n * Never throws. The announcement is what tells a client a decision is waiting; a descriptor failure\n * must cost the form, never the announcement.\n */\n /**\n * Whether the gated tool's approval gate declares `escalateTo`. Read, never invoked: the list only needs to\n * know an escalation naming nobody has somewhere to go, and resolving the person is the escalation's job.\n * A tool that can no longer be resolved declares nothing.\n */\n private gateDeclaresEscalationTarget(systemRef: string, pendingToolName: string): boolean {\n try {\n const resolved = this.resolveApprovalGatedFunctionTool(systemRef, pendingToolName);\n return resolved.kind === GatedFunctionToolResolutionKind.FOUND && resolveFunctionToolApprovalGate(resolved.functionTool)?.escalateTo !== undefined;\n } catch {\n return false;\n }\n }\n\n /**\n * The question a paused call asks, when it is an agent's QUESTION to its person (#2720, `askPersonTool`); `undefined`\n * for an ordinary approval. Whether it is a question is read from the REGISTERED tool, never from the pause, and the\n * question is rebuilt from the call by `askPersonDecisionRequest`, the one function the chat card, the inbox card and\n * the answer door all read it through.\n */\n private pausedQuestionOf(systemRef: string, pause: {\n readonly decisionRef: string;\n readonly toolName: string;\n readonly toolArgs?: Record<string, unknown>;\n readonly questionForm?: HumanInputForm;\n readonly requestedAt: string;\n readonly expiresAt?: string;\n }): HumanDecision_Request | undefined {\n if (!this.pausedCallAsksThePerson(systemRef, pause.toolName)) return undefined;\n try {\n return askPersonDecisionRequest({\n decisionId: pause.decisionRef, args: pause.toolArgs ?? {}, requestedAt: pause.requestedAt,\n ...(pause.questionForm ? { form: pause.questionForm } : {}), ...(pause.expiresAt ? { expiresAt: pause.expiresAt } : {}),\n });\n } catch (error) {\n this.logger.warn('[ConversationalExecution] A paused question\\'s arguments could not be read as a question', {\n systemRef, toolName: pause.toolName, ...projectCaughtErrorLogFields(error),\n });\n return undefined;\n }\n }\n\n /** Whether the paused call is an agent's question to its person, from the registered tool (#2720). */\n private pausedCallAsksThePerson(systemRef: string, pendingToolName: string): boolean {\n return this.pausedQuestionTool(systemRef, pendingToolName) !== undefined;\n }\n\n /**\n * The step-up an answer to a paused call will require (#2923), from its gate's declaration (`humanApproval\n * .requiresStepUpAuthentication` / `stepUp`) through the one reader every plane uses; `undefined` when it requires none.\n *\n * Read once, when the turn pauses, and kept in the pause (`stepUp`), which is what the answer and the card read: a gate\n * whose declaration changes, or a tool removed, while the call waits holds it to what it was paused under.\n */\n private pausedCallStepUpRequirementOf(systemRef: string, pendingToolName: string): HumanDecision_StepUpRequirement | undefined {\n const resolved = this.resolveApprovalGatedFunctionTool(systemRef, pendingToolName);\n if (resolved.kind !== GatedFunctionToolResolutionKind.FOUND) return undefined;\n // Never swallowed: a gate that no longer resolves cannot say it requires nothing.\n return humanDecisionStepUpRequirementOf(resolveFunctionToolApprovalGate(resolved.functionTool));\n }\n\n /** The channels that may answer a paused call (#2923), from its gate, read when the turn pauses like its step-up. */\n private pausedCallAnswerChannelsOf(systemRef: string, pendingToolName: string): HumanDecision_AnswerChannels | undefined {\n const resolved = this.resolveApprovalGatedFunctionTool(systemRef, pendingToolName);\n if (resolved.kind !== GatedFunctionToolResolutionKind.FOUND) return undefined;\n return resolveFunctionToolApprovalGate(resolved.functionTool)?.answerChannels;\n }\n\n /** The registered question tool a paused call names (`asksThePerson`), or `undefined` for any other call. */\n private pausedQuestionTool(systemRef: string, pendingToolName: string): FunctionTool | undefined {\n try {\n const resolved = this.resolveApprovalGatedFunctionTool(systemRef, pendingToolName);\n return resolved.kind === GatedFunctionToolResolutionKind.FOUND && resolved.functionTool.asksThePerson === true ? resolved.functionTool : undefined;\n } catch {\n return undefined;\n }\n }\n\n /**\n * Compose the form a paused question is asked through (#2720), on the model of the agent that asked. `undefined` for\n * an ordinary approval, and whenever no usable form came back: the question is then asked through its default form.\n */\n private async composePausedQuestionForm(params: {\n readonly systemRef: string;\n readonly toolName: string;\n readonly toolArgs: Record<string, unknown> | undefined;\n readonly agentRef: string | undefined;\n readonly requestedAt: string;\n readonly traceContext: AgentTraceContext;\n readonly abortSignal?: AbortSignal;\n }): Promise<HumanInputForm | undefined> {\n if (!params.agentRef) return undefined;\n // A host that asks its questions as written (`composesQuestionForm: false`, #2731) gets the default form.\n if (this.pausedQuestionTool(params.systemRef, params.toolName)?.composesQuestionForm === false) return undefined;\n const question = this.pausedQuestionOf(params.systemRef, {\n decisionRef: 'composing', toolName: params.toolName, toolArgs: params.toolArgs, requestedAt: params.requestedAt,\n });\n if (!question) return undefined;\n return composeHumanInputForm({\n agents: this.agentsBackend, logger: this.logger, agentRef: params.agentRef, request: question, traceContext: params.traceContext,\n ...(params.abortSignal ? { abortSignal: params.abortSignal } : {}),\n });\n }\n\n /**\n * What an answer to a paused question means for the call (#2720): the person's values as its `answers`, read the way\n * the agent reads them (`humanDecisionAgentValues`: an amount in its major unit, a day as a day), or a decline that\n * does not run it. A note the person added travels with either: as `comment` beside the answers, or after the\n * decline's own words. `undefined` when there is no answer or its form refuses it.\n */\n private settleQuestionAnswer(\n question: HumanDecision_Request, answer: HumanDecision_Answer | undefined, paused: FlowActorExecution_PausedApproval, note: string | undefined,\n /** What the agent is told on a decline: the tool's own (`questionDeclinedReason`), else `ASK_PERSON_DECLINED_REASON`. */\n declinedReason: string,\n ): { approved: boolean; modifiedToolArgs: Record<string, unknown> | undefined; reason: string | undefined } | undefined {\n if (!answer) return undefined;\n let resolved: ReturnType<typeof resolveHumanDecisionAnswer>;\n try {\n resolved = resolveHumanDecisionAnswer(question, answer);\n } catch (error) {\n if (error instanceof HumanDecisionAnswerError) return undefined;\n throw error;\n }\n // A door with no cap of its own (the WebSocket's `comment`) can send a longer note than the tool takes; it is cut to\n // the one length every door shares, rather than turning a valid answer into a refused edit (#2720 review).\n const comment = note?.trim().slice(0, HUMAN_DECISION_NOTE_MAX_LENGTH) || undefined;\n if (resolved.option.intent !== HumanDecision_ResponseIntent.PROCEED_WITH_VALUES) {\n return { approved: false, modifiedToolArgs: undefined, reason: comment ? `${declinedReason} They added: ${comment}` : declinedReason };\n }\n // The call's own arguments, without anything the model wrote where only the engine may: the person's answers and\n // note replace them, and a note the person did not give is absent rather than the model's.\n // #2292: from the call AS THE MODEL WROTE IT, which goes back to the model: `pendingToolArgs` is the form people read,\n // with any value the model saw as a placeholder put back.\n const { answers: _modelAnswers, comment: _modelComment, ...asked } = (pendingToolCallInputOf(paused.sdkModelMessages, paused.approvalId) ?? paused.pendingToolArgs ?? {}) as Record<string, unknown>;\n return {\n approved: true,\n modifiedToolArgs: { ...asked, answers: humanDecisionAgentValues(question, resolved.values), ...(comment ? { comment } : {}) },\n reason: undefined,\n };\n }\n\n private describeGatedToolInputSchema(systemRef: string, pendingToolName: string): Record<string, unknown> | undefined {\n try {\n const resolved = this.resolveApprovalGatedFunctionTool(systemRef, pendingToolName);\n if (resolved.kind !== GatedFunctionToolResolutionKind.FOUND || !resolveFunctionToolApprovalGate(resolved.functionTool)) {\n return undefined;\n }\n const descriptor = serializeZodSchema(resolved.functionTool.inputSchema);\n return descriptor ? (descriptor as unknown as Record<string, unknown>) : undefined;\n } catch (error) {\n this.logger.warn('[ConversationalExecution] Could not describe a gated tool input schema; the approval is announced without it', {\n systemRef, toolName: pendingToolName, ...projectCaughtErrorLogFields(error),\n });\n return undefined;\n }\n }\n\n /** Emit a `FLOWS_ACTORS_ERROR` payload. */\n /**\n * The system's launch gate (`config.accessControl[].roles`, #2544 follow-up), asked of the authority a turn will hold:\n * `false` when the system declares the roles that may start it and the principal holds none of them in\n * `organizationId` (or, for an APPLICATION entry, as an application role).\n *\n * Decided by the authorizer (`admitsFlowsActorsSystemStart`), which also records a refusal on the denial trail; the\n * context it is handed names the transcript's default CREATE, as the consent gate's does, so the row says which\n * resource the refused turn would have written. A turn with no verified identity is refused by a gated system (fail\n * closed: no principal can be shown to hold a role) and admitted by an ungated one, as before the gate existed.\n *\n * assurance-control: WILDO.ACCESS.AUTHORIZATION_DECISION_AUDIT — the launch gate is enforced on every conversational\n * door (in-app, A2A, chat, autonomous) and its refusals are recorded.\n */\n private async admitsSystemStart(params: {\n auth: SocketAuthResult | undefined;\n owner: ResolvedOwnerVariant;\n actorSystem: ActorSystem;\n organizationId: string | undefined;\n refusedSurface: string;\n }): Promise<boolean> {\n const { auth, owner, actorSystem, organizationId, refusedSurface } = params;\n if (flowsActorsAccessControlStartRoles(actorSystem.config?.accessControl).length === 0) return true;\n if (!auth) return false;\n const operation = this.transcriptDefaultCreateOperation(owner.resourceType);\n const executionContext = createBareExecutionContextFromVerifiedAuth(operation as ResourceConfiguration_Operation<any, any, any>, auth);\n return this.authorizer.admitsFlowsActorsSystemStart({ system: actorSystem, executionContext, organizationId, refusedSurface });\n }\n\n /**\n * The transcript resource's default CREATE: what a gate answered before the turn's own write names on its denial row.\n * It is INTERNAL_CALL (no URL-bearing default exists), so it is read from the resource's declared operations.\n */\n private transcriptDefaultCreateOperation(resourceType: ResolvedOwnerVariant['resourceType']): ResourceConfiguration_Operation<any, any, any> | undefined {\n return this.resourcesRegistry.getResourceConfiguration(resourceType)?.operations.find(\n (candidate: ResourceConfiguration_Operation<any, any, any>) =>\n candidate.operationIdentifier === CoreResourceOperation.CREATE && candidate.isOperationDefault === true,\n ) as ResourceConfiguration_Operation<any, any, any> | undefined;\n }\n\n /**\n * Hold a conversational turn to the application's declared service consent requirement\n * (`compliance.serviceConsentRequirement.requiredPurposes`) AND to the transcript resource's own\n * `consentGate` declaration, if it has one (#1258 Step 3, D1).\n *\n * A2A and WebSocket turns never pass through `authorizeInController`, yet the model call and the transcript\n * write they perform ARE the person using the service. A requirement refused on every REST, MCP and manual\n * controller operation but not here would let a person who has not consented use the application through its\n * chat surfaces (#534 re-review R2). Both doors into a model call reach it: starting a turn, and resuming one\n * after an approval decision (#534 third review M1) — a purpose withdrawn while a turn was paused must not be\n * answered by a resumed reply.\n *\n * The authorizer's own gate decides, on a context carrying the caller's verified identity and the transcript's\n * CREATE operation, so the preferences read, the fail-closed default, the machine-principal exemption and the\n * denial audit are exactly the ones every other surface gets.\n *\n * Deliberately NOT a blanket \"nothing required application-wide → admitted\" return: the transcript resource's\n * default CREATE operation may declare its OWN `consentGate`, and only `assertServiceConsentRequirementMet`\n * below can see that declaration — it needs the resolved operation, found a few lines down. Short-circuiting\n * here on `serviceConsentRequiredPurposes().length === 0` alone would duplicate half of that gate's own early\n * return (R12: `required.length === 0 && !declaration`) without being able to see `declaration`, silently\n * exempting the chat surfaces from a per-operation declaration every other entry point enforces. This mirrors\n * the identical correction already made to `evaluateServiceConsentRequirementForPrincipal` below. Nothing is\n * resolved or read when nothing is required AND the operation declares nothing — `assertServiceConsentRequirementMet`'s\n * own R12 early return still makes that the cheap path.\n *\n * Fail closed: a check that cannot be evaluated — including a caller with no verified identity — refuses the\n * turn, for the same reason the gate treats an unreadable preferences row as nothing granted.\n *\n * assurance-control: WILDO.PRIVACY.CONSENT_ENFORCEMENT — a declared service consent requirement, and a capability's\n * own consent-gate declaration, are both enforced on conversational turns (A2A and WebSocket, started or\n * resumed) as on every other user-initiated surface.\n *\n * @param recoverable - `true` when the refused decision is still answerable afterwards (a resume leaves the\n * pause standing), so the client keeps it rather than ending the attempt.\n * @returns `false` when the turn was refused; the refusal has already been emitted when an emitter was given.\n */\n private async admitsUnderServiceConsentRequirement(params: {\n auth: SocketAuthResult | undefined;\n owner: ResolvedOwnerVariant;\n systemRef: string;\n executionId: string;\n emitter?: FlowsActorsExecutionEmitter;\n recoverable?: boolean;\n }): Promise<boolean> {\n const { systemRef, executionId, emitter, recoverable = false } = params;\n if ((await this.serviceConsentVerdictForTurn(params)) === ServiceConsentRequirementVerdict.ADMITTED) return true;\n if (emitter) {\n this.emitError(\n emitter,\n systemRef,\n executionId,\n FlowsActors_ExecutionErrorCode.SERVICE_CONSENT_REQUIRED,\n 'This application requires consent you have not granted. Record it in your privacy preferences, then try again.',\n recoverable,\n );\n }\n return false;\n }\n\n /**\n * The verdict {@link admitsUnderServiceConsentRequirement} refuses on, in the authorizer's three answers: ADMITTED,\n * REFUSED (the person has not granted a required purpose; on the denial trail), or NOT_EVALUATED (no verified identity,\n * or the check failed). Every caller but the chat door refuses on both of the last two; the chat door tries the\n * message again on NOT_EVALUATED. So the warning it logs says only that the check could not be made, and each caller's\n * own outcome says what followed (review L-A).\n */\n private async serviceConsentVerdictForTurn(params: {\n auth: SocketAuthResult | undefined;\n owner: ResolvedOwnerVariant;\n systemRef: string;\n executionId: string;\n }): Promise<ServiceConsentRequirementVerdict> {\n const { auth, owner, systemRef, executionId } = params;\n if (!auth) {\n this.logger.warn('Service consent requirement cannot be evaluated for a conversational turn with no verified identity', {\n systemRef, executionId,\n });\n return ServiceConsentRequirementVerdict.NOT_EVALUATED;\n }\n\n try {\n // The operation is what the denial audit records. The transcript's CREATE is INTERNAL_CALL — no URL-bearing\n // default exists — so it is resolved from the resource's declared operations rather than from a path.\n const operation = this.transcriptDefaultCreateOperation(owner.resourceType);\n if (!operation) {\n // Still decided — the refusal is the control — but a refusal here would leave no audit row, and that\n // must be visible rather than silent (#534 third review L3).\n this.logger.warn('Transcript resource declares no default CREATE; a service consent refusal on this turn will leave no audit row', {\n systemRef, executionId, resourceType: owner.resourceType,\n });\n }\n // Built from the verified auth as a whole, so a delegated caller's client reaches the refusal row (#1595).\n const executionContext = createBareExecutionContextFromVerifiedAuth(operation as ResourceConfiguration_Operation<any, any, any>, auth);\n await this.authorizer.assertServiceConsentRequirementMet(owner.resourceType, executionContext);\n return ServiceConsentRequirementVerdict.ADMITTED;\n } catch (error) {\n // Both refusals `assertServiceConsentRequirementMet` can throw — the whole-application requirement and the\n // transcript resource's own capability declaration (#1258 Step 3) — are a clean, expected refusal here, not\n // an evaluation failure; only anything else should warn.\n const isConsentRefusal = isWildoBackendError(error) && (\n error.customMessageReference === ErrorCustomMessageReference.AUTHORIZATIONS_SERVICE_CONSENT_REQUIRED\n || error.customMessageReference === ErrorCustomMessageReference.AUTHORIZATIONS_CAPABILITY_CONSENT_REQUIRED\n );\n if (isConsentRefusal) return ServiceConsentRequirementVerdict.REFUSED;\n this.logger.warn('Service consent requirement could not be evaluated for a conversational turn', {\n systemRef,\n executionId,\n ...projectCaughtErrorLogFields(error),\n });\n return ServiceConsentRequirementVerdict.NOT_EVALUATED;\n }\n }\n\n /**\n * The thread waits for `decisionRef`, so this message or turn end is not the client's (#2721): RECOVERABLE, and naming\n * the decision as a field (#2721 re-review R-2) so a tab keeps its card only when it holds that same decision.\n */\n private emitDecisionPending(emitter: FlowsActorsExecutionEmitter, systemRef: string, executionId: string, decisionRef: string): void {\n emitter(CoreWebSocketEvent.FLOWS_ACTORS_ERROR, {\n systemRef,\n executionId,\n errorCode: FlowsActors_ExecutionErrorCode.DECISION_PENDING,\n errorMessage: decisionPendingMessage(decisionRef),\n recoverable: true,\n waitingDecisionRef: decisionRef,\n } satisfies WS_FlowsActorsErrorPayload);\n }\n\n private emitError(\n emitter: FlowsActorsExecutionEmitter,\n systemRef: string,\n executionId: string,\n errorCode: FlowsActors_ExecutionErrorCode,\n errorMessage: string,\n /**\n * `true` when the turn is still answerable — the caller may fix the input and try again.\n *\n * Defaults to `false`, which is what every pre-existing caller means: a missing system, a flow\n * system, an empty input all end the attempt. A REFUSED ARGUMENT EDIT does not: the pause is\n * deliberately left standing, so telling the client otherwise would make the surface hide the\n * decision that is still waiting for it.\n */\n recoverable = false,\n /** The structured refusal of an argument edit — what the approval card renders, as labels (#1186). */\n approvalModificationRefusal?: WS_FlowsActorsApprovalModificationRefusal,\n ): void {\n emitter(CoreWebSocketEvent.FLOWS_ACTORS_ERROR, {\n systemRef,\n executionId,\n errorCode,\n errorMessage,\n recoverable,\n ...(approvalModificationRefusal ? { approvalModificationRefusal } : {}),\n });\n }\n}\n\n/**\n * Register the row-teardown settler that ends the decisions of execution rows a teardown deletes or scrubs (#2582), for\n * each execution owner variant: an owner scope's cascade, and a person's erasure. See\n * {@link ConversationalExecutionBackendService.settleDecisionsBeforeTeardown}.\n *\n * The service is resolved at dispatch, not at registration. Every runtime that runs this startup binds it today (the\n * application backend and the minion containers both do), and the bound check is what keeps a container that did not\n * from failing a purge or an erasure: a settler that throws fails its teardown.\n *\n * In a MINION the ending is also bounded by the minion's `resourceAccess` (#2582 review L1, F6). The ending writes\n * through `SystemAccessBackendService.updateAsSystem`, and when that write misses because the decision's route moved,\n * re-reads the row through `readAsSystem`. Both resolve the services registry at call time, and a minion rebinds that\n * registry to its scoped proxy, which refuses a write or a read of a resource its allowlist does not name. So a minion\n * whose code deletes or erases an owner (a person, an organization) that holds an execution waiting on a decision must\n * also be allowed to `write` AND `read` that execution resource, or the teardown fails with\n * `ResourceAccessForbiddenError` naming it (a refused re-read fails the teardown too, rather than leaving the decision\n * requested). That is the remedy: add the resource to both lists. The cascade's own delete needs neither, because it\n * goes through the repositories. Writing the ending through the repositories as well was rejected: it would leave the\n * one service write every ending shares (the route-version compare-and-swap and its update hooks) and give a minion a\n * write its configuration never granted. The actor plane is not bounded this way: its persistence ends a question\n * through the repositories registry.\n *\n * assurance-control: WILDO.ACCESS.AUTHORIZATION_DECISION_AUDIT — a decision a purge or an erasure removes is recorded as\n * ended, and its holders are told, rather than left requested on the trail.\n */\nexport function registerFlowActorExecutionTeardownSettlement(\n servicesRegistry: ServicesRegistryHandlerBackendService,\n container: Container,\n): void {\n for (const resourceType of FLOW_ACTOR_EXECUTION_OWNER_VARIANTS) {\n servicesRegistry.registerRowTeardownSettler(resourceType, async (event) => {\n if (!container.isBound(SAAS_SERVICE_TYPES.ConversationalExecutionBackendService)) return;\n await container.get<ConversationalExecutionBackendService>(SAAS_SERVICE_TYPES.ConversationalExecutionBackendService).settleDecisionsBeforeTeardown(event);\n });\n }\n}\n\n/** #3364 step 3: an output-moderation policy as the entries a paused record stores (the organization policy's own shape). */\nfunction moderationEntriesOf(policy: FlowsActors_OutputModerationPolicy): Array<{ category: ContentSafety_HarmCategory; blockAtOrAbove: ContentSafety_HarmSeverity }> {\n return outputModerationCategories(policy).map((category) => ({ category, blockAtOrAbove: policy[category]! }));\n}\n"]}
|