deepline 0.3.526 → 0.3.528
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 +1 -1
- package/dist/bundling-sources/shared_libs/play-runtime/context.ts +141 -211
- package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +5 -0
- package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-machines.ts +66 -1
- package/dist/bundling-sources/shared_libs/play-runtime/freshness-receipt-execution.ts +135 -161
- package/dist/bundling-sources/shared_libs/play-runtime/play-run-recovery-policy.ts +56 -1
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/contracts.ts +11 -1
- package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/job.ts +36 -6
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +59 -8
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-start-admission.ts +12 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +1 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/types.ts +16 -0
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-capacity-policy.ts +25 -5
- package/dist/bundling-sources/shared_libs/play-runtime/runtime-telemetry.ts +6 -0
- package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/runner-backend-adapter.ts +6 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-claim-loop-timing.ts +145 -0
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-pool.ts +48 -5
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +316 -71
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-shared.ts +13 -5
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/play-run-recovery.ts +30 -1
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +105 -13
- package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-capacity.ts +12 -0
- package/dist/bundling-sources/shared_libs/play-runtime/tool-call/result-receipt-policy.ts +10 -1
- package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +50 -8
- package/dist/cli/auth-CWJZYLTB.js +43 -0
- package/dist/cli/{auth-JATW5XZE.mjs → auth-PPOTNK4T.mjs} +5 -5
- package/dist/cli/{billing-TSHBJIJS.js → billing-3C7T7CUQ.js} +79 -79
- package/dist/cli/{billing-UT5LIESH.mjs → billing-OEZUQ2K6.mjs} +6 -6
- package/dist/cli/{chunk-UWCEBS7F.js → chunk-237PKFIQ.js} +14 -14
- package/dist/cli/{chunk-TBQC2XS3.js → chunk-36UD7H7Y.js} +41 -41
- package/dist/cli/{chunk-26ULNPQ7.mjs → chunk-42ZSDTOC.mjs} +2 -2
- package/dist/cli/{chunk-O7WUATQC.js → chunk-4SBUXDKZ.js} +13 -13
- package/dist/cli/{chunk-SCLRGDF4.js → chunk-5MJ4CDAQ.js} +44 -44
- package/dist/cli/{chunk-BFH3DJYV.mjs → chunk-6OLQWQU5.mjs} +3 -3
- package/dist/cli/{chunk-UTCGCES2.js → chunk-7WZXUAQW.js} +7 -7
- package/dist/cli/{chunk-CYN2AHR6.js → chunk-7X3NLHI7.js} +6 -6
- package/dist/cli/{chunk-D5OEUPPM.js → chunk-ADZGTMLU.js} +98 -98
- package/dist/cli/{chunk-6COGHW7B.mjs → chunk-AFIAVG5T.mjs} +2 -2
- package/dist/cli/{chunk-BYEF4RBX.js → chunk-B3HQF2CA.js} +11 -11
- package/dist/cli/{chunk-DY2AT3JQ.mjs → chunk-B6YWCGVC.mjs} +10 -10
- package/dist/cli/{chunk-BVITYMBK.mjs → chunk-CMTY6SVY.mjs} +2 -2
- package/dist/cli/{chunk-WOLY6SU4.mjs → chunk-DCVNL5XN.mjs} +1 -1
- package/dist/cli/{chunk-6JMWATX5.mjs → chunk-FPHAUP55.mjs} +5 -5
- package/dist/cli/{chunk-7COEN3IR.js → chunk-FXYWEKUK.js} +4 -4
- package/dist/cli/{chunk-J5OXJ4JI.js → chunk-G7RTPKRJ.js} +2 -2
- package/dist/cli/{chunk-RZJWHL7L.js → chunk-GCBFSFLA.js} +5 -5
- package/dist/cli/{chunk-C3EW6I65.mjs → chunk-GFGFAAY2.mjs} +1 -1
- package/dist/cli/{chunk-XVIMOB2U.mjs → chunk-GP7E4TE4.mjs} +2 -2
- package/dist/cli/{chunk-HPACLONQ.mjs → chunk-GSBKODMU.mjs} +2 -2
- package/dist/cli/{chunk-EEYZLTXX.mjs → chunk-HJVNCRXY.mjs} +1 -1
- package/dist/cli/{chunk-WITNIMLE.js → chunk-IJAEYEJM.js} +3 -3
- package/dist/cli/{chunk-YNFPZVII.mjs → chunk-IM5XQ4DG.mjs} +5 -5
- package/dist/cli/{chunk-46HEYGLY.js → chunk-IXEEXYE2.js} +9 -9
- package/dist/cli/{chunk-MQB25LMV.mjs → chunk-IYCRX34W.mjs} +5 -5
- package/dist/cli/{chunk-6H56LKJB.js → chunk-KHVCHFE3.js} +16 -16
- package/dist/cli/{chunk-TVHDWS5U.mjs → chunk-KLGYBOGZ.mjs} +1 -1
- package/dist/cli/{chunk-UUIC2JFZ.mjs → chunk-KWIKFR7Y.mjs} +1 -1
- package/dist/cli/{chunk-ED2N4NRI.js → chunk-LT4IEJ6V.js} +16 -16
- package/dist/cli/{chunk-WBY3R55B.js → chunk-LU4EA3ET.js} +2 -2
- package/dist/cli/{chunk-477PXM65.js → chunk-MLNH4DK2.js} +22 -22
- package/dist/cli/{chunk-77RAGJIZ.mjs → chunk-NCOTOGTK.mjs} +2 -2
- package/dist/cli/{chunk-IMP7WR22.mjs → chunk-NZM4KWWV.mjs} +5 -5
- package/dist/cli/{chunk-B33J4YCC.js → chunk-OEI7YUEF.js} +3 -3
- package/dist/cli/{chunk-3MYI3IXW.js → chunk-OGVUT2KM.js} +7 -7
- package/dist/cli/{chunk-SJ6KUCGM.js → chunk-OVZSNBDJ.js} +53 -53
- package/dist/cli/{chunk-D2XMFXFM.mjs → chunk-PS2UYVAE.mjs} +6 -6
- package/dist/cli/{chunk-3ZEV5BS5.js → chunk-R5ZQVQ3K.js} +26 -26
- package/dist/cli/{chunk-TCLJXJAG.mjs → chunk-RC5CG5SE.mjs} +4 -4
- package/dist/cli/{chunk-6DHEV6IA.js → chunk-RFTBMEWL.js} +2 -2
- package/dist/cli/{chunk-2GJW4RAQ.mjs → chunk-RML3VSTN.mjs} +1 -1
- package/dist/cli/{chunk-2JNX3MDG.mjs → chunk-SP2KZ7SH.mjs} +1 -1
- package/dist/cli/{chunk-IWLDJQGV.mjs → chunk-T4QPRL3P.mjs} +3 -3
- package/dist/cli/{chunk-Y47OCS5V.mjs → chunk-ULUI2FEM.mjs} +1 -1
- package/dist/cli/{chunk-FMPGWAIR.js → chunk-WXHBD6H7.js} +1 -1
- package/dist/cli/{chunk-CDP3LMDT.js → chunk-XD2DRBPH.js} +6 -6
- package/dist/cli/{chunk-TXJW6RIM.mjs → chunk-Z25KC5V2.mjs} +1 -1
- package/dist/cli/{chunk-U6OUX47C.mjs → chunk-Z44S7VWO.mjs} +2 -2
- package/dist/cli/{chunk-F5KFGF45.js → chunk-ZFD5FJCZ.js} +5 -5
- package/dist/cli/{csv-4BLFRED6.mjs → csv-K7TRWOFJ.mjs} +4 -4
- package/dist/cli/{csv-KSJB5Z3M.js → csv-OTRVTHD2.js} +13 -13
- package/dist/cli/{db-OVW6C3DV.mjs → db-C7GQU3TZ.mjs} +6 -6
- package/dist/cli/{db-G7Z5CKO2.js → db-UO2ZFLFN.js} +27 -27
- package/dist/cli/describe-IK4UYJ5M.js +50 -0
- package/dist/cli/{describe-OEFTD7WQ.mjs → describe-LG4CPTIV.mjs} +18 -18
- package/dist/cli/{executions-O7USCBCW.js → executions-LHFVPO7E.js} +8 -8
- package/dist/cli/{executions-7ZKQ4ZU3.mjs → executions-P3INNVZE.mjs} +6 -6
- package/dist/cli/{feedback-KUBL5E3I.mjs → feedback-H22FWG63.mjs} +6 -6
- package/dist/cli/{feedback-Y55WCRIQ.js → feedback-M3HZQAWX.js} +14 -14
- package/dist/cli/git-72ADWRUQ.js +25 -0
- package/dist/cli/{git-C6ZAU5JA.mjs → git-G2N7PVFI.mjs} +5 -5
- package/dist/cli/index.js +141 -141
- package/dist/cli/index.mjs +43 -43
- package/dist/cli/{legacy-noops-OVWX4KB3.js → legacy-noops-2RVROWBY.js} +9 -9
- package/dist/cli/{legacy-noops-MUXD4HRC.mjs → legacy-noops-LDYSWTL2.mjs} +6 -6
- package/dist/cli/{monitors-2ZSGBY52.mjs → monitors-IYT3VON7.mjs} +7 -7
- package/dist/cli/{monitors-3QVYGYWA.js → monitors-U4RE6KN5.js} +100 -100
- package/dist/cli/{org-RDSPE5FB.mjs → org-R3JE22GS.mjs} +6 -6
- package/dist/cli/{org-S6Z3SDLI.js → org-SO52ZGRP.js} +86 -86
- package/dist/cli/{pages-K5DSMHLJ.mjs → pages-5RLT5YTF.mjs} +6 -6
- package/dist/cli/{pages-VUWF2OR7.js → pages-SWXJQJXH.js} +18 -18
- package/dist/cli/{play-PZLXOYEX.mjs → play-2ELYCSXZ.mjs} +18 -18
- package/dist/cli/{play-SQOJTUFC.js → play-J4UXOQOJ.js} +317 -317
- package/dist/cli/{providers-AMIGP3D4.mjs → providers-IXITXHTS.mjs} +6 -6
- package/dist/cli/{providers-FZBEPUOI.js → providers-VVUDGV2D.js} +9 -9
- package/dist/cli/{quickstart-HNOQKGOF.mjs → quickstart-HQCGDPPL.mjs} +4 -4
- package/dist/cli/{quickstart-QIHZDBGM.js → quickstart-XPH6MT47.js} +6 -6
- package/dist/cli/{run-JDW6BDNT.mjs → run-H2HQPWC4.mjs} +23 -23
- package/dist/cli/{run-IQGM3TO2.js → run-OR646AC6.js} +41 -41
- package/dist/cli/search-D27DZH2D.js +33 -0
- package/dist/cli/{search-DMVUKJ23.mjs → search-MBPI5SBW.mjs} +8 -8
- package/dist/cli/{search-output-5UAPUUHH.mjs → search-output-CYOMJNRV.mjs} +4 -4
- package/dist/cli/{search-output-UUW6UNHF.js → search-output-YGNSHBXX.js} +6 -6
- package/dist/cli/{secrets-U532KN24.js → secrets-HVZKNNLZ.js} +15 -15
- package/dist/cli/{secrets-46KSTPFN.mjs → secrets-NK2CN7WI.mjs} +6 -6
- package/dist/cli/sessions-MTISSOZ4.js +22 -0
- package/dist/cli/{sessions-RUNWYHYX.mjs → sessions-NY4G427U.mjs} +6 -6
- package/dist/cli/{settings-O2A37FFA.js → settings-PVJRDEN2.js} +86 -86
- package/dist/cli/{settings-56L3WHCY.mjs → settings-RC4FGYY2.mjs} +13 -13
- package/dist/cli/{setup-ETFSMSCH.js → setup-B7QB4YV2.js} +50 -50
- package/dist/cli/{setup-Q27X6JZY.mjs → setup-YT3XSY6X.mjs} +10 -10
- package/dist/cli/{skills-WFQRZL4D.mjs → skills-5ILFNAHR.mjs} +8 -8
- package/dist/cli/skills-BHF35NLX.js +37 -0
- package/dist/cli/{tools-EV6CKJOX.mjs → tools-7PAY32OZ.mjs} +17 -17
- package/dist/cli/tools-W5BZ37L6.js +57 -0
- package/dist/cli/update-M65CGK42.js +35 -0
- package/dist/cli/{update-KIPPFVCH.mjs → update-Z27QYB6O.mjs} +10 -10
- package/dist/cli/{views-LMJXWD4N.mjs → views-2IANF6KR.mjs} +6 -6
- package/dist/cli/{views-DNZ2HFTA.js → views-NP2SCMOV.js} +18 -18
- package/dist/cli/{workflow-ZUDTIOK6.js → workflow-2GNQL646.js} +17 -17
- package/dist/cli/{workflow-3XKUQ73U.mjs → workflow-CAMEZLLY.mjs} +7 -7
- package/dist/index.js +9 -9
- package/dist/index.mjs +6 -6
- package/dist/install-integrity.json +105 -104
- 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.js +5 -5
- package/dist/server.mjs +3 -3
- package/package.json +1 -1
- package/dist/cli/auth-L2POG3LL.js +0 -43
- package/dist/cli/describe-KMYR2JBC.js +0 -50
- package/dist/cli/git-NBVQ3VGW.js +0 -25
- package/dist/cli/search-BNWRL3YY.js +0 -33
- package/dist/cli/sessions-JZUONXH4.js +0 -22
- package/dist/cli/skills-IKDJ5JDN.js +0 -37
- package/dist/cli/tools-B735AA67.js +0 -57
- package/dist/cli/update-CNNURAM3.js +0 -35
|
@@ -9533,6 +9533,13 @@ export type PostgresSchedulerRecoveryDeferral = {
|
|
|
9533
9533
|
exhausted: boolean;
|
|
9534
9534
|
deferCount: number | null;
|
|
9535
9535
|
deadlineAtMs: number | null;
|
|
9536
|
+
/** The pacing request was honoured: uncounted, after its own delay. */
|
|
9537
|
+
paced?: true;
|
|
9538
|
+
/**
|
|
9539
|
+
* Paced only: the delay the run was requeued with, the requested pacing
|
|
9540
|
+
* delay or the backoff floor for how long the run has been paced, if longer.
|
|
9541
|
+
*/
|
|
9542
|
+
pacingDelayMs?: number;
|
|
9536
9543
|
};
|
|
9537
9544
|
|
|
9538
9545
|
/**
|
|
@@ -9959,7 +9966,8 @@ export async function resumePostgresSchedulerRun(
|
|
|
9959
9966
|
absurd_task_id = task_spawn.task_id,
|
|
9960
9967
|
recovery_json = coalesce(runs.recovery_json, '{}'::jsonb) - ARRAY[
|
|
9961
9968
|
'postCode', 'version', 'kind', 'dependency', 'reason', 'deferCount',
|
|
9962
|
-
'deadlineAtMs', 'nextRetryAtMs', 'updatedAtMs', 'exhaustedAtMs'
|
|
9969
|
+
'deadlineAtMs', 'nextRetryAtMs', 'updatedAtMs', 'exhaustedAtMs',
|
|
9970
|
+
'pacedSinceMs'
|
|
9963
9971
|
]::text[],
|
|
9964
9972
|
launch_json = runs.launch_json || jsonb_build_object(
|
|
9965
9973
|
'resumeEpoch', task_spawn.epoch,
|
|
@@ -10367,9 +10375,40 @@ export async function deferPostgresSchedulerAttemptForRecovery(
|
|
|
10367
10375
|
/** Must match the scheduler's actual DeferTask policy for observability. */
|
|
10368
10376
|
deferBaseMs?: number;
|
|
10369
10377
|
deferMaxMs?: number;
|
|
10378
|
+
/**
|
|
10379
|
+
* Compiled start pacing: requeue after exactly this delay. The defer count
|
|
10380
|
+
* is left as it is and the horizon is not started (an existing deadline is
|
|
10381
|
+
* kept), so contention for a bucket that keeps granting can never exhaust
|
|
10382
|
+
* the outage budget.
|
|
10383
|
+
*/
|
|
10384
|
+
pacingDelayMs?: number;
|
|
10385
|
+
/**
|
|
10386
|
+
* Required with pacingDelayMs. The first paced defer records
|
|
10387
|
+
* `pacedSinceMs`; once this long has passed since it, the defer is counted
|
|
10388
|
+
* on the outage ladder instead, so pacing alone cannot hold a run forever.
|
|
10389
|
+
*/
|
|
10390
|
+
pacingHorizonMs?: number;
|
|
10391
|
+
/**
|
|
10392
|
+
* Required with pacingDelayMs. A run paced for T since `pacedSinceMs` is
|
|
10393
|
+
* requeued after at least min(T / pacingBackoffDivisor,
|
|
10394
|
+
* pacingBackoffMaxMs), so a run that keeps losing the bucket backs off
|
|
10395
|
+
* instead of retrying every few seconds for the whole horizon.
|
|
10396
|
+
*/
|
|
10397
|
+
pacingBackoffDivisor?: number;
|
|
10398
|
+
pacingBackoffMaxMs?: number;
|
|
10370
10399
|
},
|
|
10371
10400
|
options?: Pick<PostgresSchedulerOptions, 'schema'>,
|
|
10372
10401
|
): Promise<PostgresSchedulerRecoveryDeferral> {
|
|
10402
|
+
if (
|
|
10403
|
+
input.pacingDelayMs !== undefined &&
|
|
10404
|
+
(input.pacingHorizonMs === undefined ||
|
|
10405
|
+
input.pacingBackoffDivisor === undefined ||
|
|
10406
|
+
input.pacingBackoffMaxMs === undefined)
|
|
10407
|
+
) {
|
|
10408
|
+
throw new Error(
|
|
10409
|
+
`Paced pre-code defer for ${input.runId}/${input.attempt} needs a pacing horizon and backoff.`,
|
|
10410
|
+
);
|
|
10411
|
+
}
|
|
10373
10412
|
const initialDeadlineAtMs = input.nowMs + input.horizonMs;
|
|
10374
10413
|
const noCodeWorkCounterDigest = createHash('sha256')
|
|
10375
10414
|
.update(`${input.runId}\u0000${input.attempt}\u0000pre-code`)
|
|
@@ -10401,6 +10440,8 @@ export async function deferPostgresSchedulerAttemptForRecovery(
|
|
|
10401
10440
|
work_counters_recorded: boolean;
|
|
10402
10441
|
defer_count: string | null;
|
|
10403
10442
|
deadline_at_ms: string | null;
|
|
10443
|
+
paced: boolean | null;
|
|
10444
|
+
paced_delay_ms: string | null;
|
|
10404
10445
|
}>(
|
|
10405
10446
|
`
|
|
10406
10447
|
WITH ${runtimeSandboxCustodyLocksSql('run.run_id = $1', options)}, candidate AS (
|
|
@@ -10415,13 +10456,38 @@ export async function deferPostgresSchedulerAttemptForRecovery(
|
|
|
10415
10456
|
AND attempts.lease_token = $3
|
|
10416
10457
|
AND attempts.status IN ('claimed', 'running', 'waiting')
|
|
10417
10458
|
AND runs.status IN ('queued', 'running', 'waiting')
|
|
10459
|
+
), pacing AS (
|
|
10460
|
+
-- A pacing request is honoured only within the pacing horizon of the
|
|
10461
|
+
-- run's first paced defer; past it, this defer is counted below.
|
|
10462
|
+
SELECT run_id,
|
|
10463
|
+
recovery_json,
|
|
10464
|
+
CASE WHEN $16::bigint IS NULL
|
|
10465
|
+
THEN (recovery_json ->> 'pacedSinceMs')::bigint
|
|
10466
|
+
ELSE coalesce((recovery_json ->> 'pacedSinceMs')::bigint, $7::bigint)
|
|
10467
|
+
END AS paced_since_ms,
|
|
10468
|
+
$16::bigint IS NOT NULL
|
|
10469
|
+
AND $7::bigint < coalesce(
|
|
10470
|
+
(recovery_json ->> 'pacedSinceMs')::bigint,
|
|
10471
|
+
$7::bigint
|
|
10472
|
+
) + $17::bigint AS paced
|
|
10473
|
+
FROM candidate
|
|
10418
10474
|
), computed AS (
|
|
10419
10475
|
SELECT run_id,
|
|
10420
|
-
|
|
10476
|
+
paced,
|
|
10477
|
+
paced_since_ms,
|
|
10478
|
+
coalesce((recovery_json ->> 'deferCount')::integer, 0)
|
|
10479
|
+
+ CASE WHEN paced THEN 0 ELSE 1 END
|
|
10421
10480
|
AS defer_count,
|
|
10422
|
-
coalesce(
|
|
10423
|
-
|
|
10424
|
-
|
|
10481
|
+
coalesce(
|
|
10482
|
+
(recovery_json ->> 'deadlineAtMs')::bigint,
|
|
10483
|
+
CASE WHEN NOT paced THEN $4::bigint END
|
|
10484
|
+
) AS deadline_at_ms,
|
|
10485
|
+
-- A run paced for T waits at least min(T / divisor, max).
|
|
10486
|
+
CASE WHEN paced THEN greatest(
|
|
10487
|
+
$16::bigint,
|
|
10488
|
+
least($19::bigint, ($7::bigint - paced_since_ms) / $18::bigint)
|
|
10489
|
+
) END AS paced_delay_ms
|
|
10490
|
+
FROM pacing
|
|
10425
10491
|
), open_circuit AS (
|
|
10426
10492
|
INSERT INTO ${tableName(POSTGRES_SCHEDULER_DEPENDENCY_CIRCUITS_TABLE, options)} AS circuit (
|
|
10427
10493
|
dependency, state, open_until_ms, probe_until_ms, probe_token, last_reason, updated_at
|
|
@@ -10452,7 +10518,7 @@ export async function deferPostgresSchedulerAttemptForRecovery(
|
|
|
10452
10518
|
AND attempts.attempt = $2
|
|
10453
10519
|
AND attempts.lease_token = $3
|
|
10454
10520
|
AND computed.defer_count <= $6
|
|
10455
|
-
AND $7::bigint < computed.deadline_at_ms
|
|
10521
|
+
AND (computed.paced OR $7::bigint < computed.deadline_at_ms)
|
|
10456
10522
|
RETURNING attempts.run_id
|
|
10457
10523
|
), requeued_run AS (
|
|
10458
10524
|
UPDATE ${tableName('runs', options)} AS runs
|
|
@@ -10467,14 +10533,22 @@ export async function deferPostgresSchedulerAttemptForRecovery(
|
|
|
10467
10533
|
'dependency', $8::text,
|
|
10468
10534
|
'reason', $9::text,
|
|
10469
10535
|
'deferCount', computed.defer_count,
|
|
10470
|
-
'deadlineAtMs', computed.deadline_at_ms,
|
|
10471
10536
|
'nextRetryAtMs',
|
|
10472
|
-
$7::bigint +
|
|
10473
|
-
|
|
10474
|
-
|
|
10475
|
-
|
|
10537
|
+
$7::bigint + CASE WHEN computed.paced THEN computed.paced_delay_ms ELSE
|
|
10538
|
+
least(
|
|
10539
|
+
$13::numeric,
|
|
10540
|
+
$12::numeric * power(2::numeric, computed.defer_count - 1)
|
|
10541
|
+
)::bigint
|
|
10542
|
+
END,
|
|
10476
10543
|
'updatedAtMs', $7::bigint
|
|
10477
|
-
)
|
|
10544
|
+
) || CASE
|
|
10545
|
+
-- A paced first defer has no horizon to record.
|
|
10546
|
+
WHEN computed.deadline_at_ms IS NULL THEN '{}'::jsonb
|
|
10547
|
+
ELSE jsonb_build_object('deadlineAtMs', computed.deadline_at_ms)
|
|
10548
|
+
END || CASE
|
|
10549
|
+
WHEN computed.paced_since_ms IS NULL THEN '{}'::jsonb
|
|
10550
|
+
ELSE jsonb_build_object('pacedSinceMs', computed.paced_since_ms)
|
|
10551
|
+
END,
|
|
10478
10552
|
updated_at = now()
|
|
10479
10553
|
FROM computed
|
|
10480
10554
|
JOIN deferred_attempt ON deferred_attempt.run_id = computed.run_id
|
|
@@ -10530,7 +10604,9 @@ export async function deferPostgresSchedulerAttemptForRecovery(
|
|
|
10530
10604
|
) AS work_counters_recorded,
|
|
10531
10605
|
EXISTS (SELECT 1 FROM open_circuit) AS circuit_opened,
|
|
10532
10606
|
(SELECT defer_count::text FROM computed LIMIT 1) AS defer_count,
|
|
10533
|
-
(SELECT deadline_at_ms::text FROM computed LIMIT 1) AS deadline_at_ms
|
|
10607
|
+
(SELECT deadline_at_ms::text FROM computed LIMIT 1) AS deadline_at_ms,
|
|
10608
|
+
(SELECT paced FROM computed LIMIT 1) AS paced,
|
|
10609
|
+
(SELECT paced_delay_ms::text FROM computed LIMIT 1) AS paced_delay_ms
|
|
10534
10610
|
`,
|
|
10535
10611
|
[
|
|
10536
10612
|
input.runId,
|
|
@@ -10552,6 +10628,10 @@ export async function deferPostgresSchedulerAttemptForRecovery(
|
|
|
10552
10628
|
input.deferMaxMs ?? 300_000,
|
|
10553
10629
|
noCodeWorkCounterEventId,
|
|
10554
10630
|
stableStringify({ events: [noCodeWorkCounterEvent] }),
|
|
10631
|
+
input.pacingDelayMs ?? null,
|
|
10632
|
+
input.pacingHorizonMs ?? null,
|
|
10633
|
+
input.pacingBackoffDivisor ?? null,
|
|
10634
|
+
input.pacingBackoffMaxMs ?? null,
|
|
10555
10635
|
],
|
|
10556
10636
|
);
|
|
10557
10637
|
const row = result.rows[0];
|
|
@@ -10570,11 +10650,23 @@ export async function deferPostgresSchedulerAttemptForRecovery(
|
|
|
10570
10650
|
}
|
|
10571
10651
|
const deferCount = row.defer_count ? Number(row.defer_count) : null;
|
|
10572
10652
|
const deadlineAtMs = row.deadline_at_ms ? Number(row.deadline_at_ms) : null;
|
|
10653
|
+
const pacingDelayMs =
|
|
10654
|
+
row.paced === true && row.paced_delay_ms !== null
|
|
10655
|
+
? Number(row.paced_delay_ms)
|
|
10656
|
+
: null;
|
|
10657
|
+
if (row.paced === true && !Number.isSafeInteger(pacingDelayMs)) {
|
|
10658
|
+
throw new Error(
|
|
10659
|
+
`Paced pre-code defer for ${input.runId}/${input.attempt} returned no requeue delay.`,
|
|
10660
|
+
);
|
|
10661
|
+
}
|
|
10573
10662
|
return {
|
|
10574
10663
|
deferred: row.deferred,
|
|
10575
10664
|
exhausted: !row.deferred,
|
|
10576
10665
|
deferCount: Number.isSafeInteger(deferCount) ? deferCount : null,
|
|
10577
10666
|
deadlineAtMs: Number.isSafeInteger(deadlineAtMs) ? deadlineAtMs : null,
|
|
10667
|
+
...(row.paced === true
|
|
10668
|
+
? { paced: true as const, pacingDelayMs: pacingDelayMs as number }
|
|
10669
|
+
: {}),
|
|
10578
10670
|
};
|
|
10579
10671
|
}
|
|
10580
10672
|
|
|
@@ -952,6 +952,11 @@ export async function abandonRuntimeSandboxOperationReservation(
|
|
|
952
952
|
attempt?: number;
|
|
953
953
|
/** A lookup 404 must not retire a terminal Run's unresolved creation. */
|
|
954
954
|
onlyWhileRunActive?: boolean;
|
|
955
|
+
/**
|
|
956
|
+
* Only once the Run is terminal: the caller has proven that any create
|
|
957
|
+
* this reservation sent has outlived every sandbox it could have made.
|
|
958
|
+
*/
|
|
959
|
+
onlyAfterRunTerminal?: boolean;
|
|
955
960
|
},
|
|
956
961
|
options?: Pick<PostgresSchedulerOptions, 'schema'>,
|
|
957
962
|
): Promise<boolean> {
|
|
@@ -986,6 +991,12 @@ export async function abandonRuntimeSandboxOperationReservation(
|
|
|
986
991
|
WHERE status IN ('queued', 'running', 'waiting')
|
|
987
992
|
)
|
|
988
993
|
)
|
|
994
|
+
AND (
|
|
995
|
+
NOT $6::boolean OR EXISTS (
|
|
996
|
+
SELECT 1 FROM custody_run
|
|
997
|
+
WHERE status IN ('completed', 'failed', 'cancelled')
|
|
998
|
+
)
|
|
999
|
+
)
|
|
989
1000
|
RETURNING operation.operation_key
|
|
990
1001
|
), released AS (
|
|
991
1002
|
UPDATE ${leases} AS lease
|
|
@@ -1003,6 +1014,7 @@ export async function abandonRuntimeSandboxOperationReservation(
|
|
|
1003
1014
|
runtimeSandboxOperationFromStates('abandon_reservation'),
|
|
1004
1015
|
input.attempt ?? null,
|
|
1005
1016
|
input.onlyWhileRunActive ?? false,
|
|
1017
|
+
input.onlyAfterRunTerminal ?? false,
|
|
1006
1018
|
],
|
|
1007
1019
|
);
|
|
1008
1020
|
return result.rows.length === 1;
|
|
@@ -19,6 +19,13 @@ export function resolveToolCallResultReceiptPolicy(input: {
|
|
|
19
19
|
force: boolean;
|
|
20
20
|
/** Historical local contexts may have no durable result store. */
|
|
21
21
|
canStoreResult?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* The logical call's occurrence index was reserved with its operation slot
|
|
24
|
+
* (#10027), so the forced result receipt is keyed in its own namespace.
|
|
25
|
+
* A receipt in the older namespace was numbered in tool-layer entry order,
|
|
26
|
+
* proves no occurrence, and is never reused for such a call.
|
|
27
|
+
*/
|
|
28
|
+
occurrenceBound?: boolean;
|
|
22
29
|
}): { resultReceiptKey: string; force: boolean } {
|
|
23
30
|
if (!input.resultReceiptKey.trim()) {
|
|
24
31
|
throw new Error('Tool Call result policy requires a result receipt key.');
|
|
@@ -39,7 +46,9 @@ export function resolveToolCallResultReceiptPolicy(input: {
|
|
|
39
46
|
orgId: input.orgId,
|
|
40
47
|
toolId: input.toolId,
|
|
41
48
|
receiptKey: input.resultReceiptKey,
|
|
42
|
-
invocationIdentity:
|
|
49
|
+
invocationIdentity: input.occurrenceBound
|
|
50
|
+
? `forced-result:reserved-v1:${input.runId}:${input.logicalCallId}`
|
|
51
|
+
: `forced-result:${input.runId}:${input.logicalCallId}`,
|
|
43
52
|
}),
|
|
44
53
|
force: false,
|
|
45
54
|
};
|
|
@@ -73,6 +73,22 @@ export const TOOL_EXECUTE_CONCURRENCY_BACKPRESSURE_MAX_ATTEMPTS = 65;
|
|
|
73
73
|
export const TOOL_EXECUTE_RUNTIME_SCHEDULER_CAPACITY_MAX_ATTEMPTS = 65;
|
|
74
74
|
/** Re-admission after a stale shared provider permit is safely replayable. */
|
|
75
75
|
export const TOOL_EXECUTE_PROVIDER_PACING_WAIT_MAX_ATTEMPTS = 65;
|
|
76
|
+
// Logical attempts advance only after a fully received retryable HTTP result.
|
|
77
|
+
// Gateway follower polls stay on the same attempt. The runtime gateway refuses
|
|
78
|
+
// a fenced attempt above this ceiling unless it claims the preceding provider
|
|
79
|
+
// 429, which bounds the wire value before fingerprints or history queries, so
|
|
80
|
+
// malformed executor traffic cannot turn one request into unbounded work.
|
|
81
|
+
export const EXECUTION_GATEWAY_MAX_LOGICAL_ATTEMPT = 32;
|
|
82
|
+
// Every fenced retry other than a shed or follower poll opens the next logical
|
|
83
|
+
// attempt. A Deepline refusal made before dispatch gets the attempts the other
|
|
84
|
+
// advancing reasons leave under the gateway ceiling: idempotency in progress,
|
|
85
|
+
// customer DB storage, and the edge, provider and replay-safe 5xx retries.
|
|
86
|
+
export const TOOL_EXECUTE_FENCED_PRE_DISPATCH_RATE_REFUSAL_MAX_ATTEMPTS =
|
|
87
|
+
EXECUTION_GATEWAY_MAX_LOGICAL_ATTEMPT -
|
|
88
|
+
(TOOL_EXECUTE_IDEMPOTENCY_IN_PROGRESS_MAX_ATTEMPTS - 1) -
|
|
89
|
+
(TOOL_EXECUTE_CUSTOMER_DB_STORAGE_UNAVAILABLE_MAX_ATTEMPTS - 1) -
|
|
90
|
+
3 * (TOOL_EXECUTE_TRANSIENT_HTTP_MAX_ATTEMPTS - 1) +
|
|
91
|
+
1;
|
|
76
92
|
export const TOOL_EXECUTE_TRANSPORT_MAX_ATTEMPTS = 3;
|
|
77
93
|
export const TOOL_EXECUTE_TRANSPORT_RETRY_DELAY_MS = 1_000;
|
|
78
94
|
// A sandbox lost new connections for about 97 seconds on 2026-10-30, and each
|
|
@@ -462,6 +478,12 @@ function isConcurrencyBackpressureResponse(input: {
|
|
|
462
478
|
);
|
|
463
479
|
}
|
|
464
480
|
|
|
481
|
+
/** Pacing limits a caller can wait out; a quota denial names when it ends instead. */
|
|
482
|
+
const PRE_DISPATCH_RATE_KINDS = new Set([
|
|
483
|
+
'requests_per_second',
|
|
484
|
+
'requests_per_minute',
|
|
485
|
+
]);
|
|
486
|
+
|
|
465
487
|
function isPreDispatchRateRefusalResponse(input: {
|
|
466
488
|
status: number;
|
|
467
489
|
bodyText: string;
|
|
@@ -474,13 +496,13 @@ function isPreDispatchRateRefusalResponse(input: {
|
|
|
474
496
|
body.failure_origin === 'deepline_rate_limit' &&
|
|
475
497
|
body.error_category === 'rate_limit' &&
|
|
476
498
|
body.provider_request_dispatched === false &&
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
499
|
+
typeof body.rate_limit_kind === 'string' &&
|
|
500
|
+
PRE_DISPATCH_RATE_KINDS.has(body.rate_limit_kind) &&
|
|
501
|
+
// Workspace tool admission precedes billing for both execute paths. Every
|
|
502
|
+
// other Deepline refusal releases a charge it opened, so a fenced call
|
|
503
|
+
// keeps replaying its recorded outcome.
|
|
504
|
+
(body.rate_limit_bucket_scope === 'customer_tool' ||
|
|
505
|
+
input.executionFenced !== true)
|
|
484
506
|
);
|
|
485
507
|
}
|
|
486
508
|
|
|
@@ -646,6 +668,8 @@ function decideToolExecuteHttpRetry(input: {
|
|
|
646
668
|
concurrencyBackpressure?: boolean;
|
|
647
669
|
runtimeSchedulerCapacity?: boolean;
|
|
648
670
|
providerPacingWait?: boolean;
|
|
671
|
+
/** A Deepline limiter refused before dispatch (`isPreDispatchRateRefusalResponse`). */
|
|
672
|
+
preDispatchRateRefusal?: boolean;
|
|
649
673
|
hardBillingFailure?: boolean;
|
|
650
674
|
hasRetryAfterHeader?: boolean;
|
|
651
675
|
transientHttpRetrySafe?: boolean;
|
|
@@ -669,6 +693,20 @@ function decideToolExecuteHttpRetry(input: {
|
|
|
669
693
|
reason: 'concurrency_backpressure',
|
|
670
694
|
};
|
|
671
695
|
}
|
|
696
|
+
// Waiting out a refusal that sent nothing is always safe, so a row waits as
|
|
697
|
+
// long as app pacing would let it rather than failing at eight attempts.
|
|
698
|
+
// A fenced retry opens a new gateway attempt, so it stays under the
|
|
699
|
+
// gateway's ceiling.
|
|
700
|
+
if (input.preDispatchRateRefusal) {
|
|
701
|
+
return {
|
|
702
|
+
retryable: true,
|
|
703
|
+
attemptCap:
|
|
704
|
+
input.executionFenced === true
|
|
705
|
+
? TOOL_EXECUTE_FENCED_PRE_DISPATCH_RATE_REFUSAL_MAX_ATTEMPTS
|
|
706
|
+
: TOOL_EXECUTE_PROVIDER_PACING_WAIT_MAX_ATTEMPTS,
|
|
707
|
+
reason: 'rate_limit',
|
|
708
|
+
};
|
|
709
|
+
}
|
|
672
710
|
if (!input.hasRetryAfterHeader) {
|
|
673
711
|
return {
|
|
674
712
|
retryable: true,
|
|
@@ -947,6 +985,7 @@ export function classifyToolExecuteHttpFailure(input: {
|
|
|
947
985
|
concurrencyBackpressure,
|
|
948
986
|
runtimeSchedulerCapacity,
|
|
949
987
|
providerPacingWait,
|
|
988
|
+
preDispatchRateRefusal,
|
|
950
989
|
hasRetryAfterHeader,
|
|
951
990
|
transientHttpRetrySafe,
|
|
952
991
|
edgeGatewayFailure,
|
|
@@ -1020,6 +1059,7 @@ export function classifyToolExecuteHttpFailure(input: {
|
|
|
1020
1059
|
concurrencyBackpressure,
|
|
1021
1060
|
runtimeSchedulerCapacity,
|
|
1022
1061
|
providerPacingWait,
|
|
1062
|
+
preDispatchRateRefusal,
|
|
1023
1063
|
hardBillingFailure,
|
|
1024
1064
|
hasRetryAfterHeader,
|
|
1025
1065
|
transientHttpRetrySafe,
|
|
@@ -1164,7 +1204,9 @@ export function classifyToolExecuteHttpFailure(input: {
|
|
|
1164
1204
|
// the tool-call budget. The run-wide retry budget is a runaway guard
|
|
1165
1205
|
// whose breach is run-fatal; a provider outage across a large map must
|
|
1166
1206
|
// surface as row failures, not exhaust it and fail the whole run.
|
|
1167
|
-
retryDecision.reason !== 'provider_server_error'
|
|
1207
|
+
retryDecision.reason !== 'provider_server_error' &&
|
|
1208
|
+
// A wait on a refusal that sent nothing is pacing, not a failed call.
|
|
1209
|
+
!preDispatchRateRefusal,
|
|
1168
1210
|
// The app reported a provider failure and asked for a retry, so it has
|
|
1169
1211
|
// already released that attempt's reservation, and admission never reopens
|
|
1170
1212
|
// one. BILLING_UNAVAILABLE may follow an authorization whose response was
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
var _chunkOVZSNBDJjs = require('./chunk-OVZSNBDJ.js');
|
|
18
|
+
require('./chunk-7WZXUAQW.js');
|
|
19
|
+
require('./chunk-IJAEYEJM.js');
|
|
20
|
+
require('./chunk-FXYWEKUK.js');
|
|
21
|
+
require('./chunk-T2N3B7IQ.js');
|
|
22
|
+
require('./chunk-XNYIZMNQ.js');
|
|
23
|
+
require('./chunk-SQWET4SL.js');
|
|
24
|
+
require('./chunk-WXHBD6H7.js');
|
|
25
|
+
require('./chunk-OG64RBAC.js');
|
|
26
|
+
require('./chunk-COGTRVWW.js');
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
exports.EXIT_WORKSPACE_MISMATCH = _chunkOVZSNBDJjs.EXIT_WORKSPACE_MISMATCH; exports.authStatusLine = _chunkOVZSNBDJjs.authStatusLine; exports.clearPendingClaim = _chunkOVZSNBDJjs.clearPendingClaim; exports.clearSatisfiedPendingClaim = _chunkOVZSNBDJjs.clearSatisfiedPendingClaim; exports.handleRegister = _chunkOVZSNBDJjs.handleRegister; exports.handleStatus = _chunkOVZSNBDJjs.handleStatus; exports.handleWait = _chunkOVZSNBDJjs.handleWait; exports.httpJson = _chunkOVZSNBDJjs.httpJson; exports.readPendingAuthClaim = _chunkOVZSNBDJjs.readPendingAuthClaim; exports.readStatusBanner = _chunkOVZSNBDJjs.readStatusBanner; exports.registerAuthCommands = _chunkOVZSNBDJjs.registerAuthCommands; exports.reportApprovalLinkShown = _chunkOVZSNBDJjs.reportApprovalLinkShown; exports.reportSetupCompleted = _chunkOVZSNBDJjs.reportSetupCompleted; exports.resolvePendingAuthClaimForResume = _chunkOVZSNBDJjs.resolvePendingAuthClaimForResume; exports.statusBannerLine = _chunkOVZSNBDJjs.statusBannerLine;
|
|
@@ -14,14 +14,14 @@ import {
|
|
|
14
14
|
reportSetupCompleted,
|
|
15
15
|
resolvePendingAuthClaimForResume,
|
|
16
16
|
statusBannerLine
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
17
|
+
} from "./chunk-T4QPRL3P.mjs";
|
|
18
|
+
import "./chunk-GP7E4TE4.mjs";
|
|
19
|
+
import "./chunk-Z25KC5V2.mjs";
|
|
20
|
+
import "./chunk-RML3VSTN.mjs";
|
|
21
21
|
import "./chunk-QNHHZ63P.mjs";
|
|
22
22
|
import "./chunk-DLIRSHV6.mjs";
|
|
23
23
|
import "./chunk-ZPGGW27Q.mjs";
|
|
24
|
-
import "./chunk-
|
|
24
|
+
import "./chunk-HJVNCRXY.mjs";
|
|
25
25
|
import "./chunk-WZYKRD7T.mjs";
|
|
26
26
|
import "./chunk-KRD6H754.mjs";
|
|
27
27
|
export {
|