deepline 0.3.483 → 0.3.485
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/bundling-sources/sdk/src/client-core.ts +91 -30
- package/dist/bundling-sources/sdk/src/compat.ts +13 -0
- package/dist/bundling-sources/sdk/src/plays/client-core.ts +4 -1
- package/dist/bundling-sources/sdk/src/plays/run-request.ts +143 -9
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/sdk/src/runs/watch-polling.ts +31 -4
- package/dist/bundling-sources/sdk/src/tool-calls.ts +1 -1
- package/dist/bundling-sources/sdk/src/types.ts +7 -1
- package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-dead-letter.ts +100 -9
- package/dist/bundling-sources/shared_libs/play-data-plane/sheet-column-storage.ts +32 -3
- package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +126 -41
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +231 -25
- package/dist/bundling-sources/shared_libs/play-runtime/daytona-runtime-config.ts +9 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-machines.ts +130 -19
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-registry.ts +105 -0
- package/dist/bundling-sources/shared_libs/play-runtime/execute-server-timing.ts +4 -2
- package/dist/bundling-sources/shared_libs/play-runtime/governor/app-runtime-rate-state-backend.ts +194 -56
- package/dist/bundling-sources/shared_libs/play-runtime/log-provenance.ts +11 -6
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/job.ts +3 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/ports.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/postgres-adapter.ts +2 -1
- package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +30 -0
- package/dist/bundling-sources/shared_libs/play-runtime/resource-governor.ts +195 -2
- package/dist/bundling-sources/shared_libs/play-runtime/run-failure.ts +20 -1
- package/dist/bundling-sources/shared_libs/play-runtime/run-ledger-projection-contract.ts +15 -0
- package/dist/bundling-sources/shared_libs/play-runtime/run-snapshot-stream.ts +2 -2
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +102 -23
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/progress-sidecar.ts +9 -1
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-control-transport.ts +25 -5
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-launch-transport.ts +133 -82
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +58 -16
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-sandbox-absence.ts +171 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-session-execution.ts +69 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +100 -40
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/types.ts +8 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +67 -9
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-incident-drills.ts +5 -5
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-receipt-store-adapter.ts +6 -3
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-sheet-errors.ts +14 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-sheet-row-writer.ts +87 -31
- package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/contract.ts +18 -0
- package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/index.ts +19 -0
- package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/runner-backend-adapter.ts +14 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +204 -6
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd.ts +39 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/ambiguous-modal-create-state.ts +21 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/compute-billing-job-state.ts +23 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/integration-operation-value-retirement-state.ts +25 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/integration-operation-value-retirement.ts +15 -1
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/outbox-repair-operation-state.ts +30 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/play-run-recovery.ts +12 -1
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-progress.ts +26 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-scope.ts +44 -15
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts +60 -11
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +743 -70
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +6 -1
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-event-search.ts +17 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-capacity.ts +34 -34
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/sandbox-cleanup-job-state.ts +23 -0
- package/dist/bundling-sources/shared_libs/play-runtime/suspension.ts +12 -0
- package/dist/bundling-sources/shared_libs/play-runtime/test-runtime-seams.ts +21 -0
- package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +1 -1
- package/dist/bundling-sources/shared_libs/plays/source-authoring-edition.ts +1 -1
- package/dist/bundling-sources/shared_libs/product-notifications/destination-state.ts +93 -0
- package/dist/cli/auth-ABZBH55L.js +43 -0
- package/dist/cli/{auth-2NXF6Q3Q.mjs → auth-OWMUENCU.mjs} +5 -5
- package/dist/cli/{billing-5PW4L5WD.js → billing-2FMNQGOX.js} +80 -80
- package/dist/cli/{billing-W2Y4EOZP.mjs → billing-JX4H3VFF.mjs} +7 -7
- package/dist/cli/{chunk-UGBZ6MCR.js → chunk-2ILND7XX.js} +2 -2
- package/dist/cli/{chunk-25IGCYJP.mjs → chunk-2ZEQ43B7.mjs} +3 -3
- package/dist/cli/{chunk-J7S3DJB4.mjs → chunk-3DBW6C7M.mjs} +13 -4
- package/dist/cli/{chunk-7APXZ3CX.mjs → chunk-3DYU3JQN.mjs} +2 -2
- package/dist/cli/{chunk-VFEW53L5.js → chunk-3OF7NSGR.js} +322 -294
- package/dist/cli/{chunk-UDF2CY4D.mjs → chunk-3Z24NKW7.mjs} +62 -34
- package/dist/cli/{chunk-62XGOB2D.js → chunk-5DCQWQCP.js} +26 -26
- package/dist/cli/{chunk-4X23YY2E.mjs → chunk-62PJ6PK7.mjs} +5 -5
- package/dist/cli/{chunk-YL64JIQ7.mjs → chunk-676NZ7K4.mjs} +1 -1
- package/dist/cli/{chunk-T5GZZJ7O.js → chunk-775AZTO7.js} +323 -247
- package/dist/cli/{chunk-C3LJSOQ6.mjs → chunk-ACTUAZYP.mjs} +5 -5
- package/dist/cli/{chunk-R2OR4RHV.js → chunk-AFADYKFE.js} +8 -8
- package/dist/cli/{chunk-GVAENVIG.js → chunk-AUQQVDAB.js} +110 -21
- package/dist/cli/{chunk-GONUMUBM.js → chunk-BSKPQB2P.js} +7 -7
- package/dist/cli/chunk-C6QWRSMQ.js +42 -0
- package/dist/cli/{chunk-AK7UKQ5R.js → chunk-CSBMKHTV.js} +5 -5
- package/dist/cli/{chunk-PRL7EKJZ.mjs → chunk-CW6TAQBF.mjs} +15 -4
- package/dist/cli/{chunk-75IIHFN6.js → chunk-DMNVM34J.js} +5 -4
- package/dist/cli/{chunk-IEV5UWPN.mjs → chunk-E73JXJA3.mjs} +1 -1
- package/dist/cli/{chunk-DS455RPF.js → chunk-EC2CVPN5.js} +3 -3
- package/dist/cli/{chunk-B7HQL77V.js → chunk-ECIXZNSW.js} +87 -76
- package/dist/cli/{chunk-JJSLEMQQ.mjs → chunk-FJY6K3BG.mjs} +93 -17
- package/dist/cli/{chunk-FK47YUPC.mjs → chunk-G5PI3RNT.mjs} +1 -1
- package/dist/cli/{chunk-GRE3ID5E.mjs → chunk-GHHJWCMD.mjs} +2 -1
- package/dist/cli/{chunk-2JWG2H2N.js → chunk-HKGXGGIV.js} +1 -1
- package/dist/cli/{chunk-2MKX3HV3.js → chunk-IHMYIHF4.js} +5 -5
- package/dist/cli/{chunk-SD7QWZTV.mjs → chunk-INW22YP7.mjs} +1 -1
- package/dist/cli/{chunk-OWUZKXE7.mjs → chunk-J7EENGKJ.mjs} +1 -1
- package/dist/cli/{chunk-AWAFYRFV.mjs → chunk-JD6HKNKD.mjs} +1 -1
- package/dist/cli/{chunk-UY7OXFVU.js → chunk-JQXUWYWX.js} +13 -13
- package/dist/cli/{chunk-GGJQ4HJW.mjs → chunk-KZTNNLIL.mjs} +2 -2
- package/dist/cli/{chunk-NREZRYPU.mjs → chunk-L352NOE3.mjs} +2 -2
- package/dist/cli/{chunk-WI2HNYQX.js → chunk-L7IQ3DFH.js} +53 -53
- package/dist/cli/{chunk-4IOY2SCQ.js → chunk-LOX3BISD.js} +4 -4
- package/dist/cli/{chunk-XRIQN6EP.js → chunk-NKPTM7SK.js} +7 -7
- package/dist/cli/{chunk-5ICAG4RE.js → chunk-NLRTFJGH.js} +14 -14
- package/dist/cli/{chunk-WKB6Y43W.js → chunk-NRNWPWBW.js} +37 -37
- package/dist/cli/{chunk-HNRELVCS.mjs → chunk-ONONSV2Q.mjs} +96 -7
- package/dist/cli/{chunk-MYB6JVSD.js → chunk-OW4OTEFF.js} +16 -16
- package/dist/cli/{chunk-ISP7ZENV.mjs → chunk-RZE5I2XJ.mjs} +4 -4
- package/dist/cli/{chunk-5LHU7NUS.js → chunk-S3WQJ5VG.js} +3 -3
- package/dist/cli/{chunk-EDMCD7MX.mjs → chunk-SR6S4EYG.mjs} +5 -5
- package/dist/cli/{chunk-2T4OSJEH.js → chunk-T4G2T5DS.js} +21 -21
- package/dist/cli/{chunk-EGHYGTJM.mjs → chunk-TMCC7ORQ.mjs} +1 -1
- package/dist/cli/{chunk-SCPFOH5Z.mjs → chunk-TSCUWWTM.mjs} +1 -1
- package/dist/cli/{chunk-7TKLISLM.js → chunk-TVW6USSG.js} +3 -3
- package/dist/cli/{chunk-QSYA6VE4.js → chunk-U6WEGDD3.js} +2 -2
- package/dist/cli/{chunk-FGEC5SWP.mjs → chunk-UPHXGZCE.mjs} +4 -4
- package/dist/cli/{chunk-5JCXS4MP.js → chunk-UQ3LQ6IF.js} +5 -5
- package/dist/cli/{chunk-JYEZ6BWX.mjs → chunk-VZYTLWOM.mjs} +2 -2
- package/dist/cli/{chunk-FAZTLYJO.mjs → chunk-W33OL4F2.mjs} +2 -2
- package/dist/cli/{chunk-ZM2YPJQJ.js → chunk-XK5DMLZE.js} +5 -1
- package/dist/cli/{chunk-LJ5747UC.mjs → chunk-XRDXNAAY.mjs} +5 -1
- package/dist/cli/{chunk-S24CK3CJ.mjs → chunk-YDA3PMKK.mjs} +3 -3
- package/dist/cli/{csv-EKEFLUIW.js → csv-HFEQPGNY.js} +13 -13
- package/dist/cli/{csv-DIFVIR23.mjs → csv-OHF3Y5KB.mjs} +4 -4
- package/dist/cli/{db-DOW4EVEU.mjs → db-M456OUXD.mjs} +7 -7
- package/dist/cli/{db-S7DDRUHX.js → db-VLQKCYQS.js} +28 -28
- package/dist/cli/describe-CP35DZ5Z.js +49 -0
- package/dist/cli/{describe-KSZFOWKV.mjs → describe-M6VXFYVL.mjs} +21 -21
- package/dist/cli/describe-core.d.mts +3 -3
- package/dist/cli/describe-core.d.ts +3 -3
- package/dist/cli/describe-core.js +4 -4
- package/dist/cli/describe-core.mjs +3 -3
- package/dist/cli/{executions-CAG7YC5K.mjs → executions-4FGRBPJF.mjs} +7 -7
- package/dist/cli/{executions-3DU5IXB6.js → executions-GKINJZI6.js} +9 -9
- package/dist/cli/{feedback-BQMPTE47.mjs → feedback-D2WMGK3V.mjs} +4 -4
- package/dist/cli/{feedback-I65JMCP2.js → feedback-ZH5K7WV7.js} +8 -8
- package/dist/cli/git-IDALMZDN.js +25 -0
- package/dist/cli/{git-UQUCD7XZ.mjs → git-OCIJ5ME4.mjs} +5 -5
- package/dist/cli/index.js +142 -139
- package/dist/cli/index.mjs +45 -42
- package/dist/cli/{legacy-noops-OLNT2BG5.js → legacy-noops-QNIVP7LO.js} +8 -8
- package/dist/cli/{legacy-noops-JXKLHUI3.mjs → legacy-noops-V6Q2X34P.mjs} +5 -5
- package/dist/cli/{monitors-DLTHHAFQ.mjs → monitors-2USHTG5G.mjs} +8 -8
- package/dist/cli/{monitors-Z5X56AZN.js → monitors-5DNK7W2K.js} +92 -92
- package/dist/cli/{org-XBHJLKUG.js → org-RPGM5AN4.js} +73 -73
- package/dist/cli/{org-6EZZHD3M.mjs → org-TL2YPYSE.mjs} +7 -7
- package/dist/cli/{pages-XVJ34SCN.js → pages-PNUKPFWV.js} +18 -18
- package/dist/cli/{pages-MYXROSVK.mjs → pages-XDEW6EE3.mjs} +7 -7
- package/dist/cli/{play-ACC4T2XQ.js → play-F5LHRKV5.js} +858 -632
- package/dist/cli/{play-5PV4LAHE.mjs → play-WINNQ4HZ.mjs} +372 -146
- package/dist/cli/{providers-JCI3KNE4.js → providers-BD4IS5U5.js} +10 -10
- package/dist/cli/{providers-2DLUGIFF.mjs → providers-PXGL3FRE.mjs} +7 -7
- package/dist/cli/{quickstart-PDSQEDLD.js → quickstart-7LVF6HZF.js} +6 -6
- package/dist/cli/{quickstart-NSL3C76K.mjs → quickstart-XTH3UQWZ.mjs} +4 -4
- package/dist/cli/{run-X5MXCM4P.mjs → run-MBMUENR7.mjs} +26 -26
- package/dist/cli/{run-UCFMHOQC.js → run-NH2BAWPA.js} +41 -41
- package/dist/cli/{search-RPEMXV6N.mjs → search-BMRWBV66.mjs} +8 -8
- package/dist/cli/search-R3MQJQMT.js +32 -0
- package/dist/cli/{search-output-MZH3HLVE.js → search-output-5NNT337U.js} +22 -16
- package/dist/cli/{search-output-6UO47B7G.mjs → search-output-QKKRD4MF.mjs} +14 -8
- package/dist/cli/{secrets-NLEQURD3.mjs → secrets-AWEXBTJV.mjs} +7 -7
- package/dist/cli/{secrets-UFBASYGY.js → secrets-KQSTOREN.js} +16 -16
- package/dist/cli/{sessions-JYH4DBEE.js → sessions-DSPLZYCJ.js} +6 -6
- package/dist/cli/{sessions-3ALFLWVU.mjs → sessions-RO25Q67X.mjs} +5 -5
- package/dist/cli/{settings-MQYKNAMB.js → settings-7JXIKNKI.js} +79 -79
- package/dist/cli/{settings-YPRILREA.mjs → settings-JMGXGK4Z.mjs} +12 -12
- package/dist/cli/{setup-5IGSHH4E.js → setup-5QFAQQRW.js} +47 -47
- package/dist/cli/{setup-DK4GM227.mjs → setup-ZQZ47FHB.mjs} +9 -9
- package/dist/cli/skills-EDZXY7DV.js +33 -0
- package/dist/cli/{skills-KYBZH3IT.mjs → skills-W3H2DL56.mjs} +7 -7
- package/dist/cli/{tools-4B2MHNBN.mjs → tools-2BZCVNBS.mjs} +19 -19
- package/dist/cli/tools-2EY2ETCZ.js +56 -0
- package/dist/cli/{update-S6VEO7NB.mjs → update-GAWYMGAW.mjs} +9 -9
- package/dist/cli/update-UKDQKNBY.js +33 -0
- package/dist/cli/{workflow-KXZZYFEF.mjs → workflow-M6LLHQ2I.mjs} +8 -8
- package/dist/cli/{workflow-FU2XVPUK.js → workflow-ZPTDFPKW.js} +18 -18
- package/dist/{client-DJ3r8VQJ.d.mts → client-BkbDHRIg.d.mts} +1 -1
- package/dist/{client-JPSNljtj.d.ts → client-D3hVHXjK.d.ts} +1 -1
- package/dist/{client-core-3SJlNsKU.d.mts → client-core-BZoSMKcY.d.mts} +30 -15
- package/dist/{client-core-rCoQ5Xz3.d.ts → client-core-DUdVqO_m.d.ts} +30 -15
- package/dist/{compiler-manifest-gkO9ZkVg.d.mts → compiler-manifest-BFTwq1HI.d.mts} +1 -1
- package/dist/{compiler-manifest-gkO9ZkVg.d.ts → compiler-manifest-BFTwq1HI.d.ts} +1 -1
- package/dist/{errors-Cc92LKH-.d.ts → errors-c3pMsylw.d.ts} +1 -1
- package/dist/{errors-CeCCOKSA.d.mts → errors-w31ybrQM.d.mts} +1 -1
- package/dist/{index-DJQKdV76.d.ts → index-CQ-15-QL.d.ts} +1 -1
- package/dist/{index-DsqWJL3Q.d.mts → index-DvNtxucX.d.mts} +1 -1
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +10 -10
- package/dist/index.mjs +7 -7
- package/dist/install-integrity.json +123 -116
- package/dist/plays/bundle-play-file.d.mts +3 -3
- package/dist/plays/bundle-play-file.d.ts +3 -3
- package/dist/plays/bundle-play-file.mjs +2 -2
- package/dist/plays/play-description.d.mts +2 -2
- package/dist/plays/play-description.d.ts +2 -2
- package/dist/plays/run-request.d.mts +2 -2
- package/dist/plays/run-request.d.ts +2 -2
- package/dist/plays/run-request.js +12 -2
- package/dist/plays/run-request.mjs +11 -1
- package/dist/release.d.mts +1 -1
- package/dist/release.d.ts +1 -1
- package/dist/release.js +2 -2
- package/dist/release.mjs +1 -1
- package/dist/server.d.mts +4 -4
- package/dist/server.d.ts +4 -4
- package/dist/server.js +6 -6
- package/dist/server.mjs +4 -4
- package/package.json +1 -1
- package/dist/cli/auth-JHQKM6QY.js +0 -43
- package/dist/cli/chunk-PHDEQ6W3.js +0 -33
- package/dist/cli/describe-RXYQCJRR.js +0 -49
- package/dist/cli/git-ADIABNMQ.js +0 -25
- package/dist/cli/search-YILJZD36.js +0 -32
- package/dist/cli/skills-I4IUZN3U.js +0 -33
- package/dist/cli/tools-NLZR7ABS.js +0 -56
- package/dist/cli/update-RVDEUJTE.js +0 -33
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** Persisted in ambiguous_modal_creates.status. */
|
|
2
|
+
export const AmbiguousModalCreateStatus = {
|
|
3
|
+
Pending: 'pending',
|
|
4
|
+
Resolved: 'resolved',
|
|
5
|
+
} as const;
|
|
6
|
+
|
|
7
|
+
export type AmbiguousModalCreateStatus =
|
|
8
|
+
(typeof AmbiguousModalCreateStatus)[keyof typeof AmbiguousModalCreateStatus];
|
|
9
|
+
|
|
10
|
+
/** Decode database text at the scheduler boundary; unknown states fail closed. */
|
|
11
|
+
export function readAmbiguousModalCreateStatus(
|
|
12
|
+
value: unknown,
|
|
13
|
+
): AmbiguousModalCreateStatus {
|
|
14
|
+
if (
|
|
15
|
+
value === AmbiguousModalCreateStatus.Pending ||
|
|
16
|
+
value === AmbiguousModalCreateStatus.Resolved
|
|
17
|
+
) {
|
|
18
|
+
return value;
|
|
19
|
+
}
|
|
20
|
+
throw new Error(`Unknown ambiguous Modal create status: ${String(value)}.`);
|
|
21
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Persisted in compute_billing_jobs_v2.status. */
|
|
2
|
+
export const ComputeBillingJobStatus = {
|
|
3
|
+
Pending: 'pending',
|
|
4
|
+
Settling: 'settling',
|
|
5
|
+
Settled: 'settled',
|
|
6
|
+
} as const;
|
|
7
|
+
|
|
8
|
+
export type ComputeBillingJobStatus =
|
|
9
|
+
(typeof ComputeBillingJobStatus)[keyof typeof ComputeBillingJobStatus];
|
|
10
|
+
|
|
11
|
+
/** Decode database text at the scheduler boundary; unknown states fail closed. */
|
|
12
|
+
export function readComputeBillingJobStatus(
|
|
13
|
+
value: unknown,
|
|
14
|
+
): ComputeBillingJobStatus {
|
|
15
|
+
if (
|
|
16
|
+
value === ComputeBillingJobStatus.Pending ||
|
|
17
|
+
value === ComputeBillingJobStatus.Settling ||
|
|
18
|
+
value === ComputeBillingJobStatus.Settled
|
|
19
|
+
) {
|
|
20
|
+
return value;
|
|
21
|
+
}
|
|
22
|
+
throw new Error(`Unknown compute billing job status: ${String(value)}.`);
|
|
23
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** Persisted in runtime_integration_operation_value_retirements.state. */
|
|
2
|
+
export const IntegrationOperationValueRetirementState = {
|
|
3
|
+
Pending: 'pending',
|
|
4
|
+
Deleting: 'deleting',
|
|
5
|
+
Deleted: 'deleted',
|
|
6
|
+
Cancelled: 'cancelled',
|
|
7
|
+
} as const;
|
|
8
|
+
|
|
9
|
+
export type IntegrationOperationValueRetirementState =
|
|
10
|
+
(typeof IntegrationOperationValueRetirementState)[keyof typeof IntegrationOperationValueRetirementState];
|
|
11
|
+
|
|
12
|
+
/** Decode database text at the scheduler boundary; unknown states fail closed. */
|
|
13
|
+
export function readIntegrationOperationValueRetirementState(
|
|
14
|
+
value: unknown,
|
|
15
|
+
): IntegrationOperationValueRetirementState {
|
|
16
|
+
if (
|
|
17
|
+
value === IntegrationOperationValueRetirementState.Pending ||
|
|
18
|
+
value === IntegrationOperationValueRetirementState.Deleting ||
|
|
19
|
+
value === IntegrationOperationValueRetirementState.Deleted ||
|
|
20
|
+
value === IntegrationOperationValueRetirementState.Cancelled
|
|
21
|
+
) {
|
|
22
|
+
return value;
|
|
23
|
+
}
|
|
24
|
+
throw new Error(`Unknown Integration Operation value retirement state: ${String(value)}.`);
|
|
25
|
+
}
|
|
@@ -4,6 +4,10 @@ import {
|
|
|
4
4
|
isIntegrationOperationValueReference,
|
|
5
5
|
type IntegrationOperationValueReference,
|
|
6
6
|
} from './integration-operation-value-reference';
|
|
7
|
+
import {
|
|
8
|
+
IntegrationOperationValueRetirementState,
|
|
9
|
+
readIntegrationOperationValueRetirementState,
|
|
10
|
+
} from './integration-operation-value-retirement-state';
|
|
7
11
|
|
|
8
12
|
/**
|
|
9
13
|
* The value-retirement journal needs only the scheduler client's query
|
|
@@ -50,6 +54,7 @@ type RetirementRow = {
|
|
|
50
54
|
object_digest: string;
|
|
51
55
|
reference_json: unknown;
|
|
52
56
|
claim_token: string;
|
|
57
|
+
state: unknown;
|
|
53
58
|
};
|
|
54
59
|
|
|
55
60
|
export type ClaimedIntegrationOperationValueRetirement = {
|
|
@@ -59,6 +64,7 @@ export type ClaimedIntegrationOperationValueRetirement = {
|
|
|
59
64
|
objectDigest: string;
|
|
60
65
|
reference: IntegrationOperationValueReference;
|
|
61
66
|
claimToken: string;
|
|
67
|
+
state: typeof IntegrationOperationValueRetirementState.Deleting;
|
|
62
68
|
};
|
|
63
69
|
|
|
64
70
|
/**
|
|
@@ -102,7 +108,8 @@ export async function claimPostgresIntegrationOperationValueRetirements(input: {
|
|
|
102
108
|
WHERE retirements.ctid = candidates.ctid
|
|
103
109
|
RETURNING retirements.org_id, retirements.operation_key,
|
|
104
110
|
retirements.object_key, retirements.object_digest,
|
|
105
|
-
retirements.reference_json, retirements.claim_token
|
|
111
|
+
retirements.reference_json, retirements.claim_token,
|
|
112
|
+
retirements.state`,
|
|
106
113
|
[limit(input.limit), claimToken],
|
|
107
114
|
);
|
|
108
115
|
return claimed.rows.map((row) => {
|
|
@@ -119,6 +126,12 @@ export async function claimPostgresIntegrationOperationValueRetirements(input: {
|
|
|
119
126
|
`Integration Operation value retirement ${row.object_key} does not match its immutable reference.`,
|
|
120
127
|
);
|
|
121
128
|
}
|
|
129
|
+
const state = readIntegrationOperationValueRetirementState(row.state);
|
|
130
|
+
if (state !== IntegrationOperationValueRetirementState.Deleting) {
|
|
131
|
+
throw new Error(
|
|
132
|
+
`Integration Operation value retirement ${row.object_key} was claimed in ${state} state.`,
|
|
133
|
+
);
|
|
134
|
+
}
|
|
122
135
|
return {
|
|
123
136
|
orgId: row.org_id,
|
|
124
137
|
operationKey: row.operation_key,
|
|
@@ -126,6 +139,7 @@ export async function claimPostgresIntegrationOperationValueRetirements(input: {
|
|
|
126
139
|
objectDigest: row.object_digest,
|
|
127
140
|
reference: row.reference_json,
|
|
128
141
|
claimToken: row.claim_token,
|
|
142
|
+
state,
|
|
129
143
|
};
|
|
130
144
|
});
|
|
131
145
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** Persisted in outbox_repair_operations.state. */
|
|
2
|
+
export const OutboxRepairOperationState = {
|
|
3
|
+
Planned: 'planned',
|
|
4
|
+
Applied: 'applied',
|
|
5
|
+
} as const;
|
|
6
|
+
|
|
7
|
+
export type OutboxRepairOperationState =
|
|
8
|
+
(typeof OutboxRepairOperationState)[keyof typeof OutboxRepairOperationState];
|
|
9
|
+
|
|
10
|
+
/** Decode database text at the scheduler boundary; unknown states fail closed. */
|
|
11
|
+
export function readOutboxRepairOperationState(
|
|
12
|
+
value: unknown,
|
|
13
|
+
): OutboxRepairOperationState {
|
|
14
|
+
if (
|
|
15
|
+
value === OutboxRepairOperationState.Planned ||
|
|
16
|
+
value === OutboxRepairOperationState.Applied
|
|
17
|
+
) {
|
|
18
|
+
return value;
|
|
19
|
+
}
|
|
20
|
+
throw new Error(`Unknown outbox repair operation state: ${String(value)}.`);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** A repair is planned once, then durably applied; applied is terminal. */
|
|
24
|
+
export function canTransitionOutboxRepairOperation(
|
|
25
|
+
from: OutboxRepairOperationState,
|
|
26
|
+
to: OutboxRepairOperationState,
|
|
27
|
+
): boolean {
|
|
28
|
+
return from === OutboxRepairOperationState.Planned &&
|
|
29
|
+
to === OutboxRepairOperationState.Applied;
|
|
30
|
+
}
|
package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/play-run-recovery.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
1
2
|
import {
|
|
2
3
|
isPlayRunRecoveryError,
|
|
3
4
|
PLAY_RUN_RECOVERY_DEFER_POLICY,
|
|
@@ -87,7 +88,17 @@ export async function transitionPreCodePlayRunRecovery(input: {
|
|
|
87
88
|
'remained unavailable before customer execution began through the bounded recovery horizon. ' +
|
|
88
89
|
'No customer code was started; inspect and redrive this run after the dependency is healthy.',
|
|
89
90
|
logs: [],
|
|
90
|
-
stats: {
|
|
91
|
+
stats: {
|
|
92
|
+
runtimeWorkCounters: {
|
|
93
|
+
logicalCalls: 0,
|
|
94
|
+
providerRequests: 0,
|
|
95
|
+
provider429s: 0,
|
|
96
|
+
},
|
|
97
|
+
runtimeWorkCounterSegment: {
|
|
98
|
+
invocationSeq: 1,
|
|
99
|
+
segmentId: randomUUID(),
|
|
100
|
+
},
|
|
101
|
+
},
|
|
91
102
|
steps: [],
|
|
92
103
|
checkpoint: input.checkpoint,
|
|
93
104
|
tableNamespace: null,
|
package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-progress.ts
CHANGED
|
@@ -17,6 +17,7 @@ import { normalizeTableNamespace } from '../../plays/row-identity';
|
|
|
17
17
|
import { PlayStepLifecycleTracker } from '../step-lifecycle-tracker';
|
|
18
18
|
import { isDurableDirectRunnerLog } from '../log-provenance';
|
|
19
19
|
import {
|
|
20
|
+
isRunnerProgressAttemptSupersededResponse,
|
|
20
21
|
updateRunStatusViaAppRuntime,
|
|
21
22
|
type RuntimeStatusUpdate,
|
|
22
23
|
} from '../app-runtime-api';
|
|
@@ -508,6 +509,12 @@ export function createPostgresSchedulerProgressReporter(input: {
|
|
|
508
509
|
status: 'running' | 'completed' | 'failed';
|
|
509
510
|
force: boolean;
|
|
510
511
|
required: boolean;
|
|
512
|
+
/**
|
|
513
|
+
* Live progress asks Run Ledger intake to fence on this attempt. Any
|
|
514
|
+
* finalize of a runner result is not live: it is designed to land after
|
|
515
|
+
* the terminal, so a merged upload that includes one is not live either.
|
|
516
|
+
*/
|
|
517
|
+
liveProgress: boolean;
|
|
511
518
|
terminalLogReplay: TerminalLogReplayPayload | null;
|
|
512
519
|
waiters: Array<{
|
|
513
520
|
resolve: () => void;
|
|
@@ -532,6 +539,7 @@ export function createPostgresSchedulerProgressReporter(input: {
|
|
|
532
539
|
: (current?.status ?? next.status),
|
|
533
540
|
force: next.force || current?.force === true,
|
|
534
541
|
required: next.required || current?.required === true,
|
|
542
|
+
liveProgress: next.liveProgress && current?.liveProgress !== false,
|
|
535
543
|
terminalLogReplay:
|
|
536
544
|
next.terminalLogReplay ?? current?.terminalLogReplay ?? null,
|
|
537
545
|
waiters: [...(current?.waiters ?? []), waiter],
|
|
@@ -648,6 +656,7 @@ export function createPostgresSchedulerProgressReporter(input: {
|
|
|
648
656
|
? { liveLogBatchOffset: nextLogTotalCount - nextLogs.length }
|
|
649
657
|
: {}),
|
|
650
658
|
liveLogProducerAttempt: producerAttempt,
|
|
659
|
+
...(request.liveProgress ? { liveProgress: true } : {}),
|
|
651
660
|
datasetLifecycleEvents: nextDatasetLifecycleEvents,
|
|
652
661
|
activityObservations: nextActivityObservations,
|
|
653
662
|
workCounters: nextWorkCounters,
|
|
@@ -657,11 +666,24 @@ export function createPostgresSchedulerProgressReporter(input: {
|
|
|
657
666
|
}
|
|
658
667
|
request.waiters.forEach(({ resolve }) => resolve());
|
|
659
668
|
} catch (error) {
|
|
669
|
+
// Keep observations for a later unfenced finalize either way.
|
|
660
670
|
requeueProgressEvents({
|
|
661
671
|
datasetLifecycleEvents: nextDatasetLifecycleEvents,
|
|
662
672
|
activityObservations: nextActivityObservations,
|
|
663
673
|
});
|
|
664
674
|
workCountersDirty = true;
|
|
675
|
+
if (isRunnerProgressAttemptSupersededResponse(error)) {
|
|
676
|
+
// Intake's commit-time fence found this attempt no longer
|
|
677
|
+
// current, as the read above would have a moment later. Settle
|
|
678
|
+
// the live upload like that branch does instead of failing a
|
|
679
|
+
// required flush: the terminal tail carries any in-flight lines.
|
|
680
|
+
console.info('[postgres-scheduler.progress_attempt_superseded]', {
|
|
681
|
+
runId: launch.runId,
|
|
682
|
+
attempt: producerAttempt ?? null,
|
|
683
|
+
});
|
|
684
|
+
request.waiters.forEach(({ resolve }) => resolve());
|
|
685
|
+
continue;
|
|
686
|
+
}
|
|
665
687
|
console.warn('[postgres-scheduler.progress_flush_failed]', {
|
|
666
688
|
runId: launch.runId,
|
|
667
689
|
error: error instanceof Error ? error.message : String(error),
|
|
@@ -685,6 +707,7 @@ export function createPostgresSchedulerProgressReporter(input: {
|
|
|
685
707
|
status?: 'running' | 'completed' | 'failed';
|
|
686
708
|
required?: boolean;
|
|
687
709
|
terminalLogReplay?: TerminalLogReplayPayload | null;
|
|
710
|
+
liveProgress?: boolean;
|
|
688
711
|
}): Promise<void> => {
|
|
689
712
|
const force = input?.force === true;
|
|
690
713
|
const status = input?.status ?? 'running';
|
|
@@ -732,6 +755,7 @@ export function createPostgresSchedulerProgressReporter(input: {
|
|
|
732
755
|
force,
|
|
733
756
|
required,
|
|
734
757
|
terminalLogReplay: input?.terminalLogReplay ?? null,
|
|
758
|
+
liveProgress: input?.liveProgress !== false,
|
|
735
759
|
},
|
|
736
760
|
{ resolve, reject },
|
|
737
761
|
);
|
|
@@ -1744,6 +1768,8 @@ export function createPostgresSchedulerProgressReporter(input: {
|
|
|
1744
1768
|
await flush({
|
|
1745
1769
|
force: true,
|
|
1746
1770
|
status,
|
|
1771
|
+
// Only the gateway's per-request ingest finalizes without a result.
|
|
1772
|
+
liveProgress: result == null,
|
|
1747
1773
|
required:
|
|
1748
1774
|
options.required === true ||
|
|
1749
1775
|
status === 'completed' ||
|
package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-scope.ts
CHANGED
|
@@ -32,9 +32,18 @@ export function acquireRateScopeSql(
|
|
|
32
32
|
const refillRate = `CASE WHEN ${minimumRateSql} IS NULL
|
|
33
33
|
THEN h.refill_per_sec
|
|
34
34
|
ELSE GREATEST(h.refill_per_sec, ${minimumRateSql}) END`;
|
|
35
|
+
// A supported throttle ceiling is learned capacity, not a cold discovery
|
|
36
|
+
// seed. Recover quickly up to it, then test higher capacity with fresh,
|
|
37
|
+
// bounded gentle probes rather than repeating the cold doubling cycle.
|
|
38
|
+
const fastRecovery = unknownProvider
|
|
39
|
+
? `(${refillRate} < ${DEFAULT_UNKNOWN_PROVIDER_FAST_RECOVERY_RPS}
|
|
40
|
+
AND (h.rate_throttle_ceiling_rps IS NULL
|
|
41
|
+
OR ${refillRate} < h.rate_throttle_ceiling_rps))`
|
|
42
|
+
: 'FALSE';
|
|
35
43
|
const recoveryRate = unknownProvider
|
|
36
|
-
? `CASE WHEN ${
|
|
37
|
-
THEN LEAST(${DEFAULT_UNKNOWN_PROVIDER_FAST_RECOVERY_RPS}, ${refillRate} * 2
|
|
44
|
+
? `CASE WHEN ${fastRecovery}
|
|
45
|
+
THEN LEAST(${DEFAULT_UNKNOWN_PROVIDER_FAST_RECOVERY_RPS}, ${refillRate} * 2,
|
|
46
|
+
COALESCE(h.rate_throttle_ceiling_rps, ${DEFAULT_UNKNOWN_PROVIDER_FAST_RECOVERY_RPS}))
|
|
38
47
|
ELSE ((${refillRate})::numeric + ${UNKNOWN_PROVIDER_PROBE_STEP_RPS})::float8 END`
|
|
39
48
|
: `${refillRate} * (1 + ${AIMD_ADDITIVE_STEP_FRACTION})`;
|
|
40
49
|
// Success counts are already applied once by the feedback writer. Measure
|
|
@@ -68,10 +77,10 @@ export function acquireRateScopeSql(
|
|
|
68
77
|
// interval at 4/8 RPS waits through additional clean sends unnecessarily.
|
|
69
78
|
// Above that seed, preserve the slower productive/sparse observation window.
|
|
70
79
|
const backpressuredRecoveryInterval = unknownProvider
|
|
71
|
-
? `CASE WHEN ${
|
|
72
|
-
THEN
|
|
73
|
-
|
|
74
|
-
|
|
80
|
+
? `CASE WHEN ${fastRecovery}
|
|
81
|
+
THEN LEAST(${floorRecoveryInterval}, CEIL(1000.0 / ${refillRate}))
|
|
82
|
+
ELSE CASE WHEN ${productiveRecovery} THEN ${AIMD_RECOVERY_STEP_MS}
|
|
83
|
+
ELSE ${sparseRecoveryInterval} END END`
|
|
75
84
|
: `${AIMD_RECOVERY_STEP_MS}`;
|
|
76
85
|
// A local no-progress pause remains active after the provider's shorter
|
|
77
86
|
// Retry-After. Only time beyond every outstanding dispatch/hold is idle.
|
|
@@ -85,7 +94,7 @@ export function acquireRateScopeSql(
|
|
|
85
94
|
const recoverySuccess = probeBaselineSupported
|
|
86
95
|
? `(${successesParameter}::int > 0 OR (
|
|
87
96
|
h.seen_backpressure
|
|
88
|
-
AND (${!unknownProvider} OR ${
|
|
97
|
+
AND (${!unknownProvider} OR ${fastRecovery})
|
|
89
98
|
AND h.rate_probe_started_at_ms >= h.last_ramp_at_ms
|
|
90
99
|
AND h.rate_probe_started_at_ms >= h.rate_observation_started_at_ms
|
|
91
100
|
AND h.rate_successes > h.rate_probe_successes_at_ramp
|
|
@@ -116,7 +125,7 @@ export function acquireRateScopeSql(
|
|
|
116
125
|
return `provider_hold_rows AS (
|
|
117
126
|
SELECT * FROM ${table} WHERE bucket_id = $1 FOR UPDATE
|
|
118
127
|
), provider_hold AS (
|
|
119
|
-
SELECT h.*,
|
|
128
|
+
SELECT h.*, ${fastRecovery} AS fast_recovery,
|
|
120
129
|
${postHoldProbeDue} AS post_hold_probe_due,
|
|
121
130
|
${pendingRecoveryWaitMs} AS pending_recovery_wait_ms,
|
|
122
131
|
GREATEST(CASE WHEN ${postHoldProbeDue} THEN 1.0 ELSE 0.0 END, LEAST(
|
|
@@ -149,23 +158,23 @@ export function updateRateScopeSql(
|
|
|
149
158
|
table: string,
|
|
150
159
|
unknownProvider = false,
|
|
151
160
|
probeBaselineSupported = true,
|
|
161
|
+
includeGovernorSnapshot = false,
|
|
152
162
|
): string {
|
|
153
163
|
// Keep the throttle epoch's productive evidence while measuring each upward
|
|
154
164
|
// probe from a new counter baseline. Losing the earlier useful work would
|
|
155
165
|
// turn an exploratory rejection into a zero-progress failure.
|
|
156
166
|
const recoveredObservation = `${unknownProvider} AND ph.seen_backpressure
|
|
157
|
-
AND ph.
|
|
167
|
+
AND ph.fast_recovery
|
|
158
168
|
AND ph.next_refill_per_sec >= ${DEFAULT_UNKNOWN_PROVIDER_FAST_RECOVERY_RPS}`;
|
|
159
169
|
const probedObservation = `${unknownProvider} AND ph.seen_backpressure
|
|
160
|
-
AND ph.
|
|
170
|
+
AND NOT ph.fast_recovery
|
|
161
171
|
AND ph.next_refill_per_sec > ph.refill_per_sec`;
|
|
162
172
|
const floorRampedObservation = `${unknownProvider} AND ph.seen_backpressure
|
|
163
|
-
AND ph.
|
|
173
|
+
AND ph.fast_recovery
|
|
164
174
|
AND ph.next_refill_per_sec > ph.refill_per_sec`;
|
|
165
175
|
const knownRampedObservation = `${!unknownProvider} AND ph.seen_backpressure
|
|
166
176
|
AND ph.next_refill_per_sec > ph.refill_per_sec`;
|
|
167
|
-
const idleFloorObservation =
|
|
168
|
-
AND ph.refill_per_sec < ${DEFAULT_UNKNOWN_PROVIDER_FAST_RECOVERY_RPS}`;
|
|
177
|
+
const idleFloorObservation = `ph.observation_was_idle AND ph.fast_recovery`;
|
|
169
178
|
const rebaseProbe =
|
|
170
179
|
'ph.rate_probe_started_at_ms < ph.last_ramp_at_ms OR ph.rate_probe_started_at_ms < COALESCE(ph.rate_observation_started_at_ms, 0) OR ph.rate_probe_successes_at_ramp > ph.rate_successes';
|
|
171
180
|
return `updated_scope AS (
|
|
@@ -219,7 +228,13 @@ export function updateRateScopeSql(
|
|
|
219
228
|
ELSE ph.rate_recovery_interval_ms END,
|
|
220
229
|
rate_throttle_ceiling_rps = CASE
|
|
221
230
|
WHEN (SELECT granted FROM grant_calc) > 0
|
|
222
|
-
AND ph.rate_observation_started_at_ms IS NULL
|
|
231
|
+
AND ph.rate_observation_started_at_ms IS NULL
|
|
232
|
+
-- Compare successful work with its measured epoch, not the raw count
|
|
233
|
+
-- or Retry-After. Sparse/failed discovery still takes the cold path.
|
|
234
|
+
AND NOT (${unknownProvider} AND ph.rate_throttle_ceiling_rps IS NOT NULL
|
|
235
|
+
AND ph.rate_successes * 1000.0
|
|
236
|
+
/ GREATEST(${AIMD_RECOVERY_STEP_MS}, ph.rate_recovery_interval_ms)
|
|
237
|
+
>= ph.rate_throttle_ceiling_rps) THEN NULL
|
|
223
238
|
ELSE ph.rate_throttle_ceiling_rps END,
|
|
224
239
|
next_dispatch_at_ms = CASE WHEN (SELECT granted FROM grant_calc) > 0 THEN
|
|
225
240
|
(SELECT first_at_ms FROM schedule_calc)
|
|
@@ -229,6 +244,20 @@ export function updateRateScopeSql(
|
|
|
229
244
|
FROM provider_hold ph CROSS JOIN now_value nv
|
|
230
245
|
WHERE h.bucket_id = $1
|
|
231
246
|
RETURNING h.bucket_id, h.rate_observation_started_at_ms, h.rate_successes,
|
|
232
|
-
h.rate_recovery_interval_ms, h.seen_backpressure
|
|
247
|
+
h.rate_recovery_interval_ms, h.seen_backpressure${
|
|
248
|
+
includeGovernorSnapshot
|
|
249
|
+
? `,
|
|
250
|
+
ph.refill_per_sec AS previous_refill_per_sec,
|
|
251
|
+
ph.rate_successes AS previous_rate_successes,
|
|
252
|
+
ph.rate_observation_started_at_ms AS previous_observation_started_at_ms,
|
|
253
|
+
ph.rate_recovery_interval_ms AS previous_recovery_interval_ms,
|
|
254
|
+
ph.rate_throttle_ceiling_rps AS previous_throttle_ceiling_rps,
|
|
255
|
+
ph.fast_recovery, ph.tokens_after_refill,
|
|
256
|
+
h.refill_per_sec, h.tokens, h.rate_throttle_ceiling_rps,
|
|
257
|
+
${probeBaselineSupported ? 'h.rate_probe_started_at_ms, h.rate_probe_successes_at_ramp' : 'NULL::bigint AS rate_probe_started_at_ms, NULL::bigint AS rate_probe_successes_at_ramp'},
|
|
258
|
+
h.last_ramp_at_ms, h.refilled_at_ms, h.next_dispatch_at_ms,
|
|
259
|
+
h.retry_at_ms, h.cool_until_ms`
|
|
260
|
+
: ''
|
|
261
|
+
}
|
|
233
262
|
)`;
|
|
234
263
|
}
|
package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
PlayRunnerRateStateAcquireInput,
|
|
3
3
|
PlayRunnerRateStateAcquireResult,
|
|
4
|
+
PlayRunnerRateStateGovernorSnapshot,
|
|
4
5
|
PlayRunnerRateStateConcurrencyGrant,
|
|
5
6
|
PlayRunnerRateStatePenalizeInput,
|
|
6
7
|
PlayRunnerRateStateReleaseInput,
|
|
@@ -10,7 +11,6 @@ import type {
|
|
|
10
11
|
import {
|
|
11
12
|
DEFAULT_ADVISORY_PROVIDER_MAX_RPS,
|
|
12
13
|
DEFAULT_UNKNOWN_PROVIDER_COLD_START_RPS,
|
|
13
|
-
DEFAULT_UNKNOWN_PROVIDER_FAST_RECOVERY_RPS,
|
|
14
14
|
DEFAULT_UNKNOWN_PROVIDER_MIN_RPS,
|
|
15
15
|
PROVIDER_AIMD_COOLDOWN_CAP_MS,
|
|
16
16
|
type PacingRule,
|
|
@@ -1019,6 +1019,8 @@ function acquireResultOf(
|
|
|
1019
1019
|
}
|
|
1020
1020
|
|
|
1021
1021
|
type RateStateAcquireInput = PlayRunnerRateStateAcquireInput & {
|
|
1022
|
+
/** Server-selected telemetry only; never accepted from an untrusted body. */
|
|
1023
|
+
includeGovernorSnapshot?: boolean;
|
|
1022
1024
|
nowMs?: number;
|
|
1023
1025
|
/**
|
|
1024
1026
|
* Server-resolved identity of the run asking (see
|
|
@@ -1029,6 +1031,41 @@ type RateStateAcquireInput = PlayRunnerRateStateAcquireInput & {
|
|
|
1029
1031
|
requesterId?: string | null;
|
|
1030
1032
|
};
|
|
1031
1033
|
|
|
1034
|
+
/** Selected diagnostic only: no additional read or state mutation. */
|
|
1035
|
+
function governorSnapshotSelectSql(
|
|
1036
|
+
input: RateStateAcquireInput,
|
|
1037
|
+
concurrency: boolean,
|
|
1038
|
+
): string {
|
|
1039
|
+
if (!input.includeGovernorSnapshot) return '';
|
|
1040
|
+
return `,
|
|
1041
|
+
(SELECT jsonb_build_object(
|
|
1042
|
+
'previousRefillPerSecond', previous_refill_per_sec,
|
|
1043
|
+
'previousRateSuccesses', previous_rate_successes,
|
|
1044
|
+
'previousObservationStartedAtMs', previous_observation_started_at_ms,
|
|
1045
|
+
'previousRecoveryIntervalMs', previous_recovery_interval_ms,
|
|
1046
|
+
'previousThrottleCeilingRps', previous_throttle_ceiling_rps,
|
|
1047
|
+
'fastRecovery', fast_recovery,
|
|
1048
|
+
'tokensAfterRefill', tokens_after_refill,
|
|
1049
|
+
'refillPerSecond', refill_per_sec,
|
|
1050
|
+
'tokens', tokens,
|
|
1051
|
+
'rateSuccesses', rate_successes,
|
|
1052
|
+
'observationStartedAtMs', rate_observation_started_at_ms,
|
|
1053
|
+
'recoveryIntervalMs', rate_recovery_interval_ms,
|
|
1054
|
+
'throttleCeilingRps', rate_throttle_ceiling_rps,
|
|
1055
|
+
'probeStartedAtMs', rate_probe_started_at_ms,
|
|
1056
|
+
'probeSuccessesAtRamp', rate_probe_successes_at_ramp,
|
|
1057
|
+
'lastRampAtMs', last_ramp_at_ms,
|
|
1058
|
+
'refilledAtMs', refilled_at_ms,
|
|
1059
|
+
'nextDispatchAtMs', next_dispatch_at_ms,
|
|
1060
|
+
'retryAtMs', retry_at_ms,
|
|
1061
|
+
'coolUntilMs', cool_until_ms,
|
|
1062
|
+
'seenBackpressure', seen_backpressure,
|
|
1063
|
+
'activeConcurrency', ${concurrency ? '(SELECT active_count FROM concurrency_context)' : 'NULL::int'},
|
|
1064
|
+
'freeConcurrency', ${concurrency ? '(SELECT free FROM free_slots)' : 'NULL::int'},
|
|
1065
|
+
'concurrencyLimit', ${concurrency ? '(SELECT MIN(max_concurrency) FROM limits)' : 'NULL::int'}
|
|
1066
|
+
) FROM updated_scope) AS governor_snapshot`;
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1032
1069
|
/**
|
|
1033
1070
|
* Fair-share identity for a rate-state acquire. A provider bucket can be shared
|
|
1034
1071
|
* by many runs (and, for a fleet-managed credential, many organizations), so
|
|
@@ -1406,6 +1443,7 @@ async function acquirePureRate(
|
|
|
1406
1443
|
scheduled_at_ms: Array<string | number> | null;
|
|
1407
1444
|
reservation_ids: string[] | null;
|
|
1408
1445
|
effective_rps: string | number;
|
|
1446
|
+
governor_snapshot?: PlayRunnerRateStateGovernorSnapshot | null;
|
|
1409
1447
|
}>(
|
|
1410
1448
|
client,
|
|
1411
1449
|
(probeBaselineSupported) => `
|
|
@@ -1595,7 +1633,7 @@ async function acquirePureRate(
|
|
|
1595
1633
|
GREATEST(1, FLOOR(MIN(next_refill_per_sec) / 100.0))::bigint AS burst_size
|
|
1596
1634
|
FROM refreshed
|
|
1597
1635
|
),
|
|
1598
|
-
${updateRateScopeSql(scopeHoldTableName(input), unknownProvider, probeBaselineSupported)},
|
|
1636
|
+
${updateRateScopeSql(scopeHoldTableName(input), unknownProvider, probeBaselineSupported, input.includeGovernorSnapshot === true)},
|
|
1599
1637
|
updated AS (
|
|
1600
1638
|
UPDATE ${bucketTableName(input)} b
|
|
1601
1639
|
SET
|
|
@@ -1692,7 +1730,7 @@ async function acquirePureRate(
|
|
|
1692
1730
|
WHERE bucket_id = $1 AND rule_id = ANY($2::text[])),
|
|
1693
1731
|
(SELECT retry_at_ms FROM provider_hold)
|
|
1694
1732
|
) AS claimed_retry_at_ms,
|
|
1695
|
-
(SELECT COALESCE(MIN(new_refill_per_sec), 0) FROM updated) AS effective_rps,
|
|
1733
|
+
(SELECT COALESCE(MIN(new_refill_per_sec), 0) FROM updated) AS effective_rps${governorSnapshotSelectSql(input, false)},
|
|
1696
1734
|
CASE
|
|
1697
1735
|
WHEN (SELECT granted FROM grant_calc) > 0 THEN ARRAY(
|
|
1698
1736
|
SELECT
|
|
@@ -1813,6 +1851,9 @@ async function acquirePureRate(
|
|
|
1813
1851
|
reservationIds: granted > 0 ? reservationIds : [],
|
|
1814
1852
|
scheduledAtMs,
|
|
1815
1853
|
effectiveRequestsPerSecond,
|
|
1854
|
+
...(input.includeGovernorSnapshot && row.governor_snapshot
|
|
1855
|
+
? { governorSnapshot: row.governor_snapshot }
|
|
1856
|
+
: {}),
|
|
1816
1857
|
coolUntilMs,
|
|
1817
1858
|
claimedRetryAtMs,
|
|
1818
1859
|
};
|
|
@@ -1989,6 +2030,7 @@ async function grantWithConcurrency(
|
|
|
1989
2030
|
concurrency_grants: unknown[] | null;
|
|
1990
2031
|
scheduled_at_ms: Array<string | number> | null;
|
|
1991
2032
|
effective_rps: string | number;
|
|
2033
|
+
governor_snapshot?: PlayRunnerRateStateGovernorSnapshot | null;
|
|
1992
2034
|
}>(
|
|
1993
2035
|
`
|
|
1994
2036
|
WITH now_value AS (
|
|
@@ -2248,7 +2290,7 @@ async function grantWithConcurrency(
|
|
|
2248
2290
|
GREATEST(1, FLOOR(MIN(next_refill_per_sec) / 100.0))::bigint AS burst_size
|
|
2249
2291
|
FROM refreshed
|
|
2250
2292
|
),
|
|
2251
|
-
${updateRateScopeSql(scopeHoldTableName(input), unknownProvider, probeBaselineSupported)},
|
|
2293
|
+
${updateRateScopeSql(scopeHoldTableName(input), unknownProvider, probeBaselineSupported, input.includeGovernorSnapshot === true)},
|
|
2252
2294
|
updated AS (
|
|
2253
2295
|
UPDATE ${bucketTableName(input)} b
|
|
2254
2296
|
SET
|
|
@@ -2371,7 +2413,7 @@ async function grantWithConcurrency(
|
|
|
2371
2413
|
WHERE bucket_id = $1 AND rule_id = ANY($2::text[])),
|
|
2372
2414
|
(SELECT retry_at_ms FROM provider_hold)
|
|
2373
2415
|
) AS claimed_retry_at_ms,
|
|
2374
|
-
(SELECT COALESCE(MIN(new_refill_per_sec), 0) FROM updated) AS effective_rps,
|
|
2416
|
+
(SELECT COALESCE(MIN(new_refill_per_sec), 0) FROM updated) AS effective_rps${governorSnapshotSelectSql(input, true)},
|
|
2375
2417
|
CASE
|
|
2376
2418
|
WHEN (SELECT granted FROM grant_calc) > 0 THEN ARRAY(
|
|
2377
2419
|
SELECT
|
|
@@ -2539,6 +2581,9 @@ async function grantWithConcurrency(
|
|
|
2539
2581
|
reservationIds: granted > 0 ? leaseIds : [],
|
|
2540
2582
|
scheduledAtMs,
|
|
2541
2583
|
effectiveRequestsPerSecond,
|
|
2584
|
+
...(input.includeGovernorSnapshot && row.governor_snapshot
|
|
2585
|
+
? { governorSnapshot: row.governor_snapshot }
|
|
2586
|
+
: {}),
|
|
2542
2587
|
coolUntilMs,
|
|
2543
2588
|
claimedRetryAtMs,
|
|
2544
2589
|
};
|
|
@@ -2628,10 +2673,10 @@ export async function validatePostgresRateStatePermit(
|
|
|
2628
2673
|
}
|
|
2629
2674
|
|
|
2630
2675
|
/**
|
|
2631
|
-
* Space unknown-provider sends after app
|
|
2632
|
-
* delays can collapse
|
|
2633
|
-
* the only learner; this internal rule row stores only
|
|
2634
|
-
*
|
|
2676
|
+
* Space unknown-provider and backpressured declared-provider sends after app
|
|
2677
|
+
* preparation, where network/charge delays can collapse spaced permits. The
|
|
2678
|
+
* existing scope remains the only learner; this internal rule row stores only
|
|
2679
|
+
* the physical cadence. Uninitialized and pristine declared scopes stay hold-only.
|
|
2635
2680
|
*/
|
|
2636
2681
|
export async function claimPostgresProviderDispatch(
|
|
2637
2682
|
client: PostgresSchedulerQueryClient,
|
|
@@ -2662,7 +2707,10 @@ export async function claimPostgresProviderDispatch(
|
|
|
2662
2707
|
SELECT h.retry_at_ms, h.cool_until_ms, h.seen_backpressure,
|
|
2663
2708
|
CASE WHEN EXISTS (
|
|
2664
2709
|
SELECT 1 FROM ${bucketTableName(input)} b
|
|
2665
|
-
WHERE b.bucket_id = h.bucket_id AND
|
|
2710
|
+
WHERE b.bucket_id = h.bucket_id AND (
|
|
2711
|
+
b.rule_id = 'default:provider-scope'
|
|
2712
|
+
OR (h.seen_backpressure AND b.rule_id <> '${PHYSICAL_DISPATCH_RULE_ID}')
|
|
2713
|
+
)
|
|
2666
2714
|
) THEN h.refill_per_sec ELSE NULL END AS physical_rps
|
|
2667
2715
|
FROM ${scopeHoldTableName(input)} h WHERE h.bucket_id = $1
|
|
2668
2716
|
FOR SHARE OF h
|
|
@@ -3615,13 +3663,14 @@ async function penalizeRateStateStatements(
|
|
|
3615
3663
|
SELECT h.*,
|
|
3616
3664
|
COALESCE(h.refill_per_sec, 1) AS refill_before,
|
|
3617
3665
|
-- A productive unknown-provider probe establishes useful capacity.
|
|
3666
|
+
-- Successful work proves useful capacity even below the discovery seed.
|
|
3618
3667
|
-- Preserve 90% of its target instead of discarding half after each
|
|
3619
3668
|
-- exploratory overshoot. Failed or sparse probes keep the stronger
|
|
3620
3669
|
-- decrease and no-progress policy. Prefer the attempt's active rules.
|
|
3621
3670
|
-- Early app feedback carries no rules: only an exclusively unknown
|
|
3622
3671
|
-- durable seed can select this policy, not an obsolete default row
|
|
3623
3672
|
-- beside declared operation rows.
|
|
3624
|
-
h.unknown_provider
|
|
3673
|
+
h.unknown_provider
|
|
3625
3674
|
AND h.rate_successes >= ${DEFAULT_UNKNOWN_PROVIDER_COLD_START_RPS}
|
|
3626
3675
|
AS productive_unknown_probe,
|
|
3627
3676
|
GREATEST(h.retry_at_ms, COALESCE($5::bigint, nv.now_ms + $2::bigint)) AS deadline,
|