deepline 0.3.548 → 0.3.549
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 +93 -11
- package/dist/bundling-sources/sdk/src/index.ts +1 -0
- package/dist/bundling-sources/sdk/src/plays/check-local-play-graph.ts +3 -0
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/sdk/src/types.ts +11 -0
- package/dist/bundling-sources/shared_libs/monitors/action-actor.ts +203 -0
- package/dist/bundling-sources/shared_libs/monitors/fleets/limits.ts +20 -0
- package/dist/bundling-sources/shared_libs/monitors/package.json +2 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-batch-operation.ts +33 -0
- package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-dead-letter.ts +19 -3
- package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-failure-codes.ts +21 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +36 -6
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +93 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-capacity.ts +9 -1
- package/dist/bundling-sources/shared_libs/plays/play-check-compact.ts +636 -0
- package/dist/cli/auth-UVEZIP3H.js +43 -0
- package/dist/cli/{auth-YOOVLLUL.mjs → auth-YENF525S.mjs} +5 -5
- package/dist/cli/{billing-HETIOUD6.js → billing-52GAHIDZ.js} +95 -95
- package/dist/cli/{billing-2NCNX6L2.mjs → billing-XPXB27G7.mjs} +9 -9
- package/dist/cli/{chunk-IIWXBRDK.js → chunk-3IUQNHIG.js} +3 -3
- package/dist/cli/{chunk-HIMZ57QD.mjs → chunk-4AUV5QJF.mjs} +5 -5
- package/dist/cli/{chunk-PVE3A2BO.js → chunk-4DJNXAPH.js} +75 -37
- package/dist/cli/{chunk-WIHQAZPV.js → chunk-4HSSPT73.js} +6 -6
- package/dist/cli/{chunk-OGDQFVCP.mjs → chunk-4QUWXUUJ.mjs} +35 -6
- package/dist/cli/{chunk-CXZLHBNK.js → chunk-5622PYAP.js} +4 -4
- package/dist/cli/{chunk-F4ON5COB.mjs → chunk-5CXE22BI.mjs} +2 -2
- package/dist/cli/{chunk-HU3DDLGD.mjs → chunk-5T37KQNG.mjs} +5 -5
- package/dist/cli/{chunk-T3RDWG5J.js → chunk-7FY7AHR6.js} +2 -2
- package/dist/cli/{chunk-PVQCX6KQ.js → chunk-ADWMIZCB.js} +67 -9
- package/dist/cli/{chunk-OQCYSLML.mjs → chunk-ANOTB6V3.mjs} +4 -4
- package/dist/cli/{chunk-XKEBQVCP.mjs → chunk-AZSVDAXT.mjs} +5 -5
- package/dist/cli/{chunk-NFMX7BRF.mjs → chunk-BDOLPGHD.mjs} +2 -2
- package/dist/cli/{chunk-VK2GSTRN.js → chunk-BDUZJX4V.js} +26 -26
- package/dist/cli/{chunk-7H6TQ6W2.js → chunk-BPBPY42E.js} +5 -5
- package/dist/cli/{chunk-3QRU6RY7.mjs → chunk-CX4KGWCH.mjs} +3 -3
- package/dist/cli/{chunk-HTZIJORU.js → chunk-CXFOYRI4.js} +99 -99
- package/dist/cli/{chunk-U35ZLVBA.mjs → chunk-DCTEH6N5.mjs} +2 -2
- package/dist/cli/{chunk-LAVPP6WD.js → chunk-DIRLEJJX.js} +41 -41
- package/dist/cli/{chunk-7JIOJLTS.js → chunk-ETLEPHLT.js} +7 -7
- package/dist/cli/{chunk-6GIZNOXQ.js → chunk-HPSCRVTM.js} +12 -12
- package/dist/cli/{chunk-BDBEEV6X.js → chunk-HWCIU3KY.js} +22 -22
- package/dist/cli/{chunk-TKGFHRHE.mjs → chunk-J6FINSAK.mjs} +49 -11
- package/dist/cli/{chunk-JQWX377P.js → chunk-KBMBNUUW.js} +5 -5
- package/dist/cli/{chunk-WI4MCR7M.js → chunk-KTZ3VU6S.js} +5 -5
- package/dist/cli/{chunk-7AJ5V3BK.mjs → chunk-L6UMWAAY.mjs} +1 -1
- package/dist/cli/{chunk-FUUYWEF4.mjs → chunk-LMFTDDAM.mjs} +2 -2
- package/dist/cli/{chunk-MWQ4WWZF.mjs → chunk-LP2VNGG3.mjs} +2 -2
- package/dist/cli/{chunk-RMCCB3XY.mjs → chunk-MAE3AKDR.mjs} +67 -9
- package/dist/cli/{chunk-BWJZ4NQJ.js → chunk-NVALIJQS.js} +15 -15
- package/dist/cli/{chunk-5XFJBIQT.js → chunk-OWX4AAJ4.js} +13 -13
- package/dist/cli/{chunk-FMQA7UZZ.mjs → chunk-PLAJ6HPD.mjs} +2 -2
- package/dist/cli/{chunk-GCEGQ7TQ.mjs → chunk-PLJCY35C.mjs} +1 -1
- package/dist/cli/{chunk-ATTURFOV.mjs → chunk-PQX4WTBY.mjs} +1 -1
- package/dist/cli/{chunk-I2JIWKCQ.js → chunk-QGKX2WBZ.js} +52 -23
- package/dist/cli/{chunk-UBQQR56I.mjs → chunk-QIZBUY2N.mjs} +4 -4
- package/dist/cli/{chunk-5XXPP3PR.js → chunk-QUELC3B2.js} +10 -10
- package/dist/cli/{chunk-HDLMX7SG.js → chunk-RMKRZJOS.js} +16 -16
- package/dist/cli/{chunk-7UJZWI5Z.js → chunk-SVNAP2QI.js} +9 -9
- package/dist/cli/{chunk-GUIYFOG2.js → chunk-TYOAOSDL.js} +3 -3
- package/dist/cli/{chunk-QZ74ZC55.mjs → chunk-U6KHWIAO.mjs} +1 -1
- package/dist/cli/{chunk-MQSKSISW.mjs → chunk-UGVXHT62.mjs} +1 -1
- package/dist/cli/{chunk-VSACOMIA.mjs → chunk-V5WPYOAE.mjs} +5 -5
- package/dist/cli/{chunk-2OG2KBYJ.js → chunk-V7WMNX4R.js} +1 -1
- package/dist/cli/{chunk-M2OZORIH.js → chunk-VLAJGF27.js} +2 -2
- package/dist/cli/{chunk-QQBRXMZM.mjs → chunk-W77LBYF3.mjs} +11 -11
- package/dist/cli/{chunk-53QLWPZK.mjs → chunk-X4RGDE4J.mjs} +1 -1
- package/dist/cli/{chunk-5OJOFUMO.js → chunk-XPYCNA43.js} +44 -44
- package/dist/cli/{chunk-XU3D2KFR.mjs → chunk-XS72HELO.mjs} +1 -1
- package/dist/cli/{chunk-AUYBBFPT.js → chunk-Y5MDCPWA.js} +53 -53
- package/dist/cli/{chunk-IQBXX54G.mjs → chunk-Y5SKYU5X.mjs} +3 -3
- package/dist/cli/{chunk-64BFUBXX.mjs → chunk-YX7BX2FA.mjs} +2 -2
- package/dist/cli/{chunk-U7HJXE6Y.js → chunk-YZTS3XA7.js} +2 -2
- package/dist/cli/{chunk-WVZF4DU7.mjs → chunk-Z3DKJOUL.mjs} +1 -1
- package/dist/cli/command-docs.js +2 -2
- package/dist/cli/command-docs.mjs +1 -1
- package/dist/cli/concurrent-runs-help-74AFW3BD.js +21 -0
- package/dist/cli/{concurrent-runs-help-FDCCZ45D.mjs → concurrent-runs-help-OYSLW55L.mjs} +6 -6
- package/dist/cli/{csv-OCEQWZO3.js → csv-FRO3UFMQ.js} +13 -13
- package/dist/cli/{csv-GJYLQ52D.mjs → csv-TFCTUYF2.mjs} +4 -4
- package/dist/cli/{db-5MA2UUHQ.mjs → db-NHVZBT2H.mjs} +6 -6
- package/dist/cli/{db-G5QGXFAX.js → db-SNFNRVZJ.js} +27 -27
- package/dist/cli/describe-2JCOC4AK.js +50 -0
- package/dist/cli/{describe-4DOJ4DHA.mjs → describe-OVFPRJJL.mjs} +18 -18
- package/dist/cli/describe-core.d.mts +2 -2
- package/dist/cli/describe-core.d.ts +2 -2
- package/dist/cli/{executions-C7SMBHHB.mjs → executions-HWMH2LTC.mjs} +6 -6
- package/dist/cli/{executions-IYEVUPJI.js → executions-RZLKKPZV.js} +8 -8
- package/dist/cli/{feedback-GYAF46GA.js → feedback-3D5OROCI.js} +14 -14
- package/dist/cli/{feedback-XUU2UKM6.mjs → feedback-WD4JVF77.mjs} +6 -6
- package/dist/cli/git-GCCPCUWJ.js +25 -0
- package/dist/cli/{git-WVCMK5AH.mjs → git-RYUKBCUZ.mjs} +5 -5
- package/dist/cli/index.js +146 -146
- package/dist/cli/index.mjs +45 -45
- package/dist/cli/{integrations-FXADGAX2.mjs → integrations-KJPFCEXL.mjs} +7 -7
- package/dist/cli/{integrations-YYBJJFVX.js → integrations-Y7OK23DW.js} +15 -15
- package/dist/cli/{legacy-noops-LJY7LDUE.mjs → legacy-noops-2PU2ZVEP.mjs} +6 -6
- package/dist/cli/{legacy-noops-REZCYES2.js → legacy-noops-G7ZY7K3K.js} +9 -9
- package/dist/cli/{mcp-XSB3ZJFR.mjs → mcp-D7F2RSOI.mjs} +4 -4
- package/dist/cli/{mcp-L5PURE5S.js → mcp-GILBYX72.js} +24 -24
- package/dist/cli/{monitors-UBPF2OLO.mjs → monitors-IK5KXY2H.mjs} +32 -8
- package/dist/cli/{monitors-I5EIHSGV.js → monitors-OXNHOT3C.js} +125 -101
- package/dist/cli/{org-PHHIN2ER.mjs → org-L5D7EISU.mjs} +6 -6
- package/dist/cli/{org-SGSTGGUD.js → org-OYM3UNTP.js} +88 -88
- package/dist/cli/{play-LEJNJLWY.mjs → play-PK6QO3WX.mjs} +837 -290
- package/dist/cli/{play-WQEKMANL.js → play-YK22QPYO.js} +1423 -876
- package/dist/cli/{providers-RSDXBXIS.js → providers-5CYP7P4N.js} +9 -9
- package/dist/cli/{providers-3W26ZDAV.mjs → providers-Z6MNJDCG.mjs} +6 -6
- package/dist/cli/{quickstart-LGJD2M36.mjs → quickstart-2I73XQXB.mjs} +4 -4
- package/dist/cli/{quickstart-U3QX4EMI.js → quickstart-2YKETYJY.js} +6 -6
- package/dist/cli/{run-YWZ3W5HK.mjs → run-KGQ6TUBB.mjs} +23 -23
- package/dist/cli/{run-F2UPZUJS.js → run-YVSEAVE5.js} +43 -43
- package/dist/cli/{search-O2OJH3PY.mjs → search-V2HPN6FU.mjs} +7 -7
- package/dist/cli/search-YG3UIZ6A.js +32 -0
- package/dist/cli/{search-output-W7OCBYBU.js → search-output-BUSANFRN.js} +6 -6
- package/dist/cli/{search-output-H5BF6SJ3.mjs → search-output-OCTOSDEO.mjs} +4 -4
- package/dist/cli/{secrets-BN4GYVRI.js → secrets-VDKTHCVB.js} +15 -15
- package/dist/cli/{secrets-65XCAA7U.mjs → secrets-WZGRBWI5.mjs} +6 -6
- package/dist/cli/{sessions-SVEVESCQ.mjs → sessions-5DTN55DZ.mjs} +6 -6
- package/dist/cli/sessions-NSPT6LHT.js +22 -0
- package/dist/cli/{settings-7YMDAFCN.js → settings-A7VSNOLI.js} +85 -85
- package/dist/cli/{settings-HAU2NP2H.mjs → settings-BK5FPQ3X.mjs} +12 -12
- package/dist/cli/{setup-5RXHZ6YI.mjs → setup-LLQVPZTP.mjs} +9 -9
- package/dist/cli/{setup-G37QXQGM.js → setup-NV27CYQ5.js} +49 -49
- package/dist/cli/{skills-Q7A3XFAU.mjs → skills-IV6HK4XA.mjs} +7 -7
- package/dist/cli/skills-UA5E4DA3.js +36 -0
- package/dist/cli/{tools-ZG4NYRGB.mjs → tools-4FKPCRD7.mjs} +17 -17
- package/dist/cli/tools-NJVPAG37.js +57 -0
- package/dist/cli/update-DKX27XZB.js +34 -0
- package/dist/cli/{update-2CMZTZCL.mjs → update-MH5M746E.mjs} +9 -9
- package/dist/cli/{views-XUMDMDIE.js → views-JW44TCGL.js} +21 -21
- package/dist/cli/{views-A6IIY4OQ.mjs → views-KXC4JDT7.mjs} +6 -6
- package/dist/cli/{workflow-4EEW6MCD.js → workflow-F5AHL2ET.js} +17 -17
- package/dist/cli/{workflow-74MYISHU.mjs → workflow-FI4DL7ZI.mjs} +7 -7
- package/dist/{client-D1uWA2Vc.d.mts → client-BEJqhQAj.d.mts} +1 -1
- package/dist/{client-Hz7SsBXs.d.ts → client-Ceo295L2.d.ts} +1 -1
- package/dist/{client-core-D3Ad7Flt.d.ts → client-core-BPYuWfBC.d.ts} +49 -1
- package/dist/{client-core-Db_e63Hb.d.mts → client-core-BqetRxx-.d.mts} +49 -1
- 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 +118 -116
- 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-7UJFY5BY.js +0 -43
- package/dist/cli/concurrent-runs-help-A2IQVZRJ.js +0 -21
- package/dist/cli/describe-SD7DRTBW.js +0 -50
- package/dist/cli/git-7YYVMY6L.js +0 -25
- package/dist/cli/search-K6ANAXLF.js +0 -32
- package/dist/cli/sessions-M52QWLA6.js +0 -22
- package/dist/cli/skills-ZK4D5BJW.js +0 -36
- package/dist/cli/tools-DBZTLYFM.js +0 -57
- package/dist/cli/update-LC5HGEEH.js +0 -34
|
@@ -1626,6 +1626,31 @@ export type MonitorFleetSyncOptions = {
|
|
|
1626
1626
|
adoptExisting?: boolean;
|
|
1627
1627
|
/** Stable retry key; generated by the caller when omitted. */
|
|
1628
1628
|
idempotencyKey?: string;
|
|
1629
|
+
/**
|
|
1630
|
+
* Called each time the server stops a large first commit at its time budget
|
|
1631
|
+
* and the SDK re-sends the same sync to continue it. A Fleet too large to
|
|
1632
|
+
* commit inside one request (about 100,000 members) is committed over
|
|
1633
|
+
* several; the returned result is the committed plan, as for one request.
|
|
1634
|
+
*/
|
|
1635
|
+
onCommitProgress?: (progress: MonitorFleetCommitProgress) => void;
|
|
1636
|
+
/**
|
|
1637
|
+
* How long one request may commit before the server stops it and the SDK
|
|
1638
|
+
* re-sends, in milliseconds. Defaults to 240,000, which is also the
|
|
1639
|
+
* server's cap; lower it when something between you and Deepline cuts
|
|
1640
|
+
* requests off sooner.
|
|
1641
|
+
*/
|
|
1642
|
+
commitBudgetMs?: number;
|
|
1643
|
+
};
|
|
1644
|
+
|
|
1645
|
+
/** How far a Fleet sync committed over several requests has got. */
|
|
1646
|
+
export type MonitorFleetCommitProgress = {
|
|
1647
|
+
fleetId: string;
|
|
1648
|
+
/** The generation being committed; published once every member is. */
|
|
1649
|
+
generation: number;
|
|
1650
|
+
membersCommitted: number;
|
|
1651
|
+
membersTotal: number;
|
|
1652
|
+
/** Requests sent so far, this one included. */
|
|
1653
|
+
attempt: number;
|
|
1629
1654
|
};
|
|
1630
1655
|
|
|
1631
1656
|
export type MonitorFleetGetOptions = {
|
|
@@ -4489,6 +4514,12 @@ export class DeeplineClient {
|
|
|
4489
4514
|
sourceCode: string;
|
|
4490
4515
|
sourcePath?: string | null;
|
|
4491
4516
|
}>;
|
|
4517
|
+
/**
|
|
4518
|
+
* `false` returns the compact view (`view: 'compact'`: issues, stages one
|
|
4519
|
+
* line each, docflow, hashes, limits only when near). Absent or `true`
|
|
4520
|
+
* returns the complete check document, as before this option existed.
|
|
4521
|
+
*/
|
|
4522
|
+
full?: boolean;
|
|
4492
4523
|
}): Promise<PlayCheckResult> {
|
|
4493
4524
|
const integrationMode = normalizePlayRunIntegrationMode(
|
|
4494
4525
|
input.integrationMode ?? this.environment.DEEPLINE_EVAL_INTEGRATION_MODE,
|
|
@@ -8358,6 +8389,14 @@ export class DeeplineClient {
|
|
|
8358
8389
|
*/
|
|
8359
8390
|
private static readonly MONITOR_FLEET_WRITE_TIMEOUT_MS = 310_000;
|
|
8360
8391
|
|
|
8392
|
+
/**
|
|
8393
|
+
* The commit budget a sync asks for (#10717): the server stops a staged
|
|
8394
|
+
* commit this long into the request and answers `staged_commit_in_progress`
|
|
8395
|
+
* instead of running into its 300 s limit; the SDK re-sends to continue.
|
|
8396
|
+
* The server caps it at the same value.
|
|
8397
|
+
*/
|
|
8398
|
+
private static readonly MONITOR_FLEET_COMMIT_BUDGET_MS = 240_000;
|
|
8399
|
+
|
|
8361
8400
|
private monitorFleetPath(fleetId: string): string {
|
|
8362
8401
|
return `/api/v2/monitors/fleets/${encodeURIComponent(fleetId)}`;
|
|
8363
8402
|
}
|
|
@@ -8388,17 +8427,60 @@ export class DeeplineClient {
|
|
|
8388
8427
|
? { expected_generation: options.expectedGeneration }
|
|
8389
8428
|
: {}),
|
|
8390
8429
|
};
|
|
8391
|
-
|
|
8392
|
-
|
|
8393
|
-
|
|
8394
|
-
|
|
8395
|
-
|
|
8396
|
-
|
|
8397
|
-
|
|
8398
|
-
|
|
8399
|
-
|
|
8400
|
-
|
|
8401
|
-
|
|
8430
|
+
// One key for every request of this sync: they are one operation.
|
|
8431
|
+
const headers = {
|
|
8432
|
+
...this.monitorFleetHeaders('sync', options?.idempotencyKey),
|
|
8433
|
+
'X-Deepline-Fleet-Commit-Budget-Ms': String(
|
|
8434
|
+
options?.commitBudgetMs ??
|
|
8435
|
+
DeeplineClient.MONITOR_FLEET_COMMIT_BUDGET_MS,
|
|
8436
|
+
),
|
|
8437
|
+
};
|
|
8438
|
+
// Members still to commit after the last request, and how many requests
|
|
8439
|
+
// in a row have not lowered it. Each request writes at least one chunk,
|
|
8440
|
+
// but each also re-plans, and a re-plan can find new work (a source that
|
|
8441
|
+
// keeps growing), so progress is judged by what is left.
|
|
8442
|
+
let remainingBefore = Number.POSITIVE_INFINITY;
|
|
8443
|
+
let stalledRequests = 0;
|
|
8444
|
+
for (let attempt = 1; ; attempt += 1) {
|
|
8445
|
+
const result = await this.http.request<MonitorFleetResult>(
|
|
8446
|
+
this.monitorFleetPath(fleetId),
|
|
8447
|
+
{
|
|
8448
|
+
method: 'PUT',
|
|
8449
|
+
body,
|
|
8450
|
+
timeout: DeeplineClient.MONITOR_FLEET_WRITE_TIMEOUT_MS,
|
|
8451
|
+
headers,
|
|
8452
|
+
maxRetries: 0,
|
|
8453
|
+
exactUrlOnly: true,
|
|
8454
|
+
},
|
|
8455
|
+
);
|
|
8456
|
+
if (result.code !== 'staged_commit_in_progress') return result;
|
|
8457
|
+
// The plan is too large to commit inside one request. The server kept
|
|
8458
|
+
// its stage open; the same sync re-sent takes it over and continues
|
|
8459
|
+
// from the members it has not written yet.
|
|
8460
|
+
const staged = (result.staged_commit ?? {}) as Record<string, unknown>;
|
|
8461
|
+
const thisRequest = Number(staged.members_committed_this_request);
|
|
8462
|
+
const remaining =
|
|
8463
|
+
Number(staged.members_total) - Number(staged.members_committed);
|
|
8464
|
+
stalledRequests = remaining < remainingBefore ? 0 : stalledRequests + 1;
|
|
8465
|
+
remainingBefore = remaining;
|
|
8466
|
+
if (!(thisRequest > 0) || stalledRequests >= 2) {
|
|
8467
|
+
// The server always commits something per request, so this is a
|
|
8468
|
+
// server defect; looping would never end.
|
|
8469
|
+
throw new DeeplineError(
|
|
8470
|
+
`Monitor Fleet '${fleetId}' commit made no progress in request ${attempt}. Re-run the same command to continue from where it stopped.`,
|
|
8471
|
+
202,
|
|
8472
|
+
'MONITOR_FLEET_COMMIT_STALLED',
|
|
8473
|
+
{ response: result },
|
|
8474
|
+
);
|
|
8475
|
+
}
|
|
8476
|
+
options?.onCommitProgress?.({
|
|
8477
|
+
fleetId,
|
|
8478
|
+
generation: Number(result.generation),
|
|
8479
|
+
membersCommitted: Number(staged.members_committed),
|
|
8480
|
+
membersTotal: Number(staged.members_total),
|
|
8481
|
+
attempt,
|
|
8482
|
+
});
|
|
8483
|
+
}
|
|
8402
8484
|
}
|
|
8403
8485
|
|
|
8404
8486
|
async listMonitorFleets(): Promise<MonitorFleetResult> {
|
|
@@ -27,6 +27,8 @@ export async function checkLocalPlayGraph(input: {
|
|
|
27
27
|
prepareArtifact?: (
|
|
28
28
|
artifact: BundledPlayFileSuccess['artifact'],
|
|
29
29
|
) => BundledPlayFileSuccess['artifact'];
|
|
30
|
+
/** Forwarded as the check request's `full`; absent keeps the API default. */
|
|
31
|
+
full?: boolean;
|
|
30
32
|
}): Promise<{ result: CheckResult; failedChild?: BundledPlayFileSuccess }> {
|
|
31
33
|
const { client, graph } = input;
|
|
32
34
|
const nodesByPath = new Map(
|
|
@@ -77,6 +79,7 @@ export async function checkLocalPlayGraph(input: {
|
|
|
77
79
|
...(input.integrationMode
|
|
78
80
|
? { integrationMode: input.integrationMode }
|
|
79
81
|
: {}),
|
|
82
|
+
...(input.full === undefined ? {} : { full: input.full }),
|
|
80
83
|
});
|
|
81
84
|
};
|
|
82
85
|
if (
|
|
@@ -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.549',
|
|
209
209
|
updateSummary: {
|
|
210
210
|
introducedIn: '0.3.90',
|
|
211
211
|
summary:
|
|
@@ -2060,6 +2060,17 @@ export interface PlayCheckResult {
|
|
|
2060
2060
|
* `valid` can never ship a file whose second play fails.
|
|
2061
2061
|
*/
|
|
2062
2062
|
exports?: PlayCheckExportResult[];
|
|
2063
|
+
/**
|
|
2064
|
+
* `'compact'` when the request set `full: false`. The compact view drops
|
|
2065
|
+
* the complete static pipeline, authoring contract and feature flags; it
|
|
2066
|
+
* carries `stages` (one line each), `docflow`, `inputSchema` and
|
|
2067
|
+
* `returnFields`, and `limits` holds only budgets near or over their limit.
|
|
2068
|
+
*/
|
|
2069
|
+
view?: 'compact';
|
|
2070
|
+
stages?: unknown[];
|
|
2071
|
+
docflow?: Record<string, unknown>;
|
|
2072
|
+
inputSchema?: Record<string, unknown>;
|
|
2073
|
+
returnFields?: unknown[];
|
|
2063
2074
|
/** Enforceable byte budgets measured during cloud preflight. */
|
|
2064
2075
|
limits?: {
|
|
2065
2076
|
revisionStorage: {
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
// Who performed a Monitor or Fleet action.
|
|
2
|
+
//
|
|
3
|
+
// Every state-changing monitor action names an actor: the person behind the
|
|
4
|
+
// request, or the automated process that decided it. A background runner that
|
|
5
|
+
// executes an operation someone already requested is not a new actor; the
|
|
6
|
+
// request it executes is the attributed action.
|
|
7
|
+
//
|
|
8
|
+
// The actor is derived from the server-resolved auth context, never from a
|
|
9
|
+
// request field.
|
|
10
|
+
|
|
11
|
+
import type { AuthContext } from '@deepline/auth/context';
|
|
12
|
+
|
|
13
|
+
/** How a person reached the action. */
|
|
14
|
+
export type MonitorUserActorVia =
|
|
15
|
+
/** Browser session, including a platform admin acting in a workspace. */
|
|
16
|
+
| 'session'
|
|
17
|
+
/** A workspace member's API key (CLI, SDK, agents). */
|
|
18
|
+
| 'api_key'
|
|
19
|
+
/** The platform-admin verbs route (`deepline-admin monitors ...`). */
|
|
20
|
+
| 'platform_admin'
|
|
21
|
+
/** GitHub deploy-on-push, attributed to the project's binding admin. */
|
|
22
|
+
| 'git_deploy'
|
|
23
|
+
/** A Play run, attributed to the user it runs for. */
|
|
24
|
+
| 'play_run';
|
|
25
|
+
|
|
26
|
+
/** Automated processes that decide monitor actions on their own. */
|
|
27
|
+
export const MONITOR_SYSTEM_PROCESSES = [
|
|
28
|
+
/** The Fleet convergence tick's daily re-plan of a Fleet's source. */
|
|
29
|
+
'fleet_daily_sync',
|
|
30
|
+
/** A failed usage settlement suspending a monitor or Fleet. */
|
|
31
|
+
'billing_suspension',
|
|
32
|
+
/** The credit or spend-cap policy turning monitors off or back on. */
|
|
33
|
+
'billing_policy',
|
|
34
|
+
/** Recovery after the workspace's credit balance is restored. */
|
|
35
|
+
'billing_recovery',
|
|
36
|
+
/** A failed renewal charge suspending a monitor. */
|
|
37
|
+
'billing_renewal_reconcile',
|
|
38
|
+
/** A provider-reported resource failure: one automatic recreate, then errored. */
|
|
39
|
+
'provider_failure',
|
|
40
|
+
/** Webhook reconciliation repairing or deleting a provider resource. */
|
|
41
|
+
'webhook_reconciliation',
|
|
42
|
+
/** The operator bridge closing or retiring a provider radar. */
|
|
43
|
+
'operator_bridge',
|
|
44
|
+
/** Workspace archive suspending every monitor in the workspace. */
|
|
45
|
+
'workspace_archive',
|
|
46
|
+
] as const;
|
|
47
|
+
|
|
48
|
+
export type MonitorSystemProcess = (typeof MONITOR_SYSTEM_PROCESSES)[number];
|
|
49
|
+
|
|
50
|
+
export type MonitorActor =
|
|
51
|
+
| {
|
|
52
|
+
kind: 'user';
|
|
53
|
+
userId: string;
|
|
54
|
+
email: string | null;
|
|
55
|
+
via: MonitorUserActorVia;
|
|
56
|
+
apiKeyId: string | null;
|
|
57
|
+
}
|
|
58
|
+
| { kind: 'system'; process: MonitorSystemProcess };
|
|
59
|
+
|
|
60
|
+
export class MonitorActorUnattributableError extends Error {
|
|
61
|
+
constructor(reason: string) {
|
|
62
|
+
super(`Monitor action has no attributable actor: ${reason}`);
|
|
63
|
+
this.name = 'MonitorActorUnattributableError';
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* The person behind a request-scoped auth context.
|
|
69
|
+
*
|
|
70
|
+
* Throws for contexts that carry no person: internal dispatch tokens and the
|
|
71
|
+
* monitor executor credentials runners mint, which have no user id. Those are
|
|
72
|
+
* system work and must name their process with `systemMonitorActor` instead
|
|
73
|
+
* of passing for a user. A `@deepline.local` email alone is not a refusal:
|
|
74
|
+
* CI and Preview test members are real users with synthetic addresses.
|
|
75
|
+
*/
|
|
76
|
+
export function monitorActorFromAuth(
|
|
77
|
+
auth: AuthContext,
|
|
78
|
+
via?: Extract<MonitorUserActorVia, 'git_deploy'>,
|
|
79
|
+
): MonitorActor {
|
|
80
|
+
if (auth.internalMonitorDispatchToken) {
|
|
81
|
+
throw new MonitorActorUnattributableError(
|
|
82
|
+
'an internal monitor dispatch context is system work; name its process.',
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
const userId = auth.userId?.trim();
|
|
86
|
+
if (!userId) {
|
|
87
|
+
throw new MonitorActorUnattributableError(
|
|
88
|
+
`${auth.authType} context for org ${auth.orgId} has no user id.`,
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
const resolvedVia: MonitorUserActorVia =
|
|
92
|
+
via ??
|
|
93
|
+
(auth.authType === 'api_key'
|
|
94
|
+
? 'api_key'
|
|
95
|
+
: auth.authType === 'session'
|
|
96
|
+
? 'session'
|
|
97
|
+
: auth.authType === 'play_deploy'
|
|
98
|
+
? 'git_deploy'
|
|
99
|
+
: auth.authType === 'internal_executor'
|
|
100
|
+
? 'play_run'
|
|
101
|
+
: unattributableAuthType(auth.authType));
|
|
102
|
+
return {
|
|
103
|
+
kind: 'user',
|
|
104
|
+
userId,
|
|
105
|
+
email: auth.actorEmail?.trim() || null,
|
|
106
|
+
via: resolvedVia,
|
|
107
|
+
apiKeyId: auth.authType === 'api_key' ? (auth.apiKeyId ?? null) : null,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function unattributableAuthType(authType: never): never {
|
|
112
|
+
throw new MonitorActorUnattributableError(
|
|
113
|
+
`unknown auth type '${String(authType)}'.`,
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** A platform admin running `deepline-admin monitors ...` in any workspace. */
|
|
118
|
+
export function platformAdminMonitorActor(admin: {
|
|
119
|
+
userId: string;
|
|
120
|
+
email: string;
|
|
121
|
+
}): MonitorActor {
|
|
122
|
+
const userId = admin.userId.trim();
|
|
123
|
+
if (!userId) {
|
|
124
|
+
throw new MonitorActorUnattributableError('platform admin has no user id.');
|
|
125
|
+
}
|
|
126
|
+
return {
|
|
127
|
+
kind: 'user',
|
|
128
|
+
userId,
|
|
129
|
+
email: admin.email.trim() || null,
|
|
130
|
+
via: 'platform_admin',
|
|
131
|
+
apiKeyId: null,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export function systemMonitorActor(
|
|
136
|
+
process: MonitorSystemProcess,
|
|
137
|
+
): MonitorActor {
|
|
138
|
+
return { kind: 'system', process };
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Flat fields for a structured log line. The email stays out of logs, as in
|
|
143
|
+
* `logMonitorAccessDenied`; the audit row holds it.
|
|
144
|
+
*/
|
|
145
|
+
export function monitorActorLogFields(actor: MonitorActor) {
|
|
146
|
+
return actor.kind === 'user'
|
|
147
|
+
? {
|
|
148
|
+
actor_kind: 'user' as const,
|
|
149
|
+
actor_user_id: actor.userId,
|
|
150
|
+
actor_via: actor.via,
|
|
151
|
+
...(actor.apiKeyId ? { actor_api_key_id: actor.apiKeyId } : {}),
|
|
152
|
+
}
|
|
153
|
+
: { actor_kind: 'system' as const, actor_process: actor.process };
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/** One line for Slack and CLI output: an email, a user id, or `system:<process>`. */
|
|
157
|
+
export function describeMonitorActor(actor: MonitorActor): string {
|
|
158
|
+
return actor.kind === 'user'
|
|
159
|
+
? (actor.email ?? `user:${actor.userId}`)
|
|
160
|
+
: `system:${actor.process}`;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/** Every recorded Monitor and Fleet action. Stored as a string. */
|
|
164
|
+
export type MonitorActionName =
|
|
165
|
+
| 'monitor_deploy'
|
|
166
|
+
| 'monitor_update'
|
|
167
|
+
| 'monitor_delete'
|
|
168
|
+
| 'monitor_reactivate'
|
|
169
|
+
| 'monitor_start'
|
|
170
|
+
| 'monitor_stop'
|
|
171
|
+
| 'monitor_sync'
|
|
172
|
+
| 'monitor_repair'
|
|
173
|
+
| 'monitor_audit'
|
|
174
|
+
| 'monitor_billing_suspend'
|
|
175
|
+
| 'monitor_provider_failure_repair'
|
|
176
|
+
| 'monitor_provider_failure_errored'
|
|
177
|
+
| 'monitor_reconcile_repair'
|
|
178
|
+
| 'monitor_reconcile_delete'
|
|
179
|
+
| 'monitor_reconcile_adopt'
|
|
180
|
+
| 'monitor_radar_close'
|
|
181
|
+
| 'monitor_legacy_retire'
|
|
182
|
+
| 'batch_deploy'
|
|
183
|
+
| 'batch_operation'
|
|
184
|
+
| 'named_batch_sync'
|
|
185
|
+
| 'named_batch_stop'
|
|
186
|
+
| 'named_batch_start'
|
|
187
|
+
| 'job_cancel'
|
|
188
|
+
| 'fleet_sync'
|
|
189
|
+
| 'fleet_commit'
|
|
190
|
+
| 'fleet_resync'
|
|
191
|
+
| 'fleet_deactivate'
|
|
192
|
+
| 'fleet_reactivate'
|
|
193
|
+
| 'fleet_billing_suspend'
|
|
194
|
+
| 'workspace_monitors_suspend'
|
|
195
|
+
| 'admin_verb';
|
|
196
|
+
|
|
197
|
+
export type MonitorActionTarget = {
|
|
198
|
+
monitorKey?: string;
|
|
199
|
+
fleetId?: string;
|
|
200
|
+
batchId?: string;
|
|
201
|
+
jobId?: string;
|
|
202
|
+
operationRunId?: string;
|
|
203
|
+
};
|
|
@@ -38,6 +38,26 @@ export const MAX_MEMBER_DEFINITION_BYTES = 2_048;
|
|
|
38
38
|
export const SINGLE_COMMIT_MAX_MEMBERS = 1_000;
|
|
39
39
|
/** Members one staged-commit chunk carries; see `commitStagedChunk`. */
|
|
40
40
|
export const STAGED_COMMIT_CHUNK_MEMBERS = 250;
|
|
41
|
+
/**
|
|
42
|
+
* A time-boxed Fleet sync (#10717). A client that re-sends a sync until it is
|
|
43
|
+
* committed asks for one with this header, whose value is the commit budget
|
|
44
|
+
* in milliseconds. The route stops a staged commit that has not finished
|
|
45
|
+
* once that much of the request has passed, and answers HTTP 202 with
|
|
46
|
+
* `code: MONITOR_FLEET_STAGED_COMMIT_IN_PROGRESS` and its stage left open;
|
|
47
|
+
* the identical sync re-sent continues it. Without the header the commit
|
|
48
|
+
* runs to the end, which is what a client that sends once expects.
|
|
49
|
+
*/
|
|
50
|
+
export const MONITOR_FLEET_COMMIT_BUDGET_HEADER =
|
|
51
|
+
'x-deepline-fleet-commit-budget-ms';
|
|
52
|
+
/**
|
|
53
|
+
* The most budget a sync may ask for: the route's 300 s, less what the
|
|
54
|
+
* chunks still in flight, the finish, and the response need after it.
|
|
55
|
+
*/
|
|
56
|
+
export const MONITOR_FLEET_MAX_COMMIT_BUDGET_MS = 240_000;
|
|
57
|
+
/** The least, so each request still has time to commit something. */
|
|
58
|
+
export const MONITOR_FLEET_MIN_COMMIT_BUDGET_MS = 1_000;
|
|
59
|
+
export const MONITOR_FLEET_STAGED_COMMIT_IN_PROGRESS =
|
|
60
|
+
'staged_commit_in_progress';
|
|
41
61
|
export const MAX_FLEET_SETTLE_ITEMS = 100;
|
|
42
62
|
/**
|
|
43
63
|
* How long a convergence claim leases its members. The create path posts
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
|
+
"./action-actor": "./action-actor.ts",
|
|
8
|
+
"./action-actor.js": "./action-actor.ts",
|
|
7
9
|
"./fleets/limits": "./fleets/limits.ts",
|
|
8
10
|
"./fleets/count-drift-alert": "./fleets/count-drift-alert.ts",
|
|
9
11
|
"./analytics-install-guides": "./analytics-install-guides.ts",
|
|
@@ -129,6 +129,39 @@ export type ProviderMonitorBatchResultState =
|
|
|
129
129
|
(typeof PROVIDER_MONITOR_BATCH_RESULT_STATES)[number];
|
|
130
130
|
|
|
131
131
|
export const PROVIDER_MONITOR_BATCH_IDEMPOTENCY_KEY_MAX_LENGTH = 96;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* `ConvexError` code for a converge request on a Fleet that another converge
|
|
135
|
+
* is already working (#10624). Callers answer it as a 409 conflict.
|
|
136
|
+
*/
|
|
137
|
+
export const MONITOR_FLEET_CONVERGE_RUNNING = 'monitor_fleet_converge_running';
|
|
138
|
+
|
|
139
|
+
/** The refusal's data when `error` is that `ConvexError`, else null. */
|
|
140
|
+
export function monitorFleetConvergeRunningRefusal(
|
|
141
|
+
error: unknown,
|
|
142
|
+
): { message: string; fleetId: string; runId: string } | null {
|
|
143
|
+
if (
|
|
144
|
+
!(error instanceof Error) ||
|
|
145
|
+
error.name !== 'ConvexError' ||
|
|
146
|
+
!('data' in error)
|
|
147
|
+
) {
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
const data = (error as { data: unknown }).data;
|
|
151
|
+
if (
|
|
152
|
+
typeof data !== 'object' ||
|
|
153
|
+
data === null ||
|
|
154
|
+
(data as { code?: unknown }).code !== MONITOR_FLEET_CONVERGE_RUNNING
|
|
155
|
+
) {
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
const { message, fleetId, runId } = data as Record<string, unknown>;
|
|
159
|
+
return typeof message === 'string' &&
|
|
160
|
+
typeof fleetId === 'string' &&
|
|
161
|
+
typeof runId === 'string'
|
|
162
|
+
? { message, fleetId, runId }
|
|
163
|
+
: null;
|
|
164
|
+
}
|
|
132
165
|
const IDEMPOTENCY_KEY = new RegExp(
|
|
133
166
|
`^[A-Za-z0-9][A-Za-z0-9._-]{0,${PROVIDER_MONITOR_BATCH_IDEMPOTENCY_KEY_MAX_LENGTH - 1}}$`,
|
|
134
167
|
);
|
|
@@ -2,6 +2,7 @@ import { randomUUID } from 'node:crypto';
|
|
|
2
2
|
import { isRepairableTenantDataPlaneError } from '@deepline/ingestion-v2/tenant-data-plane-errors';
|
|
3
3
|
import {
|
|
4
4
|
MONITOR_REFUND_SETTLEMENT_PENDING_CODE,
|
|
5
|
+
PROVIDER_BATCH_CALLBACK_UPSTREAM_RESOURCE_MISSING_CODE,
|
|
5
6
|
PROVIDER_MONITOR_CONTROL_STATE_PENDING_CODE,
|
|
6
7
|
} from '@deepline/monitors/signal-radars/inbound-failure-codes';
|
|
7
8
|
import type { SignalRadarInboundMessage } from '@deepline/monitors/signal-radars/inbound-message';
|
|
@@ -412,11 +413,25 @@ export function inboundBackoffSeconds(deliveryCount: number): number {
|
|
|
412
413
|
export const PROVIDER_MONITOR_CONTROL_STATE_PENDING_RETRY_WINDOW_MS =
|
|
413
414
|
24 * 60 * 60 * 1000;
|
|
414
415
|
|
|
416
|
+
// A failure redelivery cannot change: a payload the row builder refused
|
|
417
|
+
// (flagged `deterministic` by the worker) or a shared batch callback with no
|
|
418
|
+
// upstream resource ID. A typed-write failure from the database or control
|
|
419
|
+
// plane is not flagged and keeps its retry budget.
|
|
420
|
+
function isDeterministicInboundFailure(error: unknown) {
|
|
421
|
+
if (!error || typeof error !== 'object') return false;
|
|
422
|
+
return (
|
|
423
|
+
(error as { deterministic?: unknown }).deterministic === true ||
|
|
424
|
+
inboundFailureCode(error) ===
|
|
425
|
+
PROVIDER_BATCH_CALLBACK_UPSTREAM_RESOURCE_MISSING_CODE
|
|
426
|
+
);
|
|
427
|
+
}
|
|
428
|
+
|
|
415
429
|
/**
|
|
416
430
|
* The one terminal rule for both inbound delivery paths, the queue handler and
|
|
417
|
-
* the receipt dispatcher. A
|
|
418
|
-
*
|
|
419
|
-
*
|
|
431
|
+
* the receipt dispatcher. A deterministic failure dead-letters on its first
|
|
432
|
+
* delivery. Any other permanent failure dead-letters once its delivery budget
|
|
433
|
+
* is spent. A transient one keeps retrying, except a pending monitor binding,
|
|
434
|
+
* which also dead-letters once it is older than its retry window.
|
|
420
435
|
*/
|
|
421
436
|
export function inboundFailureNeedsDeadLetter(input: {
|
|
422
437
|
error: unknown;
|
|
@@ -425,6 +440,7 @@ export function inboundFailureNeedsDeadLetter(input: {
|
|
|
425
440
|
receivedAt: string;
|
|
426
441
|
now: number;
|
|
427
442
|
}): boolean {
|
|
443
|
+
if (isDeterministicInboundFailure(input.error)) return true;
|
|
428
444
|
if (input.deliveryCount <= input.maxDeliveries) return false;
|
|
429
445
|
if (classifyInboundFailure(input.error) === 'permanent') return true;
|
|
430
446
|
if (
|
|
@@ -22,3 +22,24 @@ export const MONITOR_REFUND_SETTLEMENT_PENDING_CODE =
|
|
|
22
22
|
/** Storage has no blob for this receipt. No retry can bring it back. */
|
|
23
23
|
export const SIGNAL_RADAR_INBOUND_PAYLOAD_MISSING_CODE =
|
|
24
24
|
'signal_radar_inbound_payload_missing';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Codes for a webhook delivery that was captured but not written. A delivery
|
|
28
|
+
* the row builder refused also carries `deterministic: true` and dead-letters
|
|
29
|
+
* on its first delivery; any other failure keeps the retry budget. A batch
|
|
30
|
+
* callback with no upstream resource is deterministic by its code alone.
|
|
31
|
+
*/
|
|
32
|
+
export const PROVIDER_CALLBACK_TYPED_WRITE_FAILED_CODE =
|
|
33
|
+
'provider_callback_typed_write_failed';
|
|
34
|
+
export const PROVIDER_CALLBACK_PAYLOAD_REJECTED_CODE =
|
|
35
|
+
'provider_callback_payload_rejected';
|
|
36
|
+
export const PROVIDER_BATCH_CALLBACK_UPSTREAM_RESOURCE_MISSING_CODE =
|
|
37
|
+
'provider_batch_callback_upstream_resource_missing';
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* A webhook payload holding text Postgres jsonb cannot store (a null byte or an
|
|
41
|
+
* unpaired surrogate). It is refused before capture, flagged deterministic, and
|
|
42
|
+
* dead-letters on its first delivery with the exact body retained.
|
|
43
|
+
*/
|
|
44
|
+
export const PROVIDER_CALLBACK_PAYLOAD_UNSTORABLE_CODE =
|
|
45
|
+
'provider_callback_payload_unstorable';
|
package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts
CHANGED
|
@@ -94,6 +94,7 @@ import {
|
|
|
94
94
|
resolveRunnerSandboxDeleteMs,
|
|
95
95
|
} from '../test-runtime-seams';
|
|
96
96
|
import {
|
|
97
|
+
isRuntimeSandboxCapacityLimitError,
|
|
97
98
|
RuntimeResourceFenceLostError,
|
|
98
99
|
type PlayRunnerRuntimeResource,
|
|
99
100
|
type PlayRunnerWorkerSlot,
|
|
@@ -777,20 +778,47 @@ function isTransientHeartbeatTimeout(error: unknown): boolean {
|
|
|
777
778
|
);
|
|
778
779
|
}
|
|
779
780
|
|
|
781
|
+
/**
|
|
782
|
+
* A workspace sandbox-capacity refusal, whether it arrives as the typed class,
|
|
783
|
+
* by name across the provider-backend boundary, or as a generic scheduler
|
|
784
|
+
* capacity error carrying its message (the prefix the scheduler's SQL matches).
|
|
785
|
+
*/
|
|
786
|
+
function isWorkspaceSandboxCapacityRefusal(error: unknown): boolean {
|
|
787
|
+
return (
|
|
788
|
+
isRuntimeSandboxCapacityLimitError(error) ||
|
|
789
|
+
(isRuntimeSchedulerCapacityError(error) &&
|
|
790
|
+
error.message.startsWith(
|
|
791
|
+
'Runtime scheduler sandbox capacity is full for organization ',
|
|
792
|
+
))
|
|
793
|
+
);
|
|
794
|
+
}
|
|
795
|
+
|
|
780
796
|
export function capacityDeferralSeconds(
|
|
781
797
|
error: unknown,
|
|
782
798
|
runId: string,
|
|
783
799
|
generation?: number,
|
|
784
800
|
): number {
|
|
785
801
|
if (!isRuntimeSchedulerCapacityError(error)) return 5;
|
|
802
|
+
// A refusal thrown inside the sandbox job reaches the launch-level catcher,
|
|
803
|
+
// which has no generation; the error carries the attempt it refused.
|
|
804
|
+
const carriedAttempt = (error as { attempt?: unknown }).attempt;
|
|
805
|
+
const attemptGeneration =
|
|
806
|
+
generation ??
|
|
807
|
+
(typeof carriedAttempt === 'number' && Number.isSafeInteger(carriedAttempt)
|
|
808
|
+
? carriedAttempt
|
|
809
|
+
: undefined);
|
|
786
810
|
// A run repeatedly rejected at the workspace cap does not need to claim
|
|
787
811
|
// another generation every 15 seconds. Preserve short retries on young
|
|
788
|
-
// runs
|
|
812
|
+
// runs, then 60 s from generation 5 and 120 s from generation 20. On
|
|
813
|
+
// 2026-11-18 mature waits still deferred 15-17 s because the job-path
|
|
814
|
+
// refusal reached this function without a generation; it now carries one.
|
|
789
815
|
const workspaceCapFloorSeconds =
|
|
790
|
-
error
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
816
|
+
isWorkspaceSandboxCapacityRefusal(error) && attemptGeneration !== undefined
|
|
817
|
+
? attemptGeneration >= 20
|
|
818
|
+
? 120
|
|
819
|
+
: attemptGeneration >= 5
|
|
820
|
+
? 60
|
|
821
|
+
: 1
|
|
794
822
|
: 1;
|
|
795
823
|
const baseSeconds = Math.max(
|
|
796
824
|
workspaceCapFloorSeconds,
|
|
@@ -3881,6 +3909,7 @@ async function executeAbsurdAttemptAdapter(
|
|
|
3881
3909
|
orgId: launch.orgId,
|
|
3882
3910
|
limit: precheck.limit,
|
|
3883
3911
|
activeLeases: precheck.activeLeases,
|
|
3912
|
+
attempt: generation,
|
|
3884
3913
|
});
|
|
3885
3914
|
}
|
|
3886
3915
|
}
|
|
@@ -4181,7 +4210,7 @@ async function executeAbsurdAttemptAdapter(
|
|
|
4181
4210
|
options,
|
|
4182
4211
|
),
|
|
4183
4212
|
);
|
|
4184
|
-
if (error
|
|
4213
|
+
if (isWorkspaceSandboxCapacityRefusal(error)) {
|
|
4185
4214
|
throw new DeferTask(
|
|
4186
4215
|
error.message,
|
|
4187
4216
|
capacityDeferralSeconds(error, runId, generation),
|
|
@@ -5701,6 +5730,7 @@ async function executeAssignedAbsurdAttempt(input: {
|
|
|
5701
5730
|
orgId: launch.orgId,
|
|
5702
5731
|
limit: reserved.limit,
|
|
5703
5732
|
activeLeases: reserved.activeLeases,
|
|
5733
|
+
attempt: generation,
|
|
5704
5734
|
});
|
|
5705
5735
|
}
|
|
5706
5736
|
if (reserved.wouldDefer) {
|