@opengeni/worker-bundle 2.0.1 → 2.0.2-canary.38686408778001
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/activities/agent-run-admission.d.ts +1 -12
- package/dist/activities/agent-turn/admission.d.ts +88 -10
- package/dist/activities/agent-turn/agent-build.d.ts +14 -3
- package/dist/activities/agent-turn/claim.d.ts +4 -1
- package/dist/activities/agent-turn/claude-core.d.ts +195 -0
- package/dist/activities/agent-turn/code-search.d.ts +60 -0
- package/dist/activities/agent-turn/codex-capacity.d.ts +3 -0
- package/dist/activities/agent-turn/codex-core-capacity.d.ts +37 -0
- package/dist/activities/agent-turn/codex-core-claim.d.ts +40 -0
- package/dist/activities/agent-turn/codex-core-errors.d.ts +102 -0
- package/dist/activities/agent-turn/codex-core-failover.d.ts +15 -0
- package/dist/activities/agent-turn/codex-core-requests.d.ts +28 -0
- package/dist/activities/agent-turn/codex-core-settlement.d.ts +77 -0
- package/dist/activities/agent-turn/codex-credit-policy.d.ts +30 -0
- package/dist/activities/agent-turn/codex-plan-entitlement.d.ts +105 -0
- package/dist/activities/agent-turn/codex-usage-policy.d.ts +2 -0
- package/dist/activities/agent-turn/codex.d.ts +2 -19
- package/dist/activities/agent-turn/compaction-interruption.d.ts +32 -0
- package/dist/activities/agent-turn/compaction-prep.d.ts +30 -1
- package/dist/activities/agent-turn/credential-leases.d.ts +64 -37
- package/dist/activities/agent-turn/credential-restriction.d.ts +3 -0
- package/dist/activities/agent-turn/errors.d.ts +172 -28
- package/dist/activities/agent-turn/failure-settlement.d.ts +10 -43
- package/dist/activities/agent-turn/final-reply.d.ts +18 -0
- package/dist/activities/agent-turn/finalization-monitor.d.ts +7 -2
- package/dist/activities/agent-turn/finalization.d.ts +2 -0
- package/dist/activities/agent-turn/github-repository-bindings.d.ts +2 -0
- package/dist/activities/agent-turn/governance-model.d.ts +13 -1
- package/dist/activities/agent-turn/history-sink.d.ts +3 -1
- package/dist/activities/agent-turn/history.d.ts +2 -0
- package/dist/activities/agent-turn/input-wait-reply.d.ts +76 -0
- package/dist/activities/agent-turn/meaningful-output.d.ts +9 -0
- package/dist/activities/agent-turn/media-artifacts.d.ts +5 -3
- package/dist/activities/agent-turn/model-call-admission.d.ts +15 -0
- package/dist/activities/agent-turn/model-usage.d.ts +56 -14
- package/dist/activities/agent-turn/model-wire-dispatch.d.ts +15 -0
- package/dist/activities/agent-turn/optional-repositories.d.ts +59 -0
- package/dist/activities/agent-turn/prompt-tool-availability.d.ts +17 -0
- package/dist/activities/agent-turn/provider-dispatch-barrier.d.ts +12 -1
- package/dist/activities/agent-turn/provider-recovery-copy.d.ts +24 -0
- package/dist/activities/agent-turn/provider-recovery-metrics.d.ts +18 -0
- package/dist/activities/agent-turn/provider-recovery-policy.d.ts +6 -0
- package/dist/activities/agent-turn/quiescence.d.ts +6 -7
- package/dist/activities/agent-turn/recovery-warning.d.ts +6 -5
- package/dist/activities/agent-turn/refresh-credentials.d.ts +6 -0
- package/dist/activities/agent-turn/run-credentials.d.ts +9 -5
- package/dist/activities/agent-turn/run.d.ts +27 -2
- package/dist/activities/agent-turn/sandbox-establish.d.ts +1 -0
- package/dist/activities/agent-turn/sandbox-provision.d.ts +25 -1
- package/dist/activities/agent-turn/sandbox-route.d.ts +3 -0
- package/dist/activities/agent-turn/sandbox-runtime.d.ts +1 -1
- package/dist/activities/agent-turn/secret-resolver.d.ts +64 -0
- package/dist/activities/agent-turn/session-title.d.ts +60 -3
- package/dist/activities/agent-turn/session-usage-custody.d.ts +66 -0
- package/dist/activities/agent-turn/skill-checkout.d.ts +25 -6
- package/dist/activities/agent-turn/skill-read.d.ts +70 -2
- package/dist/activities/agent-turn/skill-search.d.ts +2 -0
- package/dist/activities/agent-turn/skill-tools.d.ts +41 -4
- package/dist/activities/agent-turn/skill-transfer.d.ts +18 -6
- package/dist/activities/agent-turn/stream-attempt.d.ts +6 -3
- package/dist/activities/agent-turn/subscription-capacity-arming.d.ts +41 -0
- package/dist/activities/agent-turn/subscription-core-capacity.d.ts +86 -0
- package/dist/activities/agent-turn/subscription-core-failover.d.ts +69 -0
- package/dist/activities/agent-turn/subscription-core-placed.d.ts +14 -0
- package/dist/activities/agent-turn/subscription-core-requests.d.ts +109 -0
- package/dist/activities/agent-turn/subscription-core-settlement.d.ts +112 -0
- package/dist/activities/agent-turn/subscription-lease.d.ts +44 -0
- package/dist/activities/agent-turn/subscription-serving-capacity.d.ts +6 -0
- package/dist/activities/agent-turn/subscription-serving-catalog.d.ts +13 -0
- package/dist/activities/agent-turn/subscription-serving-claim.d.ts +30 -0
- package/dist/activities/agent-turn/subscription-serving-providers.d.ts +2 -0
- package/dist/activities/agent-turn/tool-environment.d.ts +30 -6
- package/dist/activities/agent-turn/tool-policy.d.ts +55 -3
- package/dist/activities/agent-turn/turn-context.d.ts +104 -5
- package/dist/activities/agent-turn/web-search.d.ts +57 -0
- package/dist/activities/agent-turn/xai-core.d.ts +96 -0
- package/dist/activities/automations.d.ts +3 -1
- package/dist/activities/browser-deadline-checkpoint.d.ts +34 -0
- package/dist/activities/capabilities.d.ts +8 -20
- package/dist/activities/codemode-dispatcher.d.ts +20 -3
- package/dist/activities/codex-capacity.d.ts +1 -56
- package/dist/activities/codex-image-generation.d.ts +49 -3
- package/dist/activities/common.d.ts +3 -1
- package/dist/activities/context-compaction.d.ts +41 -2
- package/dist/activities/environment.d.ts +1 -19
- package/dist/activities/gmail-files.d.ts +50 -0
- package/dist/activities/goals.d.ts +1 -9
- package/dist/activities/incident-telemetry-authority.d.ts +5 -2
- package/dist/activities/incident-telemetry-preflight.d.ts +10 -3
- package/dist/activities/knowledge-indexing.d.ts +19 -0
- package/dist/activities/mcp-account-routes.d.ts +2 -21
- package/dist/activities/model-call-fact-reconciler.d.ts +34 -0
- package/dist/activities/open-suffix-resume.d.ts +15 -0
- package/dist/activities/parent-wake.d.ts +17 -12
- package/dist/activities/programmatic-approvals.d.ts +10 -0
- package/dist/activities/requester-unavailable-receipt.d.ts +8 -0
- package/dist/activities/retained-screenshots.d.ts +7 -2
- package/dist/activities/run-credential-renewal.d.ts +1 -0
- package/dist/activities/run-credentials.d.ts +16 -4
- package/dist/activities/run-input.d.ts +17 -0
- package/dist/activities/sandbox-lease.d.ts +132 -12
- package/dist/activities/scheduled-tasks.d.ts +4 -35
- package/dist/activities/session-archive.d.ts +58 -0
- package/dist/activities/session-state.d.ts +15 -3
- package/dist/activities/session-storage.d.ts +44 -0
- package/dist/activities/subscription-core-claude-waits.d.ts +2 -0
- package/dist/activities/subscription-core-codex-quota.d.ts +25 -0
- package/dist/activities/subscription-core-codex-waits.d.ts +153 -0
- package/dist/activities/subscription-core-image-operation.d.ts +29 -0
- package/dist/activities/subscription-core-usage-recheck.d.ts +49 -0
- package/dist/activities/subscription-core-wait-bindings.d.ts +3 -0
- package/dist/activities/subscription-core-xai-quota.d.ts +30 -0
- package/dist/activities/subscription-core-xai-waits.d.ts +2 -0
- package/dist/activities/types.d.ts +68 -5
- package/dist/activities/video-generation-admission.d.ts +2 -8
- package/dist/activities/video-generation-credential.d.ts +15 -12
- package/dist/activities/video-generation-subscription-core.d.ts +70 -0
- package/dist/activities/workspace-capture.d.ts +2 -0
- package/dist/activities/workspace-credential-provider.d.ts +47 -0
- package/dist/activities/xai-auth.d.ts +6 -18
- package/dist/activities/xai-image-generation.d.ts +22 -6
- package/dist/{activities-control-QA6OLRQY.js → activities-control-NTXZHYET.js} +1552 -2876
- package/dist/activities-control-NTXZHYET.js.map +1 -0
- package/dist/activities-control.d.ts +64 -4
- package/dist/{activities-turn-YVVKCGAK.js → activities-turn-RKRI5GY4.js} +9238 -4392
- package/dist/activities-turn-RKRI5GY4.js.map +1 -0
- package/dist/activities.d.ts +64 -4
- package/dist/artifact-materializer-entry.js +104 -35
- package/dist/artifact-materializer-entry.js.map +1 -1
- package/dist/artifact-outbox-entry.js +132 -61
- package/dist/artifact-outbox-entry.js.map +1 -1
- package/dist/browser-deadline-checkpoint-contract.d.ts +2 -0
- package/dist/{chunk-GDCLDKSH.js → chunk-24GP3BX5.js} +79 -72
- package/dist/chunk-24GP3BX5.js.map +1 -0
- package/dist/{chunk-RAMNYSAW.js → chunk-4ER3YXOT.js} +22 -4
- package/dist/chunk-4ER3YXOT.js.map +1 -0
- package/dist/{chunk-I7HKKMUJ.js → chunk-5NNS4327.js} +734 -58
- package/dist/chunk-5NNS4327.js.map +1 -0
- package/dist/{chunk-M3NVMF2V.js → chunk-7BIHFUGB.js} +2293 -3956
- package/dist/chunk-7BIHFUGB.js.map +1 -0
- package/dist/chunk-MVESOYFC.js +3746 -0
- package/dist/chunk-MVESOYFC.js.map +1 -0
- package/dist/chunk-NQDVJ6RI.js +2823 -0
- package/dist/chunk-NQDVJ6RI.js.map +1 -0
- package/dist/chunk-O7UPBWXK.js +79 -0
- package/dist/chunk-O7UPBWXK.js.map +1 -0
- package/dist/chunk-W2QSM5HR.js +414 -0
- package/dist/chunk-W2QSM5HR.js.map +1 -0
- package/dist/chunk-ZN3XJR33.js +227 -0
- package/dist/chunk-ZN3XJR33.js.map +1 -0
- package/dist/editable-artifact-outbox-dispatcher.d.ts +12 -1
- package/dist/editable-artifact-outbox-service.d.ts +3 -1
- package/dist/host-export-pump.d.ts +3 -1
- package/dist/host-export.d.ts +2 -2
- package/dist/host-export.js +1 -1
- package/dist/http.d.ts +1 -1
- package/dist/index.d.ts +49 -48
- package/dist/index.js +835 -256
- package/dist/index.js.map +1 -1
- package/dist/internal-maintenance.d.ts +63 -0
- package/dist/maintenance-cadence.d.ts +43 -0
- package/dist/observability-metrics.d.ts +293 -24
- package/dist/onepassword-vault-provider.d.ts +7 -0
- package/dist/parent-wake-PCLH7A3Y.js +24 -0
- package/dist/parent-wake-PCLH7A3Y.js.map +1 -0
- package/dist/personal-github-git-credentials.d.ts +1 -1
- package/dist/readiness-checks.d.ts +39 -0
- package/dist/retained-process-retry.d.ts +7 -0
- package/dist/sandbox-lease-BJYU72N3.js +84 -0
- package/dist/sandbox-lease-BJYU72N3.js.map +1 -0
- package/dist/sandbox-reaper-contract.d.ts +25 -0
- package/dist/sandbox-resume.d.ts +72 -4
- package/dist/sandbox-routing.d.ts +4 -2
- package/dist/session-event-fanout.d.ts +6 -0
- package/dist/site-auth-maintenance-WK3MR2PV.js +12 -0
- package/dist/site-auth-maintenance-WK3MR2PV.js.map +1 -0
- package/dist/telemetry-scheduler.d.ts +14 -0
- package/dist/temporal-runtime-logger.d.ts +22 -0
- package/dist/turn-task-queue-reader.d.ts +18 -0
- package/dist/turn-worker-activity-telemetry.d.ts +47 -0
- package/dist/worker-service-lifecycle.d.ts +12 -0
- package/dist/workflow-bundle.js +468 -71
- package/dist/workflows/activities.d.ts +1 -1
- package/dist/workflows/browser-deadline-checkpoint.d.ts +10 -0
- package/dist/workflows/sandbox-reaper.d.ts +10 -1
- package/dist/workflows/scheduled-tasks.d.ts +4 -0
- package/dist/workflows/session-storage.d.ts +2 -0
- package/dist/workflows/session.d.ts +36 -0
- package/dist/workflows/site-auth-maintenance.d.ts +2 -1
- package/dist/workflows/workflow-wake.d.ts +14 -3
- package/dist/workflows.d.ts +3 -1
- package/package.json +26 -20
- package/src/activities/agent-run-admission.ts +1 -82
- package/src/activities/agent-turn/admission.ts +175 -24
- package/src/activities/agent-turn/agent-build.ts +226 -145
- package/src/activities/agent-turn/claim.ts +363 -64
- package/src/activities/agent-turn/claude-core.ts +587 -0
- package/src/activities/agent-turn/code-search.ts +275 -0
- package/src/activities/agent-turn/codex-capacity.ts +30 -757
- package/src/activities/agent-turn/codex-core-capacity.ts +190 -0
- package/src/activities/agent-turn/codex-core-claim.ts +83 -0
- package/src/activities/agent-turn/codex-core-errors.ts +308 -0
- package/src/activities/agent-turn/codex-core-failover.ts +73 -0
- package/src/activities/agent-turn/codex-core-requests.ts +86 -0
- package/src/activities/agent-turn/codex-core-settlement.ts +263 -0
- package/src/activities/agent-turn/codex-credit-policy.ts +247 -0
- package/src/activities/agent-turn/codex-plan-entitlement.ts +254 -0
- package/src/activities/agent-turn/codex-usage-policy.ts +2 -0
- package/src/activities/agent-turn/codex.ts +8 -76
- package/src/activities/agent-turn/compaction-interruption.ts +56 -0
- package/src/activities/agent-turn/compaction-prep.ts +249 -36
- package/src/activities/agent-turn/credential-leases.ts +269 -214
- package/src/activities/agent-turn/credential-restriction.ts +14 -0
- package/src/activities/agent-turn/errors.ts +1134 -82
- package/src/activities/agent-turn/failure-settlement.ts +879 -886
- package/src/activities/agent-turn/final-reply.ts +46 -0
- package/src/activities/agent-turn/finalization-monitor.ts +17 -5
- package/src/activities/agent-turn/finalization.ts +107 -88
- package/src/activities/agent-turn/github-repository-bindings.ts +3 -1
- package/src/activities/agent-turn/governance-model.ts +90 -22
- package/src/activities/agent-turn/history-sink.ts +26 -4
- package/src/activities/agent-turn/history.ts +25 -5
- package/src/activities/agent-turn/input-wait-reply.ts +139 -0
- package/src/activities/agent-turn/knowledge-source-tools.ts +2 -0
- package/src/activities/agent-turn/meaningful-output.ts +44 -0
- package/src/activities/agent-turn/media-artifacts.ts +3 -1
- package/src/activities/agent-turn/model-call-admission.ts +94 -0
- package/src/activities/agent-turn/model-usage.ts +299 -233
- package/src/activities/agent-turn/model-wire-dispatch.ts +27 -0
- package/src/activities/agent-turn/optional-repositories.ts +224 -0
- package/src/activities/agent-turn/prompt-tool-availability.ts +27 -0
- package/src/activities/agent-turn/provider-dispatch-barrier.ts +22 -0
- package/src/activities/agent-turn/provider-recovery-copy.ts +76 -0
- package/src/activities/agent-turn/provider-recovery-metrics.ts +64 -0
- package/src/activities/agent-turn/provider-recovery-policy.ts +25 -0
- package/src/activities/agent-turn/quiescence.ts +7 -7
- package/src/activities/agent-turn/recovery-warning.ts +6 -8
- package/src/activities/agent-turn/refresh-credentials.ts +44 -0
- package/src/activities/agent-turn/run-credentials.ts +124 -76
- package/src/activities/agent-turn/run.ts +501 -112
- package/src/activities/agent-turn/sandbox-establish.ts +152 -75
- package/src/activities/agent-turn/sandbox-provision.ts +54 -1
- package/src/activities/agent-turn/sandbox-route.ts +4 -1
- package/src/activities/agent-turn/sandbox-runtime.ts +319 -11
- package/src/activities/agent-turn/secret-resolver.ts +155 -0
- package/src/activities/agent-turn/session-title.ts +177 -12
- package/src/activities/agent-turn/session-usage-custody.ts +170 -0
- package/src/activities/agent-turn/skill-checkout.ts +111 -24
- package/src/activities/agent-turn/skill-install.ts +1 -1
- package/src/activities/agent-turn/skill-read.ts +374 -28
- package/src/activities/agent-turn/skill-save.ts +35 -7
- package/src/activities/agent-turn/skill-search.ts +9 -0
- package/src/activities/agent-turn/skill-selection.ts +4 -0
- package/src/activities/agent-turn/skill-tools.ts +208 -21
- package/src/activities/agent-turn/skill-transfer.ts +68 -23
- package/src/activities/agent-turn/stream-attempt.ts +599 -110
- package/src/activities/agent-turn/subscription-capacity-arming.ts +81 -0
- package/src/activities/agent-turn/subscription-core-capacity.ts +439 -0
- package/src/activities/agent-turn/subscription-core-failover.ts +229 -0
- package/src/activities/agent-turn/subscription-core-placed.ts +37 -0
- package/src/activities/agent-turn/subscription-core-requests.ts +271 -0
- package/src/activities/agent-turn/subscription-core-settlement.ts +234 -0
- package/src/activities/agent-turn/subscription-lease.ts +140 -0
- package/src/activities/agent-turn/subscription-serving-capacity.ts +195 -0
- package/src/activities/agent-turn/subscription-serving-catalog.ts +71 -0
- package/src/activities/agent-turn/subscription-serving-claim.ts +178 -0
- package/src/activities/agent-turn/subscription-serving-providers.ts +15 -0
- package/src/activities/agent-turn/tool-environment.ts +384 -292
- package/src/activities/agent-turn/tool-policy.ts +104 -4
- package/src/activities/agent-turn/tool-result-spill.ts +1 -0
- package/src/activities/agent-turn/turn-context.ts +124 -8
- package/src/activities/agent-turn/web-search.ts +431 -0
- package/src/activities/agent-turn/xai-core.ts +301 -0
- package/src/activities/automations.ts +81 -6
- package/src/activities/browser-deadline-checkpoint.ts +297 -0
- package/src/activities/capabilities.ts +53 -213
- package/src/activities/codemode-dispatcher.ts +236 -14
- package/src/activities/codex-capacity.ts +27 -380
- package/src/activities/codex-image-generation.ts +252 -42
- package/src/activities/common.ts +12 -0
- package/src/activities/connector-attachments.ts +3 -1
- package/src/activities/context-compaction.ts +162 -21
- package/src/activities/environment.ts +18 -106
- package/src/activities/gmail-files.ts +108 -0
- package/src/activities/goals.ts +120 -204
- package/src/activities/image-generation-operation.ts +1 -1
- package/src/activities/incident-telemetry-authority.ts +80 -50
- package/src/activities/incident-telemetry-preflight.ts +27 -15
- package/src/activities/knowledge-indexing.ts +287 -17
- package/src/activities/knowledge-source-sync.ts +10 -0
- package/src/activities/mcp-account-routes.ts +2 -124
- package/src/activities/model-call-fact-reconciler.ts +112 -0
- package/src/activities/open-suffix-resume.ts +122 -88
- package/src/activities/parent-wake.ts +89 -21
- package/src/activities/programmatic-approvals.ts +26 -0
- package/src/activities/requester-unavailable-receipt.ts +14 -0
- package/src/activities/retained-screenshots.ts +135 -24
- package/src/activities/run-credential-renewal.ts +13 -1
- package/src/activities/run-credentials.ts +61 -19
- package/src/activities/run-input.ts +116 -9
- package/src/activities/sandbox-lease.ts +1615 -73
- package/src/activities/scheduled-tasks.ts +758 -141
- package/src/activities/session-archive.ts +382 -0
- package/src/activities/session-state.ts +219 -10
- package/src/activities/session-storage.ts +124 -0
- package/src/activities/site-auth-maintenance.ts +5 -2
- package/src/activities/subscription-core-claude-waits.ts +49 -0
- package/src/activities/subscription-core-codex-quota.ts +46 -0
- package/src/activities/subscription-core-codex-waits.ts +488 -0
- package/src/activities/subscription-core-image-operation.ts +126 -0
- package/src/activities/subscription-core-usage-recheck.ts +146 -0
- package/src/activities/subscription-core-wait-bindings.ts +12 -0
- package/src/activities/subscription-core-xai-quota.ts +85 -0
- package/src/activities/subscription-core-xai-waits.ts +48 -0
- package/src/activities/types.ts +85 -9
- package/src/activities/video-generation-admission.ts +1 -36
- package/src/activities/video-generation-credential.ts +38 -56
- package/src/activities/video-generation-reconciliation.ts +150 -131
- package/src/activities/video-generation-subscription-core.ts +180 -0
- package/src/activities/workspace-capture.ts +13 -2
- package/src/activities/workspace-credential-provider.ts +302 -0
- package/src/activities/xai-auth.ts +34 -112
- package/src/activities/xai-image-generation.ts +84 -36
- package/src/activities-control.ts +8 -0
- package/src/activities-turn.ts +5 -0
- package/src/activities.ts +17 -0
- package/src/activity-services.ts +29 -4
- package/src/browser-deadline-checkpoint-contract.ts +5 -0
- package/src/editable-artifact-hint-broker.ts +3 -0
- package/src/editable-artifact-materializer-service.ts +79 -38
- package/src/editable-artifact-materializer-subprocess.ts +47 -2
- package/src/editable-artifact-outbox-dispatcher.ts +107 -46
- package/src/editable-artifact-outbox-service.ts +55 -25
- package/src/github-rest-mcp.ts +1 -1
- package/src/host-export-pump.ts +26 -4
- package/src/host-export.ts +4 -1
- package/src/http.ts +4 -2
- package/src/index.ts +222 -282
- package/src/internal-maintenance.ts +347 -0
- package/src/maintenance-cadence.ts +156 -0
- package/src/observability-metrics.ts +1173 -73
- package/src/onepassword-vault-provider.ts +11 -0
- package/src/personal-github-git-credentials.ts +3 -1
- package/src/pr-review-credentials.ts +1 -1
- package/src/readiness-checks.ts +113 -0
- package/src/retained-process-retry.ts +36 -0
- package/src/sandbox-reaper-contract.ts +33 -0
- package/src/sandbox-resume.ts +444 -73
- package/src/sandbox-routing.ts +230 -75
- package/src/session-event-fanout.ts +23 -0
- package/src/telemetry-scheduler.ts +53 -0
- package/src/temporal-runtime-logger.ts +44 -0
- package/src/turn-task-queue-reader.ts +110 -0
- package/src/turn-worker-activity-telemetry.ts +209 -0
- package/src/worker-service-lifecycle.ts +54 -1
- package/src/workflows/activities.ts +16 -1
- package/src/workflows/browser-deadline-checkpoint.ts +55 -0
- package/src/workflows/file-upload-reaper.ts +2 -0
- package/src/workflows/sandbox-reaper.ts +88 -0
- package/src/workflows/scheduled-tasks.ts +26 -13
- package/src/workflows/session-storage.ts +19 -0
- package/src/workflows/session.ts +238 -33
- package/src/workflows/site-auth-maintenance.ts +2 -1
- package/src/workflows/workflow-wake.ts +26 -4
- package/src/workflows.ts +7 -0
- package/dist/activities/agent-turn/xai-capacity.d.ts +0 -2
- package/dist/activities/codex-fleet-shadow.d.ts +0 -74
- package/dist/activities/codex-rotation.d.ts +0 -200
- package/dist/activities/xai-quota.d.ts +0 -3
- package/dist/activities-control-QA6OLRQY.js.map +0 -1
- package/dist/activities-turn-YVVKCGAK.js.map +0 -1
- package/dist/chunk-GDCLDKSH.js.map +0 -1
- package/dist/chunk-I7HKKMUJ.js.map +0 -1
- package/dist/chunk-M3NVMF2V.js.map +0 -1
- package/dist/chunk-RAMNYSAW.js.map +0 -1
- package/src/activities/agent-turn/xai-capacity.ts +0 -257
- package/src/activities/codex-fleet-shadow.ts +0 -306
- package/src/activities/codex-rotation.ts +0 -685
- package/src/activities/xai-quota.ts +0 -35
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
import { getScheduledTaskClaudeProviderAccountAuthoritySnapshot } from "@opengeni/db";
|
|
2
|
+
import {
|
|
3
|
+
ATLASSIAN_NATIVE_RETIRED_REASON,
|
|
4
|
+
isRetiredNativeAtlassianTask,
|
|
5
|
+
} from "@opengeni/contracts/atlassian-native-retirement";
|
|
6
|
+
import { GOOGLE_DRIVE_PUBLICATION_SERVER_ID } from "@opengeni/contracts/google-drive";
|
|
7
|
+
import { PERSONAL_GITHUB_CONNECTION_SURFACE_ID } from "@opengeni/contracts/personal-github";
|
|
1
8
|
import {
|
|
2
9
|
AUTOMATIC_SESSION_TITLE_FALLBACK,
|
|
3
10
|
DEFAULT_FIRST_PARTY_MCP_PERMISSIONS,
|
|
@@ -10,16 +17,24 @@ import {
|
|
|
10
17
|
SessionAgentAccess,
|
|
11
18
|
SessionMemoryScope,
|
|
12
19
|
normalizeAutomaticSessionTitle,
|
|
20
|
+
metadataWithTurnExecutionPolicyV1,
|
|
21
|
+
mergeResourceRefs,
|
|
22
|
+
resolveWorkspaceSessionToolDefaults,
|
|
13
23
|
scheduledOccurrencePayloadUtf8Bytes,
|
|
14
24
|
stableJson,
|
|
15
25
|
TurnExecutionPolicyV1,
|
|
26
|
+
type McpConnectionAccountSelection,
|
|
16
27
|
type ScheduledTask,
|
|
28
|
+
type ScheduledTaskDegradedAccount,
|
|
17
29
|
type ScheduledTaskRun,
|
|
30
|
+
type ResolvedAgentConfig,
|
|
18
31
|
} from "@opengeni/contracts";
|
|
19
32
|
import {
|
|
20
33
|
openGeniSlackBotMetadata,
|
|
21
34
|
requireOpenGeniSlackBotConnection,
|
|
35
|
+
withScheduledSlackBotPostingTools,
|
|
22
36
|
resolveWorkspaceCatalogSettings,
|
|
37
|
+
resolveScheduledTaskDefaultModel,
|
|
23
38
|
resolveSessionToolPolicy,
|
|
24
39
|
workspaceCustomModelReference,
|
|
25
40
|
lockActiveCustomModelForAdmission,
|
|
@@ -28,15 +43,25 @@ import {
|
|
|
28
43
|
ConnectionAccountSelectionError,
|
|
29
44
|
scheduledConnectionSurfaceEligibility,
|
|
30
45
|
scheduledConnectionTools,
|
|
46
|
+
scheduledTaskRunTools,
|
|
31
47
|
settingsWithEnabledCapabilityMcpServers,
|
|
32
48
|
settingsWithSessionMcpServerMetadata,
|
|
33
49
|
swapActiveSandbox,
|
|
50
|
+
applySessionAgentConfigWriteThrough,
|
|
51
|
+
resolveSessionAgentConfigForCreate,
|
|
52
|
+
recordSessionCreated,
|
|
53
|
+
recordUserMessageAccepted,
|
|
54
|
+
type ProductUsageMetricsSink,
|
|
34
55
|
} from "@opengeni/core";
|
|
35
56
|
import {
|
|
36
57
|
appendSessionEvents,
|
|
37
58
|
addSessionSystemUpdateWithSourceMutation,
|
|
38
59
|
bindScheduledTaskRunSessionInTransaction,
|
|
60
|
+
checkSessionUsageLimitAdmission,
|
|
39
61
|
createScheduledTaskRun,
|
|
62
|
+
recordScheduledTaskAdmissionFailure,
|
|
63
|
+
recordScheduledTaskAdmissionRefusal,
|
|
64
|
+
type ScheduledTaskAdmissionRefusalReason,
|
|
40
65
|
createSession,
|
|
41
66
|
createSessionWithIdempotencyKeyResult,
|
|
42
67
|
enqueueSessionWorkflowWakeIfRunnable,
|
|
@@ -49,14 +74,19 @@ import {
|
|
|
49
74
|
getScheduledTaskRunPersonalResourceAuthority,
|
|
50
75
|
getScheduledTaskPersonalResourceAuthoritySubject,
|
|
51
76
|
getScheduledTaskRevisionAuthority,
|
|
77
|
+
getScheduledTaskSubscriptionAuthority,
|
|
52
78
|
getScheduledTaskXaiProviderAccountAuthoritySnapshot,
|
|
53
79
|
getEnrollment,
|
|
54
80
|
getSandbox,
|
|
81
|
+
getSessionAuthorityEpoch,
|
|
82
|
+
issueSelfUserResourceGrant,
|
|
83
|
+
listSelfUserResourceAuthorities,
|
|
55
84
|
getRig,
|
|
56
85
|
getScheduledScopedRigVersionMetadata,
|
|
57
86
|
getNestedAgentDepthDeploymentPolicy,
|
|
58
87
|
getSessionByCreateIdempotencyKey,
|
|
59
88
|
getSessionCreationExecutionPolicy,
|
|
89
|
+
metadataWithAgentConfigCreateIdentity,
|
|
60
90
|
getVariableSet,
|
|
61
91
|
isCodexBilledModel,
|
|
62
92
|
initializeSessionStartAtomically,
|
|
@@ -77,8 +107,10 @@ import {
|
|
|
77
107
|
import { publishDurableSessionEvents } from "@opengeni/events";
|
|
78
108
|
import {
|
|
79
109
|
allowedFirstPartyMcpToolsForSession,
|
|
110
|
+
resolveSessionFirstPartyMcpTools,
|
|
80
111
|
resolveFirstPartyMcpToolPolicy,
|
|
81
112
|
resolveTurnExecutionPolicyV1,
|
|
113
|
+
TurnExecutionPolicyModelUnavailableError,
|
|
82
114
|
} from "@opengeni/config";
|
|
83
115
|
import { Context } from "@temporalio/activity";
|
|
84
116
|
import { createHash } from "node:crypto";
|
|
@@ -115,6 +147,30 @@ type ScheduledTemporalActivityIdentity = {
|
|
|
115
147
|
activityId: string;
|
|
116
148
|
};
|
|
117
149
|
|
|
150
|
+
export function scheduledTaskRunExecutionPolicy(
|
|
151
|
+
policy: TurnExecutionPolicyV1,
|
|
152
|
+
input: DispatchScheduledTaskRunInput,
|
|
153
|
+
creatorRestriction?: "developer_setup",
|
|
154
|
+
): TurnExecutionPolicyV1 {
|
|
155
|
+
return creatorRestriction === "developer_setup" ||
|
|
156
|
+
(input.triggerType !== "scheduled" && input.credentialRestriction === "developer_setup")
|
|
157
|
+
? { ...policy, credentialRestriction: "developer_setup" }
|
|
158
|
+
: policy;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/** Only a creator ceiling is standing; a manual caller ceiling is per-run. */
|
|
162
|
+
export function scheduledSessionExecutionPolicyMetadata(
|
|
163
|
+
policy: unknown,
|
|
164
|
+
creatorRestriction?: "developer_setup",
|
|
165
|
+
): Record<string, unknown> {
|
|
166
|
+
if (policy === undefined || policy === null) return {};
|
|
167
|
+
const acceptedPolicy = TurnExecutionPolicyV1.parse(policy);
|
|
168
|
+
return creatorRestriction === "developer_setup" &&
|
|
169
|
+
acceptedPolicy.credentialRestriction === "developer_setup"
|
|
170
|
+
? metadataWithTurnExecutionPolicyV1({}, acceptedPolicy)
|
|
171
|
+
: {};
|
|
172
|
+
}
|
|
173
|
+
|
|
118
174
|
export function scheduledTaskRunProducerKey(
|
|
119
175
|
input: DispatchScheduledTaskRunInput,
|
|
120
176
|
suppliedActivityIdentity?: ScheduledTemporalActivityIdentity,
|
|
@@ -184,6 +240,15 @@ export function scheduledTaskGeneratedSessionCreateIdempotencyKey(producerKey: s
|
|
|
184
240
|
* alone, with no Intl call and so no host ICU or tzdata build to make the two
|
|
185
241
|
* texts differ.
|
|
186
242
|
*/
|
|
243
|
+
/** A scheduler-generated run session: a service-created root session. */
|
|
244
|
+
function recordScheduledSessionCreated(observability: ProductUsageMetricsSink | undefined): void {
|
|
245
|
+
recordSessionCreated(observability, {
|
|
246
|
+
surface: "scheduled",
|
|
247
|
+
createdByKind: "service",
|
|
248
|
+
parentSessionId: null,
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
|
|
187
252
|
export function scheduledTaskSessionTitle(taskName: string): string {
|
|
188
253
|
return normalizeAutomaticSessionTitle(taskName) ?? "Scheduled run";
|
|
189
254
|
}
|
|
@@ -283,6 +348,9 @@ export function createScheduledTaskActivities(services: () => Promise<ControlAct
|
|
|
283
348
|
producerKey: stableProducerKey,
|
|
284
349
|
});
|
|
285
350
|
if (priorRun?.actionKind === "agent_turn") {
|
|
351
|
+
if (priorRun.admissionDiagnostic || priorRun.admissionRefusal) {
|
|
352
|
+
return scheduledAdmissionRefusalResult(priorRun);
|
|
353
|
+
}
|
|
286
354
|
const acceptedExecution = await getScheduledTaskRunAcceptedExecution(db, {
|
|
287
355
|
workspaceId: input.workspaceId,
|
|
288
356
|
runId: priorRun.id,
|
|
@@ -297,6 +365,15 @@ export function createScheduledTaskActivities(services: () => Promise<ControlAct
|
|
|
297
365
|
}
|
|
298
366
|
throw new Error("scheduled agent run is missing accepted execution truth");
|
|
299
367
|
}
|
|
368
|
+
if (priorRun.status === "queued" && isRetiredNativeAtlassianTask(acceptedExecution.task)) {
|
|
369
|
+
await markScheduledTaskRunFailedIfQueued(
|
|
370
|
+
db,
|
|
371
|
+
priorRun.workspaceId,
|
|
372
|
+
priorRun.id,
|
|
373
|
+
ATLASSIAN_NATIVE_RETIRED_REASON,
|
|
374
|
+
);
|
|
375
|
+
return scheduledRunTerminalResult(ATLASSIAN_NATIVE_RETIRED_REASON);
|
|
376
|
+
}
|
|
300
377
|
await recordScheduledTaskFiredUsage(db, acceptedExecution, priorRun);
|
|
301
378
|
if (priorRun.status === "dispatched") {
|
|
302
379
|
return await replayScheduledTaskDispatch({
|
|
@@ -320,6 +397,7 @@ export function createScheduledTaskActivities(services: () => Promise<ControlAct
|
|
|
320
397
|
try {
|
|
321
398
|
return await recoverBoundScheduledTaskDispatch({
|
|
322
399
|
db,
|
|
400
|
+
observability: baseService.observability,
|
|
323
401
|
bus,
|
|
324
402
|
settings,
|
|
325
403
|
wakeSessionWorkflow,
|
|
@@ -364,6 +442,8 @@ export function createScheduledTaskActivities(services: () => Promise<ControlAct
|
|
|
364
442
|
if (!task) {
|
|
365
443
|
return { action: "deleted" };
|
|
366
444
|
}
|
|
445
|
+
if (isRetiredNativeAtlassianTask(task))
|
|
446
|
+
return { action: "blocked", reason: ATLASSIAN_NATIVE_RETIRED_REASON };
|
|
367
447
|
if (task.action.kind !== "agent_turn") {
|
|
368
448
|
return { action: "blocked", reason: "legacy_source_schedule_requires_migration" };
|
|
369
449
|
}
|
|
@@ -408,6 +488,38 @@ export function createScheduledTaskActivities(services: () => Promise<ControlAct
|
|
|
408
488
|
taskAuthorityRevision: task.authorityRevision,
|
|
409
489
|
});
|
|
410
490
|
const taskAuthoritySubjectId = task.ownerSubjectId;
|
|
491
|
+
// Every pre-admission refusal below is recorded as a visible run receipt
|
|
492
|
+
// under this producer identity instead of throwing (a thrown activity is
|
|
493
|
+
// retried to exhaustion and leaves no run) or returning a bare blocked
|
|
494
|
+
// result (the occurrence silently disappears). Terminal refusals are
|
|
495
|
+
// deterministic for this task revision and digest; transient ones
|
|
496
|
+
// (`retryable`) are skipped and a later occurrence is admitted normally.
|
|
497
|
+
// Redelivery replays the same receipt, so no occurrence gets two runs.
|
|
498
|
+
const refuseAdmission = async (
|
|
499
|
+
reason: ScheduledTaskAdmissionRefusalReason,
|
|
500
|
+
retryable: boolean,
|
|
501
|
+
detail: string,
|
|
502
|
+
): Promise<DispatchScheduledTaskRunResult> => {
|
|
503
|
+
console.warn(
|
|
504
|
+
`[scheduled-task] refused occurrence of ${task.id} (revision ${task.authorityRevision}): ${reason}: ${detail}`,
|
|
505
|
+
);
|
|
506
|
+
const receipt = await recordScheduledTaskAdmissionRefusal(db, {
|
|
507
|
+
workspaceId: task.workspaceId,
|
|
508
|
+
taskId: task.id,
|
|
509
|
+
taskAuthorityRevision: task.authorityRevision,
|
|
510
|
+
taskExecutionDigest: task.executionDigest,
|
|
511
|
+
triggerType: input.triggerType,
|
|
512
|
+
producerKey: stableProducerKey,
|
|
513
|
+
reason,
|
|
514
|
+
retryable,
|
|
515
|
+
});
|
|
516
|
+
if (!receipt.admissionRefusal) {
|
|
517
|
+
// A concurrent delivery accepted this producer first. Follow the
|
|
518
|
+
// existing exact-receipt recovery path, never replace its outcome.
|
|
519
|
+
return createScheduledTaskActivities(services).dispatchScheduledTaskRun(input);
|
|
520
|
+
}
|
|
521
|
+
return scheduledAdmissionRefusalResult(receipt);
|
|
522
|
+
};
|
|
411
523
|
if (
|
|
412
524
|
task.action.kind === "agent_turn" &&
|
|
413
525
|
((taskRevisionAuthority?.subjectId ?? null) !== taskAuthoritySubjectId ||
|
|
@@ -415,7 +527,11 @@ export function createScheduledTaskActivities(services: () => Promise<ControlAct
|
|
|
415
527
|
(subject) => subject !== null && subject !== taskAuthoritySubjectId,
|
|
416
528
|
))
|
|
417
529
|
) {
|
|
418
|
-
|
|
530
|
+
return await refuseAdmission(
|
|
531
|
+
"scheduled_authority_unavailable",
|
|
532
|
+
false,
|
|
533
|
+
"scheduled authority differs from its immutable execution owner",
|
|
534
|
+
);
|
|
419
535
|
}
|
|
420
536
|
const acceptedTargetSessionId =
|
|
421
537
|
task.runMode === "existing_session"
|
|
@@ -438,20 +554,100 @@ export function createScheduledTaskActivities(services: () => Promise<ControlAct
|
|
|
438
554
|
)
|
|
439
555
|
: null;
|
|
440
556
|
const settings = await settingsForTask(task, targetSessionExecutionBase?.model);
|
|
441
|
-
|
|
442
|
-
|
|
557
|
+
// A task that names no model resolves the new-chat default at each fresh
|
|
558
|
+
// occurrence (saved workspace default, then a usable connected
|
|
559
|
+
// subscription under the task's frozen SuperGrok authority, then the
|
|
560
|
+
// credits default while the organization holds a credit balance, then the
|
|
561
|
+
// deployment default). A frozen SuperGrok pool that is gone only means
|
|
562
|
+
// SuperGrok is not ready. The accepted execution freezes the result, so
|
|
563
|
+
// retries and recovery never resolve again. Existing-session runs keep
|
|
564
|
+
// that session's model.
|
|
565
|
+
const resolvedDefault =
|
|
566
|
+
task.agentConfig.model || targetSessionExecutionBase
|
|
567
|
+
? null
|
|
568
|
+
: await resolveScheduledTaskDefaultModel(db, settings, task);
|
|
569
|
+
const model = task.agentConfig.model ?? resolvedDefault?.model ?? settings.openaiModel;
|
|
570
|
+
const reasoningEffort =
|
|
571
|
+
task.agentConfig.reasoningEffort ??
|
|
572
|
+
resolvedDefault?.reasoningEffort ??
|
|
573
|
+
settings.openaiReasoningEffort;
|
|
443
574
|
let sandboxBackend = task.agentConfig.sandboxBackend ?? settings.sandboxBackend;
|
|
444
575
|
let sandboxOs: "linux" | "macos" | "windows" = "linux";
|
|
445
|
-
|
|
576
|
+
// A schedule that follows the workspace defaults gets them as they are
|
|
577
|
+
// now, from the owner's registry; nothing about them was saved with it.
|
|
578
|
+
const runTools = task.agentConfig.toolPolicy
|
|
579
|
+
? scheduledTaskRunTools({
|
|
580
|
+
agentConfig: task.agentConfig,
|
|
581
|
+
settings,
|
|
582
|
+
runtimeSettings: await settingsWithEnabledCapabilityMcpServers(
|
|
583
|
+
db,
|
|
584
|
+
task.workspaceId,
|
|
585
|
+
settings,
|
|
586
|
+
taskAuthoritySubjectId ? { subjectId: taskAuthoritySubjectId } : {},
|
|
587
|
+
),
|
|
588
|
+
workspaceDefaults: resolveWorkspaceSessionToolDefaults(
|
|
589
|
+
(await requireWorkspace(db, task.workspaceId)).settings,
|
|
590
|
+
),
|
|
591
|
+
})
|
|
592
|
+
: task.agentConfig.tools;
|
|
593
|
+
let taskTools = withFirstPartyTools(settings, runTools);
|
|
446
594
|
// A task created by a live agent attempt froze its creator's effective
|
|
447
595
|
// first-party selection, permission set, and session access policy;
|
|
448
596
|
// its generated sessions inherit that boundary under today's
|
|
449
597
|
// deployment ceiling. A human/API-created task (null policy) keeps the
|
|
450
598
|
// deployment default exactly as before.
|
|
451
599
|
const creatorPolicy = await getScheduledTaskCreatorPolicy(db, task.workspaceId, task.id);
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
600
|
+
// A person-chosen Slack channel adds only the two bot posting tools;
|
|
601
|
+
// they post nowhere else, whatever the creator's own selection was.
|
|
602
|
+
let firstPartyMcpTools = withScheduledSlackBotPostingTools(
|
|
603
|
+
creatorPolicy?.firstPartyMcpTools
|
|
604
|
+
? allowedFirstPartyMcpToolsForSession(settings, creatorPolicy.firstPartyMcpTools)
|
|
605
|
+
: resolveFirstPartyMcpToolPolicy(settings).default,
|
|
606
|
+
task.agentConfig,
|
|
607
|
+
resolveFirstPartyMcpToolPolicy(settings).allowed,
|
|
608
|
+
);
|
|
609
|
+
// Agent configuration for generated sessions (null = legacy). The
|
|
610
|
+
// scheduled baseline above (creator policy or deployment default) is
|
|
611
|
+
// what "all" reproduces; capabilities only narrow it. Frozen into the
|
|
612
|
+
// accepted execution so retries and recovery never resolve again.
|
|
613
|
+
let resolvedAgentConfig: ResolvedAgentConfig | null = null;
|
|
614
|
+
let resolvedAgentInstructions: string | undefined;
|
|
615
|
+
const generatedTarget =
|
|
616
|
+
task.runMode === "new_session_per_run" ||
|
|
617
|
+
(task.runMode === "reusable_session" && task.reusableSessionId === null);
|
|
618
|
+
if (generatedTarget) {
|
|
619
|
+
try {
|
|
620
|
+
const agentResolution = resolveSessionAgentConfigForCreate({
|
|
621
|
+
settings,
|
|
622
|
+
creator: "scheduled",
|
|
623
|
+
request: task.agentConfig.agent,
|
|
624
|
+
instructions: undefined,
|
|
625
|
+
workspaceSettings: (await requireWorkspace(db, task.workspaceId)).settings,
|
|
626
|
+
parent: null,
|
|
627
|
+
goal: task.agentConfig.goal !== undefined,
|
|
628
|
+
});
|
|
629
|
+
resolvedAgentConfig = agentResolution.config;
|
|
630
|
+
resolvedAgentInstructions = agentResolution.instructions;
|
|
631
|
+
const written = applySessionAgentConfigWriteThrough({
|
|
632
|
+
config: resolvedAgentConfig,
|
|
633
|
+
firstPartyMcpTools,
|
|
634
|
+
tools: taskTools,
|
|
635
|
+
toolPolicy: { mode: "explicit", inheritedFromSessionId: null },
|
|
636
|
+
productServerIds: runTools.map((tool) => tool.id),
|
|
637
|
+
});
|
|
638
|
+
firstPartyMcpTools = written.firstPartyMcpTools;
|
|
639
|
+
taskTools = written.tools;
|
|
640
|
+
} catch (error) {
|
|
641
|
+
const status =
|
|
642
|
+
error instanceof Error ? (error as Error & { status?: unknown }).status : undefined;
|
|
643
|
+
if (!(error instanceof Error) || status !== 422) throw error;
|
|
644
|
+
return await refuseAdmission(
|
|
645
|
+
"scheduled_authority_unavailable",
|
|
646
|
+
false,
|
|
647
|
+
`scheduled agent configuration is not admissible: ${error.message}`,
|
|
648
|
+
);
|
|
649
|
+
}
|
|
650
|
+
}
|
|
455
651
|
const firstPartyMcpPermissions = creatorPolicy?.firstPartyMcpPermissions
|
|
456
652
|
? [...creatorPolicy.firstPartyMcpPermissions]
|
|
457
653
|
: [...DEFAULT_FIRST_PARTY_MCP_PERMISSIONS];
|
|
@@ -467,7 +663,8 @@ export function createScheduledTaskActivities(services: () => Promise<ControlAct
|
|
|
467
663
|
acceptedTargetSessionId && targetSessionExecutionBase
|
|
468
664
|
? await requireSession(db, task.workspaceId, acceptedTargetSessionId)
|
|
469
665
|
: null;
|
|
470
|
-
const
|
|
666
|
+
const toolWorkspaceSettings = (await requireWorkspace(db, task.workspaceId)).settings;
|
|
667
|
+
let connectionTools = await scheduledConnectionTools(
|
|
471
668
|
db,
|
|
472
669
|
task.workspaceId,
|
|
473
670
|
connectionSettings,
|
|
@@ -475,46 +672,112 @@ export function createScheduledTaskActivities(services: () => Promise<ControlAct
|
|
|
475
672
|
taskTools,
|
|
476
673
|
taskAuthoritySubjectId ?? undefined,
|
|
477
674
|
);
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
675
|
+
// Connector accounts resolve live at each fresh occurrence: every
|
|
676
|
+
// connector uses the owner's current accounts. Only an account a person
|
|
677
|
+
// pinned on a schedule that starts its own session narrows its
|
|
678
|
+
// connector. An existing-chat schedule never pins; that chat supplies
|
|
679
|
+
// its connectors and the owner's current accounts.
|
|
680
|
+
let runPins: McpConnectionAccountSelection[] =
|
|
681
|
+
task.runMode === "existing_session" ? [] : [...(task.agentConfig.pinnedAccounts ?? [])];
|
|
682
|
+
const surfaceEligibility = scheduledConnectionSurfaceEligibility(
|
|
683
|
+
settings,
|
|
684
|
+
connectionTarget ?? {
|
|
685
|
+
firstPartyMcpTools,
|
|
686
|
+
firstPartyMcpPermissions,
|
|
687
|
+
},
|
|
688
|
+
toolWorkspaceSettings,
|
|
689
|
+
);
|
|
690
|
+
const resolveTaskConnections = () =>
|
|
691
|
+
freezeConnectionAccounts({
|
|
692
|
+
db,
|
|
693
|
+
accountId: task.accountId,
|
|
694
|
+
workspaceId: task.workspaceId,
|
|
695
|
+
settings: connectionTarget
|
|
696
|
+
? settingsWithSessionMcpServerMetadata(connectionSettings, connectionTarget.mcpServers)
|
|
697
|
+
: connectionSettings,
|
|
698
|
+
tools: connectionTools,
|
|
699
|
+
resources: mergeResourceRefs(
|
|
700
|
+
connectionTarget?.resources ?? [],
|
|
701
|
+
task.agentConfig.resources,
|
|
702
|
+
),
|
|
703
|
+
source: taskAuthoritySubjectId
|
|
704
|
+
? { kind: "subject", subjectId: taskAuthoritySubjectId, accountId: task.accountId }
|
|
705
|
+
: { kind: "none" },
|
|
706
|
+
authoritySelections: runPins,
|
|
707
|
+
...surfaceEligibility,
|
|
708
|
+
}).catch((error: unknown) => {
|
|
709
|
+
if (error instanceof ConnectionAccountSelectionError) return error;
|
|
710
|
+
throw error;
|
|
711
|
+
});
|
|
712
|
+
let taskConnections = await resolveTaskConnections();
|
|
713
|
+
// A pinned account that can no longer be used is never replaced by
|
|
714
|
+
// another account. Unless the schedule requires its pinned accounts,
|
|
715
|
+
// the occurrence goes ahead without that connector and records what it
|
|
716
|
+
// ran without, so its owner can be told; a connector keeps any of its
|
|
717
|
+
// pins that still work.
|
|
718
|
+
const degradedAccounts: ScheduledTaskDegradedAccount[] = [];
|
|
719
|
+
while (
|
|
720
|
+
taskConnections instanceof ConnectionAccountSelectionError &&
|
|
721
|
+
task.agentConfig.pinnedAccountsRequired !== true
|
|
722
|
+
) {
|
|
723
|
+
const failure: ConnectionAccountSelectionError = taskConnections;
|
|
724
|
+
const stale = scheduledStalePins(runPins, failure);
|
|
725
|
+
// A personal repository pin is bound to the schedule's repository
|
|
726
|
+
// resources; there is no connector to leave out, so it cannot degrade.
|
|
727
|
+
if (
|
|
728
|
+
stale.length === 0 ||
|
|
729
|
+
stale.some((pin) => pin.serverId === PERSONAL_GITHUB_CONNECTION_SURFACE_ID)
|
|
730
|
+
) {
|
|
731
|
+
break;
|
|
732
|
+
}
|
|
733
|
+
degradedAccounts.push(...stale);
|
|
734
|
+
const staleKeys = new Set(stale.map(scheduledPinKey));
|
|
735
|
+
const staleServerIds = new Set(stale.map((pin) => pin.serverId));
|
|
736
|
+
runPins = runPins.filter((pin) => !staleKeys.has(scheduledPinKey(pin)));
|
|
737
|
+
const droppedServerIds = new Set(
|
|
738
|
+
[...staleServerIds].filter(
|
|
739
|
+
(serverId) => !runPins.some((pin) => pin.serverId === serverId),
|
|
740
|
+
),
|
|
741
|
+
);
|
|
742
|
+
if (droppedServerIds.has(GOOGLE_DRIVE_PUBLICATION_SERVER_ID)) {
|
|
743
|
+
surfaceEligibility.googleDrivePublicationEnabled = false;
|
|
744
|
+
}
|
|
745
|
+
connectionTools = connectionTools.filter(
|
|
746
|
+
(tool) => !(tool.kind === "mcp" && droppedServerIds.has(tool.id)),
|
|
747
|
+
);
|
|
748
|
+
taskTools = taskTools.filter(
|
|
749
|
+
(tool) => !(tool.kind === "mcp" && droppedServerIds.has(tool.id)),
|
|
750
|
+
);
|
|
751
|
+
taskConnections = await resolveTaskConnections();
|
|
752
|
+
}
|
|
753
|
+
if (taskConnections instanceof ConnectionAccountSelectionError) {
|
|
754
|
+
const receipt = await recordScheduledTaskAdmissionFailure(db, {
|
|
755
|
+
workspaceId: task.workspaceId,
|
|
756
|
+
taskId: task.id,
|
|
757
|
+
taskAuthorityRevision: task.authorityRevision,
|
|
758
|
+
taskExecutionDigest: task.executionDigest,
|
|
759
|
+
triggerType: input.triggerType,
|
|
760
|
+
producerKey: stableProducerKey,
|
|
761
|
+
diagnostic: taskConnections.diagnostic,
|
|
762
|
+
});
|
|
763
|
+
if (!receipt.admissionDiagnostic) {
|
|
764
|
+
// A concurrent delivery accepted this producer first. Follow the
|
|
765
|
+
// existing exact-receipt recovery path, never replace its outcome.
|
|
766
|
+
return createScheduledTaskActivities(services).dispatchScheduledTaskRun(input);
|
|
767
|
+
}
|
|
768
|
+
return scheduledAdmissionRefusalResult(receipt);
|
|
505
769
|
}
|
|
506
770
|
const {
|
|
507
771
|
personalConnectionDelegations: taskPersonalConnectionDelegations,
|
|
508
772
|
mcpAccountBindings: taskMcpAccountBindings,
|
|
773
|
+
connectionAccountIntent: taskConnectionAccountIntent,
|
|
509
774
|
} = taskConnections;
|
|
510
775
|
const taskConnectionAuthoritySubjectId =
|
|
511
776
|
taskPersonalConnectionDelegations.length > 0 ? taskAuthoritySubjectId : null;
|
|
512
777
|
const creatorSessionPolicy = scheduledCreatorSessionPolicyInput(
|
|
513
778
|
creatorPolicy?.sessionPolicy ?? null,
|
|
514
779
|
);
|
|
515
|
-
|
|
516
|
-
task.runMode === "new_session_per_run" ||
|
|
517
|
-
(task.runMode === "reusable_session" && task.reusableSessionId === null);
|
|
780
|
+
let acceptedPersonalMachine = false;
|
|
518
781
|
if (generatedTarget && task.agentConfig.machineTarget) {
|
|
519
782
|
const access = {
|
|
520
783
|
accountId: task.accountId,
|
|
@@ -526,22 +789,48 @@ export function createScheduledTaskActivities(services: () => Promise<ControlAct
|
|
|
526
789
|
access,
|
|
527
790
|
task.agentConfig.machineTarget.targetSandboxId,
|
|
528
791
|
);
|
|
792
|
+
// A personal machine runs only its owner's Only me schedule. The scoped
|
|
793
|
+
// lookup returns a personal machine to its owner alone, and every attempt
|
|
794
|
+
// re-proves the owner's membership, workspace access and grant in the
|
|
795
|
+
// database before the machine is used.
|
|
529
796
|
if (
|
|
530
797
|
!machine ||
|
|
531
798
|
machine.kind !== "selfhosted" ||
|
|
532
799
|
!machine.enrollmentId ||
|
|
533
|
-
machine.scope === "user"
|
|
800
|
+
(machine.scope === "user" && !personalMachineScheduleOwner(task, access.subjectId))
|
|
534
801
|
) {
|
|
535
|
-
|
|
802
|
+
return await refuseAdmission(
|
|
803
|
+
"machine_target_unavailable",
|
|
804
|
+
false,
|
|
805
|
+
"scheduled Connected Machine target is unavailable",
|
|
806
|
+
);
|
|
536
807
|
}
|
|
537
808
|
const enrollment = await getEnrollment(db, access, machine.enrollmentId);
|
|
538
|
-
if (!enrollment
|
|
539
|
-
|
|
809
|
+
if (!enrollment) {
|
|
810
|
+
return await refuseAdmission(
|
|
811
|
+
"machine_target_unavailable",
|
|
812
|
+
false,
|
|
813
|
+
"scheduled Connected Machine enrollment is gone",
|
|
814
|
+
);
|
|
815
|
+
}
|
|
816
|
+
if (enrollment.status !== "active") {
|
|
817
|
+
// A paused/suspended enrollment can be re-activated; skip this
|
|
818
|
+
// occurrence rather than failing the schedule.
|
|
819
|
+
return await refuseAdmission(
|
|
820
|
+
"machine_enrollment_inactive",
|
|
821
|
+
true,
|
|
822
|
+
`scheduled Connected Machine enrollment is ${enrollment.status}`,
|
|
823
|
+
);
|
|
540
824
|
}
|
|
541
825
|
sandboxBackend = "selfhosted";
|
|
542
826
|
sandboxOs = enrollment.os;
|
|
827
|
+
acceptedPersonalMachine = machine.scope === "user";
|
|
543
828
|
} else if (generatedTarget && sandboxBackend === "selfhosted") {
|
|
544
|
-
|
|
829
|
+
return await refuseAdmission(
|
|
830
|
+
"machine_target_unavailable",
|
|
831
|
+
false,
|
|
832
|
+
"self-hosted scheduled task has no Connected Machine target",
|
|
833
|
+
);
|
|
545
834
|
}
|
|
546
835
|
const generatedSessionDepthPolicy = generatedTarget
|
|
547
836
|
? await (async () => {
|
|
@@ -603,6 +892,14 @@ export function createScheduledTaskActivities(services: () => Promise<ControlAct
|
|
|
603
892
|
});
|
|
604
893
|
return {
|
|
605
894
|
...targetSessionExecutionBase,
|
|
895
|
+
effectiveFirstPartyMcpTools: resolveSessionFirstPartyMcpTools(
|
|
896
|
+
settings,
|
|
897
|
+
{
|
|
898
|
+
...targetSessionExecutionBase,
|
|
899
|
+
...(connectionTarget ? { agent: connectionTarget.agent } : {}),
|
|
900
|
+
},
|
|
901
|
+
toolWorkspaceSettings,
|
|
902
|
+
),
|
|
606
903
|
effectiveMcpServerIds: [
|
|
607
904
|
...new Set(
|
|
608
905
|
effective.toolRefs.flatMap((tool) => (tool.kind === "mcp" ? [tool.id] : [])),
|
|
@@ -628,7 +925,11 @@ export function createScheduledTaskActivities(services: () => Promise<ControlAct
|
|
|
628
925
|
)
|
|
629
926
|
: null;
|
|
630
927
|
if (generatedTarget && task.variableSetId && !acceptedVariableSet) {
|
|
631
|
-
|
|
928
|
+
return await refuseAdmission(
|
|
929
|
+
"variable_set_unavailable",
|
|
930
|
+
false,
|
|
931
|
+
`variable set not found: ${task.variableSetId}`,
|
|
932
|
+
);
|
|
632
933
|
}
|
|
633
934
|
const acceptedRig =
|
|
634
935
|
generatedTarget && task.rigId
|
|
@@ -643,12 +944,17 @@ export function createScheduledTaskActivities(services: () => Promise<ControlAct
|
|
|
643
944
|
)
|
|
644
945
|
: null;
|
|
645
946
|
if (generatedTarget && task.rigId && (!acceptedRig || !acceptedRig.activeVersion)) {
|
|
646
|
-
|
|
947
|
+
return await refuseAdmission(
|
|
948
|
+
"rig_version_unavailable",
|
|
949
|
+
false,
|
|
950
|
+
`sandbox environment has no active version to bind: ${task.rigId}`,
|
|
951
|
+
);
|
|
647
952
|
}
|
|
648
|
-
const
|
|
953
|
+
const acceptedRigDefaultVariableSetRows = acceptedRig?.activeVersion
|
|
649
954
|
? await Promise.all(
|
|
650
|
-
acceptedRig.activeVersion.defaultVariableSetIds.map(async (variableSetId) => {
|
|
651
|
-
|
|
955
|
+
acceptedRig.activeVersion.defaultVariableSetIds.map(async (variableSetId) => ({
|
|
956
|
+
variableSetId,
|
|
957
|
+
variableSet: await getVariableSet(
|
|
652
958
|
db,
|
|
653
959
|
{
|
|
654
960
|
accountId: task.accountId,
|
|
@@ -656,16 +962,23 @@ export function createScheduledTaskActivities(services: () => Promise<ControlAct
|
|
|
656
962
|
subjectId: taskAuthoritySubjectId ?? task.createdBy.subjectId,
|
|
657
963
|
},
|
|
658
964
|
variableSetId,
|
|
659
|
-
)
|
|
660
|
-
|
|
661
|
-
throw new Error(
|
|
662
|
-
`sandbox environment default Variable Set not found: ${variableSetId}`,
|
|
663
|
-
);
|
|
664
|
-
}
|
|
665
|
-
return { id: variableSet.id, generation: variableSet.generation };
|
|
666
|
-
}),
|
|
965
|
+
),
|
|
966
|
+
})),
|
|
667
967
|
)
|
|
668
968
|
: [];
|
|
969
|
+
const missingRigDefaultVariableSet = acceptedRigDefaultVariableSetRows.find(
|
|
970
|
+
(row) => !row.variableSet,
|
|
971
|
+
);
|
|
972
|
+
if (missingRigDefaultVariableSet) {
|
|
973
|
+
return await refuseAdmission(
|
|
974
|
+
"variable_set_unavailable",
|
|
975
|
+
false,
|
|
976
|
+
`sandbox environment default Variable Set not found: ${missingRigDefaultVariableSet.variableSetId}`,
|
|
977
|
+
);
|
|
978
|
+
}
|
|
979
|
+
const acceptedRigDefaultVariableSets = acceptedRigDefaultVariableSetRows.map(
|
|
980
|
+
({ variableSet }) => ({ id: variableSet!.id, generation: variableSet!.generation }),
|
|
981
|
+
);
|
|
669
982
|
let incidentPreflightRequired = incidentDeclaration.action === "required";
|
|
670
983
|
if (incidentPreflightRequired) {
|
|
671
984
|
const existingSessionId =
|
|
@@ -687,16 +1000,15 @@ export function createScheduledTaskActivities(services: () => Promise<ControlAct
|
|
|
687
1000
|
task,
|
|
688
1001
|
session: responderSession,
|
|
689
1002
|
personalConnectionDelegations: taskPersonalConnectionDelegations,
|
|
1003
|
+
plannedTools: taskTools,
|
|
690
1004
|
personalResourceAuthoritySubjectId: taskAuthoritySubjectId,
|
|
691
1005
|
executionPolicy: targetSessionExecution
|
|
692
1006
|
? {
|
|
693
1007
|
tools: targetSessionExecution.tools,
|
|
694
|
-
firstPartyMcpTools:
|
|
1008
|
+
firstPartyMcpTools:
|
|
1009
|
+
targetSessionExecution.effectiveFirstPartyMcpTools ??
|
|
1010
|
+
targetSessionExecution.firstPartyMcpTools,
|
|
695
1011
|
firstPartyMcpPermissions: targetSessionExecution.firstPartyMcpPermissions,
|
|
696
|
-
variableSetIds: targetSessionExecution.variableSets.map(
|
|
697
|
-
(variableSet) => variableSet.id,
|
|
698
|
-
),
|
|
699
|
-
variableSetId: targetSessionExecution.variableSetId,
|
|
700
1012
|
rigId: targetSessionExecution.rigId,
|
|
701
1013
|
rigVersionId: targetSessionExecution.rigVersionId,
|
|
702
1014
|
toolPolicy: targetSessionExecution.toolPolicy,
|
|
@@ -707,7 +1019,6 @@ export function createScheduledTaskActivities(services: () => Promise<ControlAct
|
|
|
707
1019
|
tools: taskTools,
|
|
708
1020
|
firstPartyMcpTools,
|
|
709
1021
|
firstPartyMcpPermissions,
|
|
710
|
-
variableSetId: acceptedVariableSet?.id ?? null,
|
|
711
1022
|
rigId: acceptedRig?.id ?? null,
|
|
712
1023
|
rigVersionId: acceptedRig?.activeVersion?.id ?? null,
|
|
713
1024
|
toolPolicy: responderSession?.toolPolicy ?? {
|
|
@@ -729,6 +1040,17 @@ export function createScheduledTaskActivities(services: () => Promise<ControlAct
|
|
|
729
1040
|
}
|
|
730
1041
|
const taskXaiProviderAccountAuthoritySnapshot =
|
|
731
1042
|
await getScheduledTaskXaiProviderAccountAuthoritySnapshot(db, task.workspaceId, task.id);
|
|
1043
|
+
const taskClaudeProviderAccountAuthoritySnapshot =
|
|
1044
|
+
await getScheduledTaskClaudeProviderAccountAuthoritySnapshot(db, task.workspaceId, task.id);
|
|
1045
|
+
// Codex v2 (M3 PR 3b, EP-T15): the task's value frozen at creation,
|
|
1046
|
+
// copied by every firing; empty when another person authorized the
|
|
1047
|
+
// current revision. Never recomputed from current membership.
|
|
1048
|
+
const taskSubscriptionAuthority = await getScheduledTaskSubscriptionAuthority(db, {
|
|
1049
|
+
workspaceId: task.workspaceId,
|
|
1050
|
+
taskId: task.id,
|
|
1051
|
+
revisionAuthorizerSubjectId: taskRevisionAuthority?.subjectId ?? null,
|
|
1052
|
+
taskAuthorityRevision: task.authorityRevision,
|
|
1053
|
+
});
|
|
732
1054
|
// A scheduled bot selection was authorized when the task was written,
|
|
733
1055
|
// but connection status and tenant/role binding are mutable. Revalidate
|
|
734
1056
|
// before any session/model cost and never fall back to a personal Slack
|
|
@@ -744,7 +1066,7 @@ export function createScheduledTaskActivities(services: () => Promise<ControlAct
|
|
|
744
1066
|
? openGeniSlackBotMetadata(slackBotConnection.metadata)
|
|
745
1067
|
: null;
|
|
746
1068
|
if (slackBotConnection && !slackBotMetadata) {
|
|
747
|
-
throw new Error("
|
|
1069
|
+
throw new Error("Opengeni Slack bot connection metadata is invalid");
|
|
748
1070
|
}
|
|
749
1071
|
const xaiAuthoritySubjectId =
|
|
750
1072
|
taskXaiProviderAccountAuthoritySnapshot.scope === "user" &&
|
|
@@ -752,21 +1074,67 @@ export function createScheduledTaskActivities(services: () => Promise<ControlAct
|
|
|
752
1074
|
? task.createdBy.subjectId
|
|
753
1075
|
: null;
|
|
754
1076
|
if (taskXaiProviderAccountAuthoritySnapshot.scope === "user" && !xaiAuthoritySubjectId) {
|
|
755
|
-
|
|
1077
|
+
return await refuseAdmission(
|
|
1078
|
+
"scheduled_authority_unavailable",
|
|
1079
|
+
false,
|
|
1080
|
+
"scheduled user-scoped xAI authority has no causal human",
|
|
1081
|
+
);
|
|
756
1082
|
}
|
|
757
1083
|
if (
|
|
758
1084
|
xaiAuthoritySubjectId &&
|
|
759
1085
|
taskAuthoritySubjectId &&
|
|
760
1086
|
xaiAuthoritySubjectId !== taskAuthoritySubjectId
|
|
761
1087
|
) {
|
|
762
|
-
|
|
1088
|
+
return await refuseAdmission(
|
|
1089
|
+
"scheduled_authority_unavailable",
|
|
1090
|
+
false,
|
|
1091
|
+
"scheduled authority classes have different causal humans",
|
|
1092
|
+
);
|
|
763
1093
|
}
|
|
764
|
-
const
|
|
1094
|
+
const claudeAuthoritySubjectId =
|
|
1095
|
+
taskClaudeProviderAccountAuthoritySnapshot.scope === "user" && task.ownerSubjectId
|
|
1096
|
+
? task.ownerSubjectId
|
|
1097
|
+
: null;
|
|
1098
|
+
if (
|
|
1099
|
+
taskClaudeProviderAccountAuthoritySnapshot.scope === "user" &&
|
|
1100
|
+
!claudeAuthoritySubjectId
|
|
1101
|
+
) {
|
|
1102
|
+
return await refuseAdmission(
|
|
1103
|
+
"scheduled_authority_unavailable",
|
|
1104
|
+
false,
|
|
1105
|
+
"scheduled user-scoped Claude authority has no causal human",
|
|
1106
|
+
);
|
|
1107
|
+
}
|
|
1108
|
+
if (
|
|
1109
|
+
claudeAuthoritySubjectId &&
|
|
1110
|
+
taskAuthoritySubjectId &&
|
|
1111
|
+
claudeAuthoritySubjectId !== taskAuthoritySubjectId
|
|
1112
|
+
) {
|
|
1113
|
+
return await refuseAdmission(
|
|
1114
|
+
"scheduled_authority_unavailable",
|
|
1115
|
+
false,
|
|
1116
|
+
"scheduled authority classes have different causal humans",
|
|
1117
|
+
);
|
|
1118
|
+
}
|
|
1119
|
+
const causalHumanSubjectId =
|
|
1120
|
+
taskAuthoritySubjectId ?? xaiAuthoritySubjectId ?? claudeAuthoritySubjectId;
|
|
1121
|
+
if (
|
|
1122
|
+
xaiAuthoritySubjectId &&
|
|
1123
|
+
claudeAuthoritySubjectId &&
|
|
1124
|
+
xaiAuthoritySubjectId !== claudeAuthoritySubjectId
|
|
1125
|
+
)
|
|
1126
|
+
return await refuseAdmission(
|
|
1127
|
+
"scheduled_authority_unavailable",
|
|
1128
|
+
false,
|
|
1129
|
+
"scheduled subscription pools have different causal humans",
|
|
1130
|
+
);
|
|
765
1131
|
if (
|
|
766
1132
|
task.agentConfig.knowledgeSource &&
|
|
767
1133
|
causalHumanSubjectId !== task.agentConfig.knowledgeSource.initiatingSubjectId
|
|
768
1134
|
) {
|
|
769
|
-
|
|
1135
|
+
return await refuseAdmission(
|
|
1136
|
+
"scheduled_authority_unavailable",
|
|
1137
|
+
false,
|
|
770
1138
|
"Source schedule requires its connection owner's current human authorization; update the source schedule to authorize it",
|
|
771
1139
|
);
|
|
772
1140
|
}
|
|
@@ -774,11 +1142,20 @@ export function createScheduledTaskActivities(services: () => Promise<ControlAct
|
|
|
774
1142
|
// workspace authority; only a user-owned resource needs the exact frozen
|
|
775
1143
|
// human, and the database admission fence re-proves the same rule for
|
|
776
1144
|
// existing/warm targets.
|
|
1145
|
+
// A personal machine additionally needs that human to be the machine's owner.
|
|
1146
|
+
const personalResourceSelected =
|
|
1147
|
+
acceptedVariableSet?.scope === "user" ||
|
|
1148
|
+
acceptedRig?.scope === "user" ||
|
|
1149
|
+
acceptedPersonalMachine;
|
|
777
1150
|
if (
|
|
778
|
-
(
|
|
779
|
-
|
|
1151
|
+
(personalResourceSelected && !causalHumanSubjectId) ||
|
|
1152
|
+
(acceptedPersonalMachine && causalHumanSubjectId !== task.ownerSubjectId)
|
|
780
1153
|
) {
|
|
781
|
-
|
|
1154
|
+
return await refuseAdmission(
|
|
1155
|
+
"scheduled_authority_unavailable",
|
|
1156
|
+
false,
|
|
1157
|
+
"scheduled personal-resource execution has no causal human",
|
|
1158
|
+
);
|
|
782
1159
|
}
|
|
783
1160
|
const admissionDenial = await agentRunAdmissionDenial(
|
|
784
1161
|
{ ...baseService, settings },
|
|
@@ -787,10 +1164,33 @@ export function createScheduledTaskActivities(services: () => Promise<ControlAct
|
|
|
787
1164
|
workspaceId: task.workspaceId,
|
|
788
1165
|
model: targetSessionExecution?.model ?? model,
|
|
789
1166
|
requestedAgentRuns: input.agentRunUsageIdempotencyKey ? 0 : 1,
|
|
1167
|
+
initiatingHumanSubjectId: causalHumanSubjectId,
|
|
790
1168
|
},
|
|
791
1169
|
);
|
|
792
1170
|
if (admissionDenial) {
|
|
793
|
-
|
|
1171
|
+
// Credits and monthly limits clear on their own (top-up, new period):
|
|
1172
|
+
// skip this occurrence visibly; a later one is admitted normally.
|
|
1173
|
+
return await refuseAdmission(admissionDenial, true, "agent run admission denied");
|
|
1174
|
+
}
|
|
1175
|
+
if (acceptedTargetSessionId && targetSessionExecutionBase) {
|
|
1176
|
+
// An occurrence that targets an existing task tree counts against
|
|
1177
|
+
// that task's usage limit. A reached limit skips the occurrence
|
|
1178
|
+
// visibly (no message, turn or wake is appended) until a person raises
|
|
1179
|
+
// or clears the limit; an unreadable state throws for activity retry,
|
|
1180
|
+
// never admitting as unlimited.
|
|
1181
|
+
const usageLimit = await checkSessionUsageLimitAdmission(db, {
|
|
1182
|
+
accountId: task.accountId,
|
|
1183
|
+
workspaceId: task.workspaceId,
|
|
1184
|
+
sessionId: acceptedTargetSessionId,
|
|
1185
|
+
runtime: true,
|
|
1186
|
+
});
|
|
1187
|
+
if (!usageLimit.allowed) {
|
|
1188
|
+
return await refuseAdmission(
|
|
1189
|
+
"session_usage_limit",
|
|
1190
|
+
true,
|
|
1191
|
+
"the target task reached its usage limit",
|
|
1192
|
+
);
|
|
1193
|
+
}
|
|
794
1194
|
}
|
|
795
1195
|
const acceptedModel = targetSessionExecution?.model ?? model;
|
|
796
1196
|
const acceptedReasoningEffort = targetSessionExecution?.reasoningEffort ?? reasoningEffort;
|
|
@@ -813,23 +1213,42 @@ export function createScheduledTaskActivities(services: () => Promise<ControlAct
|
|
|
813
1213
|
}
|
|
814
1214
|
}
|
|
815
1215
|
: undefined;
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
?
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
1216
|
+
let acceptedTurnExecutionPolicy: ReturnType<typeof resolveTurnExecutionPolicyV1>;
|
|
1217
|
+
try {
|
|
1218
|
+
acceptedTurnExecutionPolicy = resolveTurnExecutionPolicyV1(settings, {
|
|
1219
|
+
modelId: acceptedModel,
|
|
1220
|
+
requestedModelId:
|
|
1221
|
+
generatedTarget && task.agentConfig.model ? task.agentConfig.model : null,
|
|
1222
|
+
modelSource: generatedTarget
|
|
1223
|
+
? task.agentConfig.model
|
|
1224
|
+
? "explicit"
|
|
1225
|
+
: "deployment"
|
|
1226
|
+
: "session",
|
|
1227
|
+
reasoningEffort: acceptedReasoningEffort,
|
|
1228
|
+
reasoningSource: generatedTarget
|
|
1229
|
+
? task.agentConfig.reasoningEffort
|
|
1230
|
+
? "explicit"
|
|
1231
|
+
: "deployment"
|
|
1232
|
+
: "session",
|
|
1233
|
+
latencyMode: acceptedLatencyMode,
|
|
1234
|
+
latencyModeSource: generatedTarget ? "deployment" : "session",
|
|
1235
|
+
});
|
|
1236
|
+
} catch (error) {
|
|
1237
|
+
// A retired or removed model refuses every occurrence until the task
|
|
1238
|
+
// (or its target session) names an available model: record that as a
|
|
1239
|
+
// visible terminal run instead of exhausting activity retries.
|
|
1240
|
+
if (!(error instanceof TurnExecutionPolicyModelUnavailableError)) throw error;
|
|
1241
|
+
return await refuseAdmission(
|
|
1242
|
+
"scheduled_model_unavailable",
|
|
1243
|
+
false,
|
|
1244
|
+
`${error.message}: ${acceptedModel}`,
|
|
1245
|
+
);
|
|
1246
|
+
}
|
|
1247
|
+
const turnExecutionPolicy = scheduledTaskRunExecutionPolicy(
|
|
1248
|
+
acceptedTurnExecutionPolicy,
|
|
1249
|
+
input,
|
|
1250
|
+
creatorPolicy?.credentialRestriction,
|
|
1251
|
+
);
|
|
833
1252
|
const deferredEvents: Array<{
|
|
834
1253
|
sessionId: string;
|
|
835
1254
|
events: Awaited<ReturnType<typeof appendSessionEvents>>;
|
|
@@ -862,6 +1281,12 @@ export function createScheduledTaskActivities(services: () => Promise<ControlAct
|
|
|
862
1281
|
resolvedTools: taskTools,
|
|
863
1282
|
resolvedFirstPartyMcpTools: firstPartyMcpTools,
|
|
864
1283
|
resolvedFirstPartyMcpPermissions: firstPartyMcpPermissions,
|
|
1284
|
+
...(resolvedAgentConfig
|
|
1285
|
+
? {
|
|
1286
|
+
resolvedAgentConfig,
|
|
1287
|
+
...(resolvedAgentInstructions !== undefined ? { resolvedAgentInstructions } : {}),
|
|
1288
|
+
}
|
|
1289
|
+
: {}),
|
|
865
1290
|
resolvedVariableSet: acceptedVariableSet
|
|
866
1291
|
? { id: acceptedVariableSet.id, generation: acceptedVariableSet.generation }
|
|
867
1292
|
: null,
|
|
@@ -889,8 +1314,12 @@ export function createScheduledTaskActivities(services: () => Promise<ControlAct
|
|
|
889
1314
|
causalHumanSubjectId,
|
|
890
1315
|
causalHumanAuthority: taskRevisionAuthority,
|
|
891
1316
|
xaiProviderAccountAuthoritySnapshot: taskXaiProviderAccountAuthoritySnapshot,
|
|
1317
|
+
claudeProviderAccountAuthoritySnapshot: taskClaudeProviderAccountAuthoritySnapshot,
|
|
892
1318
|
xaiAuthoritySubjectId,
|
|
1319
|
+
claudeAuthoritySubjectId,
|
|
893
1320
|
connectionAuthoritySubjectId: taskConnectionAuthoritySubjectId,
|
|
1321
|
+
...(degradedAccounts.length > 0 ? { degradedAccounts } : {}),
|
|
1322
|
+
connectionAccountIntent: taskConnectionAccountIntent,
|
|
894
1323
|
triggerInitiator: input.initiator ?? { kind: "service", subjectId: "scheduler" },
|
|
895
1324
|
agentRunUsageIdempotencyKey: input.agentRunUsageIdempotencyKey ?? null,
|
|
896
1325
|
incidentPreflightRequired,
|
|
@@ -1069,8 +1498,13 @@ export function createScheduledTaskActivities(services: () => Promise<ControlAct
|
|
|
1069
1498
|
tools: taskTools,
|
|
1070
1499
|
firstPartyMcpTools,
|
|
1071
1500
|
firstPartyMcpPermissions,
|
|
1501
|
+
...(resolvedAgentConfig ? { agentConfig: resolvedAgentConfig } : {}),
|
|
1502
|
+
...(resolvedAgentInstructions !== undefined
|
|
1503
|
+
? { instructions: resolvedAgentInstructions }
|
|
1504
|
+
: {}),
|
|
1072
1505
|
...creatorSessionPolicy,
|
|
1073
|
-
...(task.agentConfig.knowledgeSource?.destination.kind === "personal"
|
|
1506
|
+
...(task.agentConfig.knowledgeSource?.destination.kind === "personal" ||
|
|
1507
|
+
task.visibility === "private"
|
|
1074
1508
|
? {
|
|
1075
1509
|
visibility: "user_private" as const,
|
|
1076
1510
|
scheduledSourceRunId: run.id,
|
|
@@ -1078,6 +1512,10 @@ export function createScheduledTaskActivities(services: () => Promise<ControlAct
|
|
|
1078
1512
|
: {}),
|
|
1079
1513
|
metadata: {
|
|
1080
1514
|
...taskMetadata,
|
|
1515
|
+
...scheduledSessionExecutionPolicyMetadata(
|
|
1516
|
+
turnExecutionPolicy,
|
|
1517
|
+
creatorPolicy?.credentialRestriction,
|
|
1518
|
+
),
|
|
1081
1519
|
model,
|
|
1082
1520
|
reasoningEffort,
|
|
1083
1521
|
scheduledTaskId: task.id,
|
|
@@ -1105,10 +1543,15 @@ export function createScheduledTaskActivities(services: () => Promise<ControlAct
|
|
|
1105
1543
|
sandboxBackend,
|
|
1106
1544
|
sandboxOs,
|
|
1107
1545
|
variableSetId: task.variableSetId ?? null,
|
|
1546
|
+
// The schedule's vault narrowing lives on the run session so every
|
|
1547
|
+
// later turn and every child inherits it through the policy chain.
|
|
1548
|
+
...(task.vaultPolicy ? { vaultPolicy: task.vaultPolicy } : {}),
|
|
1108
1549
|
rigId: frozenRigId,
|
|
1109
1550
|
rigVersionId: frozenRigVersionId,
|
|
1110
1551
|
personalConnectionDelegations: [],
|
|
1111
1552
|
initialXaiProviderAccountAuthoritySnapshot: taskXaiProviderAccountAuthoritySnapshot,
|
|
1553
|
+
initialClaudeProviderAccountAuthoritySnapshot:
|
|
1554
|
+
taskClaudeProviderAccountAuthoritySnapshot,
|
|
1112
1555
|
maxNestedAgentDepthOverride: task.agentConfig.maxNestedAgentDepth ?? null,
|
|
1113
1556
|
frozenNestedAgentDepthPolicy: {
|
|
1114
1557
|
effectiveMaxNestedAgentDepth:
|
|
@@ -1138,7 +1581,6 @@ export function createScheduledTaskActivities(services: () => Promise<ControlAct
|
|
|
1138
1581
|
tools: exactSession.tools,
|
|
1139
1582
|
firstPartyMcpTools: exactSession.firstPartyMcpTools,
|
|
1140
1583
|
firstPartyMcpPermissions: exactSession.firstPartyMcpPermissions,
|
|
1141
|
-
variableSetId: exactSession.variableSetId,
|
|
1142
1584
|
rigId: exactSession.rigId,
|
|
1143
1585
|
rigVersionId: exactSession.rigVersionId,
|
|
1144
1586
|
toolPolicy: exactSession.toolPolicy,
|
|
@@ -1173,6 +1615,7 @@ export function createScheduledTaskActivities(services: () => Promise<ControlAct
|
|
|
1173
1615
|
}
|
|
1174
1616
|
session = created.session;
|
|
1175
1617
|
sessionCreated = created.created;
|
|
1618
|
+
if (sessionCreated) recordScheduledSessionCreated(baseService.observability);
|
|
1176
1619
|
if (!sessionCreated) {
|
|
1177
1620
|
await bindScheduledTaskRunSessionInTransaction(dispatchDb, {
|
|
1178
1621
|
accountId: task.accountId,
|
|
@@ -1206,7 +1649,7 @@ export function createScheduledTaskActivities(services: () => Promise<ControlAct
|
|
|
1206
1649
|
(task.agentConfig.slackBotConnectionId ?? null)
|
|
1207
1650
|
) {
|
|
1208
1651
|
throw new Error(
|
|
1209
|
-
"scheduled alert occurrence
|
|
1652
|
+
"scheduled alert occurrence Opengeni Slack bot binding does not match its canonical session",
|
|
1210
1653
|
);
|
|
1211
1654
|
}
|
|
1212
1655
|
}
|
|
@@ -1227,6 +1670,7 @@ export function createScheduledTaskActivities(services: () => Promise<ControlAct
|
|
|
1227
1670
|
workspaceId: task.workspaceId,
|
|
1228
1671
|
sessionId: session.id,
|
|
1229
1672
|
reasoningEffortFallback: reasoningEffort,
|
|
1673
|
+
initialSubscriptionAuthority: taskSubscriptionAuthority,
|
|
1230
1674
|
createdEventPayload: {
|
|
1231
1675
|
scheduledTaskId:
|
|
1232
1676
|
typeof session.metadata.scheduledTaskId === "string"
|
|
@@ -1290,6 +1734,7 @@ export function createScheduledTaskActivities(services: () => Promise<ControlAct
|
|
|
1290
1734
|
workspaceId: task.workspaceId,
|
|
1291
1735
|
sessionId: session.id,
|
|
1292
1736
|
reasoningEffortFallback: reasoningEffort,
|
|
1737
|
+
initialSubscriptionAuthority: taskSubscriptionAuthority,
|
|
1293
1738
|
createdEventPayload: {
|
|
1294
1739
|
scheduledTaskId:
|
|
1295
1740
|
typeof session.metadata.scheduledTaskId === "string"
|
|
@@ -1389,6 +1834,7 @@ export function createScheduledTaskActivities(services: () => Promise<ControlAct
|
|
|
1389
1834
|
taskTools,
|
|
1390
1835
|
task.id,
|
|
1391
1836
|
run.id,
|
|
1837
|
+
degradedAccounts,
|
|
1392
1838
|
),
|
|
1393
1839
|
lineage: {
|
|
1394
1840
|
scheduledTaskId: task.id,
|
|
@@ -1401,10 +1847,13 @@ export function createScheduledTaskActivities(services: () => Promise<ControlAct
|
|
|
1401
1847
|
task.createdBy.kind === "subject"
|
|
1402
1848
|
? { xaiAuthoritySubjectId: task.createdBy.subjectId }
|
|
1403
1849
|
: {}),
|
|
1850
|
+
...(claudeAuthoritySubjectId ? { claudeAuthoritySubjectId } : {}),
|
|
1404
1851
|
},
|
|
1405
1852
|
personalConnectionDelegations: taskPersonalConnectionDelegations,
|
|
1406
1853
|
mcpAccountBindings: taskMcpAccountBindings,
|
|
1407
1854
|
xaiProviderAccountAuthoritySnapshot: taskXaiProviderAccountAuthoritySnapshot,
|
|
1855
|
+
claudeProviderAccountAuthoritySnapshot: taskClaudeProviderAccountAuthoritySnapshot,
|
|
1856
|
+
subscriptionAuthority: taskSubscriptionAuthority,
|
|
1408
1857
|
scheduledTaskRunId: run.id,
|
|
1409
1858
|
},
|
|
1410
1859
|
async (tx, wakeEventId, _updateId, rejectionReason) => {
|
|
@@ -1448,7 +1897,8 @@ export function createScheduledTaskActivities(services: () => Promise<ControlAct
|
|
|
1448
1897
|
);
|
|
1449
1898
|
if (
|
|
1450
1899
|
scheduledUpdate.reason === "session_cancelled" ||
|
|
1451
|
-
scheduledUpdate.reason === "session_not_idle"
|
|
1900
|
+
scheduledUpdate.reason === "session_not_idle" ||
|
|
1901
|
+
scheduledUpdate.reason === "session_paused"
|
|
1452
1902
|
) {
|
|
1453
1903
|
const error = scheduledSessionRejectionError(scheduledUpdate.reason);
|
|
1454
1904
|
return {
|
|
@@ -1457,6 +1907,9 @@ export function createScheduledTaskActivities(services: () => Promise<ControlAct
|
|
|
1457
1907
|
run: { ...run, status: "skipped" as const, error },
|
|
1458
1908
|
};
|
|
1459
1909
|
}
|
|
1910
|
+
if (scheduledUpdate.added) {
|
|
1911
|
+
recordUserMessageAccepted(baseService.observability, { surface: "scheduled" });
|
|
1912
|
+
}
|
|
1460
1913
|
if (scheduledUpdate.added && scheduledUpdate.events.length > 0) {
|
|
1461
1914
|
if (deferPublications) {
|
|
1462
1915
|
deferredEvents.push({
|
|
@@ -1496,9 +1949,8 @@ export function createScheduledTaskActivities(services: () => Promise<ControlAct
|
|
|
1496
1949
|
// the locked admission check below remains authoritative. Mirrors
|
|
1497
1950
|
// apps/api/src/domain/sessions.ts.
|
|
1498
1951
|
assertReusableSessionRevivable(session.status);
|
|
1499
|
-
//
|
|
1500
|
-
//
|
|
1501
|
-
// fail the run instead of silently running with the wrong secrets.
|
|
1952
|
+
// Slack routing remains bound to the reusable chat; execution
|
|
1953
|
+
// attachments come from its accepted target snapshot.
|
|
1502
1954
|
assertReusableSessionBindingMatches(session, task);
|
|
1503
1955
|
const bundled = await addSessionSystemUpdateWithSourceMutation(
|
|
1504
1956
|
dispatchDb,
|
|
@@ -1517,6 +1969,7 @@ export function createScheduledTaskActivities(services: () => Promise<ControlAct
|
|
|
1517
1969
|
taskTools,
|
|
1518
1970
|
task.id,
|
|
1519
1971
|
run.id,
|
|
1972
|
+
degradedAccounts,
|
|
1520
1973
|
),
|
|
1521
1974
|
lineage: {
|
|
1522
1975
|
scheduledTaskId: task.id,
|
|
@@ -1529,10 +1982,13 @@ export function createScheduledTaskActivities(services: () => Promise<ControlAct
|
|
|
1529
1982
|
task.createdBy.kind === "subject"
|
|
1530
1983
|
? { xaiAuthoritySubjectId: task.createdBy.subjectId }
|
|
1531
1984
|
: {}),
|
|
1985
|
+
...(claudeAuthoritySubjectId ? { claudeAuthoritySubjectId } : {}),
|
|
1532
1986
|
},
|
|
1533
1987
|
personalConnectionDelegations: taskPersonalConnectionDelegations,
|
|
1534
1988
|
mcpAccountBindings: taskMcpAccountBindings,
|
|
1535
1989
|
xaiProviderAccountAuthoritySnapshot: taskXaiProviderAccountAuthoritySnapshot,
|
|
1990
|
+
claudeProviderAccountAuthoritySnapshot: taskClaudeProviderAccountAuthoritySnapshot,
|
|
1991
|
+
subscriptionAuthority: taskSubscriptionAuthority,
|
|
1536
1992
|
scheduledTaskRunId: run.id,
|
|
1537
1993
|
},
|
|
1538
1994
|
async (tx, wakeEventId, _updateId, rejectionReason) => {
|
|
@@ -1592,7 +2048,11 @@ export function createScheduledTaskActivities(services: () => Promise<ControlAct
|
|
|
1592
2048
|
},
|
|
1593
2049
|
},
|
|
1594
2050
|
);
|
|
1595
|
-
if (
|
|
2051
|
+
if (
|
|
2052
|
+
bundled.reason === "session_cancelled" ||
|
|
2053
|
+
bundled.reason === "session_not_idle" ||
|
|
2054
|
+
bundled.reason === "session_paused"
|
|
2055
|
+
) {
|
|
1596
2056
|
const error = scheduledSessionRejectionError(bundled.reason);
|
|
1597
2057
|
return {
|
|
1598
2058
|
kind: "blocked" as const,
|
|
@@ -1600,6 +2060,9 @@ export function createScheduledTaskActivities(services: () => Promise<ControlAct
|
|
|
1600
2060
|
run: { ...run, status: "skipped" as const, error },
|
|
1601
2061
|
};
|
|
1602
2062
|
}
|
|
2063
|
+
if (bundled.added) {
|
|
2064
|
+
recordUserMessageAccepted(baseService.observability, { surface: "scheduled" });
|
|
2065
|
+
}
|
|
1603
2066
|
if (bundled.added && bundled.events.length > 0) {
|
|
1604
2067
|
if (deferPublications) {
|
|
1605
2068
|
deferredEvents.push({
|
|
@@ -1724,28 +2187,24 @@ class IncidentTelemetryPreflightBlockedError extends Error {
|
|
|
1724
2187
|
}
|
|
1725
2188
|
|
|
1726
2189
|
/**
|
|
1727
|
-
* Defensive backstop for the API-level
|
|
1728
|
-
*
|
|
1729
|
-
*
|
|
1730
|
-
* the wrong secrets - on the first attempt and on every recovery attempt.
|
|
2190
|
+
* Defensive backstop for the API-level Slack binding guard. Variable Sets
|
|
2191
|
+
* belong to the live target and are fenced by its accepted execution snapshot,
|
|
2192
|
+
* not by the task's retained creation defaults.
|
|
1731
2193
|
*/
|
|
1732
2194
|
function assertReusableSessionBindingMatches(
|
|
1733
|
-
session: {
|
|
1734
|
-
task: Pick<ScheduledTask, "
|
|
2195
|
+
session: { metadata: Record<string, unknown> },
|
|
2196
|
+
task: Pick<ScheduledTask, "runMode" | "agentConfig">,
|
|
1735
2197
|
): void {
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
"scheduled task variableSet attachment does not match its reusable session",
|
|
1740
|
-
);
|
|
1741
|
-
}
|
|
2198
|
+
// Existing-chat messages use the target policy frozen at admission. Task
|
|
2199
|
+
// creation defaults are not an additional authority or binding constraint.
|
|
2200
|
+
if (task.runMode === "existing_session") return;
|
|
1742
2201
|
if (
|
|
1743
2202
|
scheduledSlackBotConnectionId(session.metadata) !==
|
|
1744
2203
|
(task.agentConfig.slackBotConnectionId ?? null)
|
|
1745
2204
|
) {
|
|
1746
2205
|
throw new ScheduledRunTerminalAuthorityError(
|
|
1747
2206
|
"scheduled_reusable_binding_changed",
|
|
1748
|
-
"scheduled task
|
|
2207
|
+
"scheduled task Opengeni Slack bot binding does not match its reusable session",
|
|
1749
2208
|
);
|
|
1750
2209
|
}
|
|
1751
2210
|
}
|
|
@@ -1803,9 +2262,60 @@ function scheduledRunRecoveryTerminalError(
|
|
|
1803
2262
|
return null;
|
|
1804
2263
|
}
|
|
1805
2264
|
|
|
2265
|
+
function scheduledPinKey(pin: { serverId: string; connectionId: string | null }): string {
|
|
2266
|
+
return JSON.stringify([pin.serverId, pin.connectionId]);
|
|
2267
|
+
}
|
|
2268
|
+
|
|
2269
|
+
/**
|
|
2270
|
+
* The pinned accounts an account-selection failure names. When the owner lost
|
|
2271
|
+
* workspace access, none of their pinned accounts can be used.
|
|
2272
|
+
*/
|
|
2273
|
+
function scheduledStalePins(
|
|
2274
|
+
pins: readonly McpConnectionAccountSelection[],
|
|
2275
|
+
failure: ConnectionAccountSelectionError,
|
|
2276
|
+
): ScheduledTaskDegradedAccount[] {
|
|
2277
|
+
const pinKeys = new Set(pins.map(scheduledPinKey));
|
|
2278
|
+
const named = failure.diagnostic.accounts.flatMap((account) =>
|
|
2279
|
+
pinKeys.has(scheduledPinKey(account))
|
|
2280
|
+
? [{ serverId: account.serverId, connectionId: account.connectionId, reason: account.reason }]
|
|
2281
|
+
: [],
|
|
2282
|
+
);
|
|
2283
|
+
if (named.length > 0) return named;
|
|
2284
|
+
if (failure.diagnostic.reason === "owner_access_unavailable") {
|
|
2285
|
+
return pins.map((pin) => ({
|
|
2286
|
+
serverId: pin.serverId,
|
|
2287
|
+
connectionId: pin.connectionId,
|
|
2288
|
+
reason: "owner_access_unavailable" as const,
|
|
2289
|
+
}));
|
|
2290
|
+
}
|
|
2291
|
+
return [];
|
|
2292
|
+
}
|
|
2293
|
+
|
|
2294
|
+
/** The blocked result of a diagnostic (refused) run receipt, fresh or replayed. */
|
|
2295
|
+
function scheduledAdmissionRefusalResult(
|
|
2296
|
+
run: Pick<ScheduledTaskRun, "id" | "admissionDiagnostic" | "admissionRefusal">,
|
|
2297
|
+
): Extract<DispatchScheduledTaskRunResult, { action: "blocked" }> {
|
|
2298
|
+
if (run.admissionRefusal) {
|
|
2299
|
+
return {
|
|
2300
|
+
action: "blocked",
|
|
2301
|
+
reason: run.admissionRefusal.reason as ScheduledTaskAdmissionRefusalReason,
|
|
2302
|
+
runId: run.id,
|
|
2303
|
+
refusal: run.admissionRefusal,
|
|
2304
|
+
};
|
|
2305
|
+
}
|
|
2306
|
+
return {
|
|
2307
|
+
action: "blocked",
|
|
2308
|
+
reason: "connection_account_unavailable",
|
|
2309
|
+
runId: run.id,
|
|
2310
|
+
...(run.admissionDiagnostic ? { diagnostic: run.admissionDiagnostic } : {}),
|
|
2311
|
+
};
|
|
2312
|
+
}
|
|
2313
|
+
|
|
1806
2314
|
function scheduledRunTerminalResult(
|
|
1807
2315
|
error: string | null,
|
|
1808
2316
|
): Extract<DispatchScheduledTaskRunResult, { action: "blocked" }> {
|
|
2317
|
+
if (error === ATLASSIAN_NATIVE_RETIRED_REASON)
|
|
2318
|
+
return { action: "blocked", reason: ATLASSIAN_NATIVE_RETIRED_REASON };
|
|
1809
2319
|
if (error === "scheduled_authority_exhausted") {
|
|
1810
2320
|
return { action: "blocked", reason: "scheduled_authority_exhausted" };
|
|
1811
2321
|
}
|
|
@@ -1822,8 +2332,9 @@ function scheduledRunTerminalResult(
|
|
|
1822
2332
|
}
|
|
1823
2333
|
|
|
1824
2334
|
function scheduledSessionRejectionError(
|
|
1825
|
-
rejectionReason: "session_cancelled" | "session_not_idle" | null,
|
|
1826
|
-
): "session_cancelled" | "scheduled_session_not_idle" {
|
|
2335
|
+
rejectionReason: "session_cancelled" | "session_not_idle" | "session_paused" | null,
|
|
2336
|
+
): "session_cancelled" | "scheduled_session_not_idle" | "scheduled_session_paused" {
|
|
2337
|
+
if (rejectionReason === "session_paused") return "scheduled_session_paused";
|
|
1827
2338
|
return rejectionReason === "session_not_idle"
|
|
1828
2339
|
? "scheduled_session_not_idle"
|
|
1829
2340
|
: "session_cancelled";
|
|
@@ -1851,13 +2362,11 @@ async function prepareIncidentTelemetrySource(input: {
|
|
|
1851
2362
|
executionPolicy: input.acceptedExecution.targetSessionExecution
|
|
1852
2363
|
? {
|
|
1853
2364
|
tools: input.acceptedExecution.targetSessionExecution.tools,
|
|
1854
|
-
firstPartyMcpTools:
|
|
2365
|
+
firstPartyMcpTools:
|
|
2366
|
+
input.acceptedExecution.targetSessionExecution.effectiveFirstPartyMcpTools ??
|
|
2367
|
+
input.acceptedExecution.targetSessionExecution.firstPartyMcpTools,
|
|
1855
2368
|
firstPartyMcpPermissions:
|
|
1856
2369
|
input.acceptedExecution.targetSessionExecution.firstPartyMcpPermissions,
|
|
1857
|
-
variableSetIds: input.acceptedExecution.targetSessionExecution.variableSets.map(
|
|
1858
|
-
(variableSet) => variableSet.id,
|
|
1859
|
-
),
|
|
1860
|
-
variableSetId: input.acceptedExecution.targetSessionExecution.variableSetId,
|
|
1861
2370
|
rigId: input.acceptedExecution.targetSessionExecution.rigId,
|
|
1862
2371
|
rigVersionId: input.acceptedExecution.targetSessionExecution.rigVersionId,
|
|
1863
2372
|
toolPolicy: input.acceptedExecution.targetSessionExecution.toolPolicy,
|
|
@@ -1868,7 +2377,6 @@ async function prepareIncidentTelemetrySource(input: {
|
|
|
1868
2377
|
tools: input.acceptedExecution.resolvedTools,
|
|
1869
2378
|
firstPartyMcpTools: input.acceptedExecution.resolvedFirstPartyMcpTools,
|
|
1870
2379
|
firstPartyMcpPermissions: input.acceptedExecution.resolvedFirstPartyMcpPermissions,
|
|
1871
|
-
variableSetId: input.acceptedExecution.resolvedVariableSet?.id ?? null,
|
|
1872
2380
|
rigId: input.acceptedExecution.resolvedRig?.id ?? null,
|
|
1873
2381
|
rigVersionId: input.acceptedExecution.resolvedRig?.versionId ?? null,
|
|
1874
2382
|
toolPolicy: session.toolPolicy,
|
|
@@ -1921,6 +2429,50 @@ async function recordScheduledTaskFiredUsage(
|
|
|
1921
2429
|
});
|
|
1922
2430
|
}
|
|
1923
2431
|
|
|
2432
|
+
function personalMachineScheduleOwner(task: ScheduledTask, subjectId: string | null): boolean {
|
|
2433
|
+
return (
|
|
2434
|
+
task.visibility === "private" &&
|
|
2435
|
+
task.ownerSubjectId !== null &&
|
|
2436
|
+
task.ownerSubjectId === subjectId
|
|
2437
|
+
);
|
|
2438
|
+
}
|
|
2439
|
+
|
|
2440
|
+
/**
|
|
2441
|
+
* The owner and machine authority when an Only me schedule runs on its owner's
|
|
2442
|
+
* personal machine; null for a shared machine. Throws when a personal machine is
|
|
2443
|
+
* no longer usable by the owner, so the run fails closed.
|
|
2444
|
+
*/
|
|
2445
|
+
async function scheduledPersonalMachineOwner(
|
|
2446
|
+
db: Database,
|
|
2447
|
+
task: ScheduledTask,
|
|
2448
|
+
target: NonNullable<ScheduledTask["agentConfig"]["machineTarget"]>,
|
|
2449
|
+
): Promise<{ subjectId: string; authorityId: string } | null> {
|
|
2450
|
+
const subjectId = task.ownerSubjectId;
|
|
2451
|
+
if (task.visibility !== "private" || !subjectId) return null;
|
|
2452
|
+
const access = { accountId: task.accountId, workspaceId: task.workspaceId, subjectId };
|
|
2453
|
+
const machine = await getSandbox(db, access, target.targetSandboxId);
|
|
2454
|
+
if (machine?.scope !== "user") return null;
|
|
2455
|
+
if (!machine.enrollmentId) {
|
|
2456
|
+
throw new Error("scheduled personal Connected Machine has no enrollment");
|
|
2457
|
+
}
|
|
2458
|
+
let cursor: string | undefined;
|
|
2459
|
+
for (let page = 0; page < 50; page += 1) {
|
|
2460
|
+
const listed = await listSelfUserResourceAuthorities(db, {
|
|
2461
|
+
...access,
|
|
2462
|
+
resourceKind: "connected_machine",
|
|
2463
|
+
limit: 100,
|
|
2464
|
+
...(cursor ? { cursor } : {}),
|
|
2465
|
+
});
|
|
2466
|
+
const authority = listed.authorities.find(
|
|
2467
|
+
(candidate) => candidate.resourceId === machine.enrollmentId && candidate.status === "active",
|
|
2468
|
+
);
|
|
2469
|
+
if (authority) return { subjectId, authorityId: authority.authorityId };
|
|
2470
|
+
if (!listed.nextCursor) break;
|
|
2471
|
+
cursor = listed.nextCursor;
|
|
2472
|
+
}
|
|
2473
|
+
throw new Error("scheduled personal Connected Machine authority is not active");
|
|
2474
|
+
}
|
|
2475
|
+
|
|
1924
2476
|
async function seedScheduledGeneratedSessionRoute(input: {
|
|
1925
2477
|
db: Database;
|
|
1926
2478
|
bus: ControlActivityServices["bus"];
|
|
@@ -1936,6 +2488,7 @@ async function seedScheduledGeneratedSessionRoute(input: {
|
|
|
1936
2488
|
}): Promise<Awaited<ReturnType<typeof createSession>>> {
|
|
1937
2489
|
const target = input.task.agentConfig.machineTarget;
|
|
1938
2490
|
if (!target) return input.session;
|
|
2491
|
+
const personalOwner = await scheduledPersonalMachineOwner(input.db, input.task, target);
|
|
1939
2492
|
const seeded = await swapActiveSandbox(
|
|
1940
2493
|
{
|
|
1941
2494
|
db: input.db,
|
|
@@ -1948,11 +2501,35 @@ async function seedScheduledGeneratedSessionRoute(input: {
|
|
|
1948
2501
|
sessionId: input.session.id,
|
|
1949
2502
|
sessionBackend: input.session.sandboxBackend,
|
|
1950
2503
|
sessionGroupId: input.session.sandboxGroupId,
|
|
2504
|
+
// A personal machine attaches through the owner's scoped authorization.
|
|
2505
|
+
...(personalOwner ? { subjectId: personalOwner.subjectId } : {}),
|
|
1951
2506
|
},
|
|
1952
2507
|
target.targetSandboxId,
|
|
1953
2508
|
target.workingDir ?? null,
|
|
1954
2509
|
);
|
|
1955
2510
|
if (seeded.swapped) {
|
|
2511
|
+
if (personalOwner) {
|
|
2512
|
+
// Saving an Only me schedule on your own machine is the consent. Each run
|
|
2513
|
+
// gets a grant for exactly its own chat, so other chats keep asking.
|
|
2514
|
+
const authorityEpoch = await getSessionAuthorityEpoch(input.db, {
|
|
2515
|
+
accountId: input.task.accountId,
|
|
2516
|
+
workspaceId: input.task.workspaceId,
|
|
2517
|
+
sessionId: input.session.id,
|
|
2518
|
+
});
|
|
2519
|
+
if (authorityEpoch === null) throw new Error("scheduled run chat has no authority epoch");
|
|
2520
|
+
await issueSelfUserResourceGrant(input.db, {
|
|
2521
|
+
accountId: input.task.accountId,
|
|
2522
|
+
workspaceId: input.task.workspaceId,
|
|
2523
|
+
subjectId: personalOwner.subjectId,
|
|
2524
|
+
authorityId: personalOwner.authorityId,
|
|
2525
|
+
resourceKind: "connected_machine",
|
|
2526
|
+
mode: "session",
|
|
2527
|
+
context: "user_private",
|
|
2528
|
+
sessionId: input.session.id,
|
|
2529
|
+
expectedAuthorityEpoch: authorityEpoch,
|
|
2530
|
+
workspaceSharedAcknowledged: false,
|
|
2531
|
+
});
|
|
2532
|
+
}
|
|
1956
2533
|
return await requireSession(input.db, input.task.workspaceId, input.session.id);
|
|
1957
2534
|
}
|
|
1958
2535
|
|
|
@@ -1991,6 +2568,7 @@ async function seedScheduledGeneratedSessionRoute(input: {
|
|
|
1991
2568
|
|
|
1992
2569
|
async function recoverBoundScheduledTaskDispatch(input: {
|
|
1993
2570
|
db: Database;
|
|
2571
|
+
observability?: ProductUsageMetricsSink | undefined;
|
|
1994
2572
|
bus: ControlActivityServices["bus"];
|
|
1995
2573
|
settings: ControlActivityServices["settings"];
|
|
1996
2574
|
wakeSessionWorkflow: WakeSessionWorkflowSignal | null;
|
|
@@ -2005,6 +2583,11 @@ async function recoverBoundScheduledTaskDispatch(input: {
|
|
|
2005
2583
|
const generatedSession =
|
|
2006
2584
|
task.runMode === "new_session_per_run" ||
|
|
2007
2585
|
(task.runMode === "reusable_session" && task.reusableSessionId === null);
|
|
2586
|
+
// The immutable creator policy determines standing session authority, not
|
|
2587
|
+
// a manual caller's per-run ceiling. Read it for creation and recovery checks.
|
|
2588
|
+
const recoveredCreatorPolicy = generatedSession
|
|
2589
|
+
? await getScheduledTaskCreatorPolicy(input.db, task.workspaceId, task.id)
|
|
2590
|
+
: null;
|
|
2008
2591
|
const frozenSlack = input.acceptedExecution.resolvedSlackBotConnection;
|
|
2009
2592
|
if (frozenSlack) {
|
|
2010
2593
|
const currentSlack = await requireOpenGeniSlackBotConnection(
|
|
@@ -2027,9 +2610,8 @@ async function recoverBoundScheduledTaskDispatch(input: {
|
|
|
2027
2610
|
let session: Awaited<ReturnType<typeof createSession>>;
|
|
2028
2611
|
if (input.run.sessionId) {
|
|
2029
2612
|
session = await requireSession(input.db, task.workspaceId, input.run.sessionId);
|
|
2030
|
-
//
|
|
2031
|
-
//
|
|
2032
|
-
// run terminally rather than deliver into a diverged session.
|
|
2613
|
+
// Preserve the reusable chat's Slack routing; the accepted target snapshot
|
|
2614
|
+
// independently fences its current Variable Set attachments during recovery.
|
|
2033
2615
|
if (!generatedSession) assertReusableSessionBindingMatches(session, task);
|
|
2034
2616
|
} else if (generatedSession) {
|
|
2035
2617
|
const variableSet = input.acceptedExecution.resolvedVariableSet;
|
|
@@ -2073,14 +2655,6 @@ async function recoverBoundScheduledTaskDispatch(input: {
|
|
|
2073
2655
|
}
|
|
2074
2656
|
const taskMetadata = { ...task.agentConfig.metadata };
|
|
2075
2657
|
delete taskMetadata[OPENGENI_SLACK_BOT_SESSION_METADATA_KEY];
|
|
2076
|
-
// Tools and permissions were frozen into the accepted execution. The
|
|
2077
|
-
// creator session policy is immutable on the task row (a tombstoned task
|
|
2078
|
-
// still answers), so re-reading it here is deterministic for the same run.
|
|
2079
|
-
const recoveredCreatorPolicy = await getScheduledTaskCreatorPolicy(
|
|
2080
|
-
input.db,
|
|
2081
|
-
task.workspaceId,
|
|
2082
|
-
task.id,
|
|
2083
|
-
);
|
|
2084
2658
|
const created = await createSessionWithIdempotencyKeyResult(input.db, {
|
|
2085
2659
|
accountId: task.accountId,
|
|
2086
2660
|
workspaceId: task.workspaceId,
|
|
@@ -2090,8 +2664,16 @@ async function recoverBoundScheduledTaskDispatch(input: {
|
|
|
2090
2664
|
tools: input.acceptedExecution.resolvedTools,
|
|
2091
2665
|
firstPartyMcpTools: input.acceptedExecution.resolvedFirstPartyMcpTools,
|
|
2092
2666
|
firstPartyMcpPermissions: input.acceptedExecution.resolvedFirstPartyMcpPermissions,
|
|
2667
|
+
...(input.acceptedExecution.resolvedAgentConfig
|
|
2668
|
+
? { agentConfig: input.acceptedExecution.resolvedAgentConfig }
|
|
2669
|
+
: {}),
|
|
2670
|
+
...(input.acceptedExecution.resolvedAgentInstructions !== undefined
|
|
2671
|
+
? { instructions: input.acceptedExecution.resolvedAgentInstructions }
|
|
2672
|
+
: {}),
|
|
2093
2673
|
...scheduledCreatorSessionPolicyInput(recoveredCreatorPolicy?.sessionPolicy ?? null),
|
|
2094
|
-
...(task.
|
|
2674
|
+
...(task.vaultPolicy ? { vaultPolicy: task.vaultPolicy } : {}),
|
|
2675
|
+
...(task.agentConfig.knowledgeSource?.destination.kind === "personal" ||
|
|
2676
|
+
task.visibility === "private"
|
|
2095
2677
|
? {
|
|
2096
2678
|
visibility: "user_private" as const,
|
|
2097
2679
|
scheduledSourceRunId: input.run.id,
|
|
@@ -2099,6 +2681,10 @@ async function recoverBoundScheduledTaskDispatch(input: {
|
|
|
2099
2681
|
: {}),
|
|
2100
2682
|
metadata: {
|
|
2101
2683
|
...taskMetadata,
|
|
2684
|
+
...scheduledSessionExecutionPolicyMetadata(
|
|
2685
|
+
input.acceptedExecution.turnExecutionPolicy,
|
|
2686
|
+
recoveredCreatorPolicy?.credentialRestriction,
|
|
2687
|
+
),
|
|
2102
2688
|
model: input.acceptedExecution.resolvedModel,
|
|
2103
2689
|
reasoningEffort: input.acceptedExecution.resolvedReasoningEffort,
|
|
2104
2690
|
scheduledTaskId: task.id,
|
|
@@ -2127,6 +2713,8 @@ async function recoverBoundScheduledTaskDispatch(input: {
|
|
|
2127
2713
|
personalConnectionDelegations: [],
|
|
2128
2714
|
initialXaiProviderAccountAuthoritySnapshot:
|
|
2129
2715
|
input.acceptedExecution.xaiProviderAccountAuthoritySnapshot,
|
|
2716
|
+
initialClaudeProviderAccountAuthoritySnapshot:
|
|
2717
|
+
input.acceptedExecution.claudeProviderAccountAuthoritySnapshot,
|
|
2130
2718
|
maxNestedAgentDepthOverride: task.agentConfig.maxNestedAgentDepth ?? null,
|
|
2131
2719
|
frozenNestedAgentDepthPolicy: {
|
|
2132
2720
|
effectiveMaxNestedAgentDepth:
|
|
@@ -2157,6 +2745,7 @@ async function recoverBoundScheduledTaskDispatch(input: {
|
|
|
2157
2745
|
});
|
|
2158
2746
|
if (created.denied) throw new SessionSpawnDeniedDbError(created.denial);
|
|
2159
2747
|
session = created.session;
|
|
2748
|
+
if (created.created) recordScheduledSessionCreated(input.observability);
|
|
2160
2749
|
if (!created.created) {
|
|
2161
2750
|
await bindScheduledTaskRunSessionInTransaction(input.db, {
|
|
2162
2751
|
accountId: task.accountId,
|
|
@@ -2227,20 +2816,27 @@ async function recoverBoundScheduledTaskDispatch(input: {
|
|
|
2227
2816
|
);
|
|
2228
2817
|
const expectedTaskMetadata = { ...task.agentConfig.metadata };
|
|
2229
2818
|
delete expectedTaskMetadata[OPENGENI_SLACK_BOT_SESSION_METADATA_KEY];
|
|
2230
|
-
const expectedMetadata =
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2819
|
+
const expectedMetadata = metadataWithAgentConfigCreateIdentity(
|
|
2820
|
+
{
|
|
2821
|
+
...expectedTaskMetadata,
|
|
2822
|
+
...scheduledSessionExecutionPolicyMetadata(
|
|
2823
|
+
input.acceptedExecution.turnExecutionPolicy,
|
|
2824
|
+
recoveredCreatorPolicy?.credentialRestriction,
|
|
2825
|
+
),
|
|
2826
|
+
model: input.acceptedExecution.resolvedModel,
|
|
2827
|
+
reasoningEffort: input.acceptedExecution.resolvedReasoningEffort,
|
|
2828
|
+
scheduledTaskId: task.id,
|
|
2829
|
+
scheduledTaskRunMode: task.runMode,
|
|
2830
|
+
...(task.agentConfig.goal ? { scheduledTaskGoal: task.agentConfig.goal } : {}),
|
|
2831
|
+
scheduledTaskRunId: canonicalGeneratedRunId,
|
|
2832
|
+
...(frozenSlack ? { [OPENGENI_SLACK_BOT_SESSION_METADATA_KEY]: frozenSlack.id } : {}),
|
|
2833
|
+
},
|
|
2834
|
+
input.acceptedExecution.resolvedAgentConfig,
|
|
2835
|
+
);
|
|
2240
2836
|
if (
|
|
2241
2837
|
session.createIdempotencyKey !== expectedCreateKey ||
|
|
2242
2838
|
session.initialMessage !== task.agentConfig.prompt ||
|
|
2243
|
-
session.instructions !== null ||
|
|
2839
|
+
session.instructions !== (input.acceptedExecution.resolvedAgentInstructions ?? null) ||
|
|
2244
2840
|
session.policyRole !== null ||
|
|
2245
2841
|
stableJson(session.skills) !== "[]" ||
|
|
2246
2842
|
stableJson(session.toolPolicy) !==
|
|
@@ -2282,6 +2878,8 @@ async function recoverBoundScheduledTaskDispatch(input: {
|
|
|
2282
2878
|
stableJson(input.acceptedExecution.resolvedFirstPartyMcpTools) ||
|
|
2283
2879
|
stableJson(session.firstPartyMcpPermissions) !==
|
|
2284
2880
|
stableJson(input.acceptedExecution.resolvedFirstPartyMcpPermissions) ||
|
|
2881
|
+
stableJson(session.agent) !==
|
|
2882
|
+
stableJson(input.acceptedExecution.resolvedAgentConfig ?? null) ||
|
|
2285
2883
|
session.maxNestedAgentDepthOverride !== (task.agentConfig.maxNestedAgentDepth ?? null) ||
|
|
2286
2884
|
(session.variableSetId ?? null) !==
|
|
2287
2885
|
(input.acceptedExecution.resolvedVariableSet?.id ?? null) ||
|
|
@@ -2363,6 +2961,7 @@ async function recoverBoundScheduledTaskDispatch(input: {
|
|
|
2363
2961
|
input.acceptedExecution.resolvedTools,
|
|
2364
2962
|
task.id,
|
|
2365
2963
|
input.run.id,
|
|
2964
|
+
input.acceptedExecution.degradedAccounts ?? [],
|
|
2366
2965
|
),
|
|
2367
2966
|
lineage: {
|
|
2368
2967
|
scheduledTaskId: task.id,
|
|
@@ -2378,11 +2977,25 @@ async function recoverBoundScheduledTaskDispatch(input: {
|
|
|
2378
2977
|
...(input.acceptedExecution.xaiAuthoritySubjectId
|
|
2379
2978
|
? { xaiAuthoritySubjectId: input.acceptedExecution.xaiAuthoritySubjectId }
|
|
2380
2979
|
: {}),
|
|
2980
|
+
...(input.acceptedExecution.claudeAuthoritySubjectId
|
|
2981
|
+
? { claudeAuthoritySubjectId: input.acceptedExecution.claudeAuthoritySubjectId }
|
|
2982
|
+
: {}),
|
|
2381
2983
|
},
|
|
2382
2984
|
personalConnectionDelegations: input.acceptedExecution.personalConnectionDelegations,
|
|
2383
2985
|
mcpAccountBindings: input.acceptedExecution.mcpAccountBindings ?? null,
|
|
2384
2986
|
xaiProviderAccountAuthoritySnapshot:
|
|
2385
2987
|
input.acceptedExecution.xaiProviderAccountAuthoritySnapshot,
|
|
2988
|
+
claudeProviderAccountAuthoritySnapshot:
|
|
2989
|
+
input.acceptedExecution.claudeProviderAccountAuthoritySnapshot,
|
|
2990
|
+
// Codex v2 (M3 PR 3b): the task's value frozen at creation, narrowed to
|
|
2991
|
+
// empty when the accepted revision's authorizer is not the owner.
|
|
2992
|
+
subscriptionAuthority: await getScheduledTaskSubscriptionAuthority(input.db, {
|
|
2993
|
+
workspaceId: task.workspaceId,
|
|
2994
|
+
taskId: task.id,
|
|
2995
|
+
revisionAuthorizerSubjectId:
|
|
2996
|
+
input.acceptedExecution.causalHumanAuthority?.subjectId ?? null,
|
|
2997
|
+
taskAuthorityRevision: task.authorityRevision,
|
|
2998
|
+
}),
|
|
2386
2999
|
scheduledTaskRunId: input.run.id,
|
|
2387
3000
|
},
|
|
2388
3001
|
async (tx, wakeEventId, _updateId, rejectionReason) => {
|
|
@@ -2443,10 +3056,14 @@ async function recoverBoundScheduledTaskDispatch(input: {
|
|
|
2443
3056
|
);
|
|
2444
3057
|
if (
|
|
2445
3058
|
scheduledUpdate.reason === "session_cancelled" ||
|
|
2446
|
-
scheduledUpdate.reason === "session_not_idle"
|
|
3059
|
+
scheduledUpdate.reason === "session_not_idle" ||
|
|
3060
|
+
scheduledUpdate.reason === "session_paused"
|
|
2447
3061
|
) {
|
|
2448
3062
|
return { action: "blocked", reason: "scheduled_run_terminal" };
|
|
2449
3063
|
}
|
|
3064
|
+
if (scheduledUpdate.added) {
|
|
3065
|
+
recordUserMessageAccepted(input.observability, { surface: "scheduled" });
|
|
3066
|
+
}
|
|
2450
3067
|
if (scheduledUpdate.added && scheduledUpdate.events.length > 0) {
|
|
2451
3068
|
await publishDurableSessionEvents(
|
|
2452
3069
|
input.bus,
|