deepline 0.3.574 → 0.3.576
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundling-sources/sdk/src/release.ts +13 -1
- 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 +149 -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/durable-runs-rollout.ts +17 -0
- package/dist/bundling-sources/shared_libs/play-runtime/experiment-switches.ts +8 -0
- package/dist/bundling-sources/shared_libs/play-runtime/governor/governor.ts +4 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/modal.ts +190 -9
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-speed-profile.ts +41 -5
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +6 -66
- package/dist/cli/{agents-6WN5LYUP.mjs → agents-BLJR2Y3X.mjs} +213 -19
- package/dist/cli/{agents-7ZZSF4FS.js → agents-CJQ7KBFT.js} +235 -41
- package/dist/cli/auth-GSDYP4ZN.js +44 -0
- package/dist/cli/{auth-I2QVO677.mjs → auth-SLZIRCPE.mjs} +5 -5
- package/dist/cli/{billing-YPH4GEWU.mjs → billing-6Q4SK5KF.mjs} +9 -9
- package/dist/cli/{billing-44QFBUWA.js → billing-IECMVARO.js} +102 -102
- package/dist/cli/{chunk-MGF3MK27.mjs → chunk-2UHEJPSS.mjs} +5 -5
- package/dist/cli/{chunk-2QYU57RG.js → chunk-36254433.js} +3 -3
- package/dist/cli/{chunk-ECLCRE5P.js → chunk-45POZK3F.js} +3 -3
- package/dist/cli/{chunk-5E2PAGF5.js → chunk-4KIIXV5Z.js} +21 -21
- package/dist/cli/{chunk-7334X74C.mjs → chunk-5VABOJ4M.mjs} +2 -2
- package/dist/cli/{chunk-YR4REP4D.mjs → chunk-66K7F7LR.mjs} +1 -1
- package/dist/cli/{chunk-6GZIT3TH.js → chunk-6JQZC6HX.js} +20 -20
- package/dist/cli/{chunk-ID3LGPOE.js → chunk-6RY5COUY.js} +23 -23
- package/dist/cli/{chunk-VGIDPJXM.mjs → chunk-7DI34I73.mjs} +3 -3
- package/dist/cli/{chunk-Z3XFXFRT.js → chunk-ANPHEXTT.js} +9 -9
- package/dist/cli/{chunk-NRVEVKXR.mjs → chunk-AUR24RQB.mjs} +2 -2
- package/dist/cli/{chunk-JCO226JM.mjs → chunk-AZFSCPYK.mjs} +89 -10
- package/dist/cli/{chunk-2RPRSTHD.js → chunk-BRPUB6UA.js} +5 -5
- package/dist/cli/{chunk-XVBEEGI4.mjs → chunk-CUIFDMNP.mjs} +11 -1
- package/dist/cli/{chunk-OIZUFRTE.mjs → chunk-D5LWYP2H.mjs} +3 -3
- package/dist/cli/{chunk-PP5RMEQQ.js → chunk-DGY4EYIX.js} +5 -5
- package/dist/cli/{chunk-Q3A53SWK.mjs → chunk-DWUESXDD.mjs} +1 -1
- package/dist/cli/{chunk-7UR57HPJ.js → chunk-E4M4QZBP.js} +11 -1
- package/dist/cli/{chunk-DOZIWA66.js → chunk-EQO77FQZ.js} +5 -5
- package/dist/cli/{chunk-N6I3BB2O.js → chunk-F4H26PP6.js} +274 -274
- package/dist/cli/{chunk-L2NXB4WG.mjs → chunk-FYKHAT2F.mjs} +64 -3
- package/dist/cli/{chunk-QPSBV4FD.mjs → chunk-GI57Q7JU.mjs} +2 -2
- package/dist/cli/{chunk-H7PVSG3L.js → chunk-GZ7KYGYE.js} +15 -15
- package/dist/cli/{chunk-PW6NKI2A.mjs → chunk-HE53AI2E.mjs} +3 -3
- package/dist/cli/{chunk-LJLM4BUL.js → chunk-HHMO3CON.js} +6 -6
- package/dist/cli/{chunk-2TMAKJBT.mjs → chunk-JPFAD6G6.mjs} +2 -2
- package/dist/cli/{chunk-VLUBEMWM.js → chunk-JSIOLCTK.js} +20 -20
- package/dist/cli/{chunk-B2XLIQPH.mjs → chunk-KQTZO6NT.mjs} +2 -2
- package/dist/cli/{chunk-SLXCVPN7.js → chunk-L6H72AIX.js} +2 -2
- package/dist/cli/{chunk-X7RKCAMX.mjs → chunk-LKC7PHDX.mjs} +4 -4
- package/dist/cli/{chunk-DG56RWI2.js → chunk-M23G33MH.js} +2 -2
- package/dist/cli/{chunk-IB225ZK4.js → chunk-MDJ4LPQ5.js} +4 -4
- package/dist/cli/{chunk-AFPGYZBH.js → chunk-MXK4M7HP.js} +17 -17
- package/dist/cli/{chunk-KSHZY52O.js → chunk-MXPCTF57.js} +89 -10
- package/dist/cli/{chunk-6B5EZOI3.js → chunk-NQFZ7FYN.js} +10 -10
- package/dist/cli/{chunk-OH6WOID2.mjs → chunk-OMVBBAQP.mjs} +2 -2
- package/dist/cli/{chunk-D6ZVRKJ2.js → chunk-OXRG325T.js} +41 -41
- package/dist/cli/{chunk-G7OR3GVD.mjs → chunk-PU5VCDCJ.mjs} +5 -5
- package/dist/cli/{chunk-VYSUJMB5.js → chunk-PYFMNPTA.js} +8 -8
- package/dist/cli/{chunk-LCAXLGAY.mjs → chunk-QCD7BQ5Z.mjs} +2 -2
- package/dist/cli/{chunk-4T2U72SP.mjs → chunk-R5NKLZL2.mjs} +1 -1
- package/dist/cli/{chunk-ZTCP5BHH.mjs → chunk-RW3URFZK.mjs} +2 -2
- package/dist/cli/{chunk-IA2LTIWO.mjs → chunk-S4IW4NAI.mjs} +2 -2
- package/dist/cli/{chunk-UXIUAIL2.js → chunk-SBZSJQEI.js} +53 -53
- package/dist/cli/{chunk-XMBTAPHR.js → chunk-SKHUWQZE.js} +7 -7
- package/dist/cli/{chunk-S22FSNNC.mjs → chunk-SY3OKOI5.mjs} +1 -1
- package/dist/cli/{chunk-MAMGREBW.mjs → chunk-TZHS2W5Z.mjs} +1 -1
- package/dist/cli/{chunk-BUBOZKH2.js → chunk-UD6M2ZTY.js} +2 -2
- package/dist/cli/{chunk-W6UCS3O6.mjs → chunk-UGIH4462.mjs} +5 -5
- package/dist/cli/{chunk-7GQU46SZ.js → chunk-V25CXBR2.js} +26 -26
- package/dist/cli/{chunk-G2HW2SAP.js → chunk-WDWV77SJ.js} +13 -13
- package/dist/cli/{chunk-I62ZBEKH.js → chunk-WPGZ6V36.js} +48 -48
- package/dist/cli/{chunk-GMQZFWQU.mjs → chunk-X5V6S5KI.mjs} +7 -7
- package/dist/cli/{chunk-ZFXDD7VM.mjs → chunk-XJNJ3BWU.mjs} +1 -1
- package/dist/cli/{chunk-NDDGFX4X.js → chunk-Y4A6Y5EY.js} +11 -11
- package/dist/cli/{chunk-LLSCFLFU.mjs → chunk-YHM64N5C.mjs} +1 -1
- package/dist/cli/{chunk-JY7RKJ65.mjs → chunk-ZIGMC2X4.mjs} +13 -13
- package/dist/cli/{chunk-IXYVHTRZ.js → chunk-ZO65VJRJ.js} +70 -9
- package/dist/cli/{chunk-SRUNYWQ2.mjs → chunk-ZRC52APB.mjs} +1 -1
- package/dist/cli/{chunk-DX646HO7.mjs → chunk-ZYN6S6G2.mjs} +4 -4
- package/dist/cli/command-docs.js +2 -2
- package/dist/cli/command-docs.mjs +1 -1
- package/dist/cli/{concurrent-runs-help-ROQM6UB3.mjs → concurrent-runs-help-H3SA7J6H.mjs} +6 -6
- package/dist/cli/concurrent-runs-help-PB7GT6F2.js +22 -0
- package/dist/cli/{csv-FWGSY4GE.js → csv-6DEKR3QQ.js} +13 -13
- package/dist/cli/{csv-R7GV33BC.mjs → csv-ICXI7JAS.mjs} +4 -4
- package/dist/cli/{db-OCH35YJG.js → db-AG7INMLP.js} +27 -27
- package/dist/cli/{db-UWXA4RRV.mjs → db-VI7T5E6O.mjs} +6 -6
- package/dist/cli/describe-LMHIG3DP.js +50 -0
- package/dist/cli/{describe-QI4HMUGE.mjs → describe-S6NFWWGK.mjs} +21 -21
- package/dist/cli/describe-core.d.mts +10 -1
- package/dist/cli/describe-core.d.ts +10 -1
- package/dist/cli/describe-core.js +4 -4
- package/dist/cli/describe-core.mjs +3 -3
- package/dist/cli/{executions-7CFGC24E.js → executions-M5R5QHIA.js} +8 -8
- package/dist/cli/{executions-YF3KMZZN.mjs → executions-MK7H4Q2H.mjs} +6 -6
- package/dist/cli/{feedback-YCZHHSBS.js → feedback-L3L4FEQL.js} +14 -14
- package/dist/cli/{feedback-DWIWBS7O.mjs → feedback-ZHATL2XF.mjs} +6 -6
- package/dist/cli/{git-XCGMQQOD.mjs → git-W5DHNH2Q.mjs} +5 -5
- package/dist/cli/git-WYNCLDHD.js +26 -0
- package/dist/cli/index.js +148 -148
- package/dist/cli/index.mjs +47 -47
- package/dist/cli/{integrations-5ABAJBSW.mjs → integrations-73YSN2LI.mjs} +7 -7
- package/dist/cli/{integrations-IEZA3TGK.js → integrations-IBWNO3YP.js} +29 -29
- package/dist/cli/{legacy-noops-OZMY73Y3.mjs → legacy-noops-4LFZJTDX.mjs} +6 -6
- package/dist/cli/{legacy-noops-KNFLJ5P2.js → legacy-noops-AE6DBYJM.js} +9 -9
- package/dist/cli/{mcp-NLQAO7KP.js → mcp-BKL6M6OI.js} +24 -24
- package/dist/cli/{mcp-WSPFKQPZ.mjs → mcp-E6PTSNDE.mjs} +4 -4
- package/dist/cli/{monitors-LPKFFTOX.mjs → monitors-MXJ27KQK.mjs} +7 -7
- package/dist/cli/{monitors-BJYOB4S3.js → monitors-SW7ZCPPT.js} +100 -100
- package/dist/cli/{org-RYPMUYUW.mjs → org-HYAJ2MIK.mjs} +6 -6
- package/dist/cli/{org-WIVHI4WT.js → org-XJ44KZ5I.js} +121 -121
- package/dist/cli/{outcomes-QKX7IE3O.js → outcomes-PTXGG4BZ.js} +14 -14
- package/dist/cli/{outcomes-FADJYC4I.mjs → outcomes-PUMAXRGD.mjs} +6 -6
- package/dist/cli/{play-ID73J3NP.js → play-EPDZ3GDV.js} +349 -349
- package/dist/cli/{play-4ZKK5Q7U.mjs → play-QN3X6IAE.mjs} +20 -20
- package/dist/cli/{providers-WCCGYGW6.js → providers-GNJFGNDH.js} +9 -9
- package/dist/cli/{providers-LURYBSNO.mjs → providers-JIN5UQ7Z.mjs} +6 -6
- package/dist/cli/{quickstart-KCCSEE5J.mjs → quickstart-4EBFHGB7.mjs} +4 -4
- package/dist/cli/{quickstart-LVPOU25V.js → quickstart-YH6NNC5I.js} +6 -6
- package/dist/cli/{run-2QMJRCVA.js → run-4DRF7KQJ.js} +70 -49
- package/dist/cli/{run-XXK7DDUF.mjs → run-5467KBCP.mjs} +48 -27
- package/dist/cli/search-B2KCWPUV.js +32 -0
- package/dist/cli/{search-ZYAWW3CK.mjs → search-ZERTOGH6.mjs} +7 -7
- package/dist/cli/{search-output-N45AIOB4.mjs → search-output-OAVJXRFO.mjs} +5 -5
- package/dist/cli/{search-output-YNXAZSKT.js → search-output-OMNZN2LP.js} +8 -8
- package/dist/cli/{secrets-MHT27L2M.js → secrets-7XK2BGYX.js} +15 -15
- package/dist/cli/{secrets-7Q3AOUAS.mjs → secrets-KAVDYB4P.mjs} +6 -6
- package/dist/cli/sessions-PUQURPPC.js +23 -0
- package/dist/cli/{sessions-6QKOM7M3.mjs → sessions-TNPI6XWB.mjs} +6 -6
- package/dist/cli/{settings-NPVIDENI.mjs → settings-KUABXRAJ.mjs} +12 -12
- package/dist/cli/{settings-OP7Q6YX6.js → settings-RQ3Z3JCM.js} +85 -85
- package/dist/cli/{setup-OOT3EIMF.mjs → setup-6IX6BSS7.mjs} +9 -9
- package/dist/cli/{setup-RT6GHL3W.js → setup-TDOWNKYN.js} +49 -49
- package/dist/cli/skills-AACRY2TV.js +37 -0
- package/dist/cli/{skills-TEXI4CLZ.mjs → skills-Z6NBJ4KP.mjs} +7 -7
- package/dist/cli/{tools-G5L36M3X.mjs → tools-LQKFWK7J.mjs} +19 -19
- package/dist/cli/tools-OTYA4722.js +57 -0
- package/dist/cli/update-JTGMI6OJ.js +37 -0
- package/dist/cli/{update-YNKQTE4D.mjs → update-RUB4EIKW.mjs} +9 -9
- package/dist/cli/{views-IQFMUMLU.mjs → views-D7WY5QPR.mjs} +6 -6
- package/dist/cli/{views-OVQ5AQAU.js → views-FFLXLAGC.js} +21 -21
- package/dist/cli/{workflow-Y5IFMI7N.mjs → workflow-BV2OTEQD.mjs} +7 -7
- package/dist/cli/{workflow-RCBYXIFZ.js → workflow-QW7QVODA.js} +17 -17
- package/dist/index.js +9 -9
- package/dist/index.mjs +6 -6
- package/dist/install-integrity.json +122 -122
- package/dist/release.d.mts +9 -1
- package/dist/release.d.ts +9 -1
- package/dist/release.js +2 -2
- package/dist/release.mjs +1 -1
- package/dist/server.js +5 -5
- package/dist/server.mjs +3 -3
- package/package.json +1 -1
- package/dist/cli/auth-UKPV5U2B.js +0 -44
- package/dist/cli/concurrent-runs-help-BFVCUJF4.js +0 -22
- package/dist/cli/describe-6OI5K2SH.js +0 -50
- package/dist/cli/git-TGLNZRS3.js +0 -26
- package/dist/cli/search-AQSAXA6D.js +0 -32
- package/dist/cli/sessions-RGD7L4LC.js +0 -23
- package/dist/cli/skills-ERAA734H.js +0 -37
- package/dist/cli/tools-D5SZSIIH.js +0 -57
- package/dist/cli/update-WZ6527EF.js +0 -37
|
@@ -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.576',
|
|
209
209
|
updateSummary: {
|
|
210
210
|
introducedIn: '0.3.90',
|
|
211
211
|
summary:
|
|
@@ -262,6 +262,18 @@ export const SDK_RELEASE = {
|
|
|
262
262
|
reason:
|
|
263
263
|
'deepline search was added in SDK CLI 0.3.287 as the one search across tools, monitors, plays, and docs. On an older version run deepline tools search or deepline plays search, or update.',
|
|
264
264
|
},
|
|
265
|
+
{
|
|
266
|
+
command: 'integrations',
|
|
267
|
+
introducedIn: '0.3.543',
|
|
268
|
+
reason:
|
|
269
|
+
'deepline integrations was added in SDK CLI 0.3.543 to connect providers and manage named org authorizations. Older versions cannot print a provider setup link, so update before connecting a provider from the CLI.',
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
command: 'outcomes',
|
|
273
|
+
introducedIn: '0.3.553',
|
|
274
|
+
reason:
|
|
275
|
+
'deepline outcomes was added in SDK CLI 0.3.553. Older versions cannot read or write an outcome, so update before setting one up or checking in on it.',
|
|
276
|
+
},
|
|
265
277
|
{
|
|
266
278
|
command: 'notifications',
|
|
267
279
|
introducedIn: '0.2.40',
|
|
@@ -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,
|
|
@@ -441,6 +442,7 @@ import {
|
|
|
441
442
|
assertCustomerOutputObjectWithinLimit,
|
|
442
443
|
RUNTIME_RECEIPT_COMPLETION_BUFFER_MAX_ITEMS,
|
|
443
444
|
assertRuntimeReceiptOutputWithinLimit,
|
|
445
|
+
OutputTooLargeError,
|
|
444
446
|
RUNTIME_RECEIPT_COMPLETION_BUFFER_MAX_BYTES,
|
|
445
447
|
RUNTIME_RECEIPT_COMPLETION_DEBOUNCE_MS,
|
|
446
448
|
RUNTIME_RECEIPT_COMPLETION_MAX_IN_FLIGHT_BATCHES,
|
|
@@ -3566,6 +3568,8 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
3566
3568
|
private readonly stepCallIndexByKey = new Map<string, number>();
|
|
3567
3569
|
private readonly toolCallIndexByKey = new Map<string, number>();
|
|
3568
3570
|
private readonly freshnessCallIndexByKey = new Map<string, number>();
|
|
3571
|
+
/** Occurrence of each identical forced legacy fetch in this run. */
|
|
3572
|
+
private readonly legacyFetchRecoveryIndexByKey = new Map<string, number>();
|
|
3569
3573
|
/**
|
|
3570
3574
|
* Call-order artifacts only: the exact-request operation slot of each
|
|
3571
3575
|
* call-order invocation id, consumed when the call reaches the freshness
|
|
@@ -8293,6 +8297,25 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
8293
8297
|
? 'ctx.fetch.staleAfterSeconds'
|
|
8294
8298
|
: 'ctx.tools.execute.staleAfterSeconds',
|
|
8295
8299
|
);
|
|
8300
|
+
if (
|
|
8301
|
+
operation === 'fetch' &&
|
|
8302
|
+
stalePolicy.forceRefresh &&
|
|
8303
|
+
opts.force !== true &&
|
|
8304
|
+
!opts.receiptKey?.trim() &&
|
|
8305
|
+
DURABLE_RUNS_ROLLOUT.legacyFetchOwnRunRecovery
|
|
8306
|
+
) {
|
|
8307
|
+
try {
|
|
8308
|
+
return await this.executeLegacyForcedFetchWithOwnRunRecovery<T>({
|
|
8309
|
+
id,
|
|
8310
|
+
semanticKey: opts.semanticKey ?? null,
|
|
8311
|
+
onRecovered: opts.onRecovered,
|
|
8312
|
+
execute: () => execute(null),
|
|
8313
|
+
});
|
|
8314
|
+
} finally {
|
|
8315
|
+
const release = releaseExternalCallSlot as (() => void) | null;
|
|
8316
|
+
release?.();
|
|
8317
|
+
}
|
|
8318
|
+
}
|
|
8296
8319
|
const receiptKey =
|
|
8297
8320
|
opts.receiptKey?.trim() ||
|
|
8298
8321
|
durableCtxKey({
|
|
@@ -8346,6 +8369,129 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
8346
8369
|
}
|
|
8347
8370
|
}
|
|
8348
8371
|
|
|
8372
|
+
/**
|
|
8373
|
+
* A forced `ctx.fetch` on an artifact before edition 11 (see
|
|
8374
|
+
* `DURABLE_RUNS_ROLLOUT.legacyFetchOwnRunRecovery`). Same run, same exact
|
|
8375
|
+
* request, successful response only; anything else sends as before.
|
|
8376
|
+
*/
|
|
8377
|
+
private async executeLegacyForcedFetchWithOwnRunRecovery<T>(input: {
|
|
8378
|
+
id: string;
|
|
8379
|
+
semanticKey: string | null;
|
|
8380
|
+
onRecovered?: (
|
|
8381
|
+
output: T,
|
|
8382
|
+
receipt: RuntimeStepReceipt,
|
|
8383
|
+
source: DurableReceiptRecoverySource,
|
|
8384
|
+
) => T;
|
|
8385
|
+
execute: () => Promise<T>;
|
|
8386
|
+
}): Promise<T> {
|
|
8387
|
+
const orgId = this.#options.orgId?.trim();
|
|
8388
|
+
const store = this.durableReceiptExecutionStore();
|
|
8389
|
+
if (!orgId || !store.enabled) return await input.execute();
|
|
8390
|
+
// The semantic key already holds the method, URL, body, safe headers
|
|
8391
|
+
// (an Idempotency-Key included) and row scope, so identical requests
|
|
8392
|
+
// share a scope and only identical requests share an occurrence count.
|
|
8393
|
+
// The authored step is part of the scope, as in edition 11, so a call
|
|
8394
|
+
// inside a recovered step never shifts the count of one after it.
|
|
8395
|
+
const step = authoredStepContext.getStore();
|
|
8396
|
+
const scope = sha256Hex(
|
|
8397
|
+
stableStringify({
|
|
8398
|
+
namespace: this.currentExecutionScope.receipt.namespace,
|
|
8399
|
+
id: input.id,
|
|
8400
|
+
step:
|
|
8401
|
+
step?.context === this ? (step.invocationId ?? step.stepId) : null,
|
|
8402
|
+
semanticKey: input.semanticKey,
|
|
8403
|
+
}),
|
|
8404
|
+
);
|
|
8405
|
+
const freshIndex = this.legacyFetchRecoveryIndexByKey.get(scope) ?? 0;
|
|
8406
|
+
this.legacyFetchRecoveryIndexByKey.set(scope, freshIndex + 1);
|
|
8407
|
+
const occurrence = nextReplayableCallIndex(
|
|
8408
|
+
`legacy-fetch-recovery:${scope}`,
|
|
8409
|
+
freshIndex,
|
|
8410
|
+
);
|
|
8411
|
+
const receiptKey = `ctx:${orgId}:fetch-run-recovery:v1:${sha256Hex(
|
|
8412
|
+
stableStringify({
|
|
8413
|
+
runId: this.currentReceiptOwnerRunId,
|
|
8414
|
+
scope,
|
|
8415
|
+
occurrence,
|
|
8416
|
+
}),
|
|
8417
|
+
)}`;
|
|
8418
|
+
// The lookup is best-effort: before this switch a forced legacy fetch
|
|
8419
|
+
// never read the store, so a failed read sends as it always did.
|
|
8420
|
+
let recorded: RuntimeStepReceipt | null = null;
|
|
8421
|
+
try {
|
|
8422
|
+
recorded = await this.withRuntimeReceiptHydrationTurn(
|
|
8423
|
+
async (turn) => {
|
|
8424
|
+
const receipt = await store.get(receiptKey);
|
|
8425
|
+
turn.settleBytes(runtimeStepReceiptPayloadBytes([receipt]));
|
|
8426
|
+
return receipt;
|
|
8427
|
+
},
|
|
8428
|
+
{ source: 'durable_operation' },
|
|
8429
|
+
);
|
|
8430
|
+
} catch (error) {
|
|
8431
|
+
if (isAbortLikeError(error)) throw error;
|
|
8432
|
+
this.runtimeLog(
|
|
8433
|
+
JSON.stringify({
|
|
8434
|
+
event: 'legacy_fetch_own_run_lookup_skipped',
|
|
8435
|
+
call_key: input.id,
|
|
8436
|
+
}),
|
|
8437
|
+
{ level: 'warn' },
|
|
8438
|
+
);
|
|
8439
|
+
}
|
|
8440
|
+
if (
|
|
8441
|
+
recorded &&
|
|
8442
|
+
recorded.status === 'completed' &&
|
|
8443
|
+
recorded.output !== undefined
|
|
8444
|
+
) {
|
|
8445
|
+
this.runtimeLog(
|
|
8446
|
+
JSON.stringify({
|
|
8447
|
+
event: 'legacy_fetch_own_run_recovered',
|
|
8448
|
+
call_key: input.id,
|
|
8449
|
+
occurrence,
|
|
8450
|
+
}),
|
|
8451
|
+
);
|
|
8452
|
+
const output = recorded.output as T;
|
|
8453
|
+
const recovered = input.onRecovered
|
|
8454
|
+
? input.onRecovered(output, recorded, 'cache')
|
|
8455
|
+
: output;
|
|
8456
|
+
this.assertNoPendingDurableSuspension();
|
|
8457
|
+
return recovered;
|
|
8458
|
+
}
|
|
8459
|
+
const output = await input.execute();
|
|
8460
|
+
this.assertNoPendingDurableSuspension();
|
|
8461
|
+
assertNoSecretTaint(output, 'ctx.fetch result');
|
|
8462
|
+
if (
|
|
8463
|
+
output &&
|
|
8464
|
+
typeof output === 'object' &&
|
|
8465
|
+
(output as { ok?: unknown }).ok === true
|
|
8466
|
+
) {
|
|
8467
|
+
try {
|
|
8468
|
+
await store.complete(
|
|
8469
|
+
receiptKey,
|
|
8470
|
+
this.currentReceiptOwnerRunId,
|
|
8471
|
+
output,
|
|
8472
|
+
COMPLETED_RECEIPT_CACHE_INSERT_LEASE_ID,
|
|
8473
|
+
);
|
|
8474
|
+
} catch (error) {
|
|
8475
|
+
if (isAbortLikeError(error)) throw error;
|
|
8476
|
+
// The request already succeeded; a lost record only means a replay
|
|
8477
|
+
// sends it again, which is today's behavior. Never fail the call.
|
|
8478
|
+
this.runtimeLog(
|
|
8479
|
+
JSON.stringify({
|
|
8480
|
+
event: 'legacy_fetch_own_run_record_skipped',
|
|
8481
|
+
call_key: input.id,
|
|
8482
|
+
reason:
|
|
8483
|
+
error instanceof RuntimeReceiptWriterBufferLimitError ||
|
|
8484
|
+
error instanceof OutputTooLargeError
|
|
8485
|
+
? 'too_large'
|
|
8486
|
+
: 'error',
|
|
8487
|
+
}),
|
|
8488
|
+
{ level: 'warn' },
|
|
8489
|
+
);
|
|
8490
|
+
}
|
|
8491
|
+
}
|
|
8492
|
+
return output;
|
|
8493
|
+
}
|
|
8494
|
+
|
|
8349
8495
|
private get currentRunId(): string {
|
|
8350
8496
|
return this.currentExecutionScope.logical.runId;
|
|
8351
8497
|
}
|
|
@@ -25579,7 +25725,9 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
|
|
|
25579
25725
|
provider,
|
|
25580
25726
|
retryAfterMs,
|
|
25581
25727
|
retryAtMs,
|
|
25582
|
-
outcome:
|
|
25728
|
+
outcome: destinationBackpressureCoolsSharedBucket({ toolId, provider })
|
|
25729
|
+
? 'recorded'
|
|
25730
|
+
: 'not_recorded_destination_scoped',
|
|
25583
25731
|
})}`,
|
|
25584
25732
|
{ level: 'warn' },
|
|
25585
25733
|
);
|
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 [
|
|
@@ -45,6 +45,23 @@ export const DURABLE_RUNS_ROLLOUT = {
|
|
|
45
45
|
* `staleAfterSeconds`.
|
|
46
46
|
*/
|
|
47
47
|
sharedReadCacheWrites: true,
|
|
48
|
+
/**
|
|
49
|
+
* Own-run recovery for a forced `ctx.fetch` on artifacts before edition 11,
|
|
50
|
+
* where `staleAfterSeconds: 0` means force and kept no record, so a resumed
|
|
51
|
+
* run sent a finished request again. A successful (2xx) response is
|
|
52
|
+
* recorded under a key of the executing run, the authored call and its
|
|
53
|
+
* exact request, numbered among identical requests; a replay of that same
|
|
54
|
+
* request in that same run returns it instead of sending. A new run, a
|
|
55
|
+
* different request, a non-2xx response, a thrown failure and
|
|
56
|
+
* `{ transient: true }` behave exactly as before. As in edition 11, a 2xx
|
|
57
|
+
* whose body made the Play throw is returned again to a later attempt of
|
|
58
|
+
* the same run rather than read fresh. A failed lookup or record write
|
|
59
|
+
* sends and returns as before.
|
|
60
|
+
*
|
|
61
|
+
* Off restores the old behavior: nothing reads the records, which age out
|
|
62
|
+
* with the run's other receipts.
|
|
63
|
+
*/
|
|
64
|
+
legacyFetchOwnRunRecovery: true,
|
|
48
65
|
/**
|
|
49
66
|
* Finish-in-execute: a direct tool call sends its planned finishing receipt
|
|
50
67
|
* keys on the execute request, and the execution relay commits them before
|
|
@@ -220,6 +220,14 @@ export const EXPERIMENT_SWITCHES = {
|
|
|
220
220
|
"With E2 and no sidecar, the early sandbox carries a narrowed allowlist (each gateway IPv4 as /32, contained in the deployment's and stable 30 min); only a launch whose own fresh derivation gives the same list adopts it, and every fallback create keeps the deployment's allowlist (worker).",
|
|
221
221
|
constants: [{ file: MODAL, name: 'NARROW_EARLY_SANDBOX_EGRESS' }],
|
|
222
222
|
},
|
|
223
|
+
EW: {
|
|
224
|
+
perRun: true,
|
|
225
|
+
summary:
|
|
226
|
+
"With EN, once a launch wins the fence for an adopted narrowed early sandbox and before anything is delivered, widen its outbound policy to exactly the launch's own create allowlist, so ctx.fetch connects directly; a failed or slow widen defers the run to a fresh attempt (worker).",
|
|
227
|
+
constants: [
|
|
228
|
+
{ file: MODAL, name: 'WIDEN_EARLY_SANDBOX_EGRESS_ON_ADOPTION' },
|
|
229
|
+
],
|
|
230
|
+
},
|
|
223
231
|
V3: {
|
|
224
232
|
perRun: true,
|
|
225
233
|
summary:
|
|
@@ -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).
|
|
@@ -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);
|
|
@@ -2187,6 +2187,125 @@ export function earlyModalEgressNarrowWanted(
|
|
|
2187
2187
|
);
|
|
2188
2188
|
}
|
|
2189
2189
|
|
|
2190
|
+
/**
|
|
2191
|
+
* EW (per-run): after a launch wins the fence for an adopted EN sandbox, and
|
|
2192
|
+
* before any payload, envelope or customer code reaches it, widen the
|
|
2193
|
+
* sandbox's outbound policy to exactly the allowlist this launch's own fresh
|
|
2194
|
+
* create would carry (`modalSandboxCreateParams`). The run then has the same
|
|
2195
|
+
* egress as a non-early run, so ctx.fetch connects directly (no broker caps,
|
|
2196
|
+
* no extra hop). Until the fence is won the sandbox stays narrowed, so the
|
|
2197
|
+
* pre-admission abuse bound is unchanged. A failed or slow widen defers the
|
|
2198
|
+
* run to a fresh attempt; nothing is delivered first.
|
|
2199
|
+
*/
|
|
2200
|
+
export const WIDEN_EARLY_SANDBOX_EGRESS_ON_ADOPTION = false;
|
|
2201
|
+
|
|
2202
|
+
/** Whether this run widens an adopted EN sandbox's egress (EW). */
|
|
2203
|
+
export function earlyModalEgressWidenWanted(
|
|
2204
|
+
overrides: EarlySandboxStartRequest['experimentSwitchOverrides'],
|
|
2205
|
+
): boolean {
|
|
2206
|
+
return resolveExperimentSwitch(
|
|
2207
|
+
'EW',
|
|
2208
|
+
overrides,
|
|
2209
|
+
WIDEN_EARLY_SANDBOX_EGRESS_ON_ADOPTION,
|
|
2210
|
+
);
|
|
2211
|
+
}
|
|
2212
|
+
|
|
2213
|
+
/** Upper bound on the EW policy update on the launch's critical path. */
|
|
2214
|
+
export const EARLY_EGRESS_WIDEN_TIMEOUT_MS = 5_000;
|
|
2215
|
+
|
|
2216
|
+
/**
|
|
2217
|
+
* EW: replace an adopted EN sandbox's outbound policy with the launch's own
|
|
2218
|
+
* create allowlist. Returns null (nothing changed) when that allowlist is not
|
|
2219
|
+
* a non-empty CIDR list: Modal's update is always an allowlist, so it cannot
|
|
2220
|
+
* express OPEN egress, and an empty list would block everything; such a run
|
|
2221
|
+
* keeps its narrowed egress. The domain dimension is [] because a create with
|
|
2222
|
+
* only a CIDR list sends exactly that (an empty domain allowlist), so the
|
|
2223
|
+
* widened policy equals a fresh create's. Any failure or timeout throws the
|
|
2224
|
+
* not-live recovery, so the scheduler retries on a fresh attempt and this
|
|
2225
|
+
* launch's cleanup terminates the sandbox it won.
|
|
2226
|
+
*/
|
|
2227
|
+
export async function widenAdoptedEarlyModalEgress(input: {
|
|
2228
|
+
sandbox: Pick<ModalSandbox, 'sandboxId' | 'updateNetworkPolicy'>;
|
|
2229
|
+
createParams: Pick<ModalSandboxCreateParams, 'outboundCidrAllowlist'>;
|
|
2230
|
+
/** The launch's cancellation: a cancel ends the wait and stays a cancel. */
|
|
2231
|
+
cancellation?: Promise<never>;
|
|
2232
|
+
isCancelled?: () => boolean;
|
|
2233
|
+
timeoutMs?: number;
|
|
2234
|
+
nowMs?: () => number;
|
|
2235
|
+
}): Promise<{ elapsedMs: number; entries: number } | null> {
|
|
2236
|
+
const allowlist = input.createParams.outboundCidrAllowlist;
|
|
2237
|
+
if (!Array.isArray(allowlist) || allowlist.length === 0) return null;
|
|
2238
|
+
const nowMs = input.nowMs ?? Date.now;
|
|
2239
|
+
const startedAt = nowMs();
|
|
2240
|
+
const timeoutMs = input.timeoutMs ?? EARLY_EGRESS_WIDEN_TIMEOUT_MS;
|
|
2241
|
+
let timer: ReturnType<typeof setTimeout> | undefined;
|
|
2242
|
+
try {
|
|
2243
|
+
await Promise.race([
|
|
2244
|
+
// The signal cancels the RPC itself (Modal's call middleware), so a
|
|
2245
|
+
// timed-out update does not keep running after the run moved on.
|
|
2246
|
+
withModalCallSignal(AbortSignal.timeout(timeoutMs), () =>
|
|
2247
|
+
input.sandbox.updateNetworkPolicy({
|
|
2248
|
+
outboundCidrAllowlist: [...allowlist],
|
|
2249
|
+
outboundDomainAllowlist: [],
|
|
2250
|
+
}),
|
|
2251
|
+
),
|
|
2252
|
+
...(input.cancellation ? [input.cancellation] : []),
|
|
2253
|
+
new Promise<never>((_, reject) => {
|
|
2254
|
+
timer = setTimeout(
|
|
2255
|
+
() =>
|
|
2256
|
+
reject(
|
|
2257
|
+
new Error(
|
|
2258
|
+
`Early sandbox ${input.sandbox.sandboxId} egress widen did not finish within ${timeoutMs} ms.`,
|
|
2259
|
+
),
|
|
2260
|
+
),
|
|
2261
|
+
timeoutMs,
|
|
2262
|
+
);
|
|
2263
|
+
}),
|
|
2264
|
+
]);
|
|
2265
|
+
} catch (error) {
|
|
2266
|
+
// A cancelled run stays cancelled; only a failed or slow update defers.
|
|
2267
|
+
if (input.isCancelled?.()) throw error;
|
|
2268
|
+
throw recoveryForRunnerStartupNotLive(error);
|
|
2269
|
+
} finally {
|
|
2270
|
+
if (timer) clearTimeout(timer);
|
|
2271
|
+
}
|
|
2272
|
+
return { elapsedMs: nowMs() - startedAt, entries: allowlist.length };
|
|
2273
|
+
}
|
|
2274
|
+
|
|
2275
|
+
/**
|
|
2276
|
+
* The post-fence step of a launch that may have adopted an early sandbox, in
|
|
2277
|
+
* its required order: re-tag (leave the early tags and the reaper), then EW's
|
|
2278
|
+
* widen, before the caller stages anything. Called only after this launch's
|
|
2279
|
+
* resource record won the fence. Returns whether the sandbox is still
|
|
2280
|
+
* narrowed (so ctx.fetch must use the broker).
|
|
2281
|
+
*/
|
|
2282
|
+
export async function finishEarlyModalAdoptionAfterFence(input: {
|
|
2283
|
+
sandbox: Pick<ModalSandbox, 'sandboxId' | 'setTags' | 'updateNetworkPolicy'>;
|
|
2284
|
+
adoptedNarrowedEgress: boolean;
|
|
2285
|
+
widenWanted: boolean;
|
|
2286
|
+
createEgress: Pick<ModalSandboxCreateParams, 'outboundCidrAllowlist'>;
|
|
2287
|
+
cancellation?: Promise<never>;
|
|
2288
|
+
isCancelled?: () => boolean;
|
|
2289
|
+
emit: (stage: string, extra: Record<string, unknown>) => void;
|
|
2290
|
+
}): Promise<{ adoptedNarrowedEgress: boolean }> {
|
|
2291
|
+
await applyEarlyModalRetagAfterFence(input.sandbox);
|
|
2292
|
+
if (!input.adoptedNarrowedEgress || !input.widenWanted)
|
|
2293
|
+
return { adoptedNarrowedEgress: input.adoptedNarrowedEgress };
|
|
2294
|
+
const widened = await widenAdoptedEarlyModalEgress({
|
|
2295
|
+
sandbox: input.sandbox,
|
|
2296
|
+
createParams: input.createEgress,
|
|
2297
|
+
...(input.cancellation ? { cancellation: input.cancellation } : {}),
|
|
2298
|
+
...(input.isCancelled ? { isCancelled: input.isCancelled } : {}),
|
|
2299
|
+
});
|
|
2300
|
+
if (!widened) return { adoptedNarrowedEgress: true };
|
|
2301
|
+
input.emit('early:egress_widened', {
|
|
2302
|
+
sandboxId: input.sandbox.sandboxId,
|
|
2303
|
+
entries: widened.entries,
|
|
2304
|
+
elapsedMs: widened.elapsedMs,
|
|
2305
|
+
});
|
|
2306
|
+
return { adoptedNarrowedEgress: false };
|
|
2307
|
+
}
|
|
2308
|
+
|
|
2190
2309
|
/**
|
|
2191
2310
|
* The allowlist an early create carries: EN's narrowed list when it can be
|
|
2192
2311
|
* derived now, otherwise the deployment's (exactly today's). The gate, the
|
|
@@ -2273,6 +2392,23 @@ export function earlyModalNarrowedAllowlist(input: {
|
|
|
2273
2392
|
});
|
|
2274
2393
|
}
|
|
2275
2394
|
|
|
2395
|
+
/**
|
|
2396
|
+
* The runner config a launch sends. A runner in an adopted EN sandbox has
|
|
2397
|
+
* outbound network only to the gateways, so its ctx.fetch goes through the
|
|
2398
|
+
* gateway egress broker, as under the supervisor sidecar. Every other launch
|
|
2399
|
+
* sends its config unchanged.
|
|
2400
|
+
*/
|
|
2401
|
+
export function launchRunnerConfig<
|
|
2402
|
+
T extends { context: { egressViaRuntimeBroker?: boolean } },
|
|
2403
|
+
>(config: T, adoptedNarrowedEgress: boolean): T {
|
|
2404
|
+
return adoptedNarrowedEgress
|
|
2405
|
+
? {
|
|
2406
|
+
...config,
|
|
2407
|
+
context: { ...config.context, egressViaRuntimeBroker: true },
|
|
2408
|
+
}
|
|
2409
|
+
: config;
|
|
2410
|
+
}
|
|
2411
|
+
|
|
2276
2412
|
/**
|
|
2277
2413
|
* The egress parameters a launch adopts an early sandbox under. Without EN,
|
|
2278
2414
|
* the launch's own create parameters (today). With EN, the list this launch
|
|
@@ -2928,6 +3064,15 @@ export const modalPlayRunnerBackend: PlayRunnerBackend = {
|
|
|
2928
3064
|
PREBOOT_RUNNER_IN_EARLY_SANDBOX,
|
|
2929
3065
|
);
|
|
2930
3066
|
let sandbox: ModalSandbox;
|
|
3067
|
+
// An adopted EN sandbox reaches only the gateways until EW widens it;
|
|
3068
|
+
// while narrowed, the runner sends ctx.fetch through the gateway's
|
|
3069
|
+
// egress broker (a direct fetch to any other host cannot connect).
|
|
3070
|
+
let adoptedNarrowedEgress = false;
|
|
3071
|
+
// This launch's own create egress: what EW widens an adopted sandbox to.
|
|
3072
|
+
let launchCreateEgress: Pick<
|
|
3073
|
+
ModalSandboxCreateParams,
|
|
3074
|
+
'outboundCidrAllowlist'
|
|
3075
|
+
> = {};
|
|
2931
3076
|
let createSent = false;
|
|
2932
3077
|
try {
|
|
2933
3078
|
// This is deliberately adjacent to the real provider boundary. The
|
|
@@ -2979,6 +3124,9 @@ export const modalPlayRunnerBackend: PlayRunnerBackend = {
|
|
|
2979
3124
|
outboundCidrAllowlist: modalConfig.outboundCidrAllowlist,
|
|
2980
3125
|
supervisorSidecar: supervisorPlan !== null,
|
|
2981
3126
|
});
|
|
3127
|
+
launchCreateEgress = {
|
|
3128
|
+
outboundCidrAllowlist: sandboxParams.outboundCidrAllowlist,
|
|
3129
|
+
};
|
|
2982
3130
|
const createParams = { ...sandboxParams, tags: createTags };
|
|
2983
3131
|
const createSandbox = () =>
|
|
2984
3132
|
modalConfig.client.sandboxes.create(app, image, createParams);
|
|
@@ -3029,7 +3177,13 @@ export const modalPlayRunnerBackend: PlayRunnerBackend = {
|
|
|
3029
3177
|
: { memoryLimitMiB: runMemoryLimitMiB }),
|
|
3030
3178
|
workDir: modalConfig.workdir,
|
|
3031
3179
|
},
|
|
3032
|
-
}).then((adopted) =>
|
|
3180
|
+
}).then((adopted) => {
|
|
3181
|
+
if (adopted) {
|
|
3182
|
+
adoptedNarrowedEgress = adoptionEgress?.narrowed === true;
|
|
3183
|
+
return adopted;
|
|
3184
|
+
}
|
|
3185
|
+
return createSandbox();
|
|
3186
|
+
})
|
|
3033
3187
|
: createSandbox(),
|
|
3034
3188
|
onLateSuccess: async (lateSandbox) => {
|
|
3035
3189
|
logSandboxCreateOutcome({
|
|
@@ -3316,8 +3470,29 @@ export const modalPlayRunnerBackend: PlayRunnerBackend = {
|
|
|
3316
3470
|
throw error;
|
|
3317
3471
|
}
|
|
3318
3472
|
// This launch's record won the durable sandbox fence; only now does
|
|
3319
|
-
// an adopted early sandbox leave the early tags (and its reaper)
|
|
3320
|
-
|
|
3473
|
+
// an adopted early sandbox leave the early tags (and its reaper), and
|
|
3474
|
+
// only then (EW) may it get this launch's own create egress.
|
|
3475
|
+
const afterFence = await finishEarlyModalAdoptionAfterFence({
|
|
3476
|
+
sandbox,
|
|
3477
|
+
adoptedNarrowedEgress,
|
|
3478
|
+
widenWanted: earlyModalEgressWidenWanted(
|
|
3479
|
+
config.context.experimentSwitchOverrides,
|
|
3480
|
+
),
|
|
3481
|
+
createEgress: launchCreateEgress,
|
|
3482
|
+
cancellation: cancellationPromise,
|
|
3483
|
+
isCancelled: () => callbacks?.cancellationSignal?.aborted === true,
|
|
3484
|
+
emit: (stage, extra) =>
|
|
3485
|
+
emitModalStage(config.context, stage, extra),
|
|
3486
|
+
});
|
|
3487
|
+
adoptedNarrowedEgress = afterFence.adoptedNarrowedEgress;
|
|
3488
|
+
// Still narrowed after the post-fence step (EW off, or nothing to
|
|
3489
|
+
// widen to): the runner's ctx.fetch goes through the egress broker.
|
|
3490
|
+
// A widened run logs only early:egress_widened.
|
|
3491
|
+
if (adoptedNarrowedEgress) {
|
|
3492
|
+
emitModalStage(config.context, 'early:egress_broker', {
|
|
3493
|
+
sandboxId: sandbox.sandboxId,
|
|
3494
|
+
});
|
|
3495
|
+
}
|
|
3321
3496
|
emitModalStage(config.context, 'resource:recorded', {
|
|
3322
3497
|
sandboxId: sandbox.sandboxId,
|
|
3323
3498
|
elapsedMs: Date.now() - startedAt,
|
|
@@ -3376,7 +3551,10 @@ export const modalPlayRunnerBackend: PlayRunnerBackend = {
|
|
|
3376
3551
|
envelopeDelivery: 'stdin' as const,
|
|
3377
3552
|
}
|
|
3378
3553
|
: {}),
|
|
3379
|
-
config: withRunnerSandboxProvider(
|
|
3554
|
+
config: withRunnerSandboxProvider(
|
|
3555
|
+
launchRunnerConfig(runnerConfig, adoptedNarrowedEgress),
|
|
3556
|
+
'modal',
|
|
3557
|
+
),
|
|
3380
3558
|
...(memoryPolicy.memoryLimitMiB > memoryPolicy.reservationMemoryMiB
|
|
3381
3559
|
? { memoryLimitMiB: memoryPolicy.memoryLimitMiB }
|
|
3382
3560
|
: {}),
|
|
@@ -3464,7 +3642,10 @@ export const modalPlayRunnerBackend: PlayRunnerBackend = {
|
|
|
3464
3642
|
}),
|
|
3465
3643
|
},
|
|
3466
3644
|
bundlePromise,
|
|
3467
|
-
config: withRunnerSandboxProvider(
|
|
3645
|
+
config: withRunnerSandboxProvider(
|
|
3646
|
+
launchRunnerConfig(runnerConfig, adoptedNarrowedEgress),
|
|
3647
|
+
'modal',
|
|
3648
|
+
),
|
|
3468
3649
|
...(memoryPolicy.memoryLimitMiB >
|
|
3469
3650
|
memoryPolicy.reservationMemoryMiB
|
|
3470
3651
|
? { memoryLimitMiB: memoryPolicy.memoryLimitMiB }
|