deepline 0.3.580 → 0.3.581
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/release.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +42 -2
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/early-sandbox.ts +49 -11
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/early-sandbox-lane.ts +13 -4
- package/dist/bundling-sources/shared_libs/play-runtime/transient-service-error.ts +12 -0
- package/dist/bundling-sources/shared_libs/plays/sandbox-runtime-limits.ts +20 -0
- package/dist/cli/{agents-BF5VX5ZB.js → agents-UDTRMWPA.js} +81 -39
- package/dist/cli/{agents-JRFTZE7G.mjs → agents-VDQSVDSM.mjs} +51 -9
- package/dist/cli/{auth-XJXZ64R4.mjs → auth-SRN5FXUQ.mjs} +5 -5
- package/dist/cli/auth-UYQHRHYR.js +44 -0
- package/dist/cli/{billing-VGMTJI7W.js → billing-HGHIOFSA.js} +111 -111
- package/dist/cli/{billing-TXJBGP2I.mjs → billing-PR2SIEJM.mjs} +11 -11
- package/dist/cli/{chunk-IG3CXIJY.mjs → chunk-2MIJMDGF.mjs} +1 -1
- package/dist/cli/{chunk-2ZCFAUCV.js → chunk-2RLMHWXW.js} +3 -3
- package/dist/cli/{chunk-IM322G7M.mjs → chunk-3FMGBMT3.mjs} +1 -1
- package/dist/cli/{chunk-SQBSK74D.mjs → chunk-3I6GA5QW.mjs} +1 -1
- package/dist/cli/{chunk-XFVJ3JNA.js → chunk-3LP7J63L.js} +5 -5
- package/dist/cli/{chunk-H3B6QM6V.mjs → chunk-46EBSUZF.mjs} +3 -3
- package/dist/cli/{chunk-WJUAVMQC.js → chunk-5XVDZVCR.js} +8 -8
- package/dist/cli/{chunk-COAAKSFX.js → chunk-6U3THMRI.js} +5 -5
- package/dist/cli/{chunk-LRZGS6RZ.mjs → chunk-7MMEW2WU.mjs} +1 -1
- package/dist/cli/{chunk-URZPR54R.js → chunk-7VOSQARZ.js} +6 -6
- package/dist/cli/{chunk-ZADJC22U.js → chunk-A4IOPFEJ.js} +3 -3
- package/dist/cli/{chunk-IERWFFDB.mjs → chunk-ALXIC5U5.mjs} +5 -5
- package/dist/cli/{chunk-EI7KTESB.mjs → chunk-BDNQDWGI.mjs} +2 -2
- package/dist/cli/{chunk-3OSNEWGR.js → chunk-BQL34VOQ.js} +100 -100
- package/dist/cli/{chunk-APJ7IPRT.js → chunk-BULUFFST.js} +15 -15
- package/dist/cli/{chunk-GE4ZEMMA.mjs → chunk-CDIMI54H.mjs} +2 -2
- package/dist/cli/{chunk-ANX3PYLT.js → chunk-CN4MXBZ3.js} +13 -13
- package/dist/cli/{chunk-R77IVVEZ.js → chunk-CNRPE3AE.js} +53 -53
- package/dist/cli/{chunk-O7AWGIDD.mjs → chunk-DZMQV5FL.mjs} +2 -2
- package/dist/cli/{chunk-HEZ24K5F.js → chunk-E2EGQNOS.js} +2 -2
- package/dist/cli/{chunk-MCYZO3RB.js → chunk-E5ITZIWK.js} +16 -16
- package/dist/cli/{chunk-LC4ETCOA.mjs → chunk-E5O4CMHZ.mjs} +2 -2
- package/dist/cli/{chunk-MEDA3STC.mjs → chunk-EHTD65FE.mjs} +1 -1
- package/dist/cli/{chunk-E2G2DNAB.js → chunk-EP3GZAHK.js} +7 -7
- package/dist/cli/{chunk-MBOPKQJF.js → chunk-FXSDDEAR.js} +1 -1
- package/dist/cli/{chunk-TSOXJZSW.js → chunk-INRXX4SX.js} +41 -41
- package/dist/cli/{chunk-MP6XUVAJ.mjs → chunk-INXRW5AF.mjs} +2 -2
- package/dist/cli/{chunk-GDBNH57Z.js → chunk-IT3F7P6O.js} +10 -10
- package/dist/cli/{chunk-XQUVLYOL.js → chunk-J6ITN2X6.js} +7 -7
- package/dist/cli/{chunk-D6I7QWOZ.js → chunk-JQK42HZQ.js} +2 -2
- package/dist/cli/{chunk-NV5IJ3NY.mjs → chunk-KDITCSPN.mjs} +21 -1
- package/dist/cli/{chunk-Z6DERGHY.js → chunk-KO6OLYSD.js} +48 -48
- package/dist/cli/{chunk-YY6EB252.js → chunk-LJZESBNY.js} +2 -2
- package/dist/cli/{chunk-VOQWPUIF.js → chunk-MSCYYFLY.js} +20 -20
- package/dist/cli/{chunk-7ORX33JX.mjs → chunk-N5VJVVVV.mjs} +5 -5
- package/dist/cli/{chunk-LHV3HPAY.js → chunk-O5FIWG2O.js} +26 -26
- package/dist/cli/{chunk-U4VCAECC.mjs → chunk-OVJWDFIL.mjs} +1 -1
- package/dist/cli/{chunk-BAXLPQTM.mjs → chunk-P5ZZY4RM.mjs} +4 -4
- package/dist/cli/{chunk-PFNYLTCZ.js → chunk-PLGJG5FX.js} +5 -5
- package/dist/cli/{chunk-FCJJPEKN.mjs → chunk-RA3BWUTD.mjs} +5 -5
- package/dist/cli/{chunk-6VSUP4WN.js → chunk-SNYH4QY2.js} +4 -4
- package/dist/cli/{chunk-7HOG3JZE.mjs → chunk-SZ76UE7C.mjs} +11 -11
- package/dist/cli/{chunk-3ZBPXNSW.mjs → chunk-ULU4MEXN.mjs} +2 -2
- package/dist/cli/{chunk-V5NDHTBB.js → chunk-VJR4CKYJ.js} +23 -23
- package/dist/cli/{chunk-3P4QZIJ5.mjs → chunk-VNW454PP.mjs} +1 -1
- package/dist/cli/{chunk-ZR7PDXIA.mjs → chunk-VTPMBOHZ.mjs} +2 -2
- package/dist/cli/{chunk-GIZIWNL5.mjs → chunk-VVENTTSA.mjs} +1 -1
- package/dist/cli/{chunk-NNWEQDZR.js → chunk-VWPM4OIC.js} +20 -20
- package/dist/cli/{chunk-5BPJW6X5.mjs → chunk-WCNJSZHC.mjs} +5 -5
- package/dist/cli/{chunk-C6YXUGX2.mjs → chunk-WS5ZX4RB.mjs} +3 -3
- package/dist/cli/{chunk-VF3EGTHU.mjs → chunk-WVFDPC4K.mjs} +3 -3
- package/dist/cli/{chunk-AZTQJJH7.js → chunk-Y36SQMSN.js} +22 -2
- package/dist/cli/{chunk-HLMF53HZ.mjs → chunk-YTPXKG4C.mjs} +1 -1
- package/dist/cli/{chunk-X5RXG6VS.mjs → chunk-Z3MJX3PP.mjs} +1 -1
- package/dist/cli/{chunk-DQEHBAHL.js → chunk-ZAKNDIK7.js} +9 -9
- package/dist/cli/{chunk-BK4Z62CF.mjs → chunk-ZTKLJADJ.mjs} +4 -4
- package/dist/cli/command-docs.js +4 -4
- package/dist/cli/command-docs.mjs +3 -3
- package/dist/cli/concurrent-runs-help-QWDTLZUX.js +22 -0
- package/dist/cli/{concurrent-runs-help-DSUQRWZQ.mjs → concurrent-runs-help-Z27MIIH3.mjs} +6 -6
- package/dist/cli/{csv-HSHF6JYZ.js → csv-4TP36F5O.js} +13 -13
- package/dist/cli/{csv-QNXJBT5T.mjs → csv-4YFTMVWQ.mjs} +4 -4
- package/dist/cli/{db-VHYWVLLU.js → db-L5EGGO72.js} +27 -27
- package/dist/cli/{db-RAWY3SWS.mjs → db-U5KR6SYI.mjs} +6 -6
- package/dist/cli/describe-G3SUS76P.js +50 -0
- package/dist/cli/{describe-WZOVHWAM.mjs → describe-LZXXSQ26.mjs} +18 -18
- package/dist/cli/{executions-DQIFH4Z6.js → executions-VZKRFDGM.js} +8 -8
- package/dist/cli/{executions-QABOXV4K.mjs → executions-ZWEC5DDR.mjs} +6 -6
- package/dist/cli/{feedback-6IER2W4G.js → feedback-BTJIJCQF.js} +14 -14
- package/dist/cli/{feedback-DW4O63DG.mjs → feedback-HXQTHXEZ.mjs} +6 -6
- package/dist/cli/{git-3NAPGZGR.mjs → git-P6A45MMT.mjs} +5 -5
- package/dist/cli/git-QU673DBV.js +26 -0
- package/dist/cli/index.js +150 -150
- package/dist/cli/index.mjs +49 -49
- package/dist/cli/{integrations-TSRUTENK.mjs → integrations-4POM2CJ3.mjs} +7 -7
- package/dist/cli/{integrations-5LHIBBXB.js → integrations-VSJQBRFS.js} +29 -29
- package/dist/cli/{legacy-noops-4N63A6H7.mjs → legacy-noops-I65MIKH2.mjs} +6 -6
- package/dist/cli/{legacy-noops-S22XGYGN.js → legacy-noops-QOJGSGVO.js} +9 -9
- package/dist/cli/{mcp-4EJHRRFV.mjs → mcp-TGY6SRAC.mjs} +4 -4
- package/dist/cli/{mcp-JERBGJYE.js → mcp-WTKBSLSD.js} +24 -24
- package/dist/cli/{monitors-7BTLBD6S.mjs → monitors-E2ENT4RY.mjs} +7 -7
- package/dist/cli/{monitors-FF35CGC4.js → monitors-TLWVEXW6.js} +100 -100
- package/dist/cli/{org-QYIIBKA2.mjs → org-J2LGW5ZR.mjs} +6 -6
- package/dist/cli/{org-ADCDO7KU.js → org-PZPJJU7K.js} +121 -121
- package/dist/cli/{outcomes-C5DIBG4Q.mjs → outcomes-TMJDASU5.mjs} +6 -6
- package/dist/cli/{outcomes-2LW4GK2L.js → outcomes-Z6ZNBJ3U.js} +14 -14
- package/dist/cli/{play-DTTDTISL.mjs → play-S3Z24HUS.mjs} +21 -21
- package/dist/cli/{play-S5MZ2GRA.js → play-ZOOC57X4.js} +342 -342
- package/dist/cli/{providers-AXOEFQ6Q.mjs → providers-ETD6YLFL.mjs} +6 -6
- package/dist/cli/{providers-N2IWEJBW.js → providers-O4Y2YBS7.js} +9 -9
- package/dist/cli/{quickstart-UC5AJZWU.js → quickstart-NZALIRBP.js} +6 -6
- package/dist/cli/{quickstart-ADWSZBV6.mjs → quickstart-QZX32Y5T.mjs} +4 -4
- package/dist/cli/{run-6TDYUL7L.js → run-5UXSWJ7N.js} +44 -44
- package/dist/cli/{run-R2FVH3K6.mjs → run-HCVBRE2P.mjs} +23 -23
- package/dist/cli/search-T3SLR55O.js +32 -0
- package/dist/cli/{search-GRHUFSLY.mjs → search-Z247K76U.mjs} +7 -7
- package/dist/cli/{search-output-UPQNAFAF.mjs → search-output-XCJI3XRA.mjs} +4 -4
- package/dist/cli/{search-output-O7NY3VMD.js → search-output-XFKEGUJA.js} +6 -6
- package/dist/cli/{secrets-NKAEJLIQ.mjs → secrets-7JZXHLRU.mjs} +6 -6
- package/dist/cli/{secrets-72GJHFER.js → secrets-VUQLTUTM.js} +15 -15
- package/dist/cli/sessions-GHW2H7N2.js +23 -0
- package/dist/cli/{sessions-VIMF3UF5.mjs → sessions-UNGJ342N.mjs} +6 -6
- package/dist/cli/{settings-KCQHBFNZ.mjs → settings-67TIT4MZ.mjs} +12 -12
- package/dist/cli/{settings-HFAW5HIF.js → settings-WG5YNHC5.js} +85 -85
- package/dist/cli/{setup-2MHWGEAD.js → setup-IYUNW5ZP.js} +49 -49
- package/dist/cli/{setup-2ZD5ZIUH.mjs → setup-KMAAJOZM.mjs} +9 -9
- package/dist/cli/skills-JVLCEUBF.js +37 -0
- package/dist/cli/{skills-X2DZZG5P.mjs → skills-UVS4DODN.mjs} +7 -7
- package/dist/cli/{tools-KPTOWKD4.mjs → tools-B42JY4BX.mjs} +17 -17
- package/dist/cli/tools-ETA3BJNM.js +57 -0
- package/dist/cli/{update-6PMQCEUP.mjs → update-EBYZZ7BW.mjs} +9 -9
- package/dist/cli/update-XZEBQCEY.js +37 -0
- package/dist/cli/{views-MNBHNO6C.js → views-DOUEKLEV.js} +21 -21
- package/dist/cli/{views-VRZ5CTFL.mjs → views-QK3AFD2D.mjs} +6 -6
- package/dist/cli/{workflow-SSMFO7YE.js → workflow-TAKT2T7A.js} +17 -17
- package/dist/cli/{workflow-7JUJWA5S.mjs → workflow-UBJPGRKF.mjs} +7 -7
- package/dist/index.js +9 -9
- package/dist/index.mjs +6 -6
- package/dist/install-integrity.json +120 -120
- package/dist/plays/bundle-play-file.mjs +1 -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.js +5 -5
- package/dist/server.mjs +3 -3
- package/package.json +1 -1
- package/dist/cli/auth-25MVD7TK.js +0 -44
- package/dist/cli/concurrent-runs-help-DEN63DUM.js +0 -22
- package/dist/cli/describe-YHZ2EGBQ.js +0 -50
- package/dist/cli/git-SQ2MAKAH.js +0 -26
- package/dist/cli/search-V7ANBX3J.js +0 -32
- package/dist/cli/sessions-EO6RTMUC.js +0 -23
- package/dist/cli/skills-ID6KKDLH.js +0 -37
- package/dist/cli/tools-7UY7GERW.js +0 -57
- package/dist/cli/update-T2RDLLSY.js +0 -37
- /package/dist/cli/{chunk-YGCKMI5P.js → chunk-2M3VVGMZ.js} +0 -0
- /package/dist/cli/{chunk-7I4B6V2S.mjs → chunk-VMGJIFSB.mjs} +0 -0
|
@@ -205,7 +205,7 @@ export const SDK_RELEASE = {
|
|
|
205
205
|
// getters keep their established compatibility behavior.
|
|
206
206
|
// 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
|
|
207
207
|
// 0.3.90 is the first deliberately versioned SDK release for API v3.
|
|
208
|
-
version: '0.3.
|
|
208
|
+
version: '0.3.581',
|
|
209
209
|
updateSummary: {
|
|
210
210
|
introducedIn: '0.3.90',
|
|
211
211
|
summary:
|
|
@@ -69,6 +69,7 @@ import {
|
|
|
69
69
|
LEGACY_RUNTIME_RECEIPT_WIRE_HEADER,
|
|
70
70
|
} from './/runtime-contract';
|
|
71
71
|
import { PLAY_RUNTIME_API_COMPAT_PATH } from './/runtime-api-paths';
|
|
72
|
+
import { RUNTIME_RATE_STATE_UNAVAILABLE_RESPONSE_CODE } from './/transient-service-error';
|
|
72
73
|
import {
|
|
73
74
|
buildRunLedgerEventsIdempotencyKey,
|
|
74
75
|
isRunLedgerProjectionMismatchDiagnostic,
|
|
@@ -877,6 +878,32 @@ function isRetryableAppRuntimeResponse(input: {
|
|
|
877
878
|
return isRetryableAppRuntimeResponseStatus(input.status);
|
|
878
879
|
}
|
|
879
880
|
|
|
881
|
+
/**
|
|
882
|
+
* The rate-state store's tables are not migrated yet. A server that names this
|
|
883
|
+
* code calls the response retryable, but the rate-state backend owns that retry
|
|
884
|
+
* (governor/app-runtime-rate-state-backend.ts): an acquire fails closed after
|
|
885
|
+
* 3 attempts, 100 and 250 ms apart, and a release holds its leases until their
|
|
886
|
+
* TTL. Retrying here too would multiply those bounds by this ladder's 5
|
|
887
|
+
* attempts, so each action sends as many requests as it does for today's
|
|
888
|
+
* non-retryable 500 `runtime_durability_internal`.
|
|
889
|
+
*
|
|
890
|
+
* This reader ships before any server sends the code (reader first): until
|
|
891
|
+
* then nothing matches it. Recorded responses:
|
|
892
|
+
* tests/fixtures/play-runtime/rate-state-unavailable-response/.
|
|
893
|
+
*/
|
|
894
|
+
function isRateStateBackendOwnedRetry(
|
|
895
|
+
action: RuntimeApiRequest['action'],
|
|
896
|
+
responseCode: string | null,
|
|
897
|
+
): boolean {
|
|
898
|
+
return (
|
|
899
|
+
responseCode === RUNTIME_RATE_STATE_UNAVAILABLE_RESPONSE_CODE &&
|
|
900
|
+
(action === 'rate_state_acquire' ||
|
|
901
|
+
action === 'rate_state_release' ||
|
|
902
|
+
action === 'rate_state_penalize' ||
|
|
903
|
+
action === 'rate_state_validate')
|
|
904
|
+
);
|
|
905
|
+
}
|
|
906
|
+
|
|
880
907
|
/**
|
|
881
908
|
* The pre-reader app returns this one precise response for an action it does
|
|
882
909
|
* not yet know. Do not use a substring match here: an authorization failure
|
|
@@ -2075,9 +2102,21 @@ async function postAppRuntimeApiAttempts<TResponse>(
|
|
|
2075
2102
|
try {
|
|
2076
2103
|
responseText = await response.text();
|
|
2077
2104
|
} catch (error) {
|
|
2105
|
+
// A typed rate-state answer whose body timed out still belongs to the
|
|
2106
|
+
// rate-state backend's ladder: its header names the code.
|
|
2107
|
+
const rateStateBackendOwnedCode =
|
|
2108
|
+
isRequestTimeoutAbort(error) &&
|
|
2109
|
+
isRetryableAppRuntimeResponseStatus(response.status) &&
|
|
2110
|
+
isRateStateBackendOwnedRetry(
|
|
2111
|
+
body.action,
|
|
2112
|
+
appRuntimeErrorCode(response, ''),
|
|
2113
|
+
)
|
|
2114
|
+
? RUNTIME_RATE_STATE_UNAVAILABLE_RESPONSE_CODE
|
|
2115
|
+
: null;
|
|
2078
2116
|
if (
|
|
2079
2117
|
isRequestTimeoutAbort(error) &&
|
|
2080
|
-
!isRetryableAppRuntimeResponseStatus(response.status)
|
|
2118
|
+
(!isRetryableAppRuntimeResponseStatus(response.status) ||
|
|
2119
|
+
rateStateBackendOwnedCode)
|
|
2081
2120
|
) {
|
|
2082
2121
|
recordAppRuntimeRetryFailure({
|
|
2083
2122
|
telemetry: retryTelemetry,
|
|
@@ -2097,7 +2136,7 @@ async function postAppRuntimeApiAttempts<TResponse>(
|
|
|
2097
2136
|
finalAttemptStartedAt: attemptStartedAt,
|
|
2098
2137
|
});
|
|
2099
2138
|
throw new Error(
|
|
2100
|
-
`${boundaryLabel} ${body.action} failed with status ${response.status}: response body timed out`,
|
|
2139
|
+
`${boundaryLabel} ${body.action} failed with status ${response.status}${rateStateBackendOwnedCode ? ` code=${rateStateBackendOwnedCode}` : ''}: response body timed out`,
|
|
2101
2140
|
{ cause: error },
|
|
2102
2141
|
);
|
|
2103
2142
|
}
|
|
@@ -2153,6 +2192,7 @@ async function postAppRuntimeApiAttempts<TResponse>(
|
|
|
2153
2192
|
}
|
|
2154
2193
|
if (
|
|
2155
2194
|
ladderAttempt < maxAttempts &&
|
|
2195
|
+
!isRateStateBackendOwnedRetry(body.action, responseCode) &&
|
|
2156
2196
|
isRetryableAppRuntimeResponse({
|
|
2157
2197
|
action: body.action,
|
|
2158
2198
|
status: response.status,
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { createHash, createHmac, randomBytes, timingSafeEqual } from 'node:crypto';
|
|
2
|
-
import
|
|
2
|
+
import {
|
|
3
|
+
earlySandboxCapUnits,
|
|
4
|
+
type PlaySandboxRuntimeLimits,
|
|
5
|
+
} from '../../plays/sandbox-runtime-limits';
|
|
3
6
|
import {
|
|
4
7
|
resolveExperimentSwitch,
|
|
5
8
|
type ExperimentSwitchOverrides,
|
|
@@ -65,8 +68,9 @@ export const ADOPT_IN_PROCESS_EARLY_SANDBOX_WITHOUT_TAG_READ = false;
|
|
|
65
68
|
* credentials or customer data: no envelope, config or token exists in the
|
|
66
69
|
* sandbox until the run is adopted. The watchdog's runtime/memory limits and
|
|
67
70
|
* the runner's V8 flags are fixed at pre-boot from the early sandbox's own
|
|
68
|
-
*
|
|
69
|
-
*
|
|
71
|
+
* limits: the hinted run's validated limits when the hint carried them, else
|
|
72
|
+
* the standard profile. Its `limitsKey` encodes the same limits; adoption
|
|
73
|
+
* refuses a run whose limits differ, and staging asserts it again.
|
|
70
74
|
*
|
|
71
75
|
* Adoption (in this process only) delivers the envelope in one exec: stdin to
|
|
72
76
|
* a file (same guard as the inline launch), then the run's files, config LAST
|
|
@@ -369,19 +373,30 @@ export class EarlySandboxRegistry<
|
|
|
369
373
|
|
|
370
374
|
readonly #taken = new Set<string>();
|
|
371
375
|
|
|
372
|
-
/**
|
|
376
|
+
/**
|
|
377
|
+
* This process's early sandboxes not yet adopted, reaped or expired, in cap
|
|
378
|
+
* units (`earlySandboxCapUnits`: a standard sandbox is 1, so standard-only
|
|
379
|
+
* traffic counts exactly as before).
|
|
380
|
+
*/
|
|
373
381
|
outstanding(): number {
|
|
374
|
-
|
|
382
|
+
let units = 0;
|
|
383
|
+
for (const entry of this.#outstanding) units += this.#units.get(entry) ?? 1;
|
|
384
|
+
return units;
|
|
375
385
|
}
|
|
376
386
|
|
|
377
|
-
/** The same
|
|
387
|
+
/** The same units for one org's hints (entries put with that `orgId`). */
|
|
378
388
|
outstandingForOrg(orgId: string): number {
|
|
379
|
-
let
|
|
380
|
-
for (const owner of this.#outstandingOrg
|
|
381
|
-
if (owner === orgId)
|
|
382
|
-
return
|
|
389
|
+
let units = 0;
|
|
390
|
+
for (const [entry, owner] of this.#outstandingOrg)
|
|
391
|
+
if (owner === orgId) units += this.#units.get(entry) ?? 1;
|
|
392
|
+
return units;
|
|
383
393
|
}
|
|
384
394
|
|
|
395
|
+
readonly #units = new Map<
|
|
396
|
+
Promise<EarlySandboxEntry<TSandbox> | null>,
|
|
397
|
+
number
|
|
398
|
+
>();
|
|
399
|
+
|
|
385
400
|
readonly #outstandingOrg = new Map<
|
|
386
401
|
Promise<EarlySandboxEntry<TSandbox> | null>,
|
|
387
402
|
string
|
|
@@ -392,9 +407,11 @@ export class EarlySandboxRegistry<
|
|
|
392
407
|
entry: Promise<EarlySandboxEntry<TSandbox> | null>,
|
|
393
408
|
ttlMs: number = EARLY_SANDBOX_REAP_AFTER_MS * 2,
|
|
394
409
|
orgId?: string,
|
|
410
|
+
units: number = 1,
|
|
395
411
|
): void {
|
|
396
412
|
this.#entries.set(key, entry);
|
|
397
413
|
this.#outstanding.add(entry);
|
|
414
|
+
this.#units.set(entry, units);
|
|
398
415
|
if (orgId) this.#outstandingOrg.set(entry, orgId);
|
|
399
416
|
void entry.then(
|
|
400
417
|
(resolved) => {
|
|
@@ -449,6 +466,7 @@ export class EarlySandboxRegistry<
|
|
|
449
466
|
#release(entry: Promise<EarlySandboxEntry<TSandbox> | null>): void {
|
|
450
467
|
if (!this.#outstanding.delete(entry)) return;
|
|
451
468
|
this.#outstandingOrg.delete(entry);
|
|
469
|
+
this.#units.delete(entry);
|
|
452
470
|
for (const [sandboxId, held] of this.#outstandingBySandboxId) {
|
|
453
471
|
if (held === entry) this.#outstandingBySandboxId.delete(sandboxId);
|
|
454
472
|
}
|
|
@@ -697,7 +715,13 @@ export function startEarlySandbox<TSandbox extends EarlySandboxHandle>(
|
|
|
697
715
|
});
|
|
698
716
|
return null;
|
|
699
717
|
});
|
|
700
|
-
adapter.registry.put(
|
|
718
|
+
adapter.registry.put(
|
|
719
|
+
key,
|
|
720
|
+
started,
|
|
721
|
+
undefined,
|
|
722
|
+
orgId,
|
|
723
|
+
earlySandboxCapUnits(input.sandboxRuntimeLimits),
|
|
724
|
+
);
|
|
701
725
|
logEarlySandbox(adapter.logScope, 'hint_accepted', {
|
|
702
726
|
key,
|
|
703
727
|
orgId,
|
|
@@ -1236,6 +1260,20 @@ export async function adoptEarlySandbox<
|
|
|
1236
1260
|
sandboxId: sandbox.sandboxId,
|
|
1237
1261
|
elapsedMs: nowMs() - startedAt,
|
|
1238
1262
|
});
|
|
1263
|
+
// A genuine mismatch comes from the creating worker's own limits; a
|
|
1264
|
+
// published pre-boot plan on a sandbox whose limitsKey disagrees with
|
|
1265
|
+
// this launch's means a tag was written outside that path. Loud, so
|
|
1266
|
+
// it is never folded into the ordinary miss.
|
|
1267
|
+
if (tags[EARLY_PREBOOT_TAG]?.startsWith('plan')) {
|
|
1268
|
+
console.error(
|
|
1269
|
+
JSON.stringify({
|
|
1270
|
+
event: 'play-runner.early.limits_mismatch_with_plan',
|
|
1271
|
+
key,
|
|
1272
|
+
sandboxId: sandbox.sandboxId,
|
|
1273
|
+
how,
|
|
1274
|
+
}),
|
|
1275
|
+
);
|
|
1276
|
+
}
|
|
1239
1277
|
return null;
|
|
1240
1278
|
}
|
|
1241
1279
|
// PB: another process started a runner here and holds its delivery
|
package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/early-sandbox-lane.ts
CHANGED
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
normalizePlayRuntimeBackend,
|
|
3
3
|
type PlayRuntimeBackendId,
|
|
4
4
|
} from '../backend';
|
|
5
|
+
import { earlySandboxCapUnits } from '../../plays/sandbox-runtime-limits';
|
|
5
6
|
import { modalEarlySandboxAdapter } from '../runner-backends/backends/modal';
|
|
6
7
|
import {
|
|
7
8
|
EARLY_SANDBOX_START,
|
|
@@ -63,8 +64,9 @@ export const EARLY_SANDBOX_POLICY_LEAD_PROVIDER: RuntimeSandboxProviderId =
|
|
|
63
64
|
|
|
64
65
|
/**
|
|
65
66
|
* Early sandboxes one worker process may hold unadopted at once, summed over
|
|
66
|
-
* its Adapters' registries
|
|
67
|
-
*
|
|
67
|
+
* its Adapters' registries, in size units (`earlySandboxCapUnits`: standard 1,
|
|
68
|
+
* large 2, xlarge 4). A hint past it is refused; its run creates its own
|
|
69
|
+
* sandbox at launch.
|
|
68
70
|
*/
|
|
69
71
|
export const EARLY_SANDBOX_MAX_OUTSTANDING_PER_WORKER = 16;
|
|
70
72
|
|
|
@@ -372,10 +374,14 @@ export function startWorkerLaneEarlySandbox(
|
|
|
372
374
|
);
|
|
373
375
|
return false;
|
|
374
376
|
}
|
|
377
|
+
// Caps are in size units (`earlySandboxCapUnits`): a hint is admitted only
|
|
378
|
+
// if its own units still fit, so a standard (1-unit) hint is refused at
|
|
379
|
+
// exactly the counts it was before.
|
|
380
|
+
const units = earlySandboxCapUnits(input.sandboxRuntimeLimits);
|
|
375
381
|
const outstanding = outstandingEarlySandboxes(
|
|
376
382
|
input.adapters ?? EARLY_SANDBOX_ADAPTERS,
|
|
377
383
|
);
|
|
378
|
-
if (outstanding
|
|
384
|
+
if (outstanding + units > EARLY_SANDBOX_MAX_OUTSTANDING_PER_WORKER) {
|
|
379
385
|
return refuseEarlySandboxHint({
|
|
380
386
|
...hint,
|
|
381
387
|
reason: 'outstanding_cap',
|
|
@@ -388,7 +394,10 @@ export function startWorkerLaneEarlySandbox(
|
|
|
388
394
|
hintOrgId,
|
|
389
395
|
input.adapters ?? EARLY_SANDBOX_ADAPTERS,
|
|
390
396
|
);
|
|
391
|
-
if (
|
|
397
|
+
if (
|
|
398
|
+
orgOutstanding + units >
|
|
399
|
+
EARLY_SANDBOX_MAX_OUTSTANDING_PER_ORG_PER_WORKER
|
|
400
|
+
) {
|
|
392
401
|
return refuseEarlySandboxHint({
|
|
393
402
|
...hint,
|
|
394
403
|
reason: 'org_outstanding_cap',
|
|
@@ -57,6 +57,18 @@ export function isConvexEdgeUnavailableError(
|
|
|
57
57
|
);
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
/**
|
|
61
|
+
* The runtime API's response code for `RuntimeRateStateUnavailableError`
|
|
62
|
+
* (scheduler-backends/postgres-rate-state.ts): the provider-rate tables,
|
|
63
|
+
* columns or schema are missing until a deploy finishes migrating them.
|
|
64
|
+
*
|
|
65
|
+
* Readers ship before any writer emits it. Until the writer lands, the
|
|
66
|
+
* gateway and app route still answer that error as a non-retryable 500
|
|
67
|
+
* `runtime_durability_internal`, so this code changes nothing on its own.
|
|
68
|
+
*/
|
|
69
|
+
export const RUNTIME_RATE_STATE_UNAVAILABLE_RESPONSE_CODE =
|
|
70
|
+
'runtime_rate_state_unavailable';
|
|
71
|
+
|
|
60
72
|
export function transientServiceUnavailableDetail(
|
|
61
73
|
error: unknown,
|
|
62
74
|
): string | null {
|
|
@@ -94,6 +94,26 @@ export function playSandboxSizeForLimits(
|
|
|
94
94
|
);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
|
+
/**
|
|
98
|
+
* Early-start cap units for a sandbox of these limits: its CPU over the
|
|
99
|
+
* standard size's, from the size table (standard 1, large 2, xlarge 4).
|
|
100
|
+
* Early sandboxes are unbilled until adopted, so the outstanding caps weigh
|
|
101
|
+
* them by size. Absent or unrecognised limits count as standard: a hint only
|
|
102
|
+
* carries limits that already passed `readCarriedPlaySandboxRuntimeLimits`.
|
|
103
|
+
*/
|
|
104
|
+
export function earlySandboxCapUnits(
|
|
105
|
+
limits:
|
|
106
|
+
| Pick<PlaySandboxRuntimeLimits, 'memoryGiB' | 'cpu' | 'diskGiB'>
|
|
107
|
+
| null
|
|
108
|
+
| undefined,
|
|
109
|
+
): number {
|
|
110
|
+
if (!limits) return 1;
|
|
111
|
+
const size = playSandboxSizeForLimits(limits);
|
|
112
|
+
return size
|
|
113
|
+
? PLAY_SANDBOX_SIZE_LIMITS[size].cpu / PLAY_SANDBOX_SIZE_LIMITS.standard.cpu
|
|
114
|
+
: 1;
|
|
115
|
+
}
|
|
116
|
+
|
|
97
117
|
export const SUPPORTED_PLAY_SANDBOX_SIZES = PLAY_SANDBOX_SIZE_INPUTS.join(', ');
|
|
98
118
|
|
|
99
119
|
export type PlaySandboxRuntimeDeclaration = {
|