deepline 0.3.537 → 0.3.539

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.
Files changed (205) hide show
  1. package/dist/bundling-sources/sdk/src/client-core.ts +22 -5
  2. package/dist/bundling-sources/sdk/src/index.ts +2 -0
  3. package/dist/bundling-sources/sdk/src/plays/client-core.ts +18 -1
  4. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  5. package/dist/bundling-sources/sdk/src/runs/watch-polling.ts +33 -4
  6. package/dist/bundling-sources/shared_libs/integration-contracts/billing-entitlements.ts +1 -1
  7. package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +18 -0
  8. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +9 -1
  9. package/dist/bundling-sources/shared_libs/play-runtime/baked-runner-image.ts +392 -0
  10. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +717 -133
  11. package/dist/bundling-sources/shared_libs/play-runtime/coordinator-headers.ts +7 -0
  12. package/dist/bundling-sources/shared_libs/play-runtime/daytona-payload-contract.ts +22 -1
  13. package/dist/bundling-sources/shared_libs/play-runtime/durable-runs-rollout.ts +123 -0
  14. package/dist/bundling-sources/shared_libs/play-runtime/experiment-switches.ts +480 -0
  15. package/dist/bundling-sources/shared_libs/play-runtime/fixture-egress-fetch.ts +24 -16
  16. package/dist/bundling-sources/shared_libs/play-runtime/freshness-receipt-execution.ts +293 -53
  17. package/dist/bundling-sources/shared_libs/play-runtime/governor/block-reserving-budget-state-backend.ts +57 -2
  18. package/dist/bundling-sources/shared_libs/play-runtime/governor/budget-state-backend.ts +43 -0
  19. package/dist/bundling-sources/shared_libs/play-runtime/governor/governor.ts +141 -9
  20. package/dist/bundling-sources/shared_libs/play-runtime/launch-identity.ts +4 -0
  21. package/dist/bundling-sources/shared_libs/play-runtime/modal-runtime-config.ts +6 -0
  22. package/dist/bundling-sources/shared_libs/play-runtime/modal-supervisor-sidecar.ts +556 -0
  23. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +27 -0
  24. package/dist/bundling-sources/shared_libs/play-runtime/resource-governor.ts +19 -0
  25. package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +54 -0
  26. package/dist/bundling-sources/shared_libs/play-runtime/run-snapshot-stream.ts +5 -0
  27. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +155 -7
  28. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/relay-connection-counter.ts +103 -0
  29. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-heartbeat.ts +75 -6
  30. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-terminal-push.ts +59 -0
  31. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-payload-transport.ts +544 -73
  32. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-runtime-watchdog.ts +8 -1
  33. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/detached-runner-readiness-pacing.ts +19 -1
  34. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/modal.ts +2399 -110
  35. package/dist/bundling-sources/shared_libs/play-runtime/runtime-flow.ts +42 -8
  36. package/dist/bundling-sources/shared_libs/play-runtime/runtime-read-through.ts +287 -0
  37. package/dist/bundling-sources/shared_libs/play-runtime/runtime-receipt-finish.ts +606 -0
  38. package/dist/bundling-sources/shared_libs/play-runtime/runtime-receipt-writer.ts +274 -119
  39. package/dist/bundling-sources/shared_libs/play-runtime/runtime-speed-profile.ts +136 -0
  40. package/dist/bundling-sources/shared_libs/play-runtime/runtime-traffic-policy.ts +54 -0
  41. package/dist/bundling-sources/shared_libs/play-runtime/runtime-work-counters.ts +10 -1
  42. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +22 -0
  43. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-play-run-task.ts +18 -1
  44. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-pool.ts +18 -4
  45. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +219 -7
  46. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-shared.ts +3 -0
  47. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/early-sandbox-claim-affinity.ts +340 -0
  48. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/play-run-recovery.ts +1 -0
  49. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-progress.ts +10 -1
  50. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts +623 -7
  51. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +340 -5
  52. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runner-push.ts +61 -0
  53. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-event-search.ts +2 -1
  54. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-ledger-reconciliation.ts +269 -2
  55. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-worker-wake.ts +238 -5
  56. package/dist/bundling-sources/shared_libs/play-runtime/startup-read-tool-ids.ts +47 -0
  57. package/dist/bundling-sources/shared_libs/play-runtime/tool-call/runtime-step-receipts-adapter.ts +5 -4
  58. package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +6 -0
  59. package/dist/bundling-sources/shared_libs/play-runtime/transient-service-error.ts +11 -0
  60. package/dist/cli/auth-O5Y2VYXK.js +43 -0
  61. package/dist/cli/{auth-4SUPGDIM.mjs → auth-QD7QGD3B.mjs} +5 -5
  62. package/dist/cli/{billing-5JUA3ZM3.mjs → billing-FIZXMHBW.mjs} +31 -7
  63. package/dist/cli/{billing-SQU726P7.js → billing-KOQAF6WS.js} +114 -90
  64. package/dist/cli/{chunk-R7JYG6XO.mjs → chunk-2XMFT44N.mjs} +1 -1
  65. package/dist/cli/{chunk-XDS26J7Z.js → chunk-3YDI2PTN.js} +10 -10
  66. package/dist/cli/{chunk-KH27B2HJ.mjs → chunk-55ITVU2V.mjs} +2 -2
  67. package/dist/cli/{chunk-2Q7VXTMS.js → chunk-5QL4GJB2.js} +2 -2
  68. package/dist/cli/{chunk-D77W6Q67.js → chunk-5RUB53KG.js} +26 -26
  69. package/dist/cli/{chunk-JS2SBCWD.js → chunk-5YF35HAV.js} +6 -6
  70. package/dist/cli/{chunk-C37VELBR.mjs → chunk-6KG4KVTH.mjs} +5 -5
  71. package/dist/cli/{chunk-AX2OAXDL.mjs → chunk-6NZBLFL4.mjs} +1 -1
  72. package/dist/cli/{chunk-C3XD2WHM.mjs → chunk-6V3LNYK5.mjs} +2 -2
  73. package/dist/cli/{chunk-GPMS6OPX.mjs → chunk-ADV2IB2C.mjs} +5 -5
  74. package/dist/cli/{chunk-ZUAMXZXC.mjs → chunk-APKZGUTU.mjs} +4 -4
  75. package/dist/cli/{chunk-IQOIT6E3.js → chunk-CQJCLHBE.js} +41 -41
  76. package/dist/cli/{chunk-W3J3LT22.mjs → chunk-DZFVVP3S.mjs} +5 -5
  77. package/dist/cli/{chunk-V5IIBG2E.mjs → chunk-E4QHTDPF.mjs} +1 -1
  78. package/dist/cli/{chunk-CXTW7SRW.mjs → chunk-E7D37PLM.mjs} +8 -0
  79. package/dist/cli/{chunk-KULT6O5K.js → chunk-EAZS52DL.js} +15 -15
  80. package/dist/cli/{chunk-L3JVGNAT.mjs → chunk-F43MXIN3.mjs} +2 -2
  81. package/dist/cli/{chunk-WBTYWJLN.js → chunk-FH3P3E4S.js} +2 -2
  82. package/dist/cli/{chunk-K4WJ4BYO.mjs → chunk-FIRV7BXJ.mjs} +1 -1
  83. package/dist/cli/{chunk-NXGLJGPB.js → chunk-FSQCB5SJ.js} +2 -2
  84. package/dist/cli/{chunk-AVQET3NR.js → chunk-FTBWFDF3.js} +7 -7
  85. package/dist/cli/{chunk-QDBGPRR2.mjs → chunk-G3UFDUYU.mjs} +3 -1
  86. package/dist/cli/{chunk-ZHPSJ3LJ.mjs → chunk-GEO2EMM7.mjs} +29 -16
  87. package/dist/cli/{chunk-CGDW2CRR.mjs → chunk-GLEGINSP.mjs} +2 -2
  88. package/dist/cli/{chunk-EEFSUCYP.mjs → chunk-GLKUC5PO.mjs} +2 -2
  89. package/dist/cli/{chunk-BFHR7IC2.mjs → chunk-GNCIMHO2.mjs} +10 -10
  90. package/dist/cli/{chunk-PU42VOBI.js → chunk-ISXX5DUD.js} +3 -3
  91. package/dist/cli/{chunk-Y6AMMXWS.mjs → chunk-JBCQFG7G.mjs} +3 -3
  92. package/dist/cli/{chunk-Z2PPB3IO.mjs → chunk-JHEZQMOM.mjs} +1 -1
  93. package/dist/cli/{chunk-WBFOV5HT.js → chunk-K22EKW6L.js} +5 -5
  94. package/dist/cli/{chunk-CHIGEDAE.js → chunk-K5MZHTK7.js} +3 -3
  95. package/dist/cli/{chunk-L6QAIZNZ.js → chunk-KAEVL62Q.js} +44 -44
  96. package/dist/cli/{chunk-PJ4ZGZAN.js → chunk-KQTX545E.js} +13 -13
  97. package/dist/cli/{chunk-VP2K5B3R.mjs → chunk-LE5KN7CZ.mjs} +3 -3
  98. package/dist/cli/{chunk-BGXEMTIG.js → chunk-LEREPTAE.js} +19 -19
  99. package/dist/cli/{chunk-QPDLG7DQ.js → chunk-MI53W4DN.js} +53 -53
  100. package/dist/cli/{chunk-RMVZTBI5.mjs → chunk-MKESK3SW.mjs} +4 -4
  101. package/dist/cli/{chunk-NU7B5X6J.mjs → chunk-N3LPGGWD.mjs} +1 -1
  102. package/dist/cli/{chunk-VRYX2BR4.js → chunk-NR5PLMNG.js} +107 -107
  103. package/dist/cli/{chunk-JMHYDDBQ.js → chunk-Q4HNK7JX.js} +292 -279
  104. package/dist/cli/{chunk-37AZHCTP.mjs → chunk-RULRGMMM.mjs} +5 -5
  105. package/dist/cli/{chunk-GI3V4D7K.mjs → chunk-SDAP5MCO.mjs} +2 -2
  106. package/dist/cli/{chunk-5EOEJKSV.js → chunk-TZBCJHV6.js} +1 -1
  107. package/dist/cli/{chunk-3PMCQ3LK.js → chunk-V7DEGIYO.js} +7 -5
  108. package/dist/cli/{chunk-ALHKB3AE.js → chunk-VK5UTS5B.js} +9 -9
  109. package/dist/cli/{chunk-ZFSB7GXF.js → chunk-W32KT6LM.js} +5 -5
  110. package/dist/cli/{chunk-6BBGUQJJ.js → chunk-XTYHZEJ2.js} +8 -0
  111. package/dist/cli/{chunk-UGA5KI4A.js → chunk-XZBXQCRJ.js} +22 -22
  112. package/dist/cli/{chunk-BRRCWUOW.mjs → chunk-Y66ZMOJI.mjs} +1 -1
  113. package/dist/cli/{chunk-CFND2ACL.js → chunk-YMQFQO3K.js} +16 -16
  114. package/dist/cli/command-docs.js +2 -2
  115. package/dist/cli/command-docs.mjs +1 -1
  116. package/dist/cli/{csv-JITYN27L.js → csv-BWWJYV2C.js} +13 -13
  117. package/dist/cli/{csv-HZP6QMG7.mjs → csv-G5RQQ74W.mjs} +4 -4
  118. package/dist/cli/{db-FYSRB7O4.js → db-5KNDLADE.js} +27 -27
  119. package/dist/cli/{db-QRIRTOMM.mjs → db-AJZHWB3V.mjs} +6 -6
  120. package/dist/cli/describe-B6CN6CFJ.js +49 -0
  121. package/dist/cli/{describe-REXJVJC3.mjs → describe-QY5TKWVD.mjs} +17 -17
  122. package/dist/cli/describe-core.d.mts +3 -3
  123. package/dist/cli/describe-core.d.ts +3 -3
  124. package/dist/cli/{executions-BSTF4DDS.js → executions-BCCW76BI.js} +8 -8
  125. package/dist/cli/{executions-53KJAFOW.mjs → executions-SJPH3MZT.mjs} +6 -6
  126. package/dist/cli/{feedback-6MW3QOXX.js → feedback-GF65JKK6.js} +14 -14
  127. package/dist/cli/{feedback-CWUJJF3J.mjs → feedback-S6SZOFGK.mjs} +6 -6
  128. package/dist/cli/git-DX6NB7VF.js +25 -0
  129. package/dist/cli/{git-CKVZTJFS.mjs → git-F5FT5YVB.mjs} +5 -5
  130. package/dist/cli/index.js +143 -143
  131. package/dist/cli/index.mjs +42 -42
  132. package/dist/cli/{legacy-noops-QBL4PNGB.js → legacy-noops-ECR6FS6U.js} +9 -9
  133. package/dist/cli/{legacy-noops-USTBRFRX.mjs → legacy-noops-NOA4P5NE.mjs} +6 -6
  134. package/dist/cli/{monitors-6UCG5D7W.mjs → monitors-CTYSAGP4.mjs} +7 -7
  135. package/dist/cli/{monitors-VCR6SUZD.js → monitors-DEWBSURN.js} +100 -100
  136. package/dist/cli/{org-GSRBOJVO.mjs → org-EKSKKT7H.mjs} +6 -6
  137. package/dist/cli/{org-HPILTEG4.js → org-ZM2UUMZZ.js} +86 -86
  138. package/dist/cli/{play-TK7WOP5H.js → play-6JQOM6DE.js} +317 -317
  139. package/dist/cli/{play-QRTYQNG4.mjs → play-R2BH374J.mjs} +17 -17
  140. package/dist/cli/{providers-HEXNJ5QC.js → providers-CMIYHEMN.js} +9 -9
  141. package/dist/cli/{providers-OAQJWVBS.mjs → providers-X7WMIWO4.mjs} +6 -6
  142. package/dist/cli/{quickstart-PYZTFXZX.js → quickstart-6HVPAMSW.js} +6 -6
  143. package/dist/cli/{quickstart-FFVHTPSP.mjs → quickstart-ZZ7L6VZJ.mjs} +4 -4
  144. package/dist/cli/{run-HLN6YYZH.mjs → run-FP32RKBU.mjs} +22 -22
  145. package/dist/cli/{run-4DWJXJRO.js → run-OOHYH3GI.js} +42 -42
  146. package/dist/cli/search-34C6LFOJ.js +32 -0
  147. package/dist/cli/{search-ZHRCXGEL.mjs → search-BDDNC23Z.mjs} +7 -7
  148. package/dist/cli/{search-output-2KY6PFDH.js → search-output-5VZIQQAM.js} +6 -6
  149. package/dist/cli/{search-output-N7QXACVK.mjs → search-output-QXJ6CV5G.mjs} +4 -4
  150. package/dist/cli/{secrets-WXQ7XO5C.js → secrets-EN2HQCO3.js} +15 -15
  151. package/dist/cli/{secrets-FKMWBLHU.mjs → secrets-Z7CQSQGC.mjs} +6 -6
  152. package/dist/cli/{sessions-3YDTEDA5.mjs → sessions-I2H37OTJ.mjs} +6 -6
  153. package/dist/cli/sessions-RYQX3NDD.js +22 -0
  154. package/dist/cli/{settings-67TWLQ6E.js → settings-CTRAPFNZ.js} +85 -85
  155. package/dist/cli/{settings-JTPASUZN.mjs → settings-IYSC5PPQ.mjs} +12 -12
  156. package/dist/cli/{setup-VYNGXUJ6.mjs → setup-PU3HOVI3.mjs} +9 -9
  157. package/dist/cli/{setup-KUERQJUX.js → setup-XIN53GEW.js} +49 -49
  158. package/dist/cli/skills-576CX7DK.js +36 -0
  159. package/dist/cli/{skills-KI4KYHH6.mjs → skills-TYBML2ZO.mjs} +7 -7
  160. package/dist/cli/tools-EXMUWA3Z.js +56 -0
  161. package/dist/cli/{tools-UQDJS2RS.mjs → tools-ZVNE6M6J.mjs} +16 -16
  162. package/dist/cli/{update-7FQQUBOD.mjs → update-54WENBNT.mjs} +9 -9
  163. package/dist/cli/update-RAHETNL2.js +34 -0
  164. package/dist/cli/{views-MJK7JGZG.js → views-7L75EZOJ.js} +21 -21
  165. package/dist/cli/{views-JAM4MNNV.mjs → views-EUBB4ONT.mjs} +6 -6
  166. package/dist/cli/{workflow-AQPRIWQX.js → workflow-EZVYCR6Y.js} +17 -17
  167. package/dist/cli/{workflow-TQRV5FGO.mjs → workflow-GUKGFJ72.mjs} +7 -7
  168. package/dist/{client-BlLYQDNo.d.mts → client-D0uDBybG.d.mts} +1 -1
  169. package/dist/{client-DSQlkIDO.d.ts → client-DZTnAv4B.d.ts} +1 -1
  170. package/dist/{client-core-rX7n2H8U.d.mts → client-core-BhWf8Y1b.d.mts} +15 -2
  171. package/dist/{client-core-CDwapXy5.d.ts → client-core-og3AP1LL.d.ts} +15 -2
  172. package/dist/{compiler-manifest-BHNC4RL-.d.ts → compiler-manifest-Bes3OVA3.d.mts} +1 -1
  173. package/dist/{compiler-manifest-BHNC4RL-.d.mts → compiler-manifest-Bes3OVA3.d.ts} +1 -1
  174. package/dist/{errors-lhtIWG5Z.d.ts → errors-BJm4lLWc.d.ts} +1 -1
  175. package/dist/{errors-D7sPXrvB.d.mts → errors-Dc5r42ks.d.mts} +1 -1
  176. package/dist/{index-CQTBHXHr.d.ts → index-BfV7mRPF.d.ts} +1 -1
  177. package/dist/{index-NaDZq2xf.d.mts → index-DTkiz_Ur.d.mts} +1 -1
  178. package/dist/index.d.mts +7 -7
  179. package/dist/index.d.ts +7 -7
  180. package/dist/index.js +9 -9
  181. package/dist/index.mjs +6 -6
  182. package/dist/install-integrity.json +121 -112
  183. package/dist/plays/bundle-play-file.d.mts +3 -3
  184. package/dist/plays/bundle-play-file.d.ts +3 -3
  185. package/dist/plays/play-description.d.mts +2 -2
  186. package/dist/plays/play-description.d.ts +2 -2
  187. package/dist/plays/run-request.d.mts +2 -2
  188. package/dist/plays/run-request.d.ts +2 -2
  189. package/dist/release.d.mts +1 -1
  190. package/dist/release.d.ts +1 -1
  191. package/dist/release.js +2 -2
  192. package/dist/release.mjs +1 -1
  193. package/dist/server.d.mts +4 -4
  194. package/dist/server.d.ts +4 -4
  195. package/dist/server.js +5 -5
  196. package/dist/server.mjs +3 -3
  197. package/package.json +1 -1
  198. package/dist/cli/auth-Y2K2ZYYA.js +0 -43
  199. package/dist/cli/describe-LSOHOLFI.js +0 -49
  200. package/dist/cli/git-S7SWUZ3T.js +0 -25
  201. package/dist/cli/search-WERQBC6V.js +0 -32
  202. package/dist/cli/sessions-LXQ4Q6BS.js +0 -22
  203. package/dist/cli/skills-EFRLHY3F.js +0 -36
  204. package/dist/cli/tools-C3EIGFFP.js +0 -56
  205. package/dist/cli/update-KCY72RXH.js +0 -34
@@ -54,10 +54,18 @@ import {
54
54
  import { RUNTIME_CAPACITY_POLICY } from '../runtime-capacity-policy';
55
55
  import { RUNTIME_RELIABILITY_POLICY } from '../runtime-reliability-policy';
56
56
  import {
57
+ hedgeRuntimeTrafficPolicyRead,
57
58
  isRuntimeTrafficPolicy,
59
+ OVERLAP_RUNTIME_TRAFFIC_POLICY_READ,
60
+ RUNTIME_TRAFFIC_POLICY_HEDGE_AFTER_MS,
58
61
  type RuntimeTrafficPolicy,
59
62
  } from '../runtime-traffic-policy';
60
63
  import type { PreloadedRuntimeDbSession } from '../db-session';
64
+ import {
65
+ formatExperimentSwitchOverrides,
66
+ readCarriedExperimentSwitchOverrides,
67
+ resolveExperimentSwitch,
68
+ } from '../experiment-switches';
61
69
  import { parseRenewedPreloadedRuntimeDbSessions } from '../db-session-renewal';
62
70
  import { RUNTIME_CLAIM_HEARTBEAT_DIVISOR } from '../runtime-constants';
63
71
  import {
@@ -137,7 +145,11 @@ import {
137
145
  type DaytonaCrashDiagnostic,
138
146
  type DaytonaSandboxDeleteOutcome,
139
147
  } from '../runner-backends/backends/daytona';
140
- import { findModalSandboxIdsByTags } from '../runner-backends/backends/modal';
148
+ import {
149
+ EARLY_MODAL_SANDBOX_SWEEP_INTERVAL_MS,
150
+ findModalSandboxIdsByTags,
151
+ sweepOrphanEarlyModalSandboxesForWorker,
152
+ } from '../runner-backends/backends/modal';
141
153
  import {
142
154
  resolveDetachedRunnerRuntimeLimitSeconds,
143
155
  type DetachedRunnerSuspension,
@@ -259,6 +271,7 @@ import {
259
271
  } from '../play-runs/attempts';
260
272
  import { transitionPreCodePlayRunRecovery } from './play-run-recovery';
261
273
  import { DURABLE_RUNS_ROLLOUT } from '../durable-runs-rollout';
274
+ import { staticPipelineStartupReadToolIds } from '../startup-read-tool-ids';
262
275
  import {
263
276
  POST_CODE_RECOVERY_BUDGET,
264
277
  classifyPostCodeAttemptOutcome,
@@ -299,6 +312,12 @@ import {
299
312
  withRuntimeSchedulerClient,
300
313
  } from './postgres-pool';
301
314
  import { runWithAbsurdSchedulerQuerySignal } from './absurd-pool';
315
+ import {
316
+ createEarlySandboxClaimGate,
317
+ EARLY_SANDBOX_CLAIM_AFFINITY_READER,
318
+ hasPendingEarlySandboxClaim,
319
+ runEarlySandboxOwnerClaimProbe,
320
+ } from './early-sandbox-claim-affinity';
302
321
  import {
303
322
  createAbsurdClaimLoopTiming,
304
323
  type AbsurdClaimLoopTiming,
@@ -592,6 +611,18 @@ export const ABSURD_DAYTONA_PRE_PARK_TIMEOUT_MS = 5 * 60 * 1_000;
592
611
  const RUNTIME_CLAIM_LEASE_SECONDS =
593
612
  RUNTIME_RELIABILITY_POLICY.worker.claimLeaseSeconds;
594
613
  const HEARTBEAT_CLAIM_TIMEOUT_SECONDS = RUNTIME_CLAIM_LEASE_SECONDS;
614
+
615
+ /** `startupReadToolIds` for the runner context, from the launch's contract plan; empty when it names none. */
616
+ export function startupReadToolIdsContext(
617
+ contractSnapshot: unknown,
618
+ ): { startupReadToolIds?: string[] } {
619
+ const pipeline =
620
+ contractSnapshot && typeof contractSnapshot === 'object'
621
+ ? (contractSnapshot as { staticPipeline?: unknown }).staticPipeline
622
+ : undefined;
623
+ const ids = staticPipelineStartupReadToolIds(pipeline);
624
+ return ids.length > 0 ? { startupReadToolIds: ids } : {};
625
+ }
595
626
  /**
596
627
  * A direct LISTEN wake normally makes an idle claim immediate. This is the
597
628
  * durable safety fallback for missed notifications, an unavailable listener,
@@ -995,6 +1026,12 @@ export type AbsurdRuntimeWorkerDeps = {
995
1026
  sessions: PreloadedRuntimeDbSession[],
996
1027
  ) => void;
997
1028
  }) => Promise<string>;
1029
+ /**
1030
+ * P1 seam: start the pre-create policy read if the mint has not answered
1031
+ * after this many ms. Absent: OVERLAP_RUNTIME_TRAFFIC_POLICY_READ decides
1032
+ * (RUNTIME_TRAFFIC_POLICY_HEDGE_AFTER_MS when on, never when off).
1033
+ */
1034
+ trafficPolicyHedgeAfterMs?: number | null;
998
1035
  /** This worker's release lane id. Seam so tests can drive the belt-and-
999
1036
  * suspenders lane-mismatch guard without mutating process env. Defaults to
1000
1037
  * `currentAbsurdReleaseId()`. */
@@ -1339,6 +1376,14 @@ export async function requestAttemptExecutorToken(input: {
1339
1376
  ...(input.initializeComputeSession
1340
1377
  ? { initializeComputeSession: true }
1341
1378
  : {}),
1379
+ // EXPERIMENT: the run's overrides, so the route resolves P1 for
1380
+ // this run. Only a run that carries overrides sends the field.
1381
+ ...(input.launch.experimentSwitchOverrides
1382
+ ? {
1383
+ experimentSwitchOverrides:
1384
+ input.launch.experimentSwitchOverrides,
1385
+ }
1386
+ : {}),
1342
1387
  // Expand-before-enable rollout fence. An old worker never sends this,
1343
1388
  // so a newly deployed app cannot activate direct terminal reduction
1344
1389
  // before the owning Fly lane has the cleanup controller.
@@ -3765,9 +3810,23 @@ async function executeAbsurdAttemptAdapter(
3765
3810
  });
3766
3811
  if (gated) return gated;
3767
3812
  }
3813
+ const carriedExperimentSwitches = readCarriedExperimentSwitchOverrides(
3814
+ launch.experimentSwitchOverrides,
3815
+ );
3816
+ if (carriedExperimentSwitches) {
3817
+ // The worker-side join line for a run that carries overrides.
3818
+ console.info(
3819
+ '[absurd-runtime.worker.experiment_switches]',
3820
+ JSON.stringify({
3821
+ runId,
3822
+ attempt: generation,
3823
+ overrides: formatExperimentSwitchOverrides(carriedExperimentSwitches),
3824
+ }),
3825
+ );
3826
+ }
3768
3827
  const tokenStartedAt = performance.now();
3769
3828
  let renewedDbSessions: PreloadedRuntimeDbSession[] | null = null;
3770
- const executorToken = await runWithAbsurdExecutionLeaseHeartbeat({
3829
+ const executorTokenMint = runWithAbsurdExecutionLeaseHeartbeat({
3771
3830
  ctx,
3772
3831
  runId,
3773
3832
  operation: async () => {
@@ -3818,6 +3877,36 @@ async function executeAbsurdAttemptAdapter(
3818
3877
  }),
3819
3878
  );
3820
3879
  });
3880
+ // P1 (off): a mint slower than the hedge delay no longer serializes the
3881
+ // worker's own pre-create policy read behind it. A pure read, made with
3882
+ // the run's admission token; the minted-token read below stays the
3883
+ // fallback if it fails.
3884
+ const trafficPolicyHedgeAfterMs =
3885
+ deps.trafficPolicyHedgeAfterMs !== undefined
3886
+ ? deps.trafficPolicyHedgeAfterMs
3887
+ : resolveExperimentSwitch(
3888
+ 'P1',
3889
+ launch.experimentSwitchOverrides,
3890
+ OVERLAP_RUNTIME_TRAFFIC_POLICY_READ,
3891
+ )
3892
+ ? RUNTIME_TRAFFIC_POLICY_HEDGE_AFTER_MS
3893
+ : null;
3894
+ const trafficPolicyHedge =
3895
+ trafficPolicyHedgeAfterMs !== null &&
3896
+ prepared.kind === 'fresh_claimed' &&
3897
+ assigned.checkpoint == null &&
3898
+ assigned.suspension == null &&
3899
+ isManagedSandboxRuntimeBackend(launch.runtimeBackend)
3900
+ ? hedgeRuntimeTrafficPolicyRead({
3901
+ mint: executorTokenMint,
3902
+ delayMs: trafficPolicyHedgeAfterMs,
3903
+ read: () =>
3904
+ getRuntimeTrafficPolicyViaAppRuntime(
3905
+ deps.runtimeApiFromLaunch(launch),
3906
+ ),
3907
+ })
3908
+ : null;
3909
+ const executorToken = await executorTokenMint;
3821
3910
  // Assigned inside the mint callback; widen past control-flow narrowing.
3822
3911
  const renewedSessions = renewedDbSessions as
3823
3912
  | PreloadedRuntimeDbSession[]
@@ -3843,6 +3932,7 @@ async function executeAbsurdAttemptAdapter(
3843
3932
  computeSessionIntentPersisted,
3844
3933
  computeSessionInitialized,
3845
3934
  runtimeTrafficPolicy,
3935
+ hedgedTrafficPolicyRead: trafficPolicyHedge?.started() ?? null,
3846
3936
  runtimeApi,
3847
3937
  });
3848
3938
  } catch (error) {
@@ -4098,6 +4188,8 @@ async function executeAssignedAbsurdAttempt(input: {
4098
4188
  computeSessionIntentPersisted: boolean;
4099
4189
  computeSessionInitialized: boolean;
4100
4190
  runtimeTrafficPolicy: RuntimeTrafficPolicy | null;
4191
+ /** P1 (off): the policy read started during a slow mint, if any. */
4192
+ hedgedTrafficPolicyRead?: Promise<RuntimeTrafficPolicy> | null;
4101
4193
  runtimeApi: WorkerRuntimeApiContext;
4102
4194
  }): Promise<AbsurdRuntimeResult> {
4103
4195
  const {
@@ -4837,6 +4929,11 @@ async function executeAssignedAbsurdAttempt(input: {
4837
4929
  kind: 'app_runtime_postgres' as const,
4838
4930
  schedulerSchema: absurdSchema,
4839
4931
  },
4932
+ // Optional, switch off: name the static plan's tools so the runner's
4933
+ // park-fence startup prefetch can run (read-only lookups only).
4934
+ ...(DURABLE_RUNS_ROLLOUT.workerStartupReadToolIds
4935
+ ? startupReadToolIdsContext(launch.contractSnapshot)
4936
+ : {}),
4840
4937
  // Push execution: the Daytona sandbox runner keeps the Absurd run claim
4841
4938
  // alive itself by heartbeating the receipt gateway. The local-process
4842
4939
  // backend stays worker-babysat, so it gets no push config.
@@ -5183,8 +5280,15 @@ async function executeAssignedAbsurdAttempt(input: {
5183
5280
  ok: true as const,
5184
5281
  policy: input.runtimeTrafficPolicy,
5185
5282
  })
5186
- : measureLaunchPhase('traffic_policy_read', () =>
5187
- getRuntimeTrafficPolicyViaAppRuntime(runtimeApi),
5283
+ : (input.hedgedTrafficPolicyRead
5284
+ ? measureLaunchPhase('traffic_policy_read_hedged', () =>
5285
+ input.hedgedTrafficPolicyRead!.catch(() =>
5286
+ getRuntimeTrafficPolicyViaAppRuntime(runtimeApi),
5287
+ ),
5288
+ )
5289
+ : measureLaunchPhase('traffic_policy_read', () =>
5290
+ getRuntimeTrafficPolicyViaAppRuntime(runtimeApi),
5291
+ )
5188
5292
  ).then(
5189
5293
  (policy) => ({ ok: true as const, policy }),
5190
5294
  (error: unknown) => ({ ok: false as const, error }),
@@ -10810,6 +10914,8 @@ export async function runPostgresSchedulerSandboxCleanupController(input: {
10810
10914
  });
10811
10915
  let reservedRecovery: Promise<void> | null = null;
10812
10916
  let nextReservedRecoveryAt = 0;
10917
+ let earlyModalSweep: Promise<void> | null = null;
10918
+ let nextEarlyModalSweepAt = 0;
10813
10919
 
10814
10920
  const startJob = (job: PostgresSchedulerSandboxCleanupJob): void => {
10815
10921
  const task = processPostgresSchedulerSandboxCleanupJob({
@@ -10886,6 +10992,37 @@ export async function runPostgresSchedulerSandboxCleanupController(input: {
10886
10992
  { error: error instanceof Error ? error.message : String(error) },
10887
10993
  );
10888
10994
  }
10995
+ if (
10996
+ input.providers?.includes('modal') &&
10997
+ !earlyModalSweep &&
10998
+ Date.now() >= nextEarlyModalSweepAt
10999
+ ) {
11000
+ // Durable orphan cleanup for early (E2) sandboxes, which are created
11001
+ // before any run row exists; their create tags are the obligation.
11002
+ // Not awaited: a slow provider never holds up cleanup claims.
11003
+ nextEarlyModalSweepAt = Date.now() + EARLY_MODAL_SANDBOX_SWEEP_INTERVAL_MS;
11004
+ const sweep = sweepOrphanEarlyModalSandboxesForWorker({
11005
+ runtimeSchedulerSchema: input.schedulerOptions.schema ?? null,
11006
+ })
11007
+ .then((outcome) => {
11008
+ if ('observed' in outcome && outcome.observed > 0) {
11009
+ console.info(
11010
+ '[absurd-runtime.worker] early_modal_sandbox_sweep_observed',
11011
+ outcome,
11012
+ );
11013
+ }
11014
+ })
11015
+ .catch((error) => {
11016
+ reportReconciliationPollFailure(
11017
+ '[absurd-runtime.worker] early_modal_sandbox_sweep_failed',
11018
+ { error: error instanceof Error ? error.message : String(error) },
11019
+ );
11020
+ })
11021
+ .finally(() => {
11022
+ if (earlyModalSweep === sweep) earlyModalSweep = null;
11023
+ });
11024
+ earlyModalSweep = sweep;
11025
+ }
10889
11026
  if (input.providers?.includes('modal')) {
10890
11027
  try {
10891
11028
  const reconciliation =
@@ -11179,6 +11316,15 @@ export function resolveAbsurdIdlePollFallbackMs(
11179
11316
  return onWake?.idlePollFallbackMs ?? ABSURD_WAKE_UNAVAILABLE_POLL_INTERVAL_MS;
11180
11317
  }
11181
11318
 
11319
+ /**
11320
+ * Preview experiment E5: let an isolated (Preview) worker lane hold the one
11321
+ * elected direct LISTEN session for its queue, as Production does, so the
11322
+ * transactional `absurd_wake` NOTIFY wakes it instead of the 1 s durable poll.
11323
+ * Polling still owns correctness. Costs one direct Postgres session per lane
11324
+ * from the shared Preview budget. Off.
11325
+ */
11326
+ const PREVIEW_WORKER_DIRECT_NOTIFY_WAKE = false;
11327
+
11182
11328
  export function createAbsurdWorkerWakeHook(input: {
11183
11329
  poolOptions: RuntimeSchedulerPoolOptions;
11184
11330
  queue: string;
@@ -11373,6 +11519,15 @@ export type RuntimeWorkerHost = {
11373
11519
  close(): Promise<void>;
11374
11520
  /** A lossy hint to re-read this host's durable queue, never task admission. */
11375
11521
  wake?(): boolean;
11522
+ /**
11523
+ * CA: present only while the claim-affinity reader is on. `id` is the name
11524
+ * this worker claims under; `startOwnerProbe` runs after this worker accepts
11525
+ * a CA early-sandbox hint, so it claims the run it was named owner of.
11526
+ */
11527
+ earlySandboxClaimOwner?: {
11528
+ id: string;
11529
+ startOwnerProbe(): void;
11530
+ };
11376
11531
  };
11377
11532
 
11378
11533
  /** Own shutdown ordering across the primary queue, listener and maintenance.
@@ -11382,6 +11537,7 @@ export function createAbsurdRuntimeWorkerHostLifecycle(input: {
11382
11537
  worker: RuntimeWorkerHost;
11383
11538
  closeWake: () => void;
11384
11539
  wake?: () => boolean;
11540
+ earlySandboxClaimOwner?: RuntimeWorkerHost['earlySandboxClaimOwner'];
11385
11541
  stopControllers: () => void;
11386
11542
  controllers: readonly (Promise<unknown> | null)[];
11387
11543
  }): RuntimeWorkerHost {
@@ -11389,6 +11545,9 @@ export function createAbsurdRuntimeWorkerHostLifecycle(input: {
11389
11545
  let wake = input.wake;
11390
11546
  return {
11391
11547
  ...(wake ? { wake: () => wake?.() ?? false } : {}),
11548
+ ...(input.earlySandboxClaimOwner
11549
+ ? { earlySandboxClaimOwner: input.earlySandboxClaimOwner }
11550
+ : {}),
11392
11551
  close: () => {
11393
11552
  if (closing) return closing;
11394
11553
  wake = undefined;
@@ -11520,10 +11679,21 @@ export async function startRuntimeWorkerHost(
11520
11679
  // Times the claim query, the afterClaim hook, task setup and handler end
11521
11680
  // on the active lane (`absurd-claim-loop-timing.ts`).
11522
11681
  const claimLoopTiming = createAbsurdClaimLoopTiming({ queue });
11682
+ // CA: the claim gate needs the wake hook, which is created after the
11683
+ // client; it reads it late. Off unless the reader switch is on.
11684
+ let claimAffinityWake: (() => boolean) | null = null;
11685
+ const claimAffinityGate = EARLY_SANDBOX_CLAIM_AFFINITY_READER
11686
+ ? createEarlySandboxClaimGate({
11687
+ self: workerBase,
11688
+ queue,
11689
+ wake: () => claimAffinityWake?.() ?? false,
11690
+ })
11691
+ : undefined;
11523
11692
  const absurdClient = createAbsurdRuntimeClient(
11524
11693
  poolOptions,
11525
11694
  queue,
11526
11695
  claimLoopTiming.observer,
11696
+ claimAffinityGate,
11527
11697
  );
11528
11698
  const workerDeps: AbsurdRuntimeWorkerDeps = {
11529
11699
  ...buildDefaultDeps(absurdClient),
@@ -11548,9 +11718,14 @@ export async function startRuntimeWorkerHost(
11548
11718
  ...recovered,
11549
11719
  });
11550
11720
  }
11551
- const useDirectNotify = shouldUseRuntimeSchedulerDirectNotify(
11552
- schedulerOptions.schema,
11553
- );
11721
+ const useDirectNotify =
11722
+ PREVIEW_WORKER_DIRECT_NOTIFY_WAKE ||
11723
+ shouldUseRuntimeSchedulerDirectNotify(schedulerOptions.schema);
11724
+ console.info('[absurd-runtime.worker] wake_config', {
11725
+ queue,
11726
+ useDirectNotify,
11727
+ previewDirectNotifyWake: PREVIEW_WORKER_DIRECT_NOTIFY_WAKE,
11728
+ });
11554
11729
  const onWake = createAbsurdWorkerWakeHook({
11555
11730
  poolOptions,
11556
11731
  queue,
@@ -11560,6 +11735,41 @@ export async function startRuntimeWorkerHost(
11560
11735
  useDirectNotify,
11561
11736
  enableWakeHints: true,
11562
11737
  });
11738
+ claimAffinityWake = onWake ? () => onWake.wake() : null;
11739
+ let ownerProbeStopped = false;
11740
+ const earlySandboxClaimOwner: RuntimeWorkerHost['earlySandboxClaimOwner'] =
11741
+ claimAffinityGate && onWake
11742
+ ? {
11743
+ id: workerBase,
11744
+ startOwnerProbe: () => {
11745
+ // The elected listener is woken by the run's own NOTIFY.
11746
+ if (onWake.isListening() || ownerProbeStopped) return;
11747
+ const startedAt = Date.now();
11748
+ void runEarlySandboxOwnerClaimProbe({
11749
+ probe: () =>
11750
+ withRuntimeSchedulerClient(poolOptions, (client) =>
11751
+ hasPendingEarlySandboxClaim({
11752
+ client,
11753
+ queue,
11754
+ owner: workerBase,
11755
+ }),
11756
+ ),
11757
+ wake: () => !ownerProbeStopped && onWake.wake(),
11758
+ onError: (error) =>
11759
+ console.warn('[runtime.claim_affinity]', {
11760
+ event: 'owner_probe_failed',
11761
+ error: error instanceof Error ? error.message : String(error),
11762
+ }),
11763
+ }).then((result) =>
11764
+ console.info('[runtime.claim_affinity]', {
11765
+ event: 'owner_probe_done',
11766
+ ...result,
11767
+ elapsedMs: Date.now() - startedAt,
11768
+ }),
11769
+ );
11770
+ },
11771
+ }
11772
+ : undefined;
11563
11773
  const reportCancellationProgress = createRateLimitedRuntimeLogger({
11564
11774
  log: (...args) => console.info(...args),
11565
11775
  });
@@ -11870,11 +12080,13 @@ export async function startRuntimeWorkerHost(
11870
12080
  return createAbsurdRuntimeWorkerHostLifecycle({
11871
12081
  worker,
11872
12082
  ...(onWake ? { wake: () => onWake.wake() } : {}),
12083
+ ...(earlySandboxClaimOwner ? { earlySandboxClaimOwner } : {}),
11873
12084
  // Release LISTEN before joining accepted work, so a replacement can elect
11874
12085
  // its listener without exhausting primary scheduler sessions.
11875
12086
  closeWake: () => onWake?.close(),
11876
12087
  stopControllers: () => {
11877
12088
  standbyProbeStopped = true;
12089
+ ownerProbeStopped = true;
11878
12090
  drainStopped = true;
11879
12091
  billingStopped = true;
11880
12092
  cleanupStopped = true;
@@ -33,6 +33,7 @@ import {
33
33
  createAbsurdForRuntimeScheduler,
34
34
  type AbsurdSchedulerQueryObserver,
35
35
  } from './absurd-pool';
36
+ import type { EarlySandboxClaimGate } from './early-sandbox-claim-affinity';
36
37
  import {
37
38
  withRuntimeSchedulerClient,
38
39
  type RuntimeSchedulerPoolOptions,
@@ -543,6 +544,7 @@ export function createAbsurdRuntimeClient(
543
544
  poolOptions: RuntimeSchedulerPoolOptions,
544
545
  queueName: string = ABSURD_RUNS_QUEUE,
545
546
  observer?: AbsurdSchedulerQueryObserver,
547
+ claimGate?: EarlySandboxClaimGate,
546
548
  ): Absurd {
547
549
  return createAbsurdForRuntimeScheduler(
548
550
  poolOptions,
@@ -551,6 +553,7 @@ export function createAbsurdRuntimeClient(
551
553
  log: absurdLog,
552
554
  },
553
555
  observer,
556
+ claimGate,
554
557
  );
555
558
  }
556
559