deepline 0.3.550 → 0.3.552
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 +23 -0
- package/dist/bundling-sources/sdk/src/http-core.ts +6 -2
- package/dist/bundling-sources/sdk/src/release.ts +1 -1
- package/dist/bundling-sources/sdk/src/runs/watch-polling.ts +58 -29
- package/dist/bundling-sources/sdk/src/types.ts +22 -0
- package/dist/bundling-sources/shared_libs/integration-contracts/tool-connection.ts +42 -0
- package/dist/bundling-sources/shared_libs/monitors/package.json +2 -0
- package/dist/bundling-sources/shared_libs/monitors/provider-monitor-upstream-identity.ts +80 -13
- package/dist/bundling-sources/shared_libs/monitors/snitcher-ip2company.ts +31 -0
- package/dist/bundling-sources/shared_libs/monitors/tamradar-countries.ts +285 -0
- package/dist/bundling-sources/shared_libs/monitors/tracking-provider-guidance.ts +1 -0
- package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +163 -0
- package/dist/bundling-sources/shared_libs/play-runtime/activity-observation.ts +2 -0
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +137 -0
- package/dist/bundling-sources/shared_libs/play-runtime/durable-runs-rollout.ts +12 -0
- package/dist/bundling-sources/shared_libs/play-runtime/experiment-switches.ts +20 -16
- package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +47 -14
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +48 -3
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-constants.ts +9 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +187 -16
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts +102 -29
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +854 -3
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-event-search.ts +15 -1
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-capacity.ts +6 -2
- package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +37 -7
- package/dist/bundling-sources/shared_libs/plays/share/static-pipeline-summary.ts +43 -0
- package/dist/bundling-sources/shared_libs/product-notifications/billing-sales.ts +1 -0
- package/dist/bundling-sources/shared_libs/product-notifications/catalog.ts +38 -5
- package/dist/bundling-sources/shared_libs/product-notifications/default-policy.ts +1 -1
- package/dist/bundling-sources/shared_libs/product-notifications/events.ts +16 -0
- package/dist/cli/{auth-UJCAHGZG.mjs → auth-KVSBJZOX.mjs} +5 -5
- package/dist/cli/auth-MMNVWATX.js +43 -0
- package/dist/cli/{billing-RYWMI7JJ.mjs → billing-54RHFEBI.mjs} +20 -13
- package/dist/cli/{billing-VO2O5O5O.js → billing-FQREA7UA.js} +109 -102
- package/dist/cli/chunk-2RIKOPIM.mjs +9 -0
- package/dist/cli/{chunk-XYIECA7M.js → chunk-2WFPHBR4.js} +30 -8
- package/dist/cli/{chunk-SBNNK73L.js → chunk-3FD5EQ62.js} +6 -6
- package/dist/cli/{chunk-JLFOQRWM.js → chunk-45PVGZST.js} +270 -270
- package/dist/cli/{chunk-YSYOQYZE.js → chunk-4MK42735.js} +48 -44
- package/dist/cli/{chunk-2IW5GKB4.js → chunk-4NQF6KJ3.js} +13 -13
- package/dist/cli/{chunk-72NXIFOT.mjs → chunk-4TALT2M3.mjs} +1 -1
- package/dist/cli/{chunk-ADWMIZCB.js → chunk-4UUR4TCH.js} +22 -13
- package/dist/cli/{chunk-EMPXPEIQ.mjs → chunk-57VZVF5D.mjs} +3 -3
- package/dist/cli/{chunk-5J3TRWTB.js → chunk-634ZDA3F.js} +1 -1
- package/dist/cli/{chunk-FMXLQHM2.mjs → chunk-6O5HOODW.mjs} +13 -13
- package/dist/cli/{chunk-HCFH2V27.mjs → chunk-6PRW5UBA.mjs} +3 -2
- package/dist/cli/{chunk-N2Y2IGNB.mjs → chunk-6RZOWL2V.mjs} +1 -1
- package/dist/cli/{chunk-JKLDCFY5.js → chunk-6YCA5NKJ.js} +11 -11
- package/dist/cli/{chunk-5LUF4LAR.mjs → chunk-6ZORHRKB.mjs} +1 -0
- package/dist/cli/{chunk-DGUTBLXF.js → chunk-77AAAGVB.js} +3 -2
- package/dist/cli/{chunk-OKNOQRQ3.js → chunk-7IKQKKNX.js} +3 -3
- package/dist/cli/{chunk-JYUIIDZO.js → chunk-ADRC5I3R.js} +23 -22
- package/dist/cli/{chunk-IZCPOX7X.mjs → chunk-AQWQ2BFX.mjs} +1 -1
- package/dist/cli/{chunk-7BWMCVYU.mjs → chunk-AWJPDPMA.mjs} +1 -1
- package/dist/cli/{chunk-S6XOKGBF.mjs → chunk-AZQ264ID.mjs} +1 -1
- package/dist/cli/{chunk-EU23QOJ6.js → chunk-BAIST2BR.js} +26 -26
- package/dist/cli/{chunk-6P7TGCHQ.mjs → chunk-BGBJV26E.mjs} +10 -3
- package/dist/cli/{chunk-COHCKZQK.mjs → chunk-DJ2JDK4O.mjs} +2 -1
- package/dist/cli/{chunk-E4S7OE7B.mjs → chunk-EOPEYCY7.mjs} +3 -3
- package/dist/cli/{chunk-LUULRAQB.mjs → chunk-EUPVF4SU.mjs} +10 -7
- package/dist/cli/{chunk-TB3WT76F.js → chunk-F2LH7TGF.js} +23 -20
- package/dist/cli/{chunk-UL7HWZO7.mjs → chunk-FTJLJCE5.mjs} +2 -2
- package/dist/cli/{chunk-3WG2GURT.js → chunk-G4O75EXF.js} +9 -9
- package/dist/cli/{chunk-7AOFSZJM.mjs → chunk-GGGAEVCX.mjs} +23 -1
- package/dist/cli/{chunk-R5CYKRA2.js → chunk-GKYAYLRI.js} +12 -12
- package/dist/cli/{chunk-UV4RU2TE.js → chunk-H4ALLC2X.js} +2 -0
- package/dist/cli/{chunk-LWHWMU4V.js → chunk-HO3XK3R7.js} +7 -7
- package/dist/cli/{chunk-E2QVWDDW.mjs → chunk-HYC4MKGK.mjs} +3 -3
- package/dist/cli/{chunk-KSUTNW3X.js → chunk-IDVVIXPJ.js} +42 -41
- package/dist/cli/{chunk-BJO7ZXAK.js → chunk-IHRKLXZN.js} +5 -5
- package/dist/cli/{chunk-ZQZOYGDC.mjs → chunk-IYSTRCLX.mjs} +5 -4
- package/dist/cli/{chunk-SMLWC7PM.js → chunk-JWUAX6OP.js} +10 -10
- package/dist/cli/{chunk-RKF263LR.js → chunk-KWSH5T7K.js} +25 -18
- package/dist/cli/{chunk-I62PCYU6.js → chunk-MF2GHZDO.js} +2 -2
- package/dist/cli/{chunk-XKE2PGZ2.js → chunk-PFO3ISXA.js} +26 -15
- package/dist/cli/{chunk-MXEYNRTZ.mjs → chunk-PTVD2GVQ.mjs} +6 -5
- package/dist/cli/{chunk-QD2KT7II.mjs → chunk-QAORXEY3.mjs} +2 -2
- package/dist/cli/{chunk-2AKS64KJ.mjs → chunk-QILKGXYF.mjs} +2 -2
- package/dist/cli/{chunk-DJWM5OOY.mjs → chunk-QPKH23EC.mjs} +4 -4
- package/dist/cli/{chunk-MAE3AKDR.mjs → chunk-QX7LFGJR.mjs} +18 -9
- package/dist/cli/{chunk-CIBQVA6V.mjs → chunk-QY3ZNU6Z.mjs} +2 -2
- package/dist/cli/{chunk-MJDQZYKO.js → chunk-RBEUVDZF.js} +10 -6
- package/dist/cli/{chunk-RS6ZSKX6.js → chunk-RQZQVFCJ.js} +2 -2
- package/dist/cli/{chunk-QNWNR6DG.js → chunk-S46HWQKO.js} +53 -53
- package/dist/cli/{chunk-4NQWUUOH.mjs → chunk-S5S355UY.mjs} +2 -2
- package/dist/cli/{chunk-NM3AYEDI.js → chunk-SHLFOPD6.js} +5 -5
- package/dist/cli/{chunk-K7JZV4QW.mjs → chunk-U7QRMBIY.mjs} +2 -2
- package/dist/cli/{chunk-ECWOIXAV.js → chunk-UPMRIVZB.js} +14 -12
- package/dist/cli/{chunk-R7J7CJPZ.js → chunk-V436Z54K.js} +1 -0
- package/dist/cli/{chunk-RINUMR6C.js → chunk-VQALXEXO.js} +20 -19
- package/dist/cli/{chunk-F2RXBNT5.mjs → chunk-WE5HES3H.mjs} +7 -5
- package/dist/cli/{chunk-GWNYLIF7.mjs → chunk-WEHCBH5R.mjs} +4 -2
- package/dist/cli/{chunk-SZNX3XU3.js → chunk-WLN3SUIA.js} +3 -3
- package/dist/cli/{chunk-3W44AJOE.js → chunk-XVB7V4N7.js} +18 -16
- package/dist/cli/{chunk-HEVUFICQ.mjs → chunk-YJHE3O5M.mjs} +9 -5
- package/dist/cli/{chunk-GVW5V562.mjs → chunk-YLTMXJFC.mjs} +7 -3
- package/dist/cli/{chunk-TL3WIXDH.mjs → chunk-Z5TSLLOW.mjs} +19 -8
- package/dist/cli/{chunk-KLQILE2I.mjs → chunk-ZIAXDBXX.mjs} +2 -2
- package/dist/cli/command-docs.js +4 -4
- package/dist/cli/command-docs.mjs +3 -3
- package/dist/cli/concurrent-runs-help-FQAIHKKC.js +21 -0
- package/dist/cli/{concurrent-runs-help-766HVJR3.mjs → concurrent-runs-help-Q4KPAUJX.mjs} +7 -7
- package/dist/cli/{csv-VU52KZOX.mjs → csv-2PTVDNO6.mjs} +10 -5
- package/dist/cli/{csv-4DZKGYCU.js → csv-F5VAGX4K.js} +19 -14
- package/dist/cli/{db-UBGW373S.mjs → db-IEDXAUF7.mjs} +6 -6
- package/dist/cli/{db-KPIH4HPW.js → db-Z3OIUFMM.js} +27 -27
- package/dist/cli/{describe-NGITP6RA.mjs → describe-QDANCTS3.mjs} +21 -21
- package/dist/cli/describe-VUTT5ZKU.js +50 -0
- package/dist/cli/describe-core.d.mts +4 -2
- package/dist/cli/describe-core.d.ts +4 -2
- package/dist/cli/describe-core.js +4 -4
- package/dist/cli/describe-core.mjs +3 -3
- package/dist/cli/{executions-G3X25U3V.js → executions-H6H5655J.js} +8 -8
- package/dist/cli/{executions-CO5UF3CV.mjs → executions-R3LP74QN.mjs} +6 -6
- package/dist/cli/{feedback-ZYF65WPH.js → feedback-VFOUR66B.js} +14 -14
- package/dist/cli/{feedback-M2L5DVN2.mjs → feedback-WL3MRVT5.mjs} +6 -6
- package/dist/cli/git-ETB3GH3K.js +25 -0
- package/dist/cli/{git-AYJD5CLS.mjs → git-YX2J4GCI.mjs} +5 -5
- package/dist/cli/index.js +148 -148
- package/dist/cli/index.mjs +47 -47
- package/dist/cli/{integrations-LKEGGTZO.mjs → integrations-5ZK5KLVP.mjs} +7 -7
- package/dist/cli/{integrations-GSXXJ4CF.js → integrations-E2JZYKHS.js} +15 -15
- package/dist/cli/{legacy-noops-MZDLLEKN.js → legacy-noops-3VW4IJTH.js} +9 -9
- package/dist/cli/{legacy-noops-UF4GKMD4.mjs → legacy-noops-SMN3GSXY.mjs} +6 -6
- package/dist/cli/{mcp-RTNC6LP3.js → mcp-UQV2K4EW.js} +24 -24
- package/dist/cli/{mcp-NHQ6RMBP.mjs → mcp-V6MGCYAG.mjs} +4 -4
- package/dist/cli/{monitors-NC4ZR5DH.mjs → monitors-GGKS5W6M.mjs} +7 -7
- package/dist/cli/{monitors-WMWB6EKQ.js → monitors-R3BBDCRC.js} +100 -100
- package/dist/cli/{org-33Q7CXJB.js → org-GRYVMNSW.js} +88 -88
- package/dist/cli/{org-ZXUSYREQ.mjs → org-Z37NGJV4.mjs} +6 -6
- package/dist/cli/{play-N24XV6TI.js → play-2MVO27VO.js} +332 -332
- package/dist/cli/{play-IPWFGNRE.mjs → play-MDWPR4XG.mjs} +19 -19
- package/dist/cli/{providers-AUI7MMQS.js → providers-2AACRUZH.js} +9 -9
- package/dist/cli/{providers-MSVE7UZS.mjs → providers-AKDYFZJZ.mjs} +6 -6
- package/dist/cli/{quickstart-PSC6VTRI.js → quickstart-H6IV3PV3.js} +6 -6
- package/dist/cli/{quickstart-OME5XMW5.mjs → quickstart-QDGRJFZY.mjs} +4 -4
- package/dist/cli/{run-UTIX7CJY.js → run-2634REDK.js} +47 -47
- package/dist/cli/{run-EYTT2DHO.mjs → run-RTSQNGRD.mjs} +26 -26
- package/dist/cli/{search-FVE7PM72.mjs → search-6AOJ4XPP.mjs} +7 -7
- package/dist/cli/search-VTW2YNBS.js +32 -0
- package/dist/cli/{search-output-TQMY6BDG.mjs → search-output-6ADMTOU5.mjs} +40 -10
- package/dist/cli/{search-output-O463JNLR.js → search-output-S5ODBL5E.js} +43 -13
- package/dist/cli/{secrets-TWZ2GO73.js → secrets-LHCIIHMT.js} +15 -15
- package/dist/cli/{secrets-KCJJAHQB.mjs → secrets-TFIFBFB3.mjs} +6 -6
- package/dist/cli/sessions-CJ4FJ2WB.js +22 -0
- package/dist/cli/{sessions-ZCWAA7QL.mjs → sessions-WHBVUHVW.mjs} +6 -6
- package/dist/cli/{settings-SCR654U7.js → settings-CP4FVK2W.js} +85 -85
- package/dist/cli/{settings-4JFKCKII.mjs → settings-EBONWL5C.mjs} +12 -12
- package/dist/cli/{setup-Q2YOPGOI.mjs → setup-I5AZE3IU.mjs} +15 -10
- package/dist/cli/{setup-O6GH3UWT.js → setup-LFGHTNLQ.js} +55 -50
- package/dist/cli/skills-R7EBXREW.js +36 -0
- package/dist/cli/{skills-QHPZ6H2G.mjs → skills-W76AO5XE.mjs} +7 -7
- package/dist/cli/{tools-YO22H46E.mjs → tools-7IJHGF6W.mjs} +19 -19
- package/dist/cli/tools-V7U2BDXM.js +57 -0
- package/dist/cli/update-4COPZETK.js +34 -0
- package/dist/cli/{update-WHBC5IHE.mjs → update-GFOPZTHY.mjs} +9 -9
- package/dist/cli/{views-4CZJ5BLG.js → views-BPL2TQJ4.js} +21 -21
- package/dist/cli/{views-XNLXV2BT.mjs → views-D4NX4SBG.mjs} +6 -6
- package/dist/cli/{workflow-QUWP2CG2.mjs → workflow-YXP42FUI.mjs} +7 -7
- package/dist/cli/{workflow-C4VBARIE.js → workflow-ZYNAUCKC.js} +17 -17
- package/dist/{client-Ceo295L2.d.ts → client-Bf3IpUKN.d.ts} +1 -1
- package/dist/{client-BEJqhQAj.d.mts → client-CyXGrO4D.d.mts} +1 -1
- package/dist/{client-core-BPYuWfBC.d.ts → client-core-BWd0lX0Z.d.ts} +110 -4
- package/dist/{client-core-BqetRxx-.d.mts → client-core-BxsLnXlm.d.mts} +110 -4
- 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 +127 -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-J4OW5RNJ.js +0 -43
- package/dist/cli/chunk-NIPLY25A.mjs +0 -7
- package/dist/cli/concurrent-runs-help-3XZIHVRP.js +0 -21
- package/dist/cli/describe-4BI6E2CM.js +0 -50
- package/dist/cli/git-QRZP4DNA.js +0 -25
- package/dist/cli/search-CQ6JG2EN.js +0 -32
- package/dist/cli/sessions-LMPXUPUH.js +0 -22
- package/dist/cli/skills-M4CFE65Z.js +0 -36
- package/dist/cli/tools-CV7XA2V6.js +0 -57
- package/dist/cli/update-PUWBKPWJ.js +0 -34
|
@@ -217,7 +217,7 @@ export const EXPERIMENT_SWITCHES = {
|
|
|
217
217
|
RH: {
|
|
218
218
|
perRun: false,
|
|
219
219
|
summary:
|
|
220
|
-
"Run status route holds a watch snapshot with waitForTerminalMs until the run is terminal, bounded. E3
|
|
220
|
+
"Run status route holds a watch snapshot with waitForTerminalMs until the run is terminal, bounded. E3 needs it. The SDK asks for the hold (RUN_WATCH_SERVER_WAIT_MS) and keeps its own poll cadence unless the response carries `x-deepline-run-watch-hold: applied`. Also on, per organization, when the caller's `runtime-fast-launch` rollout grants it.",
|
|
221
221
|
constants: [
|
|
222
222
|
{
|
|
223
223
|
file: 'apps/deepline-api/src/app/api/v2/runs/[runId]/route.ts',
|
|
@@ -225,11 +225,12 @@ export const EXPERIMENT_SWITCHES = {
|
|
|
225
225
|
},
|
|
226
226
|
],
|
|
227
227
|
reason:
|
|
228
|
-
|
|
228
|
+
"read route: GET /api/v2/runs/{runId} does not read the launch, so it has no run-carried override. It is org-gated instead: the authenticated caller organization's cached `runtime-fast-launch` rollout decision turns it on.",
|
|
229
229
|
},
|
|
230
230
|
E3: {
|
|
231
231
|
perRun: false,
|
|
232
|
-
summary:
|
|
232
|
+
summary:
|
|
233
|
+
"Run watch reads the Postgres terminal first. Also on, per organization, inside an RH hold when the caller's `runtime-fast-launch` rollout grants it.",
|
|
233
234
|
constants: [
|
|
234
235
|
{
|
|
235
236
|
file: 'apps/deepline-api/src/app/api/v2/runs/[runId]/route.ts',
|
|
@@ -237,7 +238,7 @@ export const EXPERIMENT_SWITCHES = {
|
|
|
237
238
|
},
|
|
238
239
|
],
|
|
239
240
|
reason:
|
|
240
|
-
|
|
241
|
+
"read route: GET /api/v2/runs/{runId} does not read the launch, so it has no run-carried override. It is org-gated instead: the authenticated caller organization's cached `runtime-fast-launch` rollout decision turns it on.",
|
|
241
242
|
},
|
|
242
243
|
CAR: {
|
|
243
244
|
perRun: false,
|
|
@@ -277,40 +278,37 @@ export const EXPERIMENT_SWITCHES = {
|
|
|
277
278
|
'module-load time: shapes the checker program an instance builds once.',
|
|
278
279
|
},
|
|
279
280
|
C3: {
|
|
280
|
-
perRun:
|
|
281
|
-
summary:
|
|
281
|
+
perRun: true,
|
|
282
|
+
summary:
|
|
283
|
+
"Durable typecheck and source verdicts (admission): the run's source check reads and writes R2 verdicts keyed by checker fingerprint and full input (source verdicts per workspace). Responses are identical either way, but a timing A/B is confounded on a warm instance: an R2 hit seeds the process-wide typecheck result cache, and once an off run has built a program the typecheck skips R2. Measure C3 on cold instances.",
|
|
282
284
|
constants: [
|
|
283
285
|
{
|
|
284
286
|
file: 'apps/deepline-api/src/lib/plays/typecheck-verdict-store.ts',
|
|
285
287
|
name: 'DURABLE_TYPECHECK_VERDICTS',
|
|
286
288
|
},
|
|
287
289
|
],
|
|
288
|
-
reason:
|
|
289
|
-
"shared cache: one run's verdict writes would warm the other arm, so a per-run A/B is confounded.",
|
|
290
290
|
},
|
|
291
291
|
C4: {
|
|
292
|
-
perRun:
|
|
293
|
-
summary:
|
|
292
|
+
perRun: true,
|
|
293
|
+
summary:
|
|
294
|
+
'Launch credential check loaded without the checker (TS-free module; admission).',
|
|
294
295
|
constants: [
|
|
295
296
|
{
|
|
296
297
|
file: 'apps/deepline-api/src/lib/plays/launch-credential-check.ts',
|
|
297
298
|
name: 'LAUNCH_CREDENTIAL_CHECK_WITHOUT_CHECKER',
|
|
298
299
|
},
|
|
299
300
|
],
|
|
300
|
-
reason:
|
|
301
|
-
'module-load time: selects which credential-check module the instance loads and keeps.',
|
|
302
301
|
},
|
|
303
302
|
C5: {
|
|
304
|
-
perRun:
|
|
305
|
-
summary:
|
|
303
|
+
perRun: true,
|
|
304
|
+
summary:
|
|
305
|
+
'With C3, start the source-verdict read during route admission, after auth (run route). C5=1 without C3=1 is refused.',
|
|
306
306
|
constants: [
|
|
307
307
|
{
|
|
308
308
|
file: 'apps/deepline-api/src/lib/plays/play-source-verdicts.ts',
|
|
309
309
|
name: 'EARLY_SOURCE_VERDICT_READ',
|
|
310
310
|
},
|
|
311
311
|
],
|
|
312
|
-
reason:
|
|
313
|
-
'shared cache: reads the durable verdict cache that the other arm writes; also starts while auth runs, before the header is authorized.',
|
|
314
312
|
},
|
|
315
313
|
E4: {
|
|
316
314
|
perRun: false,
|
|
@@ -454,6 +452,12 @@ export function parseExperimentSwitchesHeader(
|
|
|
454
452
|
}
|
|
455
453
|
overrides[perRunId] = match[2] === '1';
|
|
456
454
|
}
|
|
455
|
+
// C5 reads the durable store C3 provides; alone it would do nothing.
|
|
456
|
+
if (overrides.C5 === true && overrides.C3 !== true) {
|
|
457
|
+
throw new ExperimentSwitchesHeaderError(
|
|
458
|
+
'Experiment switch "C5" needs "C3=1" in the same header (the early read uses the durable verdict store).',
|
|
459
|
+
);
|
|
460
|
+
}
|
|
457
461
|
return overrides;
|
|
458
462
|
}
|
|
459
463
|
|
|
@@ -288,7 +288,10 @@ import {
|
|
|
288
288
|
} from '../app-runtime-api';
|
|
289
289
|
import { RUNTIME_CAPACITY_POLICY } from '../runtime-capacity-policy';
|
|
290
290
|
import { RUNTIME_RELIABILITY_POLICY } from '../runtime-reliability-policy';
|
|
291
|
-
import {
|
|
291
|
+
import {
|
|
292
|
+
RUNNER_GATEWAY_CONNECTION_RETRY_BUDGET_MS,
|
|
293
|
+
RUNNER_GATEWAY_SCHEDULER_UNAVAILABLE_RETRY_BUDGET_MS,
|
|
294
|
+
} from '../runtime-constants';
|
|
292
295
|
|
|
293
296
|
const playRuntimeRequire = createRequire(`${process.cwd()}/package.json`);
|
|
294
297
|
const moduleRuntime = playRuntimeRequire('module') as {
|
|
@@ -587,6 +590,32 @@ function isRetryableRuntimeControlStatus(status: number): boolean {
|
|
|
587
590
|
);
|
|
588
591
|
}
|
|
589
592
|
|
|
593
|
+
/**
|
|
594
|
+
* The gateway's declared answer while its scheduler DB breaker is open or a
|
|
595
|
+
* scheduler DB call fails as unavailable. Only retry-safe (read) lookups wait
|
|
596
|
+
* it out, and the next attempt may land on a healthy gateway instance.
|
|
597
|
+
*/
|
|
598
|
+
function isRunnerGatewaySchedulerUnavailableResponse(
|
|
599
|
+
response: Response,
|
|
600
|
+
): boolean {
|
|
601
|
+
return (
|
|
602
|
+
response.status === 503 &&
|
|
603
|
+
response.headers.get('x-deepline-error-code') ===
|
|
604
|
+
'RUNTIME_SCHEDULER_UNAVAILABLE'
|
|
605
|
+
);
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
/** 100 ms, 250 ms, then 1 s growing by 1 s per attempt up to 8 s. */
|
|
609
|
+
function runnerRuntimeControlRetryDelayMs(retryAttempt: number): number {
|
|
610
|
+
return (
|
|
611
|
+
RUNNER_RUNTIME_CONTROL_RETRY_DELAYS_MS[retryAttempt - 1] ??
|
|
612
|
+
Math.min(
|
|
613
|
+
8_000,
|
|
614
|
+
1_000 * (retryAttempt - RUNNER_RUNTIME_CONTROL_RETRY_DELAYS_MS.length),
|
|
615
|
+
)
|
|
616
|
+
);
|
|
617
|
+
}
|
|
618
|
+
|
|
590
619
|
async function sleepRunnerRuntimeControlRetry(ms: number): Promise<void> {
|
|
591
620
|
await new Promise<void>((resolve) => setTimeout(resolve, ms));
|
|
592
621
|
}
|
|
@@ -758,14 +787,24 @@ export async function fetchRunnerRuntimeControl(input: {
|
|
|
758
787
|
respondedAttempts += 1;
|
|
759
788
|
if (
|
|
760
789
|
input.retrySafe &&
|
|
761
|
-
respondedAttempts < RUNNER_RUNTIME_CONTROL_MAX_ATTEMPTS &&
|
|
762
790
|
isRetryableRuntimeControlStatus(response.status)
|
|
763
791
|
) {
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
792
|
+
const delayMs = runnerRuntimeControlRetryDelayMs(respondedAttempts);
|
|
793
|
+
// A declared scheduler-breaker 503 outlasts three quick attempts, so it
|
|
794
|
+
// keeps retrying within its own wall-clock budget, then fails loudly.
|
|
795
|
+
const schedulerOutageRetryAllowed =
|
|
796
|
+
!input.init.signal?.aborted &&
|
|
797
|
+
isRunnerGatewaySchedulerUnavailableResponse(response) &&
|
|
798
|
+
Date.now() - startedAt + delayMs <=
|
|
799
|
+
RUNNER_GATEWAY_SCHEDULER_UNAVAILABLE_RETRY_BUDGET_MS;
|
|
800
|
+
if (
|
|
801
|
+
respondedAttempts < RUNNER_RUNTIME_CONTROL_MAX_ATTEMPTS ||
|
|
802
|
+
schedulerOutageRetryAllowed
|
|
803
|
+
) {
|
|
804
|
+
await response.text().catch(() => '');
|
|
805
|
+
await sleepImpl(delayMs);
|
|
806
|
+
continue;
|
|
807
|
+
}
|
|
769
808
|
}
|
|
770
809
|
// `fetch()` resolves once headers arrive. Leaving the body for callers
|
|
771
810
|
// means this attempt's timeout signal can fire during `response.json()`
|
|
@@ -797,13 +836,7 @@ export async function fetchRunnerRuntimeControl(input: {
|
|
|
797
836
|
const retryAttempt = responseReceived
|
|
798
837
|
? respondedAttempts
|
|
799
838
|
: noResponseAttempts;
|
|
800
|
-
const delayMs =
|
|
801
|
-
RUNNER_RUNTIME_CONTROL_RETRY_DELAYS_MS[retryAttempt - 1] ??
|
|
802
|
-
Math.min(
|
|
803
|
-
8_000,
|
|
804
|
-
1_000 *
|
|
805
|
-
(retryAttempt - RUNNER_RUNTIME_CONTROL_RETRY_DELAYS_MS.length),
|
|
806
|
-
);
|
|
839
|
+
const delayMs = runnerRuntimeControlRetryDelayMs(retryAttempt);
|
|
807
840
|
const outageRetryAllowed =
|
|
808
841
|
!responseReceived &&
|
|
809
842
|
(timeoutSignal.aborted || isRunnerGatewayNoResponseError(error)) &&
|
|
@@ -10929,15 +10929,27 @@ export function createRuntimeSheetDatasetPageReader(input: {
|
|
|
10929
10929
|
};
|
|
10930
10930
|
}
|
|
10931
10931
|
|
|
10932
|
+
export type RuntimeSheetDatasetRowKeysResult = {
|
|
10933
|
+
keys: string[];
|
|
10934
|
+
/** Present only for `terminalRowsAnyRun`, together with the echoed mode. */
|
|
10935
|
+
rows?: Array<{
|
|
10936
|
+
key: string;
|
|
10937
|
+
data: Record<string, unknown>;
|
|
10938
|
+
inputIndex?: number;
|
|
10939
|
+
ownedByOtherRun: boolean;
|
|
10940
|
+
}>;
|
|
10941
|
+
rowMode?: 'terminalRowsAnyRun';
|
|
10942
|
+
};
|
|
10943
|
+
|
|
10932
10944
|
export async function readRuntimeSheetDatasetRowKeys(
|
|
10933
10945
|
context: RuntimeApiContext & { playName: string },
|
|
10934
10946
|
input: {
|
|
10935
10947
|
tableNamespace: string;
|
|
10936
10948
|
runId: string;
|
|
10937
10949
|
keys: string[];
|
|
10938
|
-
rowMode?: 'output' | 'all' | 'terminalAnyRun';
|
|
10950
|
+
rowMode?: 'output' | 'all' | 'terminalAnyRun' | 'terminalRowsAnyRun';
|
|
10939
10951
|
},
|
|
10940
|
-
): Promise<
|
|
10952
|
+
): Promise<RuntimeSheetDatasetRowKeysResult> {
|
|
10941
10953
|
if (context.dbSessionStrategy === 'gateway_only') {
|
|
10942
10954
|
return await postRuntimeApi(context, {
|
|
10943
10955
|
action: 'runtime_sheet_read_row_keys',
|
|
@@ -10950,7 +10962,9 @@ export async function readRuntimeSheetDatasetRowKeys(
|
|
|
10950
10962
|
),
|
|
10951
10963
|
];
|
|
10952
10964
|
if (keys.length === 0) {
|
|
10953
|
-
return
|
|
10965
|
+
return input.rowMode === 'terminalRowsAnyRun'
|
|
10966
|
+
? { keys: [], rows: [], rowMode: 'terminalRowsAnyRun' }
|
|
10967
|
+
: { keys: [] };
|
|
10954
10968
|
}
|
|
10955
10969
|
const session = requireRuntimePostgresSession(
|
|
10956
10970
|
await getRuntimeDbSession(
|
|
@@ -10967,6 +10981,37 @@ export async function readRuntimeSheetDatasetRowKeys(
|
|
|
10967
10981
|
},
|
|
10968
10982
|
),
|
|
10969
10983
|
);
|
|
10984
|
+
if (input.rowMode === 'terminalRowsAnyRun') {
|
|
10985
|
+
// Finished rows for the requested keys, whichever run owns them now. A
|
|
10986
|
+
// later run's admission or write moves a row to itself, so run-scoped
|
|
10987
|
+
// reads omit it; finalization uses these rows to return what the earlier
|
|
10988
|
+
// run committed. Pending or running rows are absent: an unfinished
|
|
10989
|
+
// takeover is not a result. The response echoes the mode because an older
|
|
10990
|
+
// reader answers an unknown mode as an `output` read of the caller's keys.
|
|
10991
|
+
const terminalRows = await withRuntimePostgres(session, async (client) => {
|
|
10992
|
+
const { rows: matchedRows } = await client.query<Record<string, unknown>>(
|
|
10993
|
+
`SELECT *
|
|
10994
|
+
FROM ${sheetTable(session)}
|
|
10995
|
+
WHERE _key = ANY($1::text[])
|
|
10996
|
+
AND _status IN ('enriched', 'failed')`,
|
|
10997
|
+
[keys],
|
|
10998
|
+
);
|
|
10999
|
+
return matchedRows;
|
|
11000
|
+
});
|
|
11001
|
+
return {
|
|
11002
|
+
keys: terminalRows.map((raw) => String(raw._key)),
|
|
11003
|
+
rows: terminalRows.map((raw) => {
|
|
11004
|
+
const { data, inputIndex } = mapRuntimePostgresRow({ raw });
|
|
11005
|
+
return {
|
|
11006
|
+
key: String(raw._key),
|
|
11007
|
+
data,
|
|
11008
|
+
...(typeof inputIndex === 'number' ? { inputIndex } : {}),
|
|
11009
|
+
ownedByOtherRun: raw._run_id !== input.runId,
|
|
11010
|
+
};
|
|
11011
|
+
}),
|
|
11012
|
+
rowMode: 'terminalRowsAnyRun',
|
|
11013
|
+
};
|
|
11014
|
+
}
|
|
10970
11015
|
const rows = await withRuntimePostgres(session, async (client) => {
|
|
10971
11016
|
if (input.rowMode === 'terminalAnyRun') {
|
|
10972
11017
|
const { rows: matchedRows } = await client.query<{ _key: string }>(
|
|
@@ -33,6 +33,15 @@ export const SANDBOX_NETWORK_CUT_MAX_MS = 11 * 60_000;
|
|
|
33
33
|
export const RUNNER_GATEWAY_CONNECTION_RETRY_BUDGET_MS =
|
|
34
34
|
SANDBOX_NETWORK_CUT_MAX_MS + 60_000;
|
|
35
35
|
|
|
36
|
+
/**
|
|
37
|
+
* How long the runner keeps retrying a retry-safe runtime-control lookup that
|
|
38
|
+
* the gateway answers with 503 `RUNTIME_SCHEDULER_UNAVAILABLE` (its scheduler
|
|
39
|
+
* DB breaker is open). On 2026-11-19 one gateway instance held its breaker open
|
|
40
|
+
* for about 55 seconds; three attempts 350 ms apart turned that into terminal
|
|
41
|
+
* runs. This outlasts such an episode several times over, then fails loudly.
|
|
42
|
+
*/
|
|
43
|
+
export const RUNNER_GATEWAY_SCHEDULER_UNAVAILABLE_RETRY_BUDGET_MS = 3 * 60_000;
|
|
44
|
+
|
|
36
45
|
/**
|
|
37
46
|
* Runner timeout includes setup, cleanup, and billing headroom after the
|
|
38
47
|
* user-code runtime cap.
|
package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts
CHANGED
|
@@ -186,6 +186,9 @@ import {
|
|
|
186
186
|
completePostgresSchedulerComputeBillingSessionBootstrap,
|
|
187
187
|
claimPostgresSchedulerWaitingDetachedAttemptForTerminal,
|
|
188
188
|
deferPostgresSchedulerAttemptForCapacity,
|
|
189
|
+
gatePostgresSchedulerSandboxCapacity,
|
|
190
|
+
sandboxCapacityWaitFallbackSeconds,
|
|
191
|
+
sandboxCapacityWakeEventName,
|
|
189
192
|
deferPostgresSchedulerAttemptForExecutorTokenOutage,
|
|
190
193
|
detachedRunnerCeilingDeadlineMsFromSuspension,
|
|
191
194
|
enqueuePostgresSchedulerSandboxCleanupForAttempt,
|
|
@@ -367,7 +370,10 @@ import {
|
|
|
367
370
|
import { DIRECT_COMPLETED_TERMINAL_CONTRACT } from './terminal-contract';
|
|
368
371
|
import { runnerReadiness } from './runner-push';
|
|
369
372
|
import { runtimeApiBaseUrlFromLaunch } from './runtime-api-origin';
|
|
370
|
-
import {
|
|
373
|
+
import {
|
|
374
|
+
resolvePlayLaunchQueuePolicy,
|
|
375
|
+
shouldTerminalizeSandboxCapacityRejection,
|
|
376
|
+
} from '../launch-source-policy';
|
|
371
377
|
import {
|
|
372
378
|
ABSURD_CANCELLED_DEADLINE_RECONCILE_LIMIT,
|
|
373
379
|
reconcileAbsurdRuntimeCancellations,
|
|
@@ -377,6 +383,7 @@ import {
|
|
|
377
383
|
abandonRuntimeSandboxOperationReservation,
|
|
378
384
|
bindRuntimeSandboxCapacityLease,
|
|
379
385
|
createRuntimeSandboxOperationReservation,
|
|
386
|
+
DEFAULT_PLAY_SANDBOX_CONCURRENCY,
|
|
380
387
|
precheckRuntimeSandboxCapacity,
|
|
381
388
|
readReservedDaytonaCancellationOperation,
|
|
382
389
|
recordDaytonaSandboxCleanupIntent,
|
|
@@ -778,6 +785,15 @@ function isTransientHeartbeatTimeout(error: unknown): boolean {
|
|
|
778
785
|
);
|
|
779
786
|
}
|
|
780
787
|
|
|
788
|
+
function runIdSpreadSeconds(runId: string, spreadSeconds: number): number {
|
|
789
|
+
let hash = 2166136261;
|
|
790
|
+
for (let index = 0; index < runId.length; index += 1) {
|
|
791
|
+
hash ^= runId.charCodeAt(index);
|
|
792
|
+
hash = Math.imul(hash, 16777619);
|
|
793
|
+
}
|
|
794
|
+
return Math.abs(hash) % Math.max(1, Math.floor(spreadSeconds));
|
|
795
|
+
}
|
|
796
|
+
|
|
781
797
|
/**
|
|
782
798
|
* A workspace sandbox-capacity refusal, whether it arrives as the typed class,
|
|
783
799
|
* by name across the provider-backend boundary, or as a generic scheduler
|
|
@@ -825,12 +841,7 @@ export function capacityDeferralSeconds(
|
|
|
825
841
|
Math.ceil(runtimeSchedulerCapacityRetryAfterMs(error) / 1_000),
|
|
826
842
|
);
|
|
827
843
|
// Keep a saturated fleet from waking every parked run in the same second.
|
|
828
|
-
|
|
829
|
-
for (let index = 0; index < runId.length; index += 1) {
|
|
830
|
-
hash ^= runId.charCodeAt(index);
|
|
831
|
-
hash = Math.imul(hash, 16777619);
|
|
832
|
-
}
|
|
833
|
-
return baseSeconds + (Math.abs(hash) % 3);
|
|
844
|
+
return baseSeconds + runIdSpreadSeconds(runId, 3);
|
|
834
845
|
}
|
|
835
846
|
|
|
836
847
|
export async function runWithAbsurdExecutionLeaseHeartbeat<T>(input: {
|
|
@@ -3388,6 +3399,8 @@ async function prepareAbsurdAttempt(input: {
|
|
|
3388
3399
|
options: Pick<PostgresSchedulerOptions, 'schema'>;
|
|
3389
3400
|
runId: string;
|
|
3390
3401
|
queueName: string;
|
|
3402
|
+
/** This task's wait on that sandbox-capacity `seq` timed out. */
|
|
3403
|
+
retireSandboxCapacityWaitSeq?: number;
|
|
3391
3404
|
}) {
|
|
3392
3405
|
return input.deps.runWithClient(
|
|
3393
3406
|
async (client) => {
|
|
@@ -3581,6 +3594,77 @@ async function prepareAbsurdAttempt(input: {
|
|
|
3581
3594
|
);
|
|
3582
3595
|
}
|
|
3583
3596
|
|
|
3597
|
+
if (shouldGateSandboxCapacityBeforeClaim(launch, laneState.status)) {
|
|
3598
|
+
// Like the projection gate above, this runs before an attempt exists:
|
|
3599
|
+
// a full org parks the task on a wake event instead of allocating an
|
|
3600
|
+
// attempt that the in-attempt reservation would refuse.
|
|
3601
|
+
let gate: Awaited<
|
|
3602
|
+
ReturnType<typeof gatePostgresSchedulerSandboxCapacity>
|
|
3603
|
+
> | null = null;
|
|
3604
|
+
try {
|
|
3605
|
+
gate = await gatePostgresSchedulerSandboxCapacity(
|
|
3606
|
+
client,
|
|
3607
|
+
{
|
|
3608
|
+
runId: input.runId,
|
|
3609
|
+
orgId: launch.orgId,
|
|
3610
|
+
entitlementLimit: launch.concurrentRunsLimit ?? null,
|
|
3611
|
+
defaultLimit: DEFAULT_PLAY_SANDBOX_CONCURRENCY,
|
|
3612
|
+
queueName: input.queueName,
|
|
3613
|
+
nowMs: Date.now(),
|
|
3614
|
+
...(input.retireSandboxCapacityWaitSeq !== undefined
|
|
3615
|
+
? { retireSeq: input.retireSandboxCapacityWaitSeq }
|
|
3616
|
+
: {}),
|
|
3617
|
+
},
|
|
3618
|
+
input.options,
|
|
3619
|
+
);
|
|
3620
|
+
} catch (error) {
|
|
3621
|
+
if (isRetryableAttemptPreparationError(error)) throw error;
|
|
3622
|
+
// The gate is advisory. A defect in it must not spend engine
|
|
3623
|
+
// attempts or settle the run; the in-attempt reservation still
|
|
3624
|
+
// enforces the cap.
|
|
3625
|
+
console.error('[runtime.scheduler.sandbox_capacity_gate_failed]', {
|
|
3626
|
+
runId: input.runId,
|
|
3627
|
+
orgId: launch.orgId,
|
|
3628
|
+
error: error instanceof Error ? error.message : String(error),
|
|
3629
|
+
});
|
|
3630
|
+
}
|
|
3631
|
+
if (gate?.kind === 'waiting') {
|
|
3632
|
+
// A burst that started waiting together re-checks spread out.
|
|
3633
|
+
const fallbackSeconds = sandboxCapacityWaitFallbackSeconds(
|
|
3634
|
+
Date.now() - gate.sinceMs,
|
|
3635
|
+
);
|
|
3636
|
+
const delaySeconds =
|
|
3637
|
+
fallbackSeconds +
|
|
3638
|
+
runIdSpreadSeconds(input.runId, fallbackSeconds / 10);
|
|
3639
|
+
console.info('[runtime.scheduler.sandbox_capacity_wait]', {
|
|
3640
|
+
runId: input.runId,
|
|
3641
|
+
orgId: launch.orgId,
|
|
3642
|
+
limit: gate.limit,
|
|
3643
|
+
activeLeases: gate.activeLeases,
|
|
3644
|
+
ahead: gate.ahead,
|
|
3645
|
+
seq: gate.seq,
|
|
3646
|
+
waitedMs: Date.now() - gate.sinceMs,
|
|
3647
|
+
fallbackSeconds: delaySeconds,
|
|
3648
|
+
attemptAllocated: false,
|
|
3649
|
+
});
|
|
3650
|
+
return {
|
|
3651
|
+
kind: 'sandbox_capacity_wait' as const,
|
|
3652
|
+
launch,
|
|
3653
|
+
seq: gate.seq,
|
|
3654
|
+
delaySeconds,
|
|
3655
|
+
};
|
|
3656
|
+
}
|
|
3657
|
+
if (gate?.kind === 'admitted' && gate.waitedMs !== null) {
|
|
3658
|
+
console.info('[runtime.scheduler.sandbox_capacity_admitted]', {
|
|
3659
|
+
runId: input.runId,
|
|
3660
|
+
orgId: launch.orgId,
|
|
3661
|
+
limit: gate.limit,
|
|
3662
|
+
activeLeases: gate.activeLeases,
|
|
3663
|
+
waitedMs: gate.waitedMs,
|
|
3664
|
+
});
|
|
3665
|
+
}
|
|
3666
|
+
}
|
|
3667
|
+
|
|
3584
3668
|
const generation = preparation.nextAttempt;
|
|
3585
3669
|
const leaseToken = randomUUID();
|
|
3586
3670
|
const initialRuntimeResource = isManagedSandboxRuntimeBackend(
|
|
@@ -3618,6 +3702,29 @@ async function prepareAbsurdAttempt(input: {
|
|
|
3618
3702
|
);
|
|
3619
3703
|
}
|
|
3620
3704
|
|
|
3705
|
+
/**
|
|
3706
|
+
* Whether a fresh attempt for this run should first pass the pre-claim
|
|
3707
|
+
* sandbox-capacity gate. Only a queued run on a managed sandbox backend under
|
|
3708
|
+
* enforced capacity takes it. A trigger with a finite capacity wait keeps the
|
|
3709
|
+
* in-attempt rejection that terminalizes it.
|
|
3710
|
+
*/
|
|
3711
|
+
export function shouldGateSandboxCapacityBeforeClaim(
|
|
3712
|
+
launch: Pick<
|
|
3713
|
+
PlaySchedulerSubmitInput,
|
|
3714
|
+
'orgId' | 'runtimeBackend' | 'triggerSource'
|
|
3715
|
+
>,
|
|
3716
|
+
runStatus: string | null | undefined,
|
|
3717
|
+
): boolean {
|
|
3718
|
+
return (
|
|
3719
|
+
runStatus === 'queued' &&
|
|
3720
|
+
Boolean(launch.orgId?.trim()) &&
|
|
3721
|
+
isManagedSandboxRuntimeBackend(launch.runtimeBackend) &&
|
|
3722
|
+
runtimeSandboxCapacityAdmissionMode() === 'enforce' &&
|
|
3723
|
+
resolvePlayLaunchQueuePolicy(launch.triggerSource)
|
|
3724
|
+
.sandboxCapacityMaxWaitSeconds === null
|
|
3725
|
+
);
|
|
3726
|
+
}
|
|
3727
|
+
|
|
3621
3728
|
function isRetryableAttemptPreparationError(error: unknown): boolean {
|
|
3622
3729
|
return (
|
|
3623
3730
|
isConnectionCategoryError(error) ||
|
|
@@ -3641,6 +3748,7 @@ async function prepareAbsurdAttemptForTask(input: {
|
|
|
3641
3748
|
options: Pick<PostgresSchedulerOptions, 'schema'>;
|
|
3642
3749
|
runId: string;
|
|
3643
3750
|
queueName: string;
|
|
3751
|
+
retireSandboxCapacityWaitSeq?: number;
|
|
3644
3752
|
}) {
|
|
3645
3753
|
try {
|
|
3646
3754
|
return await prepareAbsurdAttempt(input);
|
|
@@ -3767,6 +3875,62 @@ async function executeAbsurdAttemptAdapter(
|
|
|
3767
3875
|
throw error;
|
|
3768
3876
|
}
|
|
3769
3877
|
}
|
|
3878
|
+
// The org's sandbox slots are full. No attempt exists and none is
|
|
3879
|
+
// allocated: park on this wait's own event, which a lease release (or an
|
|
3880
|
+
// admitted waiter seeing spare slots) emits, with a long fallback timer.
|
|
3881
|
+
const awaitedSandboxCapacityWaits = new Set<number>();
|
|
3882
|
+
while (prepared.kind === 'sandbox_capacity_wait') {
|
|
3883
|
+
const { seq, delaySeconds } = prepared;
|
|
3884
|
+
if (seq === null || awaitedSandboxCapacityWaits.has(seq)) {
|
|
3885
|
+
// A raced wait start, or a wake that did not advance the wait. Neither
|
|
3886
|
+
// can suspend on a fresh event, so retry through the engine's timer.
|
|
3887
|
+
throw new DeferTask(
|
|
3888
|
+
`Run ${runId} is waiting for a sandbox slot in its workspace.`,
|
|
3889
|
+
seq === null ? 5 : delaySeconds,
|
|
3890
|
+
);
|
|
3891
|
+
}
|
|
3892
|
+
awaitedSandboxCapacityWaits.add(seq);
|
|
3893
|
+
let retireSandboxCapacityWaitSeq: number | undefined;
|
|
3894
|
+
try {
|
|
3895
|
+
await ctx.awaitEvent(sandboxCapacityWakeEventName(runId, seq), {
|
|
3896
|
+
stepName: `sandbox-capacity-wait:${seq}`,
|
|
3897
|
+
timeout: delaySeconds,
|
|
3898
|
+
});
|
|
3899
|
+
} catch (error) {
|
|
3900
|
+
// Absurd's own timeout first: the retryable check below also matches
|
|
3901
|
+
// any error named TimeoutError.
|
|
3902
|
+
if (error instanceof TimeoutError) {
|
|
3903
|
+
retireSandboxCapacityWaitSeq = seq;
|
|
3904
|
+
} else if (isRetryableAttemptPreparationError(error)) {
|
|
3905
|
+
// No attempt exists yet: a database blip must not spend an engine
|
|
3906
|
+
// attempt (the last one settles the run).
|
|
3907
|
+
throw new DeferTask(
|
|
3908
|
+
`Run ${runId} sandbox-capacity wait deferred: ${error instanceof Error ? error.message : String(error)}`,
|
|
3909
|
+
30,
|
|
3910
|
+
);
|
|
3911
|
+
} else {
|
|
3912
|
+
throw error;
|
|
3913
|
+
}
|
|
3914
|
+
}
|
|
3915
|
+
prepared = await prepareAbsurdAttemptForTask({
|
|
3916
|
+
ctx,
|
|
3917
|
+
deps,
|
|
3918
|
+
options,
|
|
3919
|
+
runId,
|
|
3920
|
+
queueName,
|
|
3921
|
+
...(retireSandboxCapacityWaitSeq !== undefined
|
|
3922
|
+
? { retireSandboxCapacityWaitSeq }
|
|
3923
|
+
: {}),
|
|
3924
|
+
});
|
|
3925
|
+
}
|
|
3926
|
+
if (prepared.kind === 'created_projection_pending') {
|
|
3927
|
+
// Preparation checks the projection before capacity, so this is a
|
|
3928
|
+
// projection lost after it was delivered; retry through the engine.
|
|
3929
|
+
throw new DeferTask(
|
|
3930
|
+
`Run ${runId} lost its run-created projection while waiting for a sandbox slot.`,
|
|
3931
|
+
prepared.delaySeconds,
|
|
3932
|
+
);
|
|
3933
|
+
}
|
|
3770
3934
|
if (prepared.kind === 'missing') {
|
|
3771
3935
|
throw new Error(
|
|
3772
3936
|
`absurd runtime worker: no launch row for run ${runId} (schema=${
|
|
@@ -3872,10 +4036,7 @@ async function executeAbsurdAttemptAdapter(
|
|
|
3872
4036
|
// only spares a doomed attempt that work, and throws the same capacity
|
|
3873
4037
|
// error, so deferral and terminalization are unchanged. A failed read
|
|
3874
4038
|
// falls through to the ordinary path.
|
|
3875
|
-
if (
|
|
3876
|
-
isManagedSandboxRuntimeBackend(launch.runtimeBackend) &&
|
|
3877
|
-
launch.orgId
|
|
3878
|
-
) {
|
|
4039
|
+
if (isManagedSandboxRuntimeBackend(launch.runtimeBackend) && launch.orgId) {
|
|
3879
4040
|
const capacityMode = runtimeSandboxCapacityAdmissionMode();
|
|
3880
4041
|
let precheck: Awaited<
|
|
3881
4042
|
ReturnType<typeof precheckRuntimeSandboxCapacity>
|
|
@@ -3897,11 +4058,14 @@ async function executeAbsurdAttemptAdapter(
|
|
|
3897
4058
|
{ runId, phase: 'sandbox_capacity_precheck' },
|
|
3898
4059
|
);
|
|
3899
4060
|
} catch (error) {
|
|
3900
|
-
console.warn(
|
|
3901
|
-
|
|
3902
|
-
|
|
3903
|
-
|
|
3904
|
-
|
|
4061
|
+
console.warn(
|
|
4062
|
+
'[absurd-runtime.worker] sandbox_capacity_precheck_failed',
|
|
4063
|
+
{
|
|
4064
|
+
runId,
|
|
4065
|
+
attempt: generation,
|
|
4066
|
+
error: error instanceof Error ? error.message : String(error),
|
|
4067
|
+
},
|
|
4068
|
+
);
|
|
3905
4069
|
}
|
|
3906
4070
|
}
|
|
3907
4071
|
if (precheck?.full) {
|
|
@@ -4203,6 +4367,13 @@ async function executeAbsurdAttemptAdapter(
|
|
|
4203
4367
|
sandboxCapacity: {
|
|
4204
4368
|
limit: error.limit,
|
|
4205
4369
|
nowMs: Date.now(),
|
|
4370
|
+
// The next execution parks at the pre-claim gate.
|
|
4371
|
+
...(shouldGateSandboxCapacityBeforeClaim(
|
|
4372
|
+
executionLaunch,
|
|
4373
|
+
'queued',
|
|
4374
|
+
)
|
|
4375
|
+
? { waitQueueName: queueName }
|
|
4376
|
+
: {}),
|
|
4206
4377
|
},
|
|
4207
4378
|
}
|
|
4208
4379
|
: {}),
|