deepline 0.3.573 → 0.3.575
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/config.ts +19 -0
- package/dist/bundling-sources/sdk/src/play.ts +7 -4
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/sdk/src/types.ts +8 -0
- package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +0 -18
- package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +8 -0
- package/dist/bundling-sources/shared_libs/play-runtime/builtin-pacing.ts +18 -0
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +4 -1
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/commands/roll-receipt-gateway.ts +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/vercel-fly-rollback-alignment.ts +0 -14
- package/dist/bundling-sources/shared_libs/play-runtime/governor/governor.ts +4 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-launch-transport.ts +43 -7
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-payload-transport.ts +56 -20
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/modal.ts +45 -7
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +6 -66
- package/dist/cli/agents-BCLO3KQJ.js +996 -0
- package/dist/cli/agents-ULGDKUTM.mjs +996 -0
- package/dist/cli/{auth-XX3HLRQ2.mjs → auth-4WCL7A6W.mjs} +5 -5
- package/dist/cli/auth-DXUHEL5I.js +44 -0
- package/dist/cli/{billing-QASEPOBL.mjs → billing-7JQ6EUQU.mjs} +10 -10
- package/dist/cli/{billing-6TY2HMC6.js → billing-BF5LVXOM.js} +106 -106
- package/dist/cli/{chunk-NUH56LTU.mjs → chunk-2T7XOKVL.mjs} +5 -5
- package/dist/cli/{chunk-KQZBN7TB.js → chunk-2UM3I2MY.js} +1 -1
- package/dist/cli/{chunk-MQOJ7SP4.mjs → chunk-3PVKXUSJ.mjs} +9 -1
- package/dist/cli/{chunk-6JTJP3WO.mjs → chunk-56N3XAT6.mjs} +5 -5
- package/dist/cli/{chunk-T2QI52F2.mjs → chunk-5D7OJY4W.mjs} +1 -1
- package/dist/cli/{chunk-JAW75RAO.js → chunk-5H6254MJ.js} +27 -20
- package/dist/cli/{chunk-N3VZTISZ.js → chunk-5VSHQG5E.js} +8 -8
- package/dist/cli/{chunk-KART6FR6.js → chunk-636GD4IR.js} +2 -2
- package/dist/cli/{chunk-XWO4J34B.js → chunk-6IKLITVH.js} +6 -6
- package/dist/cli/{chunk-Z6KWSBOX.js → chunk-737Y7QGT.js} +41 -41
- package/dist/cli/{chunk-XVFRNNL2.js → chunk-7DLAJ6JJ.js} +53 -53
- package/dist/cli/{chunk-GWPXWKQR.js → chunk-AO56MZ7D.js} +15 -7
- package/dist/cli/{chunk-DIZI5YGW.js → chunk-AS5XGOZY.js} +2 -2
- package/dist/cli/{chunk-ESKNCTFI.mjs → chunk-BM536WWR.mjs} +1 -1
- package/dist/cli/{chunk-LPYUGPTF.mjs → chunk-BONMEBWZ.mjs} +4 -4
- package/dist/cli/{chunk-4LWBURSS.mjs → chunk-BQUAE6LQ.mjs} +1 -1
- package/dist/cli/{chunk-QDQOXHXQ.mjs → chunk-CVY4MBXH.mjs} +5 -5
- package/dist/cli/{chunk-N6KF6X3D.js → chunk-DMPGJCNZ.js} +177 -6
- package/dist/cli/{chunk-ENHQBPR5.mjs → chunk-DWUESXDD.mjs} +4 -3
- package/dist/cli/{chunk-5NEJOCOK.mjs → chunk-E4RYSSXX.mjs} +2 -2
- package/dist/cli/{chunk-IZK2BLBW.js → chunk-EV3OPDHF.js} +20 -20
- package/dist/cli/{chunk-YKHXWO7N.js → chunk-EZIXKNKM.js} +3 -3
- package/dist/cli/{chunk-64MOX3SN.mjs → chunk-FDCU3VAJ.mjs} +174 -3
- package/dist/cli/{chunk-X3BGF6UU.js → chunk-FXXERR52.js} +10 -10
- package/dist/cli/{chunk-BM4GE67C.mjs → chunk-FYKHAT2F.mjs} +81 -7
- package/dist/cli/{chunk-UNTBQY64.js → chunk-G2H6SQQY.js} +11 -11
- package/dist/cli/{chunk-WQEGXOUT.js → chunk-G4WPDCXA.js} +48 -48
- package/dist/cli/{chunk-OG3YWDYA.js → chunk-GB4IZ5TV.js} +13 -13
- package/dist/cli/{chunk-N5VL6BHF.mjs → chunk-GQZFZG6R.mjs} +2 -2
- package/dist/cli/{chunk-JCVAVHDP.mjs → chunk-H3CG72RZ.mjs} +21 -16
- package/dist/cli/{chunk-FXLVMWWA.js → chunk-H6JMRLAZ.js} +280 -275
- package/dist/cli/{chunk-UBTEDSIK.js → chunk-HEOM3FAC.js} +20 -20
- package/dist/cli/{chunk-CY3BUFMG.js → chunk-HO76C7AE.js} +2 -2
- package/dist/cli/{chunk-XAIXTB74.mjs → chunk-IAJ65IDZ.mjs} +4 -4
- package/dist/cli/{chunk-ENLJ67CZ.mjs → chunk-IBYMGR5Y.mjs} +1 -1
- package/dist/cli/{chunk-4K6UVILG.mjs → chunk-IOWLFWWG.mjs} +2 -2
- package/dist/cli/{chunk-NJTTRJ32.mjs → chunk-JGLCK2XF.mjs} +2 -2
- package/dist/cli/{chunk-DLWVJ66I.js → chunk-KNCNFL76.js} +4 -4
- package/dist/cli/{chunk-XLN4Z654.mjs → chunk-MN7JLH2T.mjs} +2 -2
- package/dist/cli/{chunk-IXCGWJJZ.mjs → chunk-MWLOBURN.mjs} +2 -2
- package/dist/cli/{chunk-6ASDTHEN.js → chunk-MXK4M7HP.js} +21 -17
- package/dist/cli/{chunk-C52RRBYB.mjs → chunk-NF722E6C.mjs} +1 -1
- package/dist/cli/{chunk-TNCJ2J76.js → chunk-PQYDO72W.js} +26 -26
- package/dist/cli/{chunk-PW3PADXI.mjs → chunk-QEDRUURT.mjs} +1 -1
- package/dist/cli/{chunk-QFDT35HF.mjs → chunk-QKP3WYSZ.mjs} +3 -3
- package/dist/cli/{chunk-M2UJWUWX.mjs → chunk-RHRRY2BX.mjs} +3 -3
- package/dist/cli/{chunk-HUJMFETO.mjs → chunk-RW3URFZK.mjs} +7 -3
- package/dist/cli/{chunk-TBLP7HDL.js → chunk-SKHUWQZE.js} +10 -9
- package/dist/cli/{chunk-WSXRJ2RZ.mjs → chunk-SYQTBHRX.mjs} +3 -3
- package/dist/cli/{chunk-ANSHNREL.mjs → chunk-TMFR2B45.mjs} +3 -3
- package/dist/cli/{chunk-5MCC4D25.mjs → chunk-TTBZ7QXX.mjs} +1 -1
- package/dist/cli/{chunk-ROSPYLDN.mjs → chunk-UQZP7XBQ.mjs} +17 -10
- package/dist/cli/{chunk-TJSKDOXN.js → chunk-V5XLENWK.js} +7 -7
- package/dist/cli/{chunk-DSE45YP4.mjs → chunk-X47J55ZJ.mjs} +2 -2
- package/dist/cli/{chunk-FUVVTHXE.js → chunk-XFV353R2.js} +23 -23
- package/dist/cli/{chunk-OPD6XUIG.js → chunk-YNAXKA23.js} +5 -5
- package/dist/cli/{chunk-LHPYCJNL.js → chunk-ZO65VJRJ.js} +87 -13
- package/dist/cli/{chunk-2USXCXPZ.js → chunk-ZQXJYO5P.js} +5 -5
- package/dist/cli/{chunk-UZLTBBAG.js → chunk-ZS6DT4LD.js} +15 -15
- package/dist/cli/{chunk-KQLIG4YR.js → chunk-ZYSJND73.js} +9 -9
- package/dist/cli/command-docs.js +3 -3
- package/dist/cli/command-docs.mjs +2 -2
- package/dist/cli/{concurrent-runs-help-IILHMHBX.mjs → concurrent-runs-help-HITK6EOO.mjs} +7 -7
- package/dist/cli/concurrent-runs-help-JLWY54WL.js +22 -0
- package/dist/cli/{csv-OSJQVDAS.js → csv-RS7XHQ4P.js} +13 -13
- package/dist/cli/{csv-VGYW2PQZ.mjs → csv-V2T23MXT.mjs} +4 -4
- package/dist/cli/{db-3IQYT3WD.mjs → db-OQ4RNTGE.mjs} +6 -6
- package/dist/cli/{db-2IMS6K2F.js → db-WFIVRPKY.js} +27 -27
- package/dist/cli/describe-33PBWO5O.js +50 -0
- package/dist/cli/{describe-IGJ4CHUC.mjs → describe-AXV2EEX3.mjs} +21 -21
- package/dist/cli/describe-core.d.mts +13 -2
- package/dist/cli/describe-core.d.ts +13 -2
- package/dist/cli/describe-core.js +4 -4
- package/dist/cli/describe-core.mjs +3 -3
- package/dist/cli/{executions-VOJN4NPF.js → executions-5H2RIWZ3.js} +8 -8
- package/dist/cli/{executions-6F3PLVCR.mjs → executions-THP5ZDBQ.mjs} +6 -6
- package/dist/cli/{feedback-BP5G27DT.mjs → feedback-2EJPILGE.mjs} +6 -6
- package/dist/cli/{feedback-5N7GKSMC.js → feedback-UOI6UEGA.js} +14 -14
- package/dist/cli/git-2OPYEPYW.js +26 -0
- package/dist/cli/{git-FHNCP7QA.mjs → git-DI3LJIAT.mjs} +5 -5
- package/dist/cli/index.js +152 -148
- package/dist/cli/index.mjs +51 -47
- package/dist/cli/{integrations-KKCEEWDU.mjs → integrations-DJYS5VRK.mjs} +7 -7
- package/dist/cli/{integrations-JZV55BZT.js → integrations-TYN2BSQ6.js} +29 -29
- package/dist/cli/{legacy-noops-OVOHF47E.js → legacy-noops-GXQHNLGJ.js} +9 -9
- package/dist/cli/{legacy-noops-YOPWDLRG.mjs → legacy-noops-Z457BB6O.mjs} +6 -6
- package/dist/cli/{mcp-SJAXFYTI.mjs → mcp-NAW3GFNN.mjs} +4 -4
- package/dist/cli/{mcp-F2XGBA6W.js → mcp-WMBOOTQL.js} +24 -24
- package/dist/cli/{monitors-PFH3FQLD.mjs → monitors-A7NYAXSJ.mjs} +7 -7
- package/dist/cli/{monitors-RQRNQRYB.js → monitors-OOQVE7XR.js} +100 -100
- package/dist/cli/{org-PZC6SUZD.mjs → org-7YCDUSZE.mjs} +6 -6
- package/dist/cli/{org-WPOEKMTG.js → org-D2AMIVBS.js} +121 -121
- package/dist/cli/{outcomes-EXOCNHOC.js → outcomes-2FKZDJSQ.js} +17 -15
- package/dist/cli/{outcomes-ZS7XD3KQ.mjs → outcomes-TNTKCUEO.mjs} +9 -7
- package/dist/cli/{play-UKSRFVIU.mjs → play-L6CVHSN4.mjs} +88 -33
- package/dist/cli/{play-JS2TEEE7.js → play-NWKHCHVZ.js} +393 -338
- package/dist/cli/{providers-U6IODPMJ.mjs → providers-22LO747B.mjs} +6 -6
- package/dist/cli/{providers-3U4MWBLU.js → providers-PZGOI5CN.js} +9 -9
- package/dist/cli/{quickstart-G5QN5CUE.mjs → quickstart-3ZRVKGMH.mjs} +4 -4
- package/dist/cli/{quickstart-SHBAEDX6.js → quickstart-LLWOC2GR.js} +6 -6
- package/dist/cli/{run-3ZOJ6V7C.mjs → run-D46W2GUA.mjs} +48 -27
- package/dist/cli/{run-SZRKNLUT.js → run-SNF23STR.js} +70 -49
- package/dist/cli/search-H57MZPLF.js +32 -0
- package/dist/cli/{search-2VX5WNMJ.mjs → search-XWVCICIX.mjs} +7 -7
- package/dist/cli/{search-output-WGDHYYHX.js → search-output-36GHD67U.js} +12 -9
- package/dist/cli/{search-output-U5N2O6IA.mjs → search-output-YM5QXFQQ.mjs} +9 -6
- package/dist/cli/{secrets-SQKP5ILO.mjs → secrets-7PTZEFRC.mjs} +6 -6
- package/dist/cli/{secrets-UITJOGVQ.js → secrets-UXCIHG5I.js} +15 -15
- package/dist/cli/{sessions-LSXO2OKX.mjs → sessions-DTXJKRP4.mjs} +6 -6
- package/dist/cli/sessions-JJZMQSH4.js +23 -0
- package/dist/cli/{settings-YGYRDPOK.mjs → settings-74B6UOS4.mjs} +12 -12
- package/dist/cli/{settings-VZI675JG.js → settings-EYSDZE37.js} +85 -85
- package/dist/cli/{setup-GXGXRWKN.mjs → setup-2QRZ36CH.mjs} +9 -9
- package/dist/cli/{setup-OJ33NOWK.js → setup-E7PVXBPL.js} +49 -49
- package/dist/cli/{skills-3VDYIFAX.mjs → skills-2WZ7N3UW.mjs} +7 -7
- package/dist/cli/skills-RIF2DCZI.js +37 -0
- package/dist/cli/tools-7VRQ4GSI.js +57 -0
- package/dist/cli/{tools-3TKEGDBP.mjs → tools-YK5SCUZD.mjs} +19 -19
- package/dist/cli/{update-K6A4QXTC.mjs → update-563YQK53.mjs} +9 -9
- package/dist/cli/update-CMZAIAES.js +37 -0
- package/dist/cli/{views-2PPIVWDK.mjs → views-ISNCRZUP.mjs} +6 -6
- package/dist/cli/{views-SGGO77XS.js → views-OLPS6TPG.js} +21 -21
- package/dist/cli/{workflow-JTG6QEFO.mjs → workflow-B3ZKU3OR.mjs} +7 -7
- package/dist/cli/{workflow-YSFOOTPB.js → workflow-CUSCTYMW.js} +17 -17
- package/dist/{client-DCnExziW.d.ts → client-BrdMPFCM.d.ts} +1 -1
- package/dist/{client-ClJlqkKt.d.mts → client-CF-bsrtI.d.mts} +1 -1
- package/dist/{client-core-DAOPQnGD.d.mts → client-core-DM1ZedOG.d.mts} +8 -0
- package/dist/{client-core-BKq5ZNAl.d.ts → client-core-rMoUWSYM.d.ts} +8 -0
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +9 -9
- package/dist/index.mjs +6 -6
- package/dist/install-integrity.json +128 -126
- package/dist/plays/play-description.d.mts +1 -1
- package/dist/plays/play-description.d.ts +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 +5 -5
- package/dist/server.mjs +3 -3
- package/package.json +1 -1
- package/dist/cli/auth-DGR7ZQJL.js +0 -44
- package/dist/cli/concurrent-runs-help-HEIDXAM2.js +0 -22
- package/dist/cli/describe-LBU4I6SU.js +0 -50
- package/dist/cli/git-JUSPUUOH.js +0 -26
- package/dist/cli/search-TAFMLK4K.js +0 -32
- package/dist/cli/sessions-RA6FBIHJ.js +0 -23
- package/dist/cli/skills-J5QVWKLQ.js +0 -37
- package/dist/cli/tools-3PQXQGXL.js +0 -57
- package/dist/cli/update-CA3DZ75E.js +0 -37
- /package/dist/cli/{chunk-2RIKOPIM.mjs → chunk-HECXJBED.mjs} +0 -0
- /package/dist/cli/{chunk-H4ALLC2X.js → chunk-TJCENACZ.js} +0 -0
|
@@ -1028,6 +1028,25 @@ function activeOrganizationFromEnv(
|
|
|
1028
1028
|
return { org_id: orgId, org_name: orgName };
|
|
1029
1029
|
}
|
|
1030
1030
|
|
|
1031
|
+
/**
|
|
1032
|
+
* The org a dashboard link printed for `baseUrl` is for: the one saved with
|
|
1033
|
+
* the credential the CLI resolves for that host, or null when none is saved.
|
|
1034
|
+
* The dashboard only switches to it for a member, so a link carries it as a
|
|
1035
|
+
* request, never as authority.
|
|
1036
|
+
*/
|
|
1037
|
+
export function resolveCliDashboardOrgId(baseUrl: string): string | null {
|
|
1038
|
+
// ponytail: the default credential for the host; a command run with an
|
|
1039
|
+
// explicit key or --auth-scope still links the default credential's org.
|
|
1040
|
+
const apiKey = resolveApiKeyForBaseUrl(baseUrl);
|
|
1041
|
+
if (!apiKey) return null;
|
|
1042
|
+
const normalized = normalizeBaseUrl(baseUrl);
|
|
1043
|
+
if (!normalized) return null;
|
|
1044
|
+
return (
|
|
1045
|
+
resolveCliCommandContext({ baseUrl: normalized, apiKey })
|
|
1046
|
+
.active_organization?.org_id ?? null
|
|
1047
|
+
);
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1031
1050
|
/**
|
|
1032
1051
|
* Resolve display-only organization metadata from the exact credential source
|
|
1033
1052
|
* selected for this CLI process. The metadata never participates in routing.
|
|
@@ -564,9 +564,7 @@ type DocflowHelperObserver = {
|
|
|
564
564
|
*/
|
|
565
565
|
export function __deeplineCurrentDocflowContext(): DocflowHelperObserver | null {
|
|
566
566
|
const context =
|
|
567
|
-
docflowRunContexts?.getStore() ??
|
|
568
|
-
scriptRuns.getStore()?.context ??
|
|
569
|
-
null;
|
|
567
|
+
docflowRunContexts?.getStore() ?? scriptRuns.getStore()?.context ?? null;
|
|
570
568
|
if (!context) return null;
|
|
571
569
|
// Display-only: a context that cannot be read is no context at all.
|
|
572
570
|
let observe: unknown;
|
|
@@ -581,7 +579,12 @@ export function __deeplineCurrentDocflowContext(): DocflowHelperObserver | null
|
|
|
581
579
|
}
|
|
582
580
|
if (typeof observe !== 'function') return null;
|
|
583
581
|
return {
|
|
584
|
-
__deeplineObserveDocflowNode: (
|
|
582
|
+
__deeplineObserveDocflowNode: (
|
|
583
|
+
nodeId,
|
|
584
|
+
inputCaptures,
|
|
585
|
+
outputPaths,
|
|
586
|
+
execute,
|
|
587
|
+
) =>
|
|
585
588
|
observe.call(context, nodeId, inputCaptures, outputPaths, execute, {
|
|
586
589
|
origin: 'helper',
|
|
587
590
|
}),
|
|
@@ -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.575',
|
|
209
209
|
updateSummary: {
|
|
210
210
|
introducedIn: '0.3.90',
|
|
211
211
|
summary:
|
|
@@ -315,6 +315,14 @@ export interface ToolDefinition extends ToolExecutionMetadataFields {
|
|
|
315
315
|
}>;
|
|
316
316
|
/** User-facing pricing summary. Internal provider/settlement costs are intentionally omitted. */
|
|
317
317
|
pricing?: ToolPricingSummary | null;
|
|
318
|
+
/**
|
|
319
|
+
* Set when the tool runs on this workspace's own provider key, so Deepline
|
|
320
|
+
* charges 0 credits: `own_provider_credentials` (the provider bills the
|
|
321
|
+
* workspace) or `free` (free on Deepline). Absent for managed pricing.
|
|
322
|
+
*/
|
|
323
|
+
billingSource?: string;
|
|
324
|
+
/** Display label for {@link billingSource}: "your key" on a saved key. */
|
|
325
|
+
billingSourceLabel?: string;
|
|
318
326
|
/** How to use the tool well: the provider's summary and the tool's own notes. */
|
|
319
327
|
guidance?: { provider?: string; tool?: string };
|
|
320
328
|
/** Copyable play-runtime guidance for V2 tool execution results. */
|
|
@@ -545,24 +545,6 @@
|
|
|
545
545
|
"failureAlert": "github_workflow_run",
|
|
546
546
|
"domainReportRequired": true
|
|
547
547
|
},
|
|
548
|
-
{
|
|
549
|
-
"id": "github.release-train",
|
|
550
|
-
"name": "Release train",
|
|
551
|
-
"scheduler": "github_actions",
|
|
552
|
-
"cadence": "*/5 * * * *",
|
|
553
|
-
"timezone": "UTC",
|
|
554
|
-
"source": ".github/workflows/release-train.yml",
|
|
555
|
-
"locator": "schedule:",
|
|
556
|
-
"owner": "platform",
|
|
557
|
-
"criticality": "operational",
|
|
558
|
-
"purpose": "Recheck whether the latest main commit can start a release train after a cadence or capacity deferral.",
|
|
559
|
-
"successDefinition": "The starter is disabled, or it records a dispatch or deferral decision and GitHub accepts any selected train dispatch.",
|
|
560
|
-
"failureDefinition": "Git ref or train history lookup fails, the configured cadence is invalid, or GitHub rejects the selected dispatch.",
|
|
561
|
-
"startGraceMs": 600000,
|
|
562
|
-
"runTimeoutMs": 300000,
|
|
563
|
-
"failureAlert": "github_workflow_run",
|
|
564
|
-
"domainReportRequired": true
|
|
565
|
-
},
|
|
566
548
|
{
|
|
567
549
|
"id": "github.runtime-lifecycle",
|
|
568
550
|
"name": "On-Demand Runtime Lifecycle Load Check",
|
|
@@ -256,6 +256,13 @@ type RuntimeApiRequest =
|
|
|
256
256
|
inputSha256?: string;
|
|
257
257
|
replayedFromRunId?: string | null;
|
|
258
258
|
firstClaimLatencyMs?: number;
|
|
259
|
+
/**
|
|
260
|
+
* Epoch ms the scheduler committed the run's start (its outbox row).
|
|
261
|
+
* The app records run.started at this time instead of when the
|
|
262
|
+
* delivery arrives, so a late delivery cannot put startedAt after
|
|
263
|
+
* finishedAt. Optional: older workers omit it.
|
|
264
|
+
*/
|
|
265
|
+
startedAt?: number;
|
|
259
266
|
}
|
|
260
267
|
| {
|
|
261
268
|
action: 'record_first_claim_latency';
|
|
@@ -3143,6 +3150,7 @@ export async function startRunViaAppRuntime(
|
|
|
3143
3150
|
replayedFromRunId?: string | null;
|
|
3144
3151
|
firstClaimLatencyMs?: number;
|
|
3145
3152
|
idempotencyKey?: string;
|
|
3153
|
+
startedAt?: number;
|
|
3146
3154
|
},
|
|
3147
3155
|
): Promise<void> {
|
|
3148
3156
|
await postAppRuntimeApi<{ ok: true }>(context, {
|
|
@@ -37,6 +37,24 @@ export const CTX_FETCH_EGRESS_PACING = {
|
|
|
37
37
|
rules: [CTX_FETCH_EGRESS_PACING_RULE],
|
|
38
38
|
} satisfies BuiltinPacingPolicy;
|
|
39
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Whether a 429 from the called service may cool the tool's shared rate
|
|
42
|
+
* bucket. A provider's 429 normally speaks for its whole quota, so it does.
|
|
43
|
+
* `generic_http` is every public host behind one workspace bucket: one site's
|
|
44
|
+
* `Retry-After` says nothing about another, and recording it would hold every
|
|
45
|
+
* other HTTP call in the workspace for as long as that site asked. The call
|
|
46
|
+
* that received the 429 still honors it on its own retry.
|
|
47
|
+
*/
|
|
48
|
+
export function destinationBackpressureCoolsSharedBucket(input: {
|
|
49
|
+
toolId?: string;
|
|
50
|
+
provider: string;
|
|
51
|
+
}): boolean {
|
|
52
|
+
return (
|
|
53
|
+
input.toolId !== CTX_FETCH_EGRESS_TOOL_ID &&
|
|
54
|
+
input.provider !== CTX_FETCH_EGRESS_PROVIDER
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
40
58
|
export function resolveBuiltinPacing(
|
|
41
59
|
toolId: string,
|
|
42
60
|
): { provider: string; rules: PacingRule[] } | null {
|
|
@@ -176,6 +176,7 @@ import {
|
|
|
176
176
|
import {
|
|
177
177
|
CTX_FETCH_EGRESS_PROVIDER,
|
|
178
178
|
CTX_FETCH_EGRESS_TOOL_ID,
|
|
179
|
+
destinationBackpressureCoolsSharedBucket,
|
|
179
180
|
} from './builtin-pacing';
|
|
180
181
|
import {
|
|
181
182
|
legacyRawFromToolResponseRawV2,
|
|
@@ -25579,7 +25580,9 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
25579
25580
|
provider,
|
|
25580
25581
|
retryAfterMs,
|
|
25581
25582
|
retryAtMs,
|
|
25582
|
-
outcome:
|
|
25583
|
+
outcome: destinationBackpressureCoolsSharedBucket({ toolId, provider })
|
|
25584
|
+
? 'recorded'
|
|
25585
|
+
: 'not_recorded_destination_scoped',
|
|
25583
25586
|
})}`,
|
|
25584
25587
|
{ level: 'warn' },
|
|
25585
25588
|
);
|
package/dist/bundling-sources/shared_libs/play-runtime/deployment/commands/roll-receipt-gateway.ts
CHANGED
|
@@ -1734,7 +1734,7 @@ async function activate(operationId: string): Promise<void> {
|
|
|
1734
1734
|
}
|
|
1735
1735
|
|
|
1736
1736
|
// There is deliberately no release-SHA fence here. The workflow's
|
|
1737
|
-
// release
|
|
1737
|
+
// Production release concurrency group runs one release at a time and
|
|
1738
1738
|
// debounces queued pushes to the newest main commit, so a cutover that has
|
|
1739
1739
|
// started finishes even when main moves; the newer commit releases next.
|
|
1740
1740
|
// Aborting here used to strand every release once merges landed faster than
|
package/dist/bundling-sources/shared_libs/play-runtime/deployment/vercel-fly-rollback-alignment.ts
CHANGED
|
@@ -56,7 +56,6 @@ export interface VercelDeploymentEventSummary {
|
|
|
56
56
|
export type VercelPromotionTiming = {
|
|
57
57
|
requestedAt: number;
|
|
58
58
|
previousReleaseAt?: number;
|
|
59
|
-
train?: { runId: string; attempt: string; durationMs: number };
|
|
60
59
|
};
|
|
61
60
|
|
|
62
61
|
export function vercelPromotionTimingKey(deploymentId: string): string {
|
|
@@ -311,19 +310,6 @@ export function buildVercelDeploymentSlackText(
|
|
|
311
310
|
`${formatDuration(sinceRelease)} since last Production release`,
|
|
312
311
|
);
|
|
313
312
|
}
|
|
314
|
-
const train = timing.train;
|
|
315
|
-
if (
|
|
316
|
-
train &&
|
|
317
|
-
/^[1-9]\d*$/.test(train.runId) &&
|
|
318
|
-
/^[1-9]\d*$/.test(train.attempt) &&
|
|
319
|
-
Number.isFinite(train.durationMs) &&
|
|
320
|
-
train.durationMs >= 0
|
|
321
|
-
) {
|
|
322
|
-
const url = `https://github.com/getaero-io/deepline-api/actions/runs/${train.runId}/attempts/${train.attempt}`;
|
|
323
|
-
timingParts.push(
|
|
324
|
-
`CI train <${url}|${formatDuration(train.durationMs)}>`,
|
|
325
|
-
);
|
|
326
|
-
}
|
|
327
313
|
}
|
|
328
314
|
}
|
|
329
315
|
return [
|
|
@@ -38,6 +38,7 @@ import {
|
|
|
38
38
|
InMemoryBudgetStateBackend,
|
|
39
39
|
type BudgetStateBackend,
|
|
40
40
|
} from './budget-state-backend';
|
|
41
|
+
import { destinationBackpressureCoolsSharedBucket } from '../builtin-pacing';
|
|
41
42
|
import { PROVIDER_CONCURRENCY_SAFETY_LIMIT } from '../provider-capacity/provider-concurrency-policy';
|
|
42
43
|
|
|
43
44
|
export interface WorkLease {
|
|
@@ -1012,6 +1013,9 @@ export function createPlayExecutionGovernor(
|
|
|
1012
1013
|
resolveRowConcurrency(policy, requested, input.maxConcurrentRows),
|
|
1013
1014
|
|
|
1014
1015
|
async reportProviderBackpressure(bp) {
|
|
1016
|
+
// Arbitrary-host egress: the 429 belongs to one destination, not to
|
|
1017
|
+
// the workspace's shared generic_http bucket.
|
|
1018
|
+
if (!destinationBackpressureCoolsSharedBucket(bp)) return;
|
|
1015
1019
|
// DB-authoritative pacer: route backpressure ONLY to the row via
|
|
1016
1020
|
// penalize. The in-memory adaptive admission must not also halve, or the
|
|
1017
1021
|
// provider would be throttled twice (once in the row, once in memory).
|
|
@@ -299,7 +299,7 @@ export class DaytonaLaunchOutcomeUnknownError extends Error {
|
|
|
299
299
|
}
|
|
300
300
|
}
|
|
301
301
|
|
|
302
|
-
function providerError(error: unknown): unknown {
|
|
302
|
+
function providerError(error: unknown, emptyBody = false): unknown {
|
|
303
303
|
if (!axios.isAxiosError(error)) return error;
|
|
304
304
|
const status = error.response?.status;
|
|
305
305
|
const data = error.response?.data;
|
|
@@ -324,12 +324,29 @@ function providerError(error: unknown): unknown {
|
|
|
324
324
|
429: DaytonaRateLimitError,
|
|
325
325
|
};
|
|
326
326
|
const ErrorClass = errorClasses[status ?? 0] ?? DaytonaError;
|
|
327
|
-
|
|
327
|
+
const failure = new ErrorClass(
|
|
328
328
|
message,
|
|
329
329
|
status,
|
|
330
330
|
undefined,
|
|
331
331
|
typeof data?.code === 'string' ? data.code : error.code,
|
|
332
332
|
);
|
|
333
|
+
if (status !== undefined && emptyBody) {
|
|
334
|
+
// Not enumerable, so serialized errors keep their existing shape.
|
|
335
|
+
Object.defineProperty(failure, 'emptyResponseBody', { value: true });
|
|
336
|
+
}
|
|
337
|
+
return failure;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Daytona answered with an HTTP status and a body of zero bytes: no message and
|
|
342
|
+
* no code of its own. Only this client's transport records it, as a field, so
|
|
343
|
+
* callers never read it from the message.
|
|
344
|
+
*/
|
|
345
|
+
export function daytonaResponseBodyWasEmpty(error: unknown): boolean {
|
|
346
|
+
return (
|
|
347
|
+
isDaytonaProviderError(error) &&
|
|
348
|
+
(error as { emptyResponseBody?: unknown }).emptyResponseBody === true
|
|
349
|
+
);
|
|
333
350
|
}
|
|
334
351
|
|
|
335
352
|
/** Every SDK request owns its socket deadline, including streamed response bodies. */
|
|
@@ -338,8 +355,26 @@ function createTransport(signal: () => AbortSignal | undefined) {
|
|
|
338
355
|
InternalAxiosRequestConfig,
|
|
339
356
|
{ finish(): void; signal: AbortSignal }
|
|
340
357
|
>();
|
|
358
|
+
// Each answer's body size before axios decodes it. A decoded `null` or `""`
|
|
359
|
+
// came from a body, so only zero raw bytes counts as no body. A body this
|
|
360
|
+
// cannot measure, such as a stream, is never recorded as empty.
|
|
361
|
+
const rawBodyBytes = new WeakMap<InternalAxiosRequestConfig, number>();
|
|
362
|
+
function recordRawBody(this: InternalAxiosRequestConfig, body: unknown) {
|
|
363
|
+
const bytes =
|
|
364
|
+
typeof body === 'string'
|
|
365
|
+
? Buffer.byteLength(body)
|
|
366
|
+
: Buffer.isBuffer(body) || body instanceof ArrayBuffer
|
|
367
|
+
? body.byteLength
|
|
368
|
+
: undefined;
|
|
369
|
+
if (bytes !== undefined) rawBodyBytes.set(this, bytes);
|
|
370
|
+
return body;
|
|
371
|
+
}
|
|
341
372
|
const transport = axios.create();
|
|
342
373
|
transport.interceptors.request.use((request) => {
|
|
374
|
+
request.transformResponse = [
|
|
375
|
+
recordRawBody,
|
|
376
|
+
...[request.transformResponse ?? []].flat(),
|
|
377
|
+
];
|
|
343
378
|
const controller = new AbortController();
|
|
344
379
|
// Honor the SDK's shorter command/delete windows; upload gets at most the
|
|
345
380
|
// existing 90s staging budget even without an enclosing phase scope.
|
|
@@ -389,13 +424,14 @@ function createTransport(signal: () => AbortSignal | undefined) {
|
|
|
389
424
|
return response;
|
|
390
425
|
},
|
|
391
426
|
(error: unknown) => {
|
|
392
|
-
const
|
|
393
|
-
|
|
394
|
-
? active.get(error.config)
|
|
395
|
-
: undefined;
|
|
427
|
+
const config = axios.isAxiosError(error) ? error.config : undefined;
|
|
428
|
+
const scope = config ? active.get(config) : undefined;
|
|
396
429
|
scope?.finish();
|
|
397
430
|
if (scope?.signal.aborted) throw scope.signal.reason;
|
|
398
|
-
throw providerError(
|
|
431
|
+
throw providerError(
|
|
432
|
+
error,
|
|
433
|
+
config !== undefined && rawBodyBytes.get(config) === 0,
|
|
434
|
+
);
|
|
399
435
|
},
|
|
400
436
|
);
|
|
401
437
|
return transport;
|
|
@@ -45,6 +45,10 @@ import type {
|
|
|
45
45
|
DaytonaSandbox,
|
|
46
46
|
DaytonaStageEmitter,
|
|
47
47
|
} from './daytona-lifecycle';
|
|
48
|
+
import {
|
|
49
|
+
daytonaErrorStatusForLog,
|
|
50
|
+
daytonaResponseBodyWasEmpty,
|
|
51
|
+
} from './daytona-launch-transport';
|
|
48
52
|
import {
|
|
49
53
|
buildDaytonaRuntimeWatchdogSource,
|
|
50
54
|
PLAY_RUNNER_UV_THREADPOOL_SIZE,
|
|
@@ -143,19 +147,34 @@ function bakedRunnerGuardPrefix(verify?: {
|
|
|
143
147
|
export class DaytonaNodeUnavailableError extends Error {
|
|
144
148
|
constructor(
|
|
145
149
|
readonly diagnostic: {
|
|
146
|
-
reason: 'command_failed' | 'empty_output';
|
|
150
|
+
reason: 'command_failed' | 'empty_output' | 'provider_rejected';
|
|
147
151
|
exitCode: number | null;
|
|
148
152
|
attempts: number;
|
|
149
153
|
responseBytes: number;
|
|
150
154
|
},
|
|
155
|
+
options?: { cause?: unknown },
|
|
151
156
|
) {
|
|
152
157
|
super(
|
|
153
158
|
`Daytona Node executable was not ready before payload staging (${diagnostic.reason}, exit ${diagnostic.exitCode ?? 'unknown'}).`,
|
|
159
|
+
options,
|
|
154
160
|
);
|
|
155
161
|
this.name = 'DaytonaNodeUnavailableError';
|
|
156
162
|
}
|
|
157
163
|
}
|
|
158
164
|
|
|
165
|
+
/**
|
|
166
|
+
* Daytona refused the readiness read with a bare 400: no message and no code.
|
|
167
|
+
* A sandbox whose toolbox is still starting answers this way, and the read
|
|
168
|
+
* sends no payload or customer command, so it is read again. A 400 that says
|
|
169
|
+
* anything stays loud: it would fail the same way on every sandbox.
|
|
170
|
+
*/
|
|
171
|
+
function isUnexplainedDaytonaRejection(error: unknown): error is Error {
|
|
172
|
+
return (
|
|
173
|
+
daytonaErrorStatusForLog(error) === 400 &&
|
|
174
|
+
daytonaResponseBodyWasEmpty(error)
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
|
|
159
178
|
/**
|
|
160
179
|
* A prebaked runner the launcher expects in the sandbox image. `verified`
|
|
161
180
|
* settles with whether the sandbox itself proved the file exists and hashes to
|
|
@@ -1415,31 +1434,48 @@ export async function stageDaytonaRunnerPayload(
|
|
|
1415
1434
|
// provider's actual Node executable before constructing either launcher.
|
|
1416
1435
|
const nodeStartedAt = Date.now();
|
|
1417
1436
|
// A started sandbox may still be bringing its toolbox/runtime online. Retry
|
|
1418
|
-
// only an unsuccessful or empty readiness read
|
|
1419
|
-
// handing the pre-code failure back to the
|
|
1437
|
+
// only an unsuccessful or empty readiness read, or a bare 400 rejection of
|
|
1438
|
+
// it, on this same sandbox before handing the pre-code failure back to the
|
|
1439
|
+
// existing startup recovery owner.
|
|
1420
1440
|
const retryDelaysMs = [0, 150, 350] as const;
|
|
1421
1441
|
let node!: Awaited<ReturnType<DaytonaSandbox['process']['executeCommand']>>;
|
|
1422
1442
|
for (const [attempt, delayMs] of retryDelaysMs.entries()) {
|
|
1423
1443
|
if (delayMs) await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
input.
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1444
|
+
let rejection: Error | undefined;
|
|
1445
|
+
try {
|
|
1446
|
+
node = await input.sandbox.process.executeCommand(
|
|
1447
|
+
'node -p process.execPath',
|
|
1448
|
+
input.workDir,
|
|
1449
|
+
{},
|
|
1450
|
+
5,
|
|
1451
|
+
);
|
|
1452
|
+
} catch (error) {
|
|
1453
|
+
if (!isUnexplainedDaytonaRejection(error)) throw error;
|
|
1454
|
+
rejection = error;
|
|
1455
|
+
}
|
|
1456
|
+
if (!rejection && node.exitCode === 0 && node.result.trim() !== '') break;
|
|
1457
|
+
const diagnostic: DaytonaNodeUnavailableError['diagnostic'] = rejection
|
|
1458
|
+
? {
|
|
1459
|
+
reason: 'provider_rejected',
|
|
1460
|
+
exitCode: null,
|
|
1461
|
+
attempts: attempt + 1,
|
|
1462
|
+
responseBytes: 0,
|
|
1463
|
+
}
|
|
1464
|
+
: {
|
|
1465
|
+
reason: node.exitCode === 0 ? 'empty_output' : 'command_failed',
|
|
1466
|
+
exitCode:
|
|
1467
|
+
typeof node.exitCode === 'number' && Number.isInteger(node.exitCode)
|
|
1468
|
+
? node.exitCode
|
|
1469
|
+
: null,
|
|
1470
|
+
attempts: attempt + 1,
|
|
1471
|
+
responseBytes: Buffer.byteLength(node.result),
|
|
1472
|
+
};
|
|
1440
1473
|
input.emitStage('runtime:node_unavailable', diagnostic);
|
|
1441
1474
|
if (attempt === retryDelaysMs.length - 1) {
|
|
1442
|
-
throw new DaytonaNodeUnavailableError(
|
|
1475
|
+
throw new DaytonaNodeUnavailableError(
|
|
1476
|
+
diagnostic,
|
|
1477
|
+
rejection ? { cause: rejection } : undefined,
|
|
1478
|
+
);
|
|
1443
1479
|
}
|
|
1444
1480
|
}
|
|
1445
1481
|
const nodeBinaryPath = node.result.trim();
|
|
@@ -922,9 +922,7 @@ function emitModalStage(
|
|
|
922
922
|
stage,
|
|
923
923
|
// Early-start stages name their org so per-org monitoring reads it
|
|
924
924
|
// directly; other stages are unchanged.
|
|
925
|
-
...(stage.startsWith('early:')
|
|
926
|
-
? { orgId: context.orgId ?? null }
|
|
927
|
-
: {}),
|
|
925
|
+
...(stage.startsWith('early:') ? { orgId: context.orgId ?? null } : {}),
|
|
928
926
|
...extra,
|
|
929
927
|
atMs: Date.now(),
|
|
930
928
|
}),
|
|
@@ -1671,7 +1669,9 @@ export async function startEarlyModalPreboot(input: {
|
|
|
1671
1669
|
? {}
|
|
1672
1670
|
: { memoryLimitMiB: runner.memoryLimitMiB }),
|
|
1673
1671
|
bakedRunnerHash: bakedRunner.hash,
|
|
1674
|
-
runnerCommandSha256: earlyPrebootRunnerCommandSha256(
|
|
1672
|
+
runnerCommandSha256: earlyPrebootRunnerCommandSha256(
|
|
1673
|
+
runner.command,
|
|
1674
|
+
),
|
|
1675
1675
|
}),
|
|
1676
1676
|
};
|
|
1677
1677
|
const bytes = modalSandboxTagsBytes(published);
|
|
@@ -2273,6 +2273,23 @@ export function earlyModalNarrowedAllowlist(input: {
|
|
|
2273
2273
|
});
|
|
2274
2274
|
}
|
|
2275
2275
|
|
|
2276
|
+
/**
|
|
2277
|
+
* The runner config a launch sends. A runner in an adopted EN sandbox has
|
|
2278
|
+
* outbound network only to the gateways, so its ctx.fetch goes through the
|
|
2279
|
+
* gateway egress broker, as under the supervisor sidecar. Every other launch
|
|
2280
|
+
* sends its config unchanged.
|
|
2281
|
+
*/
|
|
2282
|
+
export function launchRunnerConfig<
|
|
2283
|
+
T extends { context: { egressViaRuntimeBroker?: boolean } },
|
|
2284
|
+
>(config: T, adoptedNarrowedEgress: boolean): T {
|
|
2285
|
+
return adoptedNarrowedEgress
|
|
2286
|
+
? {
|
|
2287
|
+
...config,
|
|
2288
|
+
context: { ...config.context, egressViaRuntimeBroker: true },
|
|
2289
|
+
}
|
|
2290
|
+
: config;
|
|
2291
|
+
}
|
|
2292
|
+
|
|
2276
2293
|
/**
|
|
2277
2294
|
* The egress parameters a launch adopts an early sandbox under. Without EN,
|
|
2278
2295
|
* the launch's own create parameters (today). With EN, the list this launch
|
|
@@ -2928,6 +2945,10 @@ export const modalPlayRunnerBackend: PlayRunnerBackend = {
|
|
|
2928
2945
|
PREBOOT_RUNNER_IN_EARLY_SANDBOX,
|
|
2929
2946
|
);
|
|
2930
2947
|
let sandbox: ModalSandbox;
|
|
2948
|
+
// An adopted EN sandbox reaches only the two gateways, so the runner
|
|
2949
|
+
// must send ctx.fetch through the gateway's egress broker; a direct
|
|
2950
|
+
// fetch to any other host cannot connect.
|
|
2951
|
+
let adoptedNarrowedEgress = false;
|
|
2931
2952
|
let createSent = false;
|
|
2932
2953
|
try {
|
|
2933
2954
|
// This is deliberately adjacent to the real provider boundary. The
|
|
@@ -3029,7 +3050,13 @@ export const modalPlayRunnerBackend: PlayRunnerBackend = {
|
|
|
3029
3050
|
: { memoryLimitMiB: runMemoryLimitMiB }),
|
|
3030
3051
|
workDir: modalConfig.workdir,
|
|
3031
3052
|
},
|
|
3032
|
-
}).then((adopted) =>
|
|
3053
|
+
}).then((adopted) => {
|
|
3054
|
+
if (adopted) {
|
|
3055
|
+
adoptedNarrowedEgress = adoptionEgress?.narrowed === true;
|
|
3056
|
+
return adopted;
|
|
3057
|
+
}
|
|
3058
|
+
return createSandbox();
|
|
3059
|
+
})
|
|
3033
3060
|
: createSandbox(),
|
|
3034
3061
|
onLateSuccess: async (lateSandbox) => {
|
|
3035
3062
|
logSandboxCreateOutcome({
|
|
@@ -3101,6 +3128,11 @@ export const modalPlayRunnerBackend: PlayRunnerBackend = {
|
|
|
3101
3128
|
sandboxId: sandbox.sandboxId,
|
|
3102
3129
|
elapsedMs: Date.now() - startedAt,
|
|
3103
3130
|
});
|
|
3131
|
+
if (adoptedNarrowedEgress) {
|
|
3132
|
+
emitModalStage(config.context, 'early:egress_broker', {
|
|
3133
|
+
sandboxId: sandbox.sandboxId,
|
|
3134
|
+
});
|
|
3135
|
+
}
|
|
3104
3136
|
logSandboxCreateOutcome({
|
|
3105
3137
|
provider: 'modal',
|
|
3106
3138
|
outcome: 'succeeded',
|
|
@@ -3376,7 +3408,10 @@ export const modalPlayRunnerBackend: PlayRunnerBackend = {
|
|
|
3376
3408
|
envelopeDelivery: 'stdin' as const,
|
|
3377
3409
|
}
|
|
3378
3410
|
: {}),
|
|
3379
|
-
config: withRunnerSandboxProvider(
|
|
3411
|
+
config: withRunnerSandboxProvider(
|
|
3412
|
+
launchRunnerConfig(runnerConfig, adoptedNarrowedEgress),
|
|
3413
|
+
'modal',
|
|
3414
|
+
),
|
|
3380
3415
|
...(memoryPolicy.memoryLimitMiB > memoryPolicy.reservationMemoryMiB
|
|
3381
3416
|
? { memoryLimitMiB: memoryPolicy.memoryLimitMiB }
|
|
3382
3417
|
: {}),
|
|
@@ -3464,7 +3499,10 @@ export const modalPlayRunnerBackend: PlayRunnerBackend = {
|
|
|
3464
3499
|
}),
|
|
3465
3500
|
},
|
|
3466
3501
|
bundlePromise,
|
|
3467
|
-
config: withRunnerSandboxProvider(
|
|
3502
|
+
config: withRunnerSandboxProvider(
|
|
3503
|
+
launchRunnerConfig(runnerConfig, adoptedNarrowedEgress),
|
|
3504
|
+
'modal',
|
|
3505
|
+
),
|
|
3468
3506
|
...(memoryPolicy.memoryLimitMiB >
|
|
3469
3507
|
memoryPolicy.reservationMemoryMiB
|
|
3470
3508
|
? { memoryLimitMiB: memoryPolicy.memoryLimitMiB }
|
|
@@ -15363,72 +15363,6 @@ export async function readPostgresSchedulerComputeBillingRecovery(
|
|
|
15363
15363
|
: null;
|
|
15364
15364
|
}
|
|
15365
15365
|
|
|
15366
|
-
/** A finalized Preview charge can outlive its test workspace and job ACK. */
|
|
15367
|
-
export async function acknowledgeFinalizedTrainComputeBillingJob(
|
|
15368
|
-
client: PostgresSchedulerQueryClient,
|
|
15369
|
-
input: {
|
|
15370
|
-
schema: string;
|
|
15371
|
-
runId: string;
|
|
15372
|
-
orgId: string;
|
|
15373
|
-
attemptCount: number;
|
|
15374
|
-
resumeEpoch: string | null;
|
|
15375
|
-
resourceSnapshot: ReadonlyArray<readonly [number, unknown]>;
|
|
15376
|
-
},
|
|
15377
|
-
): Promise<boolean> {
|
|
15378
|
-
const { schema, runId, orgId, attemptCount, resumeEpoch, resourceSnapshot } =
|
|
15379
|
-
input;
|
|
15380
|
-
if (!/^runtime_scheduler_preview_release_train(?:_[b-d])?$/u.test(schema)) {
|
|
15381
|
-
throw new Error(
|
|
15382
|
-
'Finalized train billing recovery requires a named Preview lane.',
|
|
15383
|
-
);
|
|
15384
|
-
}
|
|
15385
|
-
const result = await client.query(
|
|
15386
|
-
`WITH matching_run AS MATERIALIZED (
|
|
15387
|
-
SELECT run.run_id
|
|
15388
|
-
FROM ${tableName('runs', { schema })} AS run
|
|
15389
|
-
WHERE run.run_id = $1 AND run.org_id = $2
|
|
15390
|
-
AND run.status IN ('completed', 'failed', 'cancelled')
|
|
15391
|
-
AND run.launch_json->>'schedulerSchema' = $3
|
|
15392
|
-
AND (run.launch_json->>'resumeEpoch') IS NOT DISTINCT FROM $4
|
|
15393
|
-
AND coalesce(run.admission_json, run.launch_json)->>'schedulerSchema' = $3
|
|
15394
|
-
AND (coalesce(run.admission_json, run.launch_json)->>'resumeEpoch')
|
|
15395
|
-
IS NOT DISTINCT FROM $4
|
|
15396
|
-
FOR UPDATE OF run
|
|
15397
|
-
), matching_attempts AS MATERIALIZED (
|
|
15398
|
-
SELECT attempt.attempt, attempt.resource_json
|
|
15399
|
-
FROM ${tableName('attempts', { schema })} AS attempt
|
|
15400
|
-
JOIN matching_run ON matching_run.run_id = attempt.run_id
|
|
15401
|
-
ORDER BY attempt.attempt
|
|
15402
|
-
FOR UPDATE OF attempt
|
|
15403
|
-
)
|
|
15404
|
-
UPDATE ${tableName('compute_billing_jobs_v2', { schema })} AS job
|
|
15405
|
-
SET status = 'settled', blocked_at = NULL, block_reason = NULL,
|
|
15406
|
-
last_error = NULL, settled_at = now(), updated_at = now()
|
|
15407
|
-
FROM matching_run
|
|
15408
|
-
WHERE job.run_id = matching_run.run_id
|
|
15409
|
-
AND job.status = 'pending' AND job.blocked_at IS NOT NULL
|
|
15410
|
-
AND job.lease_owner IS NULL AND job.lease_expires_at IS NULL
|
|
15411
|
-
AND job.attempt_count = $5
|
|
15412
|
-
AND $6::jsonb = (
|
|
15413
|
-
SELECT coalesce(
|
|
15414
|
-
jsonb_agg(jsonb_build_array(attempt, resource_json) ORDER BY attempt),
|
|
15415
|
-
'[]'::jsonb
|
|
15416
|
-
)
|
|
15417
|
-
FROM matching_attempts
|
|
15418
|
-
)
|
|
15419
|
-
RETURNING job.run_id`,
|
|
15420
|
-
[
|
|
15421
|
-
runId,
|
|
15422
|
-
orgId,
|
|
15423
|
-
schema,
|
|
15424
|
-
resumeEpoch,
|
|
15425
|
-
attemptCount,
|
|
15426
|
-
JSON.stringify(resourceSnapshot),
|
|
15427
|
-
],
|
|
15428
|
-
);
|
|
15429
|
-
return result.rows.length === 1;
|
|
15430
|
-
}
|
|
15431
|
-
|
|
15432
15366
|
/**
|
|
15433
15367
|
* Explicit operator reconciliation takes its own settlement lease atomically.
|
|
15434
15368
|
* A retained worker must not win a pending-row race and use the old issuer.
|
|
@@ -29630,12 +29564,18 @@ async function projectPostgresSchedulerStartEvent(
|
|
|
29630
29564
|
// own envelope. Both reuse the immutable launch for omitted start metadata.
|
|
29631
29565
|
const start = { ...launch, ...(event.payload as Record<string, unknown>) };
|
|
29632
29566
|
const payload = hydrateRetainedPlayPipelines(start);
|
|
29567
|
+
const startCommittedAtMs = event.createdAt.getTime();
|
|
29633
29568
|
await startRunViaAppRuntime(runtimeApi, {
|
|
29634
29569
|
deliveryLeaseOwner: event.leaseOwner ?? undefined,
|
|
29635
29570
|
idempotencyKey: buildRunLedgerStartIdempotencyKey({
|
|
29636
29571
|
runId: event.runId,
|
|
29637
29572
|
deliveryKey: event.deliveryKey,
|
|
29638
29573
|
}),
|
|
29574
|
+
// The start's own commit time, so the app's run.started is not stamped
|
|
29575
|
+
// with this (possibly late) delivery's arrival time.
|
|
29576
|
+
...(Number.isFinite(startCommittedAtMs) && startCommittedAtMs > 0
|
|
29577
|
+
? { startedAt: startCommittedAtMs }
|
|
29578
|
+
: {}),
|
|
29639
29579
|
playName: stringPayloadField(start, 'playName') ?? event.runId,
|
|
29640
29580
|
playReference: stringPayloadField(start, 'playReference'),
|
|
29641
29581
|
definitionScope: launch?.definitionScope ?? undefined,
|