deepline 0.3.484 → 0.3.486
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/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/ledger-safe-payload.ts +8 -4
- 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 +139 -67
- 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 +206 -7
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd.ts +39 -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 +28 -9
- 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 +656 -64
- 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 +25 -33
- 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/cli/auth-ARKH3OAU.js +43 -0
- package/dist/cli/{auth-EBFOTF7X.mjs → auth-B4DJO4FB.mjs} +5 -5
- package/dist/cli/{billing-G2G3EF3I.js → billing-GDWAMARK.js} +80 -80
- package/dist/cli/{billing-2ZOIMW5V.mjs → billing-IIQ3VNXU.mjs} +7 -7
- package/dist/cli/{chunk-YWC5AN26.mjs → chunk-2DVFQYPG.mjs} +62 -34
- package/dist/cli/{chunk-UWOY74RU.js → chunk-5DUP4ZUE.js} +21 -21
- package/dist/cli/{chunk-EACX7QXO.mjs → chunk-5QYZ4MEW.mjs} +2 -2
- package/dist/cli/{chunk-HEI3BWIV.mjs → chunk-5RLVCOKH.mjs} +1 -1
- package/dist/cli/{chunk-TIRSKEZH.mjs → chunk-5Y7LLRWO.mjs} +1 -1
- package/dist/cli/{chunk-IXWQOVNW.js → chunk-5YILTBF7.js} +87 -76
- package/dist/cli/{chunk-OHKKDPA5.js → chunk-7FTQKEZ6.js} +13 -13
- package/dist/cli/{chunk-TN2GW57M.mjs → chunk-A456YVDE.mjs} +1 -1
- package/dist/cli/{chunk-GVAENVIG.js → chunk-AUQQVDAB.js} +110 -21
- package/dist/cli/{chunk-3XQIVEAT.js → chunk-BJL7RYQN.js} +3 -3
- package/dist/cli/{chunk-2AWYJXBX.js → chunk-BNB2RK4L.js} +5 -5
- package/dist/cli/{chunk-U7IJAGWB.js → chunk-BYEDI5PM.js} +7 -7
- package/dist/cli/{chunk-RLLEH2SP.js → chunk-C4GFBB52.js} +26 -26
- package/dist/cli/{chunk-AK7UKQ5R.js → chunk-CSBMKHTV.js} +5 -5
- package/dist/cli/{chunk-UT4YMA2N.js → chunk-DFHS5XVZ.js} +5 -4
- package/dist/cli/{chunk-XZXIWPT3.mjs → chunk-F3G2HAUQ.mjs} +1 -1
- package/dist/cli/{chunk-C62NI2X6.js → chunk-FCAKAW6S.js} +5 -5
- package/dist/cli/{chunk-AF7MOUZP.mjs → chunk-FGPJXQEJ.mjs} +2 -2
- package/dist/cli/chunk-FSCOYTRV.js +42 -0
- package/dist/cli/{chunk-6GRZEYSG.js → chunk-GCEUOHJW.js} +7 -7
- 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-QIDDTIVZ.js → chunk-KPIVQFXZ.js} +322 -294
- package/dist/cli/{chunk-4IOY2SCQ.js → chunk-LOX3BISD.js} +4 -4
- package/dist/cli/{chunk-WYUCDLVR.mjs → chunk-MJ56FCYU.mjs} +2 -1
- package/dist/cli/{chunk-DBJ62RAO.js → chunk-NSPMJLYA.js} +3 -3
- package/dist/cli/{chunk-HNRELVCS.mjs → chunk-ONONSV2Q.mjs} +96 -7
- package/dist/cli/{chunk-PU52JXKA.mjs → chunk-P6KGYOCM.mjs} +13 -4
- package/dist/cli/{chunk-VEVGM6B5.js → chunk-PCYZDTDC.js} +14 -14
- package/dist/cli/{chunk-NW4QJE54.js → chunk-PHWFY26F.js} +2 -2
- package/dist/cli/{chunk-LTZXLYKE.mjs → chunk-PKOFEHZL.mjs} +93 -17
- package/dist/cli/{chunk-7K5CWKKZ.mjs → chunk-PQHDZHZG.mjs} +2 -2
- package/dist/cli/{chunk-UKM74PAA.js → chunk-PTM3QRAT.js} +37 -37
- package/dist/cli/{chunk-YGN77QA5.mjs → chunk-PV7AYBKQ.mjs} +3 -3
- package/dist/cli/{chunk-4OEOM6GP.mjs → chunk-PYDHVRAF.mjs} +5 -5
- package/dist/cli/{chunk-FRD5WFT4.js → chunk-QD22TY33.js} +323 -247
- package/dist/cli/{chunk-5KNRQWHE.js → chunk-QEQ3KHVY.js} +3 -3
- package/dist/cli/{chunk-KGOC6HGI.js → chunk-S5EYODEG.js} +53 -53
- package/dist/cli/{chunk-FQK7BULS.js → chunk-S7OILDJH.js} +1 -1
- package/dist/cli/{chunk-TRLDJNVE.mjs → chunk-T3Q6BMVH.mjs} +1 -1
- package/dist/cli/{chunk-5K5CAND4.mjs → chunk-TBE2K5W4.mjs} +4 -4
- package/dist/cli/{chunk-YHA3EV3I.mjs → chunk-TE2QT2MX.mjs} +15 -4
- package/dist/cli/{chunk-ZOKM7DVA.js → chunk-TNHY3ATN.js} +8 -8
- package/dist/cli/{chunk-4OVHIWE7.mjs → chunk-U23L57VU.mjs} +2 -2
- package/dist/cli/{chunk-5GOG5ZGC.mjs → chunk-UEJLWUJ3.mjs} +2 -2
- package/dist/cli/{chunk-6NPWXE32.mjs → chunk-VJLL5XIP.mjs} +1 -1
- package/dist/cli/{chunk-WXRM3UC6.mjs → chunk-WCOJH4W4.mjs} +3 -3
- package/dist/cli/{chunk-4SFC2XUF.mjs → chunk-XAZWUW6I.mjs} +5 -5
- 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-V7JCMBLU.mjs → chunk-YIKHNZ6B.mjs} +4 -4
- package/dist/cli/{chunk-M4PG7FGC.js → chunk-YS6JOYYS.js} +2 -2
- package/dist/cli/{chunk-DEXSQGXB.mjs → chunk-ZMRZ3BXG.mjs} +5 -5
- package/dist/cli/{chunk-CYWBAV5H.js → chunk-ZQI26KE4.js} +16 -16
- package/dist/cli/{csv-S3CHUKI6.js → csv-3PSMPZM5.js} +13 -13
- package/dist/cli/{csv-NLWVWD3H.mjs → csv-LFCT3WQ4.mjs} +4 -4
- package/dist/cli/{db-OGRPAEEM.mjs → db-HULKVAMU.mjs} +7 -7
- package/dist/cli/{db-WBSKMMOH.js → db-R7I2PPTV.js} +28 -28
- package/dist/cli/{describe-FAD3Z7LN.mjs → describe-D55V42LH.mjs} +21 -21
- package/dist/cli/describe-H47BLOEP.js +49 -0
- 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-LYCL344R.mjs → executions-ICVVOYVG.mjs} +7 -7
- package/dist/cli/{executions-SOAZHCY4.js → executions-O37FN2SK.js} +9 -9
- package/dist/cli/{feedback-AVF6V7SV.mjs → feedback-3K3QPGCQ.mjs} +4 -4
- package/dist/cli/{feedback-OROUPUNJ.js → feedback-MAZQ7C6S.js} +8 -8
- package/dist/cli/{git-J5N5M57H.mjs → git-2MMD5KJS.mjs} +5 -5
- package/dist/cli/git-RQ2XLFYZ.js +25 -0
- package/dist/cli/index.js +142 -139
- package/dist/cli/index.mjs +45 -42
- package/dist/cli/{legacy-noops-QAQMZMEG.js → legacy-noops-2OX2Y3Y2.js} +8 -8
- package/dist/cli/{legacy-noops-ENRRM7BL.mjs → legacy-noops-VLSWJ6VE.mjs} +5 -5
- package/dist/cli/{monitors-CKQ65WRL.mjs → monitors-2NODQQWG.mjs} +8 -8
- package/dist/cli/{monitors-SFMQ5LFR.js → monitors-UCSV5FOR.js} +92 -92
- package/dist/cli/{org-3UNTDLT2.js → org-4YY73VTW.js} +73 -73
- package/dist/cli/{org-K4UIEU5P.mjs → org-W7AUQCDE.mjs} +7 -7
- package/dist/cli/{pages-NKZTGB4C.js → pages-FBZEUMXK.js} +18 -18
- package/dist/cli/{pages-6GPGBIAH.mjs → pages-ZRP7U5PO.mjs} +7 -7
- package/dist/cli/{play-BDEADESI.js → play-LFCTQJXA.js} +858 -632
- package/dist/cli/{play-62BEE7IX.mjs → play-XF2BSGTP.mjs} +372 -146
- package/dist/cli/{providers-SXGP44GH.js → providers-5456JNHP.js} +10 -10
- package/dist/cli/{providers-X3CUWMFP.mjs → providers-SICAPKGI.mjs} +7 -7
- package/dist/cli/{quickstart-XQ4426M4.js → quickstart-2KLLIPIU.js} +6 -6
- package/dist/cli/{quickstart-7LN22BKX.mjs → quickstart-IBVG6GX6.mjs} +4 -4
- package/dist/cli/{run-PBJ4ZJ4W.js → run-DNLDGJRC.js} +41 -41
- package/dist/cli/{run-XXSN3B5A.mjs → run-XPIZIQ7H.mjs} +26 -26
- package/dist/cli/search-2KQA65LH.js +32 -0
- package/dist/cli/{search-M75VMADD.mjs → search-PW22AEAL.mjs} +8 -8
- package/dist/cli/{search-output-F6HCFYEI.js → search-output-H6F6QMRF.js} +22 -16
- package/dist/cli/{search-output-NUQAKWDM.mjs → search-output-JFD53H2N.mjs} +14 -8
- package/dist/cli/{secrets-J2H6V33R.mjs → secrets-542CTZRZ.mjs} +7 -7
- package/dist/cli/{secrets-LRYY4QPE.js → secrets-LCCRRAN7.js} +16 -16
- package/dist/cli/{sessions-YPF62CZE.js → sessions-5FYDQE3N.js} +6 -6
- package/dist/cli/{sessions-IMT336UV.mjs → sessions-CALLS2XD.mjs} +5 -5
- package/dist/cli/{settings-PDWVQIGH.mjs → settings-GSKPHUEC.mjs} +12 -12
- package/dist/cli/{settings-35YYC5WA.js → settings-ORGKOBP6.js} +79 -79
- package/dist/cli/{setup-UR7GOR7H.js → setup-4BUWJKB6.js} +47 -47
- package/dist/cli/{setup-DG5DISSE.mjs → setup-V57GHVAF.mjs} +9 -9
- package/dist/cli/skills-KYZPPGSN.js +33 -0
- package/dist/cli/{skills-U6NJD5J7.mjs → skills-NGLCFQFT.mjs} +7 -7
- package/dist/cli/tools-AFYXUEMD.js +56 -0
- package/dist/cli/{tools-2HGEOELR.mjs → tools-G2YNCFNX.mjs} +19 -19
- package/dist/cli/{update-FRAYBAHK.mjs → update-IZ3Z5T5C.mjs} +9 -9
- package/dist/cli/update-T6JJ7A3K.js +33 -0
- package/dist/cli/{workflow-JKKLOMBX.js → workflow-7AHST2XV.js} +18 -18
- package/dist/cli/{workflow-DDKVTF36.mjs → workflow-L7ROQIM7.mjs} +8 -8
- 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 +117 -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-L5CSV3UO.js +0 -43
- package/dist/cli/chunk-KA2LNIUP.js +0 -33
- package/dist/cli/describe-UIAYCHWW.js +0 -49
- package/dist/cli/git-ATMWC27D.js +0 -25
- package/dist/cli/search-IGHLRLBD.js +0 -32
- package/dist/cli/skills-4U5WC4MJ.js +0 -33
- package/dist/cli/tools-PYJTQVVS.js +0 -56
- package/dist/cli/update-344OTRFM.js +0 -33
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';
|
|
@@ -294,15 +295,8 @@ function shouldPublishTerminalResultLog(
|
|
|
294
295
|
line: string,
|
|
295
296
|
): boolean {
|
|
296
297
|
// Direct workers keep host lifecycle noise out of the customer Run Log
|
|
297
|
-
// Stream.
|
|
298
|
-
|
|
299
|
-
// after the runner has gone away and the normal terminal result is no longer
|
|
300
|
-
// available through the status projection.
|
|
301
|
-
return (
|
|
302
|
-
mode !== 'direct_worker' ||
|
|
303
|
-
CTX_LOG_TIMESTAMP_PREFIX_RE.test(line) ||
|
|
304
|
-
line.startsWith('[runtime.phase_summary] ')
|
|
305
|
-
);
|
|
298
|
+
// Stream. Runtime measurements travel as structured stats, not log lines.
|
|
299
|
+
return mode !== 'direct_worker' || CTX_LOG_TIMESTAMP_PREFIX_RE.test(line);
|
|
306
300
|
}
|
|
307
301
|
|
|
308
302
|
type TerminalLogReplayPayload = NonNullable<
|
|
@@ -508,6 +502,12 @@ export function createPostgresSchedulerProgressReporter(input: {
|
|
|
508
502
|
status: 'running' | 'completed' | 'failed';
|
|
509
503
|
force: boolean;
|
|
510
504
|
required: boolean;
|
|
505
|
+
/**
|
|
506
|
+
* Live progress asks Run Ledger intake to fence on this attempt. Any
|
|
507
|
+
* finalize of a runner result is not live: it is designed to land after
|
|
508
|
+
* the terminal, so a merged upload that includes one is not live either.
|
|
509
|
+
*/
|
|
510
|
+
liveProgress: boolean;
|
|
511
511
|
terminalLogReplay: TerminalLogReplayPayload | null;
|
|
512
512
|
waiters: Array<{
|
|
513
513
|
resolve: () => void;
|
|
@@ -532,6 +532,7 @@ export function createPostgresSchedulerProgressReporter(input: {
|
|
|
532
532
|
: (current?.status ?? next.status),
|
|
533
533
|
force: next.force || current?.force === true,
|
|
534
534
|
required: next.required || current?.required === true,
|
|
535
|
+
liveProgress: next.liveProgress && current?.liveProgress !== false,
|
|
535
536
|
terminalLogReplay:
|
|
536
537
|
next.terminalLogReplay ?? current?.terminalLogReplay ?? null,
|
|
537
538
|
waiters: [...(current?.waiters ?? []), waiter],
|
|
@@ -648,6 +649,7 @@ export function createPostgresSchedulerProgressReporter(input: {
|
|
|
648
649
|
? { liveLogBatchOffset: nextLogTotalCount - nextLogs.length }
|
|
649
650
|
: {}),
|
|
650
651
|
liveLogProducerAttempt: producerAttempt,
|
|
652
|
+
...(request.liveProgress ? { liveProgress: true } : {}),
|
|
651
653
|
datasetLifecycleEvents: nextDatasetLifecycleEvents,
|
|
652
654
|
activityObservations: nextActivityObservations,
|
|
653
655
|
workCounters: nextWorkCounters,
|
|
@@ -657,11 +659,24 @@ export function createPostgresSchedulerProgressReporter(input: {
|
|
|
657
659
|
}
|
|
658
660
|
request.waiters.forEach(({ resolve }) => resolve());
|
|
659
661
|
} catch (error) {
|
|
662
|
+
// Keep observations for a later unfenced finalize either way.
|
|
660
663
|
requeueProgressEvents({
|
|
661
664
|
datasetLifecycleEvents: nextDatasetLifecycleEvents,
|
|
662
665
|
activityObservations: nextActivityObservations,
|
|
663
666
|
});
|
|
664
667
|
workCountersDirty = true;
|
|
668
|
+
if (isRunnerProgressAttemptSupersededResponse(error)) {
|
|
669
|
+
// Intake's commit-time fence found this attempt no longer
|
|
670
|
+
// current, as the read above would have a moment later. Settle
|
|
671
|
+
// the live upload like that branch does instead of failing a
|
|
672
|
+
// required flush: the terminal tail carries any in-flight lines.
|
|
673
|
+
console.info('[postgres-scheduler.progress_attempt_superseded]', {
|
|
674
|
+
runId: launch.runId,
|
|
675
|
+
attempt: producerAttempt ?? null,
|
|
676
|
+
});
|
|
677
|
+
request.waiters.forEach(({ resolve }) => resolve());
|
|
678
|
+
continue;
|
|
679
|
+
}
|
|
665
680
|
console.warn('[postgres-scheduler.progress_flush_failed]', {
|
|
666
681
|
runId: launch.runId,
|
|
667
682
|
error: error instanceof Error ? error.message : String(error),
|
|
@@ -685,6 +700,7 @@ export function createPostgresSchedulerProgressReporter(input: {
|
|
|
685
700
|
status?: 'running' | 'completed' | 'failed';
|
|
686
701
|
required?: boolean;
|
|
687
702
|
terminalLogReplay?: TerminalLogReplayPayload | null;
|
|
703
|
+
liveProgress?: boolean;
|
|
688
704
|
}): Promise<void> => {
|
|
689
705
|
const force = input?.force === true;
|
|
690
706
|
const status = input?.status ?? 'running';
|
|
@@ -732,6 +748,7 @@ export function createPostgresSchedulerProgressReporter(input: {
|
|
|
732
748
|
force,
|
|
733
749
|
required,
|
|
734
750
|
terminalLogReplay: input?.terminalLogReplay ?? null,
|
|
751
|
+
liveProgress: input?.liveProgress !== false,
|
|
735
752
|
},
|
|
736
753
|
{ resolve, reject },
|
|
737
754
|
);
|
|
@@ -1744,6 +1761,8 @@ export function createPostgresSchedulerProgressReporter(input: {
|
|
|
1744
1761
|
await flush({
|
|
1745
1762
|
force: true,
|
|
1746
1763
|
status,
|
|
1764
|
+
// Only the gateway's per-request ingest finalizes without a result.
|
|
1765
|
+
liveProgress: result == null,
|
|
1747
1766
|
required:
|
|
1748
1767
|
options.required === true ||
|
|
1749
1768
|
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,
|