deepline 0.3.524 → 0.3.525
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 +8 -0
- package/dist/bundling-sources/sdk/src/http-core.ts +14 -0
- package/dist/bundling-sources/sdk/src/plays/play-description.ts +1 -0
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/sdk/src/types.ts +10 -0
- package/dist/bundling-sources/shared_libs/observability/dlq.ts +19 -0
- package/dist/bundling-sources/shared_libs/observability/queue-health.ts +9 -0
- package/dist/bundling-sources/shared_libs/observability/queue-item-connectors.ts +1 -0
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +38 -0
- package/dist/bundling-sources/shared_libs/play-runtime/freshness-receipt-execution.ts +94 -9
- package/dist/bundling-sources/shared_libs/play-runtime/run-retry-summary.ts +202 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/modal.ts +60 -8
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-telemetry.ts +112 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +39 -1
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/durable-run-sql.ts +13 -5
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/play-run-recovery.ts +10 -1
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-retry-facts.ts +62 -0
- package/dist/cli/auth-K7PMRXNG.js +43 -0
- package/dist/cli/{auth-QXJMVLPN.mjs → auth-TH3VGYBK.mjs} +5 -5
- package/dist/cli/{billing-SNSIFM4B.mjs → billing-CMHFI2LN.mjs} +8 -8
- package/dist/cli/{billing-N5R4HTHT.js → billing-TWKVUFU2.js} +83 -83
- package/dist/cli/{chunk-TZTWH53O.js → chunk-2WFVLOB7.js} +1 -1
- package/dist/cli/{chunk-BXVYVIMB.js → chunk-4UWXFXQF.js} +3 -3
- package/dist/cli/{chunk-II3BJKCH.mjs → chunk-5BSGWIQD.mjs} +2 -2
- package/dist/cli/{chunk-WOEPDSO3.js → chunk-5JFAQUZS.js} +26 -26
- package/dist/cli/{chunk-RVHUW4TN.js → chunk-5YAJGRWB.js} +17 -17
- package/dist/cli/{chunk-ITJ7NB2D.mjs → chunk-7AOFSZJM.mjs} +3 -1
- package/dist/cli/{chunk-RIX26ZJD.mjs → chunk-7C4F4TLR.mjs} +1 -1
- package/dist/cli/{chunk-RTDX5NNN.mjs → chunk-7OF3A4KJ.mjs} +3 -3
- package/dist/cli/{chunk-2ZWNIS54.js → chunk-AVDEYOVP.js} +269 -269
- package/dist/cli/{chunk-GJYLC4JB.mjs → chunk-BNH4Y35W.mjs} +2 -2
- package/dist/cli/{chunk-I75VRGQG.js → chunk-CKTRQSRA.js} +22 -22
- package/dist/cli/{chunk-R457IMHJ.mjs → chunk-CLTL7ZJI.mjs} +1 -1
- package/dist/cli/{chunk-7E6B7VMS.js → chunk-CQSANB3V.js} +5 -5
- package/dist/cli/{chunk-7OQGZBDG.js → chunk-CWRL6IQP.js} +13 -6
- package/dist/cli/{chunk-HLAFGQPV.mjs → chunk-CZNEQMJR.mjs} +5 -2
- package/dist/cli/{chunk-7QM6DNR4.js → chunk-DYS3KWYF.js} +11 -11
- package/dist/cli/{chunk-GMO3JDZA.mjs → chunk-EP6YH6QJ.mjs} +2 -2
- package/dist/cli/{chunk-V4RJ57MA.js → chunk-ESWM2JW4.js} +2 -2
- package/dist/cli/{chunk-YGOI5ZE5.mjs → chunk-ETHVJ2ZE.mjs} +1 -1
- package/dist/cli/{chunk-3WWTBQHC.mjs → chunk-GCLNX72G.mjs} +2 -2
- package/dist/cli/{chunk-R2VZVHJP.mjs → chunk-GESIFFQX.mjs} +1 -1
- package/dist/cli/{chunk-BXIQD2IY.mjs → chunk-IMO3HXWZ.mjs} +1 -1
- package/dist/cli/{chunk-2ZX7XSAQ.mjs → chunk-JVWSIA2V.mjs} +4 -4
- package/dist/cli/{chunk-YXVYPYIP.js → chunk-KBOSALBI.js} +10 -10
- package/dist/cli/{chunk-RUULUCBP.js → chunk-KEZ3KBWW.js} +10 -10
- package/dist/cli/{chunk-YCIXY66B.mjs → chunk-KPINGHIF.mjs} +2 -2
- package/dist/cli/{chunk-KKPBCB6D.mjs → chunk-LAMGJQDY.mjs} +2 -2
- package/dist/cli/{chunk-OCT4SUJA.js → chunk-LE537GBC.js} +13 -6
- package/dist/cli/{chunk-HTYT2OHB.js → chunk-LXKH4MKH.js} +6 -6
- package/dist/cli/{chunk-EO55Y4QW.mjs → chunk-M43ZYNDA.mjs} +5 -5
- package/dist/cli/{chunk-PFKKZVFK.js → chunk-MHBSRNI7.js} +41 -41
- package/dist/cli/{chunk-ANKD3AIR.js → chunk-MRUFGOJR.js} +2 -2
- package/dist/cli/{chunk-Z4MOEQSY.js → chunk-N4MMU3QF.js} +21 -21
- package/dist/cli/{chunk-ATATJNJ6.js → chunk-NB2ECLQE.js} +9 -9
- package/dist/cli/{chunk-YKFW3NNA.mjs → chunk-NO4URKKT.mjs} +5 -5
- package/dist/cli/{chunk-66N76YZG.js → chunk-NRBCETWL.js} +44 -44
- package/dist/cli/{chunk-OQ5G7RFQ.mjs → chunk-OWQF6WVH.mjs} +10 -3
- package/dist/cli/{chunk-CH7JVSA7.mjs → chunk-OXFIJYN3.mjs} +8 -8
- package/dist/cli/{chunk-EQNAQENZ.js → chunk-P62LON53.js} +2 -2
- package/dist/cli/{chunk-NMU3VR5U.js → chunk-PMH4GLMD.js} +1 -0
- package/dist/cli/{chunk-S3A4IXBQ.mjs → chunk-PSX3WHIH.mjs} +1 -0
- package/dist/cli/{chunk-V7KUBDEB.js → chunk-QR7VYYNM.js} +144 -141
- package/dist/cli/{chunk-KSQXBLRW.mjs → chunk-RMZ6CISE.mjs} +3 -3
- package/dist/cli/{chunk-GTGJBZVH.js → chunk-S5LUY3KJ.js} +7 -7
- package/dist/cli/{chunk-SF4QJVBE.js → chunk-TFEGJEYO.js} +3 -3
- package/dist/cli/{chunk-VHTVXS5A.js → chunk-TO72GW5I.js} +16 -16
- package/dist/cli/{chunk-WCVIPZWX.mjs → chunk-TXSBPBHB.mjs} +5 -5
- package/dist/cli/{chunk-MW3YMPD2.mjs → chunk-U4M32NFS.mjs} +1 -1
- package/dist/cli/{chunk-NUC7ZVDG.mjs → chunk-UQYKSOGO.mjs} +5 -5
- package/dist/cli/{chunk-536TGWR6.mjs → chunk-UXF3ODJJ.mjs} +2 -2
- package/dist/cli/{chunk-LRWDZDBS.js → chunk-V2GN4PLK.js} +5 -5
- package/dist/cli/{chunk-SMWFOGUT.js → chunk-V65J64FL.js} +53 -53
- package/dist/cli/{chunk-V2YIBBVT.mjs → chunk-VYIAWAKJ.mjs} +1 -1
- package/dist/cli/{chunk-JDIQBZ6O.js → chunk-WA3FG7DH.js} +14 -14
- package/dist/cli/{chunk-XURWFEXM.mjs → chunk-WEYFSBAD.mjs} +13 -6
- package/dist/cli/{chunk-T43FF5PF.mjs → chunk-WGRDOPAK.mjs} +2 -2
- package/dist/cli/{chunk-NTLBZUHD.js → chunk-XYIECA7M.js} +4 -2
- package/dist/cli/{chunk-FXTV5B3D.mjs → chunk-YC7FKAJ4.mjs} +12 -12
- package/dist/cli/{chunk-BN5VKY4X.js → chunk-ZS2WHWWL.js} +7 -7
- package/dist/cli/{chunk-PFKWKWUJ.mjs → chunk-ZWFTHEPT.mjs} +2 -2
- package/dist/cli/command-docs.js +2 -2
- package/dist/cli/command-docs.mjs +1 -1
- package/dist/cli/{csv-Q2LWKXAV.js → csv-5JHWVJ5N.js} +13 -13
- package/dist/cli/{csv-HT2JBCW2.mjs → csv-OO554TPX.mjs} +4 -4
- package/dist/cli/{db-XEV4WEE4.js → db-CYQJ4OXF.js} +28 -28
- package/dist/cli/{db-CS3XQ2LX.mjs → db-SQKJ6RKU.mjs} +7 -7
- package/dist/cli/describe-N7AKTUQV.mjs +50 -0
- package/dist/cli/describe-PASXOL3R.js +50 -0
- package/dist/cli/describe-core.d.mts +4 -2
- package/dist/cli/describe-core.d.ts +4 -2
- package/dist/cli/describe-core.js +5 -5
- package/dist/cli/describe-core.mjs +4 -4
- package/dist/cli/{executions-L6XFG5MP.mjs → executions-F34DORW6.mjs} +7 -7
- package/dist/cli/{executions-JCC34WAD.js → executions-K7EGCRKX.js} +9 -9
- package/dist/cli/{feedback-AWBDO5I6.mjs → feedback-GQHKCS66.mjs} +5 -5
- package/dist/cli/{feedback-HV2M2G7N.js → feedback-NOQVCA3Q.js} +10 -10
- package/dist/cli/{git-S4LRXTRX.mjs → git-2EEITXDB.mjs} +5 -5
- package/dist/cli/git-UU4YFJ2Q.js +25 -0
- package/dist/cli/index.js +145 -145
- package/dist/cli/index.mjs +44 -44
- package/dist/cli/{legacy-noops-7MOKBL4O.mjs → legacy-noops-JHMY5XRB.mjs} +6 -6
- package/dist/cli/{legacy-noops-RGSZUD6V.js → legacy-noops-RFNHQ7RG.js} +9 -9
- package/dist/cli/{monitors-XQNXDZPQ.mjs → monitors-RDMP6SPZ.mjs} +8 -8
- package/dist/cli/{monitors-JEFM2C5W.js → monitors-UKRZ4BDK.js} +101 -101
- package/dist/cli/{org-GYLA5V32.js → org-OX7TYTHV.js} +87 -87
- package/dist/cli/{org-KTMJZGTN.mjs → org-RF3G4KMB.mjs} +7 -7
- package/dist/cli/{pages-WOMU2T2O.mjs → pages-FBM3MGSP.mjs} +7 -7
- package/dist/cli/{pages-RY4U7OCL.js → pages-MKQT5LFV.js} +19 -19
- package/dist/cli/{play-2Q6MWJ3D.js → play-OOVX2DMV.js} +756 -707
- package/dist/cli/{play-KOYGGNYS.mjs → play-YWC2UORM.mjs} +151 -102
- package/dist/cli/{providers-HOIRHMN2.js → providers-2CGZYLER.js} +10 -10
- package/dist/cli/{providers-7YKDITJC.mjs → providers-3PEQESIU.mjs} +7 -7
- package/dist/cli/{quickstart-OWCJOSQA.js → quickstart-6AANHKQZ.js} +6 -6
- package/dist/cli/{quickstart-RDXHSMVX.mjs → quickstart-KVB36SOW.mjs} +4 -4
- package/dist/cli/{run-MT2ABKO5.js → run-NJ7WV5TK.js} +46 -46
- package/dist/cli/{run-RT73NDP5.mjs → run-QC23NRKO.mjs} +27 -27
- package/dist/cli/{search-CJPKIGSA.mjs → search-7BMFFZI2.mjs} +9 -9
- package/dist/cli/search-NH4DTXUK.js +33 -0
- package/dist/cli/{search-output-AREMA544.mjs → search-output-CALZ4ZI2.mjs} +4 -4
- package/dist/cli/{search-output-OSBZ7WK6.js → search-output-XC2AVBFX.js} +6 -6
- package/dist/cli/{secrets-BTIY2FEJ.mjs → secrets-7ZHA57DI.mjs} +7 -7
- package/dist/cli/{secrets-OV6KH633.js → secrets-VHU4B2D4.js} +16 -16
- package/dist/cli/sessions-2TE5JWVP.js +18 -0
- package/dist/cli/{sessions-3CO3ZFOD.mjs → sessions-YYULWFZE.mjs} +6 -6
- package/dist/cli/{settings-7BQIC7QN.mjs → settings-AVY4NNHI.mjs} +14 -14
- package/dist/cli/{settings-LBIECYDB.js → settings-WV77QJGD.js} +87 -87
- package/dist/cli/{setup-XPTSNNES.mjs → setup-AOUJ3RMU.mjs} +10 -10
- package/dist/cli/{setup-QZE7QR3F.js → setup-GE5TLTC4.js} +50 -50
- package/dist/cli/{skills-TGGKIQLT.mjs → skills-FVWO2G66.mjs} +8 -8
- package/dist/cli/skills-OL7LD6QX.js +37 -0
- package/dist/cli/{tools-MKIFX2TQ.mjs → tools-URE655B4.mjs} +20 -20
- package/dist/cli/tools-VQ5JO6DI.js +57 -0
- package/dist/cli/{update-5R3D3WNH.mjs → update-5B4G4345.mjs} +10 -10
- package/dist/cli/update-7ZOIOTZN.js +35 -0
- package/dist/cli/{views-VHKDHHUP.mjs → views-GSECJ5IK.mjs} +7 -7
- package/dist/cli/{views-VPWEINIA.js → views-IC762HEQ.js} +19 -19
- package/dist/cli/{workflow-D5DF65N6.mjs → workflow-6UQM565I.mjs} +8 -8
- package/dist/cli/{workflow-7K2VEQ4V.js → workflow-EME7ZEOV.js} +18 -18
- package/dist/{client-C5_6W8yd.d.mts → client-Bd2meveV.d.mts} +1 -1
- package/dist/{client-iXW4TOat.d.ts → client-CBCVhL8U.d.ts} +1 -1
- package/dist/{client-core-Dob428Z4.d.mts → client-core-CGj8V9mw.d.mts} +67 -0
- package/dist/{client-core-B-GPfmaC.d.ts → client-core-CsRRWCFy.d.ts} +67 -0
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +10 -10
- package/dist/index.mjs +7 -7
- package/dist/install-integrity.json +120 -118
- package/dist/plays/play-description.d.mts +1 -1
- package/dist/plays/play-description.d.ts +1 -1
- package/dist/plays/play-description.js +2 -2
- package/dist/plays/play-description.mjs +1 -1
- package/dist/plays/run-request.d.mts +1 -1
- package/dist/plays/run-request.d.ts +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.d.mts +2 -2
- package/dist/server.d.ts +2 -2
- package/dist/server.js +6 -6
- package/dist/server.mjs +4 -4
- package/package.json +1 -1
- package/dist/cli/auth-OKPHHMMP.js +0 -43
- package/dist/cli/describe-5G5NXO5E.js +0 -50
- package/dist/cli/describe-OUTXLDGZ.mjs +0 -50
- package/dist/cli/git-GDPTG52F.js +0 -25
- package/dist/cli/search-7VBA6IGS.js +0 -33
- package/dist/cli/sessions-B3WNEWRW.js +0 -18
- package/dist/cli/skills-TXBRTWEV.js +0 -37
- package/dist/cli/tools-RZJV4X3J.js +0 -57
- package/dist/cli/update-YWGGPWUA.js +0 -35
|
@@ -62,6 +62,8 @@ const MODAL_CAPACITY_RELEASE_RETRY_DELAYS_MS = [0, 100, 500, 2_000] as const;
|
|
|
62
62
|
const MODAL_LATE_CREATE_PERSIST_RETRY_DELAYS_MS = [0, 100, 500, 2_000] as const;
|
|
63
63
|
// The SDK does not export gRPC status codes.
|
|
64
64
|
const MODAL_GRPC_STATUS_NOT_FOUND = 5;
|
|
65
|
+
const MODAL_GRPC_STATUS_UNKNOWN = 2;
|
|
66
|
+
const MODAL_GRPC_STATUS_INTERNAL = 13;
|
|
65
67
|
type ModalSandbox = Awaited<ReturnType<ModalClient['sandboxes']['create']>>;
|
|
66
68
|
|
|
67
69
|
class ModalPayloadUploadTimeoutError extends Error {
|
|
@@ -74,15 +76,30 @@ class ModalPayloadUploadTimeoutError extends Error {
|
|
|
74
76
|
}
|
|
75
77
|
|
|
76
78
|
/**
|
|
77
|
-
* A file did not reach the sandbox
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
79
|
+
* A file did not reach the sandbox for a reason another sandbox can outrun.
|
|
80
|
+
* Staging sends no command, so nothing could run. By exact class name, as
|
|
81
|
+
* `isModalSandboxNotFoundError` reads the SDK's errors:
|
|
82
|
+
*
|
|
83
|
+
* - `NotFoundError`: Modal reports the sandbox unavailable.
|
|
84
|
+
* - `SandboxFilesystemError` itself, not a subclass: the SDK's class for a
|
|
85
|
+
* write that failed for no reason it names. Its translation of an unexpected
|
|
86
|
+
* control-plane answer ("An unexpected error occurred, please contact
|
|
87
|
+
* support@modal.com") is this class; on Nov 13 it failed 77 runs before
|
|
88
|
+
* `upload:done`. A refused credential folds into it too. That is Deepline's
|
|
89
|
+
* credential, so it defers and a persistent one exhausts the bounded budget
|
|
90
|
+
* as `PLATFORM_RECOVERY_EXHAUSTED`.
|
|
91
|
+
*
|
|
92
|
+
* The named subclasses (permission, not a directory, is a directory) describe
|
|
93
|
+
* the write itself, which any sandbox would repeat, so they stay loud. So does
|
|
94
|
+
* a stalled upload: its input may be too large for any sandbox, and Modal
|
|
95
|
+
* starts one sandbox per attempt, so no earlier start failure in the attempt
|
|
96
|
+
* can show otherwise.
|
|
83
97
|
*/
|
|
84
98
|
function isUndeliveredModalRunnerFailure(error: unknown): boolean {
|
|
85
|
-
return
|
|
99
|
+
return (
|
|
100
|
+
error instanceof Error &&
|
|
101
|
+
(error.name === 'NotFoundError' || error.name === 'SandboxFilesystemError')
|
|
102
|
+
);
|
|
86
103
|
}
|
|
87
104
|
|
|
88
105
|
async function writeModalFileWithDeadline(input: {
|
|
@@ -131,6 +148,41 @@ export class ModalSandboxCreateOutcomeUnknownError extends Error {
|
|
|
131
148
|
}
|
|
132
149
|
}
|
|
133
150
|
|
|
151
|
+
/**
|
|
152
|
+
* The pre-code recovery for a Modal create that Modal itself rejected. A typed
|
|
153
|
+
* rejection keeps its own reason (capacity, unavailable). A gRPC `INTERNAL` or
|
|
154
|
+
* `UNKNOWN` answer to the create, such as Modal's "unexpected error", returned
|
|
155
|
+
* no sandbox, so no runner and no customer code exist: it defers on the
|
|
156
|
+
* bounded start budget instead of failing the run. Modal does not create a
|
|
157
|
+
* second sandbox inside an attempt, so the deferral is the retry.
|
|
158
|
+
*
|
|
159
|
+
* Everything else stays terminal. `sandboxes.create` builds the image and the
|
|
160
|
+
* request locally before sending it, so a non-gRPC error is our config and a
|
|
161
|
+
* retry would repeat it. A create that never settled
|
|
162
|
+
* (`ModalSandboxCreateOutcomeUnknownError`) may still produce that sandbox, so
|
|
163
|
+
* its intent stays pending for the reconciler.
|
|
164
|
+
*/
|
|
165
|
+
function recoveryForModalCreateRejection(
|
|
166
|
+
error: unknown,
|
|
167
|
+
createSent: boolean,
|
|
168
|
+
): unknown {
|
|
169
|
+
const typed = recoveryForModalSandboxCreateFailure(error);
|
|
170
|
+
if (typed) return typed;
|
|
171
|
+
if (createSent && isModalCreateRejectedByModal(error)) {
|
|
172
|
+
return recoveryForRunnerStartupNotLive(error);
|
|
173
|
+
}
|
|
174
|
+
return error;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/** Modal's control plane answered the create with an untyped gRPC failure. */
|
|
178
|
+
function isModalCreateRejectedByModal(error: unknown): boolean {
|
|
179
|
+
if (!(error instanceof Error) || error.name !== 'ClientError') return false;
|
|
180
|
+
const code = (error as { code?: unknown }).code;
|
|
181
|
+
return (
|
|
182
|
+
code === MODAL_GRPC_STATUS_INTERNAL || code === MODAL_GRPC_STATUS_UNKNOWN
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
|
|
134
186
|
export async function awaitModalSandboxCreate<T>(input: {
|
|
135
187
|
create: Promise<T>;
|
|
136
188
|
timeoutMs?: number;
|
|
@@ -635,7 +687,7 @@ export const modalPlayRunnerBackend: PlayRunnerBackend = {
|
|
|
635
687
|
// A create rejection proves no sandbox and no customer code exist.
|
|
636
688
|
// Preserve that fact for the scheduler rather than converting it
|
|
637
689
|
// into a terminal runner result below.
|
|
638
|
-
throw
|
|
690
|
+
throw recoveryForModalCreateRejection(error, createSent);
|
|
639
691
|
}
|
|
640
692
|
const billingStartedAt = Date.now();
|
|
641
693
|
runtimeTiming.modalCreateMs = billingStartedAt - startedAt;
|
|
@@ -235,3 +235,115 @@ export function emitRecoveredSecretResolutionRetry(input: {
|
|
|
235
235
|
},
|
|
236
236
|
});
|
|
237
237
|
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Durability decisions, as fixed-shape telemetry lines.
|
|
241
|
+
*
|
|
242
|
+
* Each line is emitted where the decision is made, through the process's
|
|
243
|
+
* existing log stream (the Fly worker's stdout feeds `deepline-runtime-logs`,
|
|
244
|
+
* the app's feeds `vercel`). A line carries identities, enums, and counts
|
|
245
|
+
* only: never inputs, outputs, provider text, or secrets. Its size does not
|
|
246
|
+
* grow with the run.
|
|
247
|
+
*/
|
|
248
|
+
const DURABILITY_DECISION_REASON = /^[a-z][a-z0-9_]{0,95}$/;
|
|
249
|
+
|
|
250
|
+
/** A code-owned snake_case reason, or `unrecognized` for anything else. */
|
|
251
|
+
function durabilityDecisionReason(reason: unknown): string {
|
|
252
|
+
return typeof reason === 'string' && DURABILITY_DECISION_REASON.test(reason)
|
|
253
|
+
? reason
|
|
254
|
+
: 'unrecognized';
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
function durabilityDecisionCount(value: unknown): number | null {
|
|
258
|
+
return typeof value === 'number' && Number.isSafeInteger(value) && value >= 0
|
|
259
|
+
? value
|
|
260
|
+
: null;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
export type PlayRunRecoveryDecision = {
|
|
264
|
+
runId: string;
|
|
265
|
+
orgId: string | null;
|
|
266
|
+
/** The scheduler attempt the decision retired. */
|
|
267
|
+
attempt: number;
|
|
268
|
+
/** `pre_code`: no customer code started. `post_code`: it may have. */
|
|
269
|
+
stage: 'pre_code' | 'post_code';
|
|
270
|
+
/** `deferred`: the same run retries later. `exhausted`: its budget ended. */
|
|
271
|
+
outcome: 'deferred' | 'exhausted';
|
|
272
|
+
/** The scheduler's persisted recovery reason. */
|
|
273
|
+
reason: string;
|
|
274
|
+
/** Pre-code only: the dependency whose circuit owns the decision. */
|
|
275
|
+
dependency: 'modal' | 'runtime' | null;
|
|
276
|
+
/** The run's recovery count for this stage after this decision. */
|
|
277
|
+
deferCount: number | null;
|
|
278
|
+
/** Deferred only: how long until the retry is due. */
|
|
279
|
+
delayMs: number | null;
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* One line per platform recovery decision: `play.run.recovery_decision`.
|
|
284
|
+
* Exhaustion is an error (the run fails); a deferral is a warning.
|
|
285
|
+
*/
|
|
286
|
+
export function emitPlayRunRecoveryDecision(
|
|
287
|
+
input: PlayRunRecoveryDecision,
|
|
288
|
+
): void {
|
|
289
|
+
emitPlayTelemetry({
|
|
290
|
+
level: input.outcome === 'exhausted' ? 'error' : 'warn',
|
|
291
|
+
event: 'play.run.recovery_decision',
|
|
292
|
+
tag: '[play.run.recovery_decision]',
|
|
293
|
+
fields: {
|
|
294
|
+
orgId: input.orgId,
|
|
295
|
+
runId: input.runId,
|
|
296
|
+
attempt: durabilityDecisionCount(input.attempt),
|
|
297
|
+
stage: input.stage,
|
|
298
|
+
outcome: input.outcome,
|
|
299
|
+
reason: durabilityDecisionReason(input.reason),
|
|
300
|
+
dependency: input.dependency,
|
|
301
|
+
deferCount: durabilityDecisionCount(input.deferCount),
|
|
302
|
+
delayMs:
|
|
303
|
+
input.outcome === 'deferred'
|
|
304
|
+
? durabilityDecisionCount(input.delayMs)
|
|
305
|
+
: null,
|
|
306
|
+
},
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
export type PlayRunResumeDecision = {
|
|
311
|
+
runId: string;
|
|
312
|
+
orgId: string;
|
|
313
|
+
/**
|
|
314
|
+
* `accepted`: a new epoch was queued. `refused`: a typed refusal (HTTP 400, 403, 404
|
|
315
|
+
* or 409). `failed`: the request errored before a decision (500 or 503).
|
|
316
|
+
*/
|
|
317
|
+
outcome: 'accepted' | 'refused' | 'failed';
|
|
318
|
+
/** Refused only: the typed refusal reason. */
|
|
319
|
+
reason: string | null;
|
|
320
|
+
/** Accepted only: the new resume epoch. */
|
|
321
|
+
epoch: number | null;
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
/** One line per `runs resume` decision: `play.run.resume_decision`. */
|
|
325
|
+
export function emitPlayRunResumeDecision(input: PlayRunResumeDecision): void {
|
|
326
|
+
emitPlayTelemetry({
|
|
327
|
+
level:
|
|
328
|
+
input.outcome === 'failed'
|
|
329
|
+
? 'error'
|
|
330
|
+
: input.outcome === 'refused'
|
|
331
|
+
? 'warn'
|
|
332
|
+
: 'info',
|
|
333
|
+
event: 'play.run.resume_decision',
|
|
334
|
+
tag: '[play.run.resume_decision]',
|
|
335
|
+
fields: {
|
|
336
|
+
orgId: input.orgId,
|
|
337
|
+
runId: input.runId,
|
|
338
|
+
outcome: input.outcome,
|
|
339
|
+
reason:
|
|
340
|
+
input.outcome === 'refused'
|
|
341
|
+
? durabilityDecisionReason(input.reason)
|
|
342
|
+
: null,
|
|
343
|
+
epoch:
|
|
344
|
+
input.outcome === 'accepted'
|
|
345
|
+
? durabilityDecisionCount(input.epoch)
|
|
346
|
+
: null,
|
|
347
|
+
},
|
|
348
|
+
});
|
|
349
|
+
}
|
package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts
CHANGED
|
@@ -359,7 +359,10 @@ import {
|
|
|
359
359
|
createRunLedgerProjectionJob,
|
|
360
360
|
type RunLedgerProjectionStats,
|
|
361
361
|
} from '../play-runs/projection';
|
|
362
|
-
import {
|
|
362
|
+
import {
|
|
363
|
+
emitPlayRunRecoveryDecision,
|
|
364
|
+
emitPlayRuntimeSpan,
|
|
365
|
+
} from '../runtime-telemetry';
|
|
363
366
|
|
|
364
367
|
/**
|
|
365
368
|
* A token exchange crosses an HTTP boundary, which otherwise erases the
|
|
@@ -4210,6 +4213,19 @@ async function executeAssignedAbsurdAttempt(input: {
|
|
|
4210
4213
|
delayMs: deferral.delayMs,
|
|
4211
4214
|
historyRows: deferral.historyRows,
|
|
4212
4215
|
});
|
|
4216
|
+
if (deferral.deferred || deferral.exhausted) {
|
|
4217
|
+
emitPlayRunRecoveryDecision({
|
|
4218
|
+
runId,
|
|
4219
|
+
orgId: launch.orgId ?? null,
|
|
4220
|
+
attempt: generation,
|
|
4221
|
+
stage: 'post_code',
|
|
4222
|
+
outcome: deferral.deferred ? 'deferred' : 'exhausted',
|
|
4223
|
+
reason: outcome.reason,
|
|
4224
|
+
dependency: null,
|
|
4225
|
+
deferCount: deferral.deferCount,
|
|
4226
|
+
delayMs: deferral.delayMs,
|
|
4227
|
+
});
|
|
4228
|
+
}
|
|
4213
4229
|
if (deferral.deferred && deferral.delayMs !== null) {
|
|
4214
4230
|
// The lost attempts' receipt claims would otherwise hold their calls
|
|
4215
4231
|
// until the leases expire; the retried attempt must claim them now.
|
|
@@ -5678,12 +5694,34 @@ async function executeAssignedAbsurdAttempt(input: {
|
|
|
5678
5694
|
...(detail ? { detail } : {}),
|
|
5679
5695
|
...(providerText ? { providerText } : {}),
|
|
5680
5696
|
});
|
|
5697
|
+
emitPlayRunRecoveryDecision({
|
|
5698
|
+
runId,
|
|
5699
|
+
orgId: launch.orgId ?? null,
|
|
5700
|
+
attempt: generation,
|
|
5701
|
+
stage: 'pre_code',
|
|
5702
|
+
outcome: 'deferred',
|
|
5703
|
+
reason: recovery.reason,
|
|
5704
|
+
dependency: recovery.dependency,
|
|
5705
|
+
deferCount: recovery.deferCount,
|
|
5706
|
+
delayMs: recovery.delaySeconds * 1_000,
|
|
5707
|
+
});
|
|
5681
5708
|
throw new DeferTask(
|
|
5682
5709
|
`Platform recovery deferred for ${recovery.dependency}: ${recovery.reason}`,
|
|
5683
5710
|
recovery.delaySeconds,
|
|
5684
5711
|
);
|
|
5685
5712
|
}
|
|
5686
5713
|
if (recovery.kind === 'exhausted') {
|
|
5714
|
+
emitPlayRunRecoveryDecision({
|
|
5715
|
+
runId,
|
|
5716
|
+
orgId: launch.orgId ?? null,
|
|
5717
|
+
attempt: generation,
|
|
5718
|
+
stage: 'pre_code',
|
|
5719
|
+
outcome: 'exhausted',
|
|
5720
|
+
reason: recovery.reason,
|
|
5721
|
+
dependency: recovery.dependency,
|
|
5722
|
+
deferCount: recovery.deferCount,
|
|
5723
|
+
delayMs: null,
|
|
5724
|
+
});
|
|
5687
5725
|
return finalizeTerminal({
|
|
5688
5726
|
claim,
|
|
5689
5727
|
runnerResult: recovery.terminalResult,
|
package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/durable-run-sql.ts
CHANGED
|
@@ -69,18 +69,24 @@ export const isDurableRunFailureCause = isDurableRunFailureCauseFilter;
|
|
|
69
69
|
const PLATFORM_RECOVERY_EXHAUSTED_PREFIX = 'PLATFORM_RECOVERY_EXHAUSTED:';
|
|
70
70
|
/**
|
|
71
71
|
* Leading codes the runtime writes when Deepline, not the Play, failed the
|
|
72
|
-
* run: the sandbox never started a runner,
|
|
72
|
+
* run: the sandbox never started a runner, the scheduler was unavailable, a
|
|
73
|
+
* Modal create never settled, or the payload upload to a Modal sandbox missed
|
|
74
|
+
* its deadline. None of these ran customer code.
|
|
73
75
|
*/
|
|
74
76
|
const PLATFORM_RUNTIME_FAILURE_CODES = [
|
|
75
77
|
'RUNTIME_SANDBOX_START_FAILED',
|
|
76
78
|
'RUNTIME_SCHEDULER_UNAVAILABLE',
|
|
79
|
+
'RUNTIME_MODAL_SANDBOX_CREATE_OUTCOME_UNKNOWN',
|
|
80
|
+
'MODAL_PAYLOAD_UPLOAD_TIMEOUT',
|
|
77
81
|
] as const;
|
|
78
82
|
/**
|
|
79
83
|
* Runtime error classes whose stored message is `<Class>: <CODE>: ...`. Only
|
|
80
84
|
* these names are stripped before reading the leading code: a Play's own
|
|
81
85
|
* `Error: <CODE>: ...` keeps its class prefix and stays the Play's.
|
|
82
86
|
*/
|
|
83
|
-
const RUNTIME_ERROR_CLASS_PREFIXES = [
|
|
87
|
+
const RUNTIME_ERROR_CLASS_PREFIXES = [
|
|
88
|
+
'DaytonaRunnerInitializationError',
|
|
89
|
+
] as const;
|
|
84
90
|
/**
|
|
85
91
|
* The exhausted-recovery message is a fixed Deepline template
|
|
86
92
|
* (`platformRecoveryExhaustedMessage` and the pre-code variant), well under
|
|
@@ -106,9 +112,11 @@ export const DURABLE_RUN_FAILURE_MESSAGE_MAX_CHARS = 512;
|
|
|
106
112
|
* admission sessions expired) failed on Deepline's authority, not its code.
|
|
107
113
|
* So did a sandbox that never started a runner (`RUNTIME_SANDBOX_START_FAILED`,
|
|
108
114
|
* also behind a known runtime error class such as
|
|
109
|
-
* `DaytonaRunnerInitializationError: `)
|
|
110
|
-
* (`RUNTIME_SCHEDULER_UNAVAILABLE`)
|
|
111
|
-
*
|
|
115
|
+
* `DaytonaRunnerInitializationError: `), an unavailable scheduler
|
|
116
|
+
* (`RUNTIME_SCHEDULER_UNAVAILABLE`), a Modal create that never settled
|
|
117
|
+
* (`RUNTIME_MODAL_SANDBOX_CREATE_OUTCOME_UNKNOWN`) and a Modal payload upload
|
|
118
|
+
* past its deadline (`MODAL_PAYLOAD_UPLOAD_TIMEOUT`). Only the leading code
|
|
119
|
+
* position counts, so stored rows of any age read the same way.
|
|
112
120
|
*/
|
|
113
121
|
export function durableRunFailureLateralSql(): string {
|
|
114
122
|
return `LEFT JOIN LATERAL (
|
package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/play-run-recovery.ts
CHANGED
|
@@ -27,7 +27,13 @@ export type PlayRunRecoveryOutcome =
|
|
|
27
27
|
deadlineAtMs: number | null;
|
|
28
28
|
delaySeconds: number;
|
|
29
29
|
}
|
|
30
|
-
| {
|
|
30
|
+
| {
|
|
31
|
+
kind: 'exhausted';
|
|
32
|
+
dependency: 'modal' | 'runtime';
|
|
33
|
+
reason: string;
|
|
34
|
+
deferCount: number | null;
|
|
35
|
+
terminalResult: PlayRunnerResult;
|
|
36
|
+
};
|
|
31
37
|
|
|
32
38
|
export async function transitionPreCodePlayRunRecovery(input: {
|
|
33
39
|
error: unknown;
|
|
@@ -81,6 +87,9 @@ export async function transitionPreCodePlayRunRecovery(input: {
|
|
|
81
87
|
if (recovery.exhausted) {
|
|
82
88
|
return {
|
|
83
89
|
kind: 'exhausted',
|
|
90
|
+
dependency: decision.dependency,
|
|
91
|
+
reason: decision.reason,
|
|
92
|
+
deferCount: recovery.deferCount,
|
|
84
93
|
terminalResult: {
|
|
85
94
|
status: 'failed',
|
|
86
95
|
error:
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The scheduler facts behind a run's retry summary. Read-only, one row, and
|
|
3
|
+
* constant work: the run by primary key plus the recovering predicate, which
|
|
4
|
+
* reads only the run's newest attempt by its `(run_id, attempt)` key.
|
|
5
|
+
*/
|
|
6
|
+
import {
|
|
7
|
+
MALFORMED_STORED_JSON,
|
|
8
|
+
type RunRetryFacts,
|
|
9
|
+
} from '../run-retry-summary';
|
|
10
|
+
import {
|
|
11
|
+
durableRunRecoveringSql,
|
|
12
|
+
durableRunTable,
|
|
13
|
+
type DurableRunSqlOptions,
|
|
14
|
+
} from './durable-run-sql';
|
|
15
|
+
import type { PostgresSchedulerQueryClient } from './postgres';
|
|
16
|
+
|
|
17
|
+
/** JSON columns arrive as text so every driver hands back the same shape. */
|
|
18
|
+
type RawRunRetryFacts = Record<string, unknown> & {
|
|
19
|
+
resume_epoch: string | null;
|
|
20
|
+
recovery_json: string | null;
|
|
21
|
+
recovering: boolean | null;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
/** Unparseable stored JSON stays visibly malformed for the projection. */
|
|
25
|
+
function parsedJson(value: string | null): unknown {
|
|
26
|
+
if (value === null) return null;
|
|
27
|
+
try {
|
|
28
|
+
return JSON.parse(value) as unknown;
|
|
29
|
+
} catch {
|
|
30
|
+
return MALFORMED_STORED_JSON;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* One run's retry facts, or null when this scheduler schema has no such run
|
|
36
|
+
* for the org. The org filter is part of the query: the runs table is shared.
|
|
37
|
+
*/
|
|
38
|
+
export async function readRunRetryFacts(
|
|
39
|
+
client: PostgresSchedulerQueryClient,
|
|
40
|
+
input: { runId: string; orgId: string },
|
|
41
|
+
options?: DurableRunSqlOptions,
|
|
42
|
+
): Promise<RunRetryFacts | null> {
|
|
43
|
+
const result = await client.query<RawRunRetryFacts>(
|
|
44
|
+
`
|
|
45
|
+
SELECT (coalesce(runs.admission_json, runs.launch_json) -> 'resumeEpoch')::text
|
|
46
|
+
AS resume_epoch,
|
|
47
|
+
runs.recovery_json::text AS recovery_json,
|
|
48
|
+
${durableRunRecoveringSql(options)} AS recovering
|
|
49
|
+
FROM ${durableRunTable('runs', options)} AS runs
|
|
50
|
+
WHERE runs.run_id = $1
|
|
51
|
+
AND runs.org_id = $2
|
|
52
|
+
`,
|
|
53
|
+
[input.runId, input.orgId],
|
|
54
|
+
);
|
|
55
|
+
const row = result.rows[0];
|
|
56
|
+
if (!row) return null;
|
|
57
|
+
return {
|
|
58
|
+
resumeEpoch: parsedJson(row.resume_epoch),
|
|
59
|
+
recovery: parsedJson(row.recovery_json),
|
|
60
|
+
recovering: row.recovering === true,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
var _chunkV65J64FLjs = require('./chunk-V65J64FL.js');
|
|
18
|
+
require('./chunk-S5LUY3KJ.js');
|
|
19
|
+
require('./chunk-TFEGJEYO.js');
|
|
20
|
+
require('./chunk-LE537GBC.js');
|
|
21
|
+
require('./chunk-T2N3B7IQ.js');
|
|
22
|
+
require('./chunk-XNYIZMNQ.js');
|
|
23
|
+
require('./chunk-SQWET4SL.js');
|
|
24
|
+
require('./chunk-2WFVLOB7.js');
|
|
25
|
+
require('./chunk-OG64RBAC.js');
|
|
26
|
+
require('./chunk-COGTRVWW.js');
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
exports.EXIT_WORKSPACE_MISMATCH = _chunkV65J64FLjs.EXIT_WORKSPACE_MISMATCH; exports.authStatusLine = _chunkV65J64FLjs.authStatusLine; exports.clearPendingClaim = _chunkV65J64FLjs.clearPendingClaim; exports.clearSatisfiedPendingClaim = _chunkV65J64FLjs.clearSatisfiedPendingClaim; exports.handleRegister = _chunkV65J64FLjs.handleRegister; exports.handleStatus = _chunkV65J64FLjs.handleStatus; exports.handleWait = _chunkV65J64FLjs.handleWait; exports.httpJson = _chunkV65J64FLjs.httpJson; exports.readPendingAuthClaim = _chunkV65J64FLjs.readPendingAuthClaim; exports.readStatusBanner = _chunkV65J64FLjs.readStatusBanner; exports.registerAuthCommands = _chunkV65J64FLjs.registerAuthCommands; exports.reportApprovalLinkShown = _chunkV65J64FLjs.reportApprovalLinkShown; exports.reportSetupCompleted = _chunkV65J64FLjs.reportSetupCompleted; exports.resolvePendingAuthClaimForResume = _chunkV65J64FLjs.resolvePendingAuthClaimForResume; exports.statusBannerLine = _chunkV65J64FLjs.statusBannerLine;
|
|
@@ -14,14 +14,14 @@ import {
|
|
|
14
14
|
reportSetupCompleted,
|
|
15
15
|
resolvePendingAuthClaimForResume,
|
|
16
16
|
statusBannerLine
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
17
|
+
} from "./chunk-RMZ6CISE.mjs";
|
|
18
|
+
import "./chunk-GCLNX72G.mjs";
|
|
19
|
+
import "./chunk-U4M32NFS.mjs";
|
|
20
|
+
import "./chunk-OWQF6WVH.mjs";
|
|
21
21
|
import "./chunk-QNHHZ63P.mjs";
|
|
22
22
|
import "./chunk-DLIRSHV6.mjs";
|
|
23
23
|
import "./chunk-ZPGGW27Q.mjs";
|
|
24
|
-
import "./chunk-
|
|
24
|
+
import "./chunk-7C4F4TLR.mjs";
|
|
25
25
|
import "./chunk-WZYKRD7T.mjs";
|
|
26
26
|
import "./chunk-KRD6H754.mjs";
|
|
27
27
|
export {
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DeeplineClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-KPINGHIF.mjs";
|
|
4
4
|
import {
|
|
5
5
|
iterateCursorPages,
|
|
6
6
|
requireBillingIdempotencyKey
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-CZNEQMJR.mjs";
|
|
8
8
|
import "./chunk-L2VKAASU.mjs";
|
|
9
9
|
import "./chunk-FKD3KL5Q.mjs";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-PSX3WHIH.mjs";
|
|
11
11
|
import "./chunk-UBKA33KY.mjs";
|
|
12
12
|
import {
|
|
13
13
|
PLAY_RUNTIME_PRICING_NOTE
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-WEYFSBAD.mjs";
|
|
15
15
|
import "./chunk-5LUF4LAR.mjs";
|
|
16
16
|
import {
|
|
17
17
|
PLAY_SANDBOX_SIZE_INPUTS
|
|
@@ -22,9 +22,9 @@ import {
|
|
|
22
22
|
openInBrowser,
|
|
23
23
|
printCommandEnvelope,
|
|
24
24
|
shouldEmitJson
|
|
25
|
-
} from "./chunk-
|
|
26
|
-
import "./chunk-
|
|
27
|
-
import "./chunk-
|
|
25
|
+
} from "./chunk-GCLNX72G.mjs";
|
|
26
|
+
import "./chunk-U4M32NFS.mjs";
|
|
27
|
+
import "./chunk-OWQF6WVH.mjs";
|
|
28
28
|
import {
|
|
29
29
|
AuthError,
|
|
30
30
|
ConfigError
|
|
@@ -33,7 +33,7 @@ import "./chunk-DLIRSHV6.mjs";
|
|
|
33
33
|
import {
|
|
34
34
|
DeeplineError
|
|
35
35
|
} from "./chunk-ZPGGW27Q.mjs";
|
|
36
|
-
import "./chunk-
|
|
36
|
+
import "./chunk-7C4F4TLR.mjs";
|
|
37
37
|
import "./chunk-WZYKRD7T.mjs";
|
|
38
38
|
import "./chunk-KRD6H754.mjs";
|
|
39
39
|
|