deepline 0.3.522 → 0.3.523
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 +118 -0
- package/dist/bundling-sources/sdk/src/index.ts +3 -0
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +47 -18
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +1 -0
- package/dist/bundling-sources/shared_libs/play-runtime/db-session-renewal.ts +209 -0
- package/dist/bundling-sources/shared_libs/play-runtime/durable-runs-rollout.ts +16 -6
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-tool-hooks.ts +5 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-modal-fallback.ts +1 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +38 -5
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/modal.ts +92 -10
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-deadline-reconciliation.ts +96 -25
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +29 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd.ts +139 -17
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/durable-run-sql.ts +26 -3
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +145 -5
- package/dist/bundling-sources/shared_libs/play-runtime/tool-cache-policy.ts +190 -10
- package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +85 -5
- package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +21 -11
- package/dist/cli/{artifacts-RY2MK74N.mjs → artifacts-RBHR2DG4.mjs} +6 -6
- package/dist/cli/{artifacts-GIZZH5VA.js → artifacts-RZTS2JHZ.js} +18 -18
- package/dist/cli/auth-DPWYFQR5.js +43 -0
- package/dist/cli/{auth-YIBY5IKT.mjs → auth-ENQUQS56.mjs} +5 -5
- package/dist/cli/{billing-G3IX3SNY.mjs → billing-6A27ULCX.mjs} +7 -7
- package/dist/cli/{billing-UDKL53GI.js → billing-6HONTJOY.js} +82 -82
- package/dist/cli/{chunk-4DFWDA2Q.js → chunk-2BRDHM4S.js} +9 -9
- package/dist/cli/{chunk-EJBW7Y6Z.js → chunk-326WVSWS.js} +108 -96
- package/dist/cli/{chunk-7JEN3FX4.js → chunk-36LQQL5C.js} +5 -5
- package/dist/cli/{chunk-GVKW3LCA.js → chunk-4NWY7JBB.js} +11 -11
- package/dist/cli/{chunk-RKE5YTHY.mjs → chunk-4V63IJCL.mjs} +5 -5
- package/dist/cli/{chunk-VFCVH2LV.mjs → chunk-5WFQXAD4.mjs} +5 -5
- package/dist/cli/{chunk-4TUMKJZX.mjs → chunk-6DBRBWHC.mjs} +2 -2
- package/dist/cli/{chunk-CFXERH7F.mjs → chunk-6OZ2WSHD.mjs} +1 -1
- package/dist/cli/{chunk-5H22VJPE.js → chunk-7GNKAACY.js} +6 -6
- package/dist/cli/{chunk-G65FJ5JX.mjs → chunk-7M5FRSFP.mjs} +2 -2
- package/dist/cli/{chunk-PDLRUZ42.mjs → chunk-DNXP3D5H.mjs} +5 -5
- package/dist/cli/{chunk-OAQIVJFY.mjs → chunk-F3WRLFFM.mjs} +2 -2
- package/dist/cli/{chunk-RI672VNY.js → chunk-FBMOBNJY.js} +2 -2
- package/dist/cli/{chunk-NDNG3MAT.mjs → chunk-H7275EZU.mjs} +5 -5
- package/dist/cli/{chunk-C6WGMODR.mjs → chunk-HSVGP4CI.mjs} +2 -2
- package/dist/cli/{chunk-DNJJ3ULJ.js → chunk-HUC5SGJQ.js} +2 -2
- package/dist/cli/{chunk-DARD7TJ7.js → chunk-HUIFUE4L.js} +53 -53
- package/dist/cli/{chunk-52MHE7B4.mjs → chunk-I62LJ7NU.mjs} +1 -1
- package/dist/cli/{chunk-BZY335JP.js → chunk-IEVXYHGJ.js} +5 -5
- package/dist/cli/{chunk-FQQAAR3Q.mjs → chunk-JCTTXLAZ.mjs} +1 -1
- package/dist/cli/{chunk-3KMGVOBM.mjs → chunk-JGZQBDYG.mjs} +4 -4
- package/dist/cli/{chunk-ZUAKRBZB.js → chunk-JMMNCJ7Z.js} +1 -1
- package/dist/cli/{chunk-UV6XCHOZ.mjs → chunk-JVEFMOY2.mjs} +1 -1
- package/dist/cli/{chunk-FNHUDCJE.js → chunk-K326BEVR.js} +10 -10
- package/dist/cli/{chunk-MD524MRB.mjs → chunk-KILRUAXF.mjs} +1 -1
- package/dist/cli/{chunk-XXY4E57R.mjs → chunk-LZL6V5M5.mjs} +2 -2
- package/dist/cli/{chunk-GMYDVW7Z.js → chunk-MCXPJYBN.js} +3 -3
- package/dist/cli/{chunk-VE6FHVXZ.mjs → chunk-MHTRYBXY.mjs} +78 -1
- package/dist/cli/{chunk-ISUUSSS4.js → chunk-MT3WG3KR.js} +16 -16
- package/dist/cli/{chunk-37SXIFIU.js → chunk-MZROKQV3.js} +44 -44
- package/dist/cli/{chunk-4MF44THR.js → chunk-N5MLEXZ7.js} +50 -8
- package/dist/cli/{chunk-XR6TN5DT.mjs → chunk-NWTMQGPP.mjs} +6 -6
- package/dist/cli/{chunk-Y3LDRCMB.mjs → chunk-PCORO245.mjs} +2 -2
- package/dist/cli/{chunk-534YYHIF.js → chunk-PESMXAUG.js} +6 -6
- package/dist/cli/{chunk-RDJTCW3I.mjs → chunk-QMBL5ZIQ.mjs} +3 -3
- package/dist/cli/{chunk-LFSOBW7E.mjs → chunk-QOO5W5XS.mjs} +22 -10
- package/dist/cli/{chunk-ZZ7U4YJS.mjs → chunk-QSAC3IVI.mjs} +1 -1
- package/dist/cli/{chunk-HYR34KFA.js → chunk-QYXIODWH.js} +78 -1
- package/dist/cli/{chunk-BONXEWYF.mjs → chunk-RKREB7MU.mjs} +3 -3
- package/dist/cli/{chunk-KMBF3N2Z.js → chunk-RQN4PHRE.js} +16 -16
- package/dist/cli/{chunk-XT25FX6T.js → chunk-S4YKRH3W.js} +3 -3
- package/dist/cli/{chunk-F5D623KO.js → chunk-SBGKKOCC.js} +26 -26
- package/dist/cli/{chunk-5477PEHL.mjs → chunk-SXTVJIGB.mjs} +1 -1
- package/dist/cli/{chunk-7J5PLHII.mjs → chunk-U6DLLV3S.mjs} +1 -1
- package/dist/cli/{chunk-ENWJFUWK.mjs → chunk-UH3EAFFN.mjs} +2 -2
- package/dist/cli/{chunk-DLDWAPA5.js → chunk-UQN4VTZL.js} +4 -4
- package/dist/cli/{chunk-DRDZBRXV.js → chunk-V46J3UTM.js} +7 -7
- package/dist/cli/{chunk-5BQPEHEP.js → chunk-WGVJA4I5.js} +14 -14
- package/dist/cli/{chunk-SFMCKB57.mjs → chunk-WVQOXYTQ.mjs} +44 -2
- package/dist/cli/{chunk-VIM6I7RC.js → chunk-XVXEARHC.js} +41 -41
- package/dist/cli/{chunk-6SJPZV5E.js → chunk-XYL26236.js} +2 -2
- package/dist/cli/{chunk-ZZLZCO6Y.js → chunk-ZWN4RXC2.js} +22 -22
- package/dist/cli/command-docs.js +2 -2
- package/dist/cli/command-docs.mjs +1 -1
- package/dist/cli/{csv-3HIE4VCO.js → csv-UBACJK75.js} +13 -13
- package/dist/cli/{csv-PE35WGRO.mjs → csv-YFJ2JLUP.mjs} +4 -4
- package/dist/cli/{db-O2YRTTDO.js → db-2ZPA2LZ7.js} +27 -27
- package/dist/cli/{db-L7ZMMQKW.mjs → db-NKGYTAQO.mjs} +6 -6
- package/dist/cli/{describe-NI324Y2M.mjs → describe-GX7DRKWZ.mjs} +18 -18
- package/dist/cli/describe-WQZF7MEG.js +50 -0
- package/dist/cli/describe-core.d.mts +3 -3
- package/dist/cli/describe-core.d.ts +3 -3
- package/dist/cli/{executions-T6KU2OKK.mjs → executions-HTHQ7KKD.mjs} +6 -6
- package/dist/cli/{executions-VH4DKLFI.js → executions-NXMRGPIL.js} +8 -8
- package/dist/cli/{feedback-ZLC6G5OK.js → feedback-TGVQACRO.js} +10 -10
- package/dist/cli/{feedback-SCSJC3FX.mjs → feedback-USP4T34P.mjs} +5 -5
- package/dist/cli/{git-I4LVQCID.mjs → git-KUONEHCD.mjs} +5 -5
- package/dist/cli/git-X3SCQREB.js +25 -0
- package/dist/cli/index.js +145 -145
- package/dist/cli/index.mjs +44 -44
- package/dist/cli/{legacy-noops-UPFWEHPG.js → legacy-noops-2JY3CQ24.js} +9 -9
- package/dist/cli/{legacy-noops-44FQ2256.mjs → legacy-noops-B2GMHU42.mjs} +6 -6
- package/dist/cli/{monitors-LMSASWXE.mjs → monitors-2OVBZJ6Z.mjs} +7 -7
- package/dist/cli/{monitors-JN6IQGK6.js → monitors-XI6I52AX.js} +100 -100
- package/dist/cli/{org-F7O3ZU5O.js → org-5TUQ2H6Y.js} +235 -72
- package/dist/cli/{org-QYLVEE7A.mjs → org-BNJW764Y.mjs} +169 -6
- package/dist/cli/{pages-5XE4LBZN.mjs → pages-QC3TQIPW.mjs} +6 -6
- package/dist/cli/{pages-KEL3Y4L4.js → pages-UXCLX53Y.js} +18 -18
- package/dist/cli/{play-MWQG3G32.mjs → play-45PPG5SZ.mjs} +18 -18
- package/dist/cli/{play-OURHH6KV.js → play-KRWMZ7FG.js} +317 -317
- package/dist/cli/{providers-IQY7LUBB.mjs → providers-JDT35MRL.mjs} +6 -6
- package/dist/cli/{providers-ZCBWPE3C.js → providers-RBUJ72Y3.js} +9 -9
- package/dist/cli/{quickstart-L45NGRMI.mjs → quickstart-GD2SWGAC.mjs} +4 -4
- package/dist/cli/{quickstart-O53OXTN6.js → quickstart-JZ4Q3HFT.js} +6 -6
- package/dist/cli/{run-W745Z3Z5.js → run-JEAHA367.js} +41 -41
- package/dist/cli/{run-VCSIWLEU.mjs → run-KIZ3HBI2.mjs} +23 -23
- package/dist/cli/{search-THELKULN.mjs → search-5UFNXHFK.mjs} +8 -8
- package/dist/cli/search-6JULJMD7.js +33 -0
- package/dist/cli/{search-output-N7MJLYYD.mjs → search-output-HAXPKQO6.mjs} +4 -4
- package/dist/cli/{search-output-SJW7LEOM.js → search-output-W3RDSVLE.js} +6 -6
- package/dist/cli/{secrets-44ST3FJH.mjs → secrets-JAWT66B2.mjs} +6 -6
- package/dist/cli/{secrets-GDXPX3KB.js → secrets-PC7C2Q32.js} +15 -15
- package/dist/cli/{sessions-LYCBI77S.mjs → sessions-325V7G35.mjs} +6 -6
- package/dist/cli/sessions-WFUCOJHZ.js +18 -0
- package/dist/cli/{settings-GXPDMJFG.mjs → settings-FKHTA65P.mjs} +13 -13
- package/dist/cli/{settings-3WOFF642.js → settings-RGU6Y2QR.js} +86 -86
- package/dist/cli/{setup-YM6JEB64.mjs → setup-43GOYTFC.mjs} +10 -10
- package/dist/cli/{setup-YHLMBJP4.js → setup-ZMZ7HU2I.js} +50 -50
- package/dist/cli/skills-3XTQ6FFM.js +37 -0
- package/dist/cli/{skills-WX4XWEAT.mjs → skills-Q2VAHSXM.mjs} +8 -8
- package/dist/cli/{tools-K24VSQ7S.mjs → tools-BUH7ZWDS.mjs} +17 -17
- package/dist/cli/tools-UK2R4YXQ.js +57 -0
- package/dist/cli/{update-PSSCF5AT.mjs → update-JFALWOHD.mjs} +10 -10
- package/dist/cli/update-LNKPHS54.js +35 -0
- package/dist/cli/{workflow-DGOPYATO.mjs → workflow-ISJKLY6X.mjs} +7 -7
- package/dist/cli/{workflow-FPVI3NIA.js → workflow-YELST32A.js} +17 -17
- package/dist/{client-DA71-2_u.d.mts → client-C2N7MofG.d.mts} +1 -1
- package/dist/{client-B-2Am2y6.d.ts → client-C7lTRJjw.d.ts} +1 -1
- package/dist/{client-core-BXbds1cb.d.mts → client-core-BTkDSKGn.d.mts} +79 -2
- package/dist/{client-core-C0IzDKMJ.d.ts → client-core-hmhBi7Ib.d.ts} +79 -2
- package/dist/{compiler-manifest-B4mIIbw7.d.mts → compiler-manifest-DsxsQP-T.d.mts} +14 -7
- package/dist/{compiler-manifest-B4mIIbw7.d.ts → compiler-manifest-DsxsQP-T.d.ts} +14 -7
- package/dist/{errors-Gj9i5Rkd.d.ts → errors-Bk5h1D-C.d.ts} +1 -1
- package/dist/{errors-C2F4qzAq.d.mts → errors-qdJUVQ3g.d.mts} +1 -1
- package/dist/{index-5JZBufdF.d.mts → index-PaupwX1B.d.mts} +1 -1
- package/dist/{index-BXtSj8bv.d.ts → index-bL66eHYz.d.ts} +1 -1
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +9 -9
- package/dist/index.mjs +6 -6
- 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 +7 -5
- 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/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 +5 -5
- package/dist/server.mjs +3 -3
- package/package.json +1 -1
- package/dist/cli/auth-JSES2JOQ.js +0 -43
- package/dist/cli/describe-EB336DAO.js +0 -50
- package/dist/cli/git-23T7TXAH.js +0 -25
- package/dist/cli/search-R6K7ZAMU.js +0 -33
- package/dist/cli/sessions-2V5ZFOWL.js +0 -18
- package/dist/cli/skills-XNGADDO6.js +0 -37
- package/dist/cli/tools-ROUMCB7B.js +0 -57
- package/dist/cli/update-RXURGIRW.js +0 -35
|
@@ -1328,6 +1328,8 @@ function emitDaytonaStage(
|
|
|
1328
1328
|
playName: context.playName ?? null,
|
|
1329
1329
|
stage,
|
|
1330
1330
|
...extra,
|
|
1331
|
+
// This worker's clock at the stage; log rows carry the shipper's.
|
|
1332
|
+
atMs: Date.now(),
|
|
1331
1333
|
};
|
|
1332
1334
|
try {
|
|
1333
1335
|
console.info('[play-runner.daytona.stage]', JSON.stringify(payload));
|
|
@@ -1531,6 +1533,24 @@ function isFailedDaytonaRunnerStart(error: unknown): boolean {
|
|
|
1531
1533
|
);
|
|
1532
1534
|
}
|
|
1533
1535
|
|
|
1536
|
+
/**
|
|
1537
|
+
* The last sandbox of an attempt breached the upload deadline, but an earlier
|
|
1538
|
+
* sandbox of the same attempt failed for another, Daytona-side reason (for
|
|
1539
|
+
* example a control-request timeout). The upload never finished, so no command
|
|
1540
|
+
* was sent and no customer code ran. One breach is not evidence of an input
|
|
1541
|
+
* too large for any sandbox, so it defers like any other failed start. When
|
|
1542
|
+
* every sandbox of the attempt breached, the upload stays loud.
|
|
1543
|
+
*/
|
|
1544
|
+
function isUploadDeadlineAfterOtherStartFailure(
|
|
1545
|
+
error: unknown,
|
|
1546
|
+
executionAttempt: number,
|
|
1547
|
+
): boolean {
|
|
1548
|
+
return (
|
|
1549
|
+
error instanceof DaytonaUploadDeadlineBreachError &&
|
|
1550
|
+
error.attemptTimings.length < executionAttempt
|
|
1551
|
+
);
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1534
1554
|
/** Which failure ended a start, for the stage log: the run error has less. */
|
|
1535
1555
|
function startFailureForLog(error: unknown) {
|
|
1536
1556
|
const diagnostic =
|
|
@@ -1590,19 +1610,28 @@ function isRetryableUnstartedDaytonaRunner(
|
|
|
1590
1610
|
// that waiting state. Defer a runner with no exit evidence, or the observed
|
|
1591
1611
|
// pre-start 127 shape (no Node process or startup marker). A fresh attempt
|
|
1592
1612
|
// fences the old sandbox; persistent failures exhaust the existing budget.
|
|
1613
|
+
// A sandbox Daytona could not answer for at all (command and session both
|
|
1614
|
+
// unreadable) also has no exit evidence: it is the same unstarted runner,
|
|
1615
|
+
// only on a sandbox that vanished, so it defers too.
|
|
1593
1616
|
const noExit =
|
|
1594
1617
|
diagnostic.exitCode === null && diagnostic.exitCodeFile === null;
|
|
1595
1618
|
const exitedBeforeStartup =
|
|
1619
|
+
diagnostic.commandFound &&
|
|
1620
|
+
diagnostic.sessionFound &&
|
|
1596
1621
|
(diagnostic.exitCode === null || diagnostic.exitCode === 127) &&
|
|
1597
1622
|
diagnostic.exitCodeFile === 127 &&
|
|
1598
1623
|
diagnostic.processSummary?.node === 0 &&
|
|
1599
1624
|
diagnostic.runnerStartup === null &&
|
|
1600
1625
|
diagnostic.errors.includes('startup_diagnostic_unavailable');
|
|
1626
|
+
const sandboxUnreadable =
|
|
1627
|
+
!diagnostic.commandFound &&
|
|
1628
|
+
!diagnostic.sessionFound &&
|
|
1629
|
+
diagnostic.errors.includes('get_session_command_failed') &&
|
|
1630
|
+
diagnostic.errors.includes('get_session_failed');
|
|
1631
|
+
const runnerReadable = diagnostic.commandFound && diagnostic.sessionFound;
|
|
1601
1632
|
return (
|
|
1602
|
-
diagnostic.
|
|
1603
|
-
|
|
1604
|
-
(noExit || exitedBeforeStartup) &&
|
|
1605
|
-
!diagnostic.schedulerReadinessObserved
|
|
1633
|
+
!diagnostic.schedulerReadinessObserved &&
|
|
1634
|
+
((noExit && (runnerReadable || sandboxUnreadable)) || exitedBeforeStartup)
|
|
1606
1635
|
);
|
|
1607
1636
|
}
|
|
1608
1637
|
|
|
@@ -2239,7 +2268,11 @@ export const daytonaPlayRunnerBackend: PlayRunnerBackend = {
|
|
|
2239
2268
|
? 'runner_startup_not_live'
|
|
2240
2269
|
: sandboxForAttempt &&
|
|
2241
2270
|
!parkStarted &&
|
|
2242
|
-
isFailedDaytonaRunnerStart(error)
|
|
2271
|
+
(isFailedDaytonaRunnerStart(error) ||
|
|
2272
|
+
isUploadDeadlineAfterOtherStartFailure(
|
|
2273
|
+
error,
|
|
2274
|
+
executionAttempt,
|
|
2275
|
+
))
|
|
2243
2276
|
? 'runner_start_failed'
|
|
2244
2277
|
: isRetryableDaytonaInfrastructureFailure(error)
|
|
2245
2278
|
? 'daytona_infrastructure'
|
|
@@ -216,21 +216,32 @@ function failed(
|
|
|
216
216
|
};
|
|
217
217
|
}
|
|
218
218
|
|
|
219
|
+
/**
|
|
220
|
+
* One fixed-size launch stage line, the Modal twin of
|
|
221
|
+
* `[play-runner.daytona.stage]`. `atMs` is this worker's clock when the stage
|
|
222
|
+
* happened, so a reader never has to use log ingest time. Callers pass only
|
|
223
|
+
* scalars: ids, counts, durations, booleans, never payloads or credentials.
|
|
224
|
+
*/
|
|
219
225
|
function emitModalStage(
|
|
220
226
|
context: PlayRunnerExecutionConfig['context'],
|
|
221
227
|
stage: string,
|
|
222
228
|
extra: Record<string, unknown> = {},
|
|
223
229
|
): void {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
230
|
+
try {
|
|
231
|
+
console.info(
|
|
232
|
+
'[play-runner.modal.stage]',
|
|
233
|
+
JSON.stringify({
|
|
234
|
+
workflowId: context.workflowId ?? null,
|
|
235
|
+
runId: context.runId ?? null,
|
|
236
|
+
playName: context.playName ?? null,
|
|
237
|
+
stage,
|
|
238
|
+
...extra,
|
|
239
|
+
atMs: Date.now(),
|
|
240
|
+
}),
|
|
241
|
+
);
|
|
242
|
+
} catch {
|
|
243
|
+
// Diagnostic delivery never changes the launch it describes.
|
|
244
|
+
}
|
|
234
245
|
}
|
|
235
246
|
|
|
236
247
|
export async function confirmDetachedModalRunnerReady(input: {
|
|
@@ -370,6 +381,10 @@ export const modalPlayRunnerBackend: PlayRunnerBackend = {
|
|
|
370
381
|
if (providerCircuitClaim && !providerCircuitClaim.allowed) {
|
|
371
382
|
throw recoveryForOpenModalCircuit();
|
|
372
383
|
}
|
|
384
|
+
emitModalStage(config.context, 'placement:admitted', {
|
|
385
|
+
circuitProbe: Boolean(providerCircuitClaim?.probeToken),
|
|
386
|
+
elapsedMs: Date.now() - startedAt,
|
|
387
|
+
});
|
|
373
388
|
const modalConfig = await loadModalRequiredConfig({
|
|
374
389
|
runtimeSchedulerSchema: config.context.runtimeSchedulerSchema,
|
|
375
390
|
limits: config.context.sandboxRuntimeLimits,
|
|
@@ -379,9 +394,20 @@ export const modalPlayRunnerBackend: PlayRunnerBackend = {
|
|
|
379
394
|
limits: modalConfig.limits,
|
|
380
395
|
runtimeSchedulerSchema: config.context.runtimeSchedulerSchema,
|
|
381
396
|
});
|
|
397
|
+
emitModalStage(config.context, 'config:resolved', {
|
|
398
|
+
cpu: resources.physicalCpuCores,
|
|
399
|
+
memoryMiB: memoryPolicy.reservationMemoryMiB,
|
|
400
|
+
memoryLimitMiB: memoryPolicy.memoryLimitMiB,
|
|
401
|
+
timeoutSeconds: modalConfig.limits.timeoutSeconds,
|
|
402
|
+
elapsedMs: Date.now() - startedAt,
|
|
403
|
+
});
|
|
382
404
|
const app = await modalConfig.client.apps.fromName(modalConfig.appName, {
|
|
383
405
|
createIfMissing: true,
|
|
384
406
|
});
|
|
407
|
+
emitModalStage(config.context, 'app:resolved', {
|
|
408
|
+
modalAppId: app.appId,
|
|
409
|
+
elapsedMs: Date.now() - startedAt,
|
|
410
|
+
});
|
|
385
411
|
const baseImage = modalConfig.client.images.fromRegistry(
|
|
386
412
|
modalConfig.image,
|
|
387
413
|
);
|
|
@@ -401,8 +427,16 @@ export const modalPlayRunnerBackend: PlayRunnerBackend = {
|
|
|
401
427
|
.build(app),
|
|
402
428
|
)
|
|
403
429
|
: baseImage;
|
|
430
|
+
emitModalStage(config.context, 'image:resolved', {
|
|
431
|
+
built: image !== baseImage,
|
|
432
|
+
elapsedMs: Date.now() - startedAt,
|
|
433
|
+
});
|
|
404
434
|
const capacityReservation =
|
|
405
435
|
await callbacks?.reserveSandboxCapacity?.('modal');
|
|
436
|
+
emitModalStage(config.context, 'capacity:reserved', {
|
|
437
|
+
reserved: Boolean(capacityReservation),
|
|
438
|
+
elapsedMs: Date.now() - startedAt,
|
|
439
|
+
});
|
|
406
440
|
const createTags = {
|
|
407
441
|
source: 'deepline-play-runner',
|
|
408
442
|
orgId: config.context.orgId ?? 'unknown',
|
|
@@ -451,6 +485,9 @@ export const modalPlayRunnerBackend: PlayRunnerBackend = {
|
|
|
451
485
|
? { sandboxCapacityLeaseId: capacityReservation.leaseId }
|
|
452
486
|
: {}),
|
|
453
487
|
});
|
|
488
|
+
emitModalStage(config.context, 'create:requested', {
|
|
489
|
+
elapsedMs: Date.now() - startedAt,
|
|
490
|
+
});
|
|
454
491
|
createSent = true;
|
|
455
492
|
sandbox = await awaitModalSandboxCreate({
|
|
456
493
|
create: modalConfig.client.sandboxes.create(app, image, {
|
|
@@ -535,12 +572,28 @@ export const modalPlayRunnerBackend: PlayRunnerBackend = {
|
|
|
535
572
|
await callbacks?.onAmbiguousModalCreateResolved?.();
|
|
536
573
|
},
|
|
537
574
|
});
|
|
575
|
+
emitModalStage(config.context, 'create:response', {
|
|
576
|
+
sandboxId: sandbox.sandboxId,
|
|
577
|
+
elapsedMs: Date.now() - startedAt,
|
|
578
|
+
});
|
|
538
579
|
logSandboxCreateOutcome({
|
|
539
580
|
provider: 'modal',
|
|
540
581
|
outcome: 'succeeded',
|
|
541
582
|
runId: config.context.runId,
|
|
542
583
|
});
|
|
543
584
|
} catch (error) {
|
|
585
|
+
emitModalStage(config.context, 'create:failed', {
|
|
586
|
+
sent: createSent,
|
|
587
|
+
outcome:
|
|
588
|
+
error instanceof ModalSandboxCreateOutcomeUnknownError
|
|
589
|
+
? 'unknown'
|
|
590
|
+
: 'failed',
|
|
591
|
+
reason:
|
|
592
|
+
recoveryForModalSandboxCreateFailure(error)?.decision.reason ??
|
|
593
|
+
null,
|
|
594
|
+
errorName: error instanceof Error ? error.name : null,
|
|
595
|
+
elapsedMs: Date.now() - startedAt,
|
|
596
|
+
});
|
|
544
597
|
if (createSent) {
|
|
545
598
|
logSandboxCreateOutcome({
|
|
546
599
|
provider: 'modal',
|
|
@@ -671,6 +724,10 @@ export const modalPlayRunnerBackend: PlayRunnerBackend = {
|
|
|
671
724
|
runtimeResourceRegistrationError = error;
|
|
672
725
|
throw error;
|
|
673
726
|
}
|
|
727
|
+
emitModalStage(config.context, 'resource:recorded', {
|
|
728
|
+
sandboxId: sandbox.sandboxId,
|
|
729
|
+
elapsedMs: Date.now() - startedAt,
|
|
730
|
+
});
|
|
674
731
|
|
|
675
732
|
// The baseline only has to predate this runner's first heartbeat, which
|
|
676
733
|
// cannot exist before exec. Read it while the payload uploads instead
|
|
@@ -679,6 +736,17 @@ export const modalPlayRunnerBackend: PlayRunnerBackend = {
|
|
|
679
736
|
captureDetachedDaytonaRunnerReadinessBaseline({
|
|
680
737
|
readiness: readRunnerReadiness,
|
|
681
738
|
});
|
|
739
|
+
baselineHeartbeatRead.then(
|
|
740
|
+
(heartbeatAt) =>
|
|
741
|
+
emitModalStage(config.context, 'readiness:baseline_read', {
|
|
742
|
+
hasBaseline: heartbeatAt !== null,
|
|
743
|
+
elapsedMs: Date.now() - startedAt,
|
|
744
|
+
}),
|
|
745
|
+
() =>
|
|
746
|
+
emitModalStage(config.context, 'readiness:baseline_failed', {
|
|
747
|
+
elapsedMs: Date.now() - startedAt,
|
|
748
|
+
}),
|
|
749
|
+
);
|
|
682
750
|
// Awaited (and its failure surfaced) below; this only keeps an upload
|
|
683
751
|
// failure from orphaning the read.
|
|
684
752
|
baselineHeartbeatRead.catch(() => undefined);
|
|
@@ -727,6 +795,7 @@ export const modalPlayRunnerBackend: PlayRunnerBackend = {
|
|
|
727
795
|
sandboxId: sandbox.sandboxId,
|
|
728
796
|
timeoutSeconds: modalConfig.limits.timeoutSeconds,
|
|
729
797
|
mode: 'detached',
|
|
798
|
+
elapsedMs: Date.now() - startedAt,
|
|
730
799
|
});
|
|
731
800
|
const executeStartedAt = Date.now();
|
|
732
801
|
await Promise.race([
|
|
@@ -734,6 +803,12 @@ export const modalPlayRunnerBackend: PlayRunnerBackend = {
|
|
|
734
803
|
cancellationPromise,
|
|
735
804
|
]);
|
|
736
805
|
runtimeTiming.modalExecuteMs = Date.now() - executeStartedAt;
|
|
806
|
+
const commandAcceptedAtMs = Date.now();
|
|
807
|
+
emitModalStage(config.context, 'execute:accepted', {
|
|
808
|
+
sandboxId: sandbox.sandboxId,
|
|
809
|
+
execMs: runtimeTiming.modalExecuteMs,
|
|
810
|
+
elapsedMs: commandAcceptedAtMs - startedAt,
|
|
811
|
+
});
|
|
737
812
|
await callbacks?.onRunnerCommandAccepted?.({
|
|
738
813
|
provider: 'modal',
|
|
739
814
|
sandboxId: sandbox.sandboxId,
|
|
@@ -747,6 +822,13 @@ export const modalPlayRunnerBackend: PlayRunnerBackend = {
|
|
|
747
822
|
baselineHeartbeatAt,
|
|
748
823
|
cancellation: cancellationPromise,
|
|
749
824
|
});
|
|
825
|
+
const heartbeatReadyAtMs = Date.now();
|
|
826
|
+
emitModalStage(config.context, 'execute:heartbeat_ready', {
|
|
827
|
+
sandboxId: sandbox.sandboxId,
|
|
828
|
+
elapsedMs: heartbeatReadyAtMs - startedAt,
|
|
829
|
+
commandAcceptedToHeartbeatMs:
|
|
830
|
+
heartbeatReadyAtMs - commandAcceptedAtMs,
|
|
831
|
+
});
|
|
750
832
|
const runnerAttempt = Math.max(
|
|
751
833
|
0,
|
|
752
834
|
Math.floor(config.context.runAttempt ?? 0),
|
|
@@ -25,6 +25,63 @@ import { resolveRuntimeSchedulerSchemaEnv } from './runtime-scheduler-schema';
|
|
|
25
25
|
export const ABSURD_CANCELLED_DEADLINE_RECONCILE_LIMIT = 100;
|
|
26
26
|
const QUEUED_CANCELLATION_RECONCILE_LIMIT = 20;
|
|
27
27
|
|
|
28
|
+
/** A cancel request older than this has outlived ordinary sandbox cleanup. */
|
|
29
|
+
export const UNDRAINED_RUNTIME_CANCELLATION_WARNING_AFTER_MS = 5 * 60_000;
|
|
30
|
+
/** At most one undrained-cancellation warning per process per interval. */
|
|
31
|
+
export const UNDRAINED_RUNTIME_CANCELLATION_WARNING_INTERVAL_MS = 60_000;
|
|
32
|
+
const UNDRAINED_RUNTIME_CANCELLATION_SAMPLE_LIMIT = 5;
|
|
33
|
+
let lastUndrainedCancellationWarningAtMs: number | null = null;
|
|
34
|
+
|
|
35
|
+
/** Test seam: forget the process-wide warning rate limit. */
|
|
36
|
+
export function resetUndrainedRuntimeCancellationWarningForTests(): void {
|
|
37
|
+
lastUndrainedCancellationWarningAtMs = null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Report cancel requests that have waited longer than the threshold, from
|
|
42
|
+
* paths that already read them (the worker drain and a repeated stop). Emits
|
|
43
|
+
* one bounded structured warning per process per interval: a count, the
|
|
44
|
+
* oldest age, and a fixed-size run sample. Requests without a parseable
|
|
45
|
+
* request clock (historical rows) are not reported.
|
|
46
|
+
*/
|
|
47
|
+
export function noteUndrainedRuntimeCancellations(input: {
|
|
48
|
+
source: 'drain_pending' | 'repeat_stop';
|
|
49
|
+
requests: ReadonlyArray<{ runId: string; requestedAt: string | null }>;
|
|
50
|
+
nowMs?: number;
|
|
51
|
+
}): boolean {
|
|
52
|
+
const nowMs = input.nowMs ?? Date.now();
|
|
53
|
+
const overdue = input.requests
|
|
54
|
+
.map((request) => ({
|
|
55
|
+
runId: request.runId,
|
|
56
|
+
ageMs: nowMs - Date.parse(request.requestedAt ?? ''),
|
|
57
|
+
}))
|
|
58
|
+
.filter(
|
|
59
|
+
(request) =>
|
|
60
|
+
Number.isFinite(request.ageMs) &&
|
|
61
|
+
request.ageMs >= UNDRAINED_RUNTIME_CANCELLATION_WARNING_AFTER_MS,
|
|
62
|
+
)
|
|
63
|
+
.sort((left, right) => right.ageMs - left.ageMs);
|
|
64
|
+
if (overdue.length === 0) return false;
|
|
65
|
+
if (
|
|
66
|
+
lastUndrainedCancellationWarningAtMs !== null &&
|
|
67
|
+
nowMs - lastUndrainedCancellationWarningAtMs <
|
|
68
|
+
UNDRAINED_RUNTIME_CANCELLATION_WARNING_INTERVAL_MS
|
|
69
|
+
) {
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
lastUndrainedCancellationWarningAtMs = nowMs;
|
|
73
|
+
console.warn('[absurd-runtime.cancel] undrained_cancellation', {
|
|
74
|
+
source: input.source,
|
|
75
|
+
overdueCount: overdue.length,
|
|
76
|
+
oldestAgeMs: overdue[0]!.ageMs,
|
|
77
|
+
thresholdMs: UNDRAINED_RUNTIME_CANCELLATION_WARNING_AFTER_MS,
|
|
78
|
+
sampleRunIds: overdue
|
|
79
|
+
.slice(0, UNDRAINED_RUNTIME_CANCELLATION_SAMPLE_LIMIT)
|
|
80
|
+
.map((request) => request.runId),
|
|
81
|
+
});
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
|
|
28
85
|
function quoteAbsurdTable(table: string): string {
|
|
29
86
|
return `"${table.replaceAll('"', '""')}"`;
|
|
30
87
|
}
|
|
@@ -269,6 +326,7 @@ export async function reconcileQueuedAbsurdRuntimeCancellations(input: {
|
|
|
269
326
|
const queued = await input.client.query<{
|
|
270
327
|
key: string;
|
|
271
328
|
reason: string | null;
|
|
329
|
+
requested_at: string | null;
|
|
272
330
|
}>(
|
|
273
331
|
`WITH selected AS (
|
|
274
332
|
SELECT key FROM ${schedulerSchema}.control
|
|
@@ -281,37 +339,50 @@ export async function reconcileQueuedAbsurdRuntimeCancellations(input: {
|
|
|
281
339
|
SET updated_at = clock_timestamp()
|
|
282
340
|
FROM selected
|
|
283
341
|
WHERE request.key = selected.key
|
|
284
|
-
RETURNING request.key, request.value->>'reason' AS reason
|
|
342
|
+
RETURNING request.key, request.value->>'reason' AS reason,
|
|
343
|
+
request.value->>'requestedAt' AS requested_at`,
|
|
285
344
|
[limit],
|
|
286
345
|
);
|
|
287
346
|
let reconciled = 0;
|
|
288
347
|
let skipped = 0;
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
348
|
+
const stillPending: Array<{ runId: string; requestedAt: string | null }> = [];
|
|
349
|
+
try {
|
|
350
|
+
for (const row of queued.rows) {
|
|
351
|
+
const runId = row.key.slice('runtime_cancel:'.length);
|
|
352
|
+
if (!runId) {
|
|
353
|
+
throw new Error(`Malformed runtime cancellation request "${row.key}".`);
|
|
354
|
+
}
|
|
355
|
+
try {
|
|
356
|
+
const outcome = await finalizeCancelledRunAfterCleanup({
|
|
357
|
+
client: input.client,
|
|
358
|
+
runId,
|
|
359
|
+
reason: row.reason || 'Cancelled play run.',
|
|
360
|
+
schedulerSchema,
|
|
361
|
+
schedulerOptions: input.schedulerOptions,
|
|
362
|
+
controlKey: row.key,
|
|
363
|
+
});
|
|
364
|
+
if (outcome === 'cancelled') reconciled += 1;
|
|
365
|
+
else skipped += 1;
|
|
366
|
+
if (outcome === 'pending') {
|
|
367
|
+
stillPending.push({ runId, requestedAt: row.requested_at });
|
|
368
|
+
}
|
|
369
|
+
} catch (error) {
|
|
370
|
+
if (
|
|
371
|
+
isRuntimeSchedulerQueryCancellationError(error) ||
|
|
372
|
+
isRuntimeSchedulerRetryableTransactionError(error)
|
|
373
|
+
) {
|
|
374
|
+
skipped += 1;
|
|
375
|
+
stillPending.push({ runId, requestedAt: row.requested_at });
|
|
376
|
+
break;
|
|
377
|
+
}
|
|
378
|
+
throw error;
|
|
312
379
|
}
|
|
313
|
-
throw error;
|
|
314
380
|
}
|
|
381
|
+
} finally {
|
|
382
|
+
noteUndrainedRuntimeCancellations({
|
|
383
|
+
source: 'drain_pending',
|
|
384
|
+
requests: stillPending,
|
|
385
|
+
});
|
|
315
386
|
}
|
|
316
387
|
return { reconciled, skipped };
|
|
317
388
|
}
|
package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts
CHANGED
|
@@ -56,6 +56,8 @@ import {
|
|
|
56
56
|
isRuntimeTrafficPolicy,
|
|
57
57
|
type RuntimeTrafficPolicy,
|
|
58
58
|
} from '../runtime-traffic-policy';
|
|
59
|
+
import type { PreloadedRuntimeDbSession } from '../db-session';
|
|
60
|
+
import { parseRenewedPreloadedRuntimeDbSessions } from '../db-session-renewal';
|
|
59
61
|
import { RUNTIME_CLAIM_HEARTBEAT_DIVISOR } from '../runtime-constants';
|
|
60
62
|
import { runtimeLimitExceededCause } from '../run-failure';
|
|
61
63
|
import {
|
|
@@ -853,6 +855,9 @@ export type AbsurdRuntimeWorkerDeps = {
|
|
|
853
855
|
initializeComputeSession?: boolean;
|
|
854
856
|
onComputeSessionInitialized?: () => void;
|
|
855
857
|
onRuntimeTrafficPolicy?: (policy: RuntimeTrafficPolicy) => void;
|
|
858
|
+
onPreloadedDbSessionsRenewed?: (
|
|
859
|
+
sessions: PreloadedRuntimeDbSession[],
|
|
860
|
+
) => void;
|
|
856
861
|
}) => Promise<string>;
|
|
857
862
|
/** This worker's release lane id. Seam so tests can drive the belt-and-
|
|
858
863
|
* suspenders lane-mismatch guard without mutating process env. Defaults to
|
|
@@ -1108,6 +1113,9 @@ export async function requestAttemptExecutorToken(input: {
|
|
|
1108
1113
|
initializeComputeSession?: boolean;
|
|
1109
1114
|
onComputeSessionInitialized?: () => void;
|
|
1110
1115
|
onRuntimeTrafficPolicy?: (policy: RuntimeTrafficPolicy) => void;
|
|
1116
|
+
onPreloadedDbSessionsRenewed?: (
|
|
1117
|
+
sessions: PreloadedRuntimeDbSession[],
|
|
1118
|
+
) => void;
|
|
1111
1119
|
}): Promise<string> {
|
|
1112
1120
|
const internalToken = process.env.DEEPLINE_INTERNAL_TOKEN?.trim();
|
|
1113
1121
|
if (!internalToken) {
|
|
@@ -1180,6 +1188,7 @@ export async function requestAttemptExecutorToken(input: {
|
|
|
1180
1188
|
const responseForFingerprint = response.clone();
|
|
1181
1189
|
const body = (await response.json().catch(() => null)) as {
|
|
1182
1190
|
executorToken?: unknown;
|
|
1191
|
+
preloadedDbSessions?: unknown;
|
|
1183
1192
|
error?: unknown;
|
|
1184
1193
|
code?: unknown;
|
|
1185
1194
|
capacitySource?: unknown;
|
|
@@ -1242,6 +1251,15 @@ export async function requestAttemptExecutorToken(input: {
|
|
|
1242
1251
|
response.headers.get('x-request-id') ??
|
|
1243
1252
|
null,
|
|
1244
1253
|
});
|
|
1254
|
+
// An app that renewed this run's expired admission sessions returns them;
|
|
1255
|
+
// older apps omit the field and the launch's stored sessions stay in use.
|
|
1256
|
+
// A malformed array is ignored the same way, never half-applied.
|
|
1257
|
+
const renewedDbSessions = parseRenewedPreloadedRuntimeDbSessions(
|
|
1258
|
+
body.preloadedDbSessions,
|
|
1259
|
+
);
|
|
1260
|
+
if (renewedDbSessions) {
|
|
1261
|
+
input.onPreloadedDbSessionsRenewed?.(renewedDbSessions);
|
|
1262
|
+
}
|
|
1245
1263
|
if (
|
|
1246
1264
|
input.initializeComputeSession === true &&
|
|
1247
1265
|
body.computeSessionInitialized?.sessionId ===
|
|
@@ -3570,6 +3588,7 @@ async function executeAbsurdAttemptAdapter(
|
|
|
3570
3588
|
if (gated) return gated;
|
|
3571
3589
|
}
|
|
3572
3590
|
const tokenStartedAt = performance.now();
|
|
3591
|
+
let renewedDbSessions: PreloadedRuntimeDbSession[] | null = null;
|
|
3573
3592
|
const executorToken = await runWithAbsurdExecutionLeaseHeartbeat({
|
|
3574
3593
|
ctx,
|
|
3575
3594
|
runId,
|
|
@@ -3593,6 +3612,11 @@ async function executeAbsurdAttemptAdapter(
|
|
|
3593
3612
|
attempt: generation,
|
|
3594
3613
|
leaseToken,
|
|
3595
3614
|
schedulerSchema: options?.schema ?? null,
|
|
3615
|
+
onPreloadedDbSessionsRenewed: (
|
|
3616
|
+
sessions: PreloadedRuntimeDbSession[],
|
|
3617
|
+
) => {
|
|
3618
|
+
renewedDbSessions = sessions;
|
|
3619
|
+
},
|
|
3596
3620
|
...(initializeComputeSession
|
|
3597
3621
|
? {
|
|
3598
3622
|
initializeComputeSession: true,
|
|
@@ -3616,9 +3640,14 @@ async function executeAbsurdAttemptAdapter(
|
|
|
3616
3640
|
}),
|
|
3617
3641
|
);
|
|
3618
3642
|
});
|
|
3643
|
+
// Assigned inside the mint callback; widen past control-flow narrowing.
|
|
3644
|
+
const renewedSessions = renewedDbSessions as
|
|
3645
|
+
| PreloadedRuntimeDbSession[]
|
|
3646
|
+
| null;
|
|
3619
3647
|
executionLaunch = {
|
|
3620
3648
|
...launch,
|
|
3621
3649
|
executorToken,
|
|
3650
|
+
...(renewedSessions ? { preloadedDbSessions: renewedSessions } : {}),
|
|
3622
3651
|
};
|
|
3623
3652
|
const runtimeApi = deps.runtimeApiFromLaunch(executionLaunch);
|
|
3624
3653
|
return await executeAssignedAbsurdAttempt({
|